/* The Android app's look, token for token (android/.../ui/BrandTheme.kt and
   ui/components/BrandTokens.kt): the Nocturne field, glass panels, midnight statement planes and
   the lit violet action. Phone layout at every width, as in the app; wide screens only centre it.
   Do not restore the retired cream/lime palette or condensed headings (AGENTS.md). */
@font-face {
  font-family: "Manrope";
  src: url("/assets/manrope.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --canvas: #f1ecfb;
  --paper: #ffffff;
  --ink: #130c22;
  --muted: #665e78;
  --line: #ddd3ef;
  --paper-edge: rgba(221, 211, 239, 0.7);
  --edge-lit: #ffffff;
  --accent: #6d20f5;
  --on-accent: #ffffff;
  --panel: #e7e0f6;
  --tint: #e9e0ff;
  --on-tint: #6d20f5;
  --lilac: #c8b6ff;
  --bubble-out: linear-gradient(90deg, #c8b6ff, #c1abfe);
  --statement: #120a26;
  --statement-edge: rgba(200, 182, 255, 0.06);
  --on-statement: #ffffff;
  --on-statement-muted: #dbd1ec;
  --statement-accent: #c8b6ff;
  --action: linear-gradient(90deg, #6d20f5, #7d3ef6);
  --danger: #b3261e;
  --error: #a12a32;
  --online: #35a854;
  --unread: #e5484d;
  --favorite: #e3aa25;
  --badge: #c62828;
  --glow: rgba(138, 86, 247, 0.17);
  --glow-lilac: rgba(169, 134, 251, 0.1);
  --shadow-paper: 0 2px 8px rgba(110, 59, 234, 0.1), 0 1px 2px rgba(74, 29, 180, 0.08);
  --shadow-raised: 0 4px 14px rgba(110, 59, 234, 0.12), 0 2px 4px rgba(74, 29, 180, 0.08);
  --shadow-floating: 0 8px 28px rgba(110, 59, 234, 0.18), 0 3px 8px rgba(74, 29, 180, 0.1);
  --shadow-action: 0 6px 18px rgba(110, 59, 234, 0.34);
  --scrim: rgba(20, 8, 50, 0.56);
  --gutter: 16px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #09051a;
  --paper: #150e29;
  --ink: #f1ecfb;
  --muted: #bbb0ce;
  --line: #4d4170;
  --paper-edge: #30254e;
  --edge-lit: rgba(200, 182, 255, 0.34);
  --accent: #c8b6ff;
  --on-accent: #130c22;
  --panel: #1c1433;
  --tint: #2b1b56;
  --on-tint: #c8b6ff;
  --bubble-out: linear-gradient(90deg, #2b1b56, #47337a);
  --statement: #1d1338;
  --statement-edge: rgba(200, 182, 255, 0.22);
  --action: linear-gradient(90deg, #7c3ef8, #844bf7);
  --danger: #ffb4ab;
  --error: #ffb4ab;
  --glow: rgba(138, 86, 247, 0.32);
  --glow-lilac: rgba(169, 134, 251, 0.14);
  --shadow-paper: 0 2px 8px rgba(110, 59, 234, 0.16);
  --shadow-raised: 0 4px 14px rgba(110, 59, 234, 0.2);
  --shadow-floating: 0 8px 28px rgba(110, 59, 234, 0.3);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  background: var(--canvas);
  color: var(--ink);
  font-family: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
}
button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}

/* The field: the page with its two still pools of light. */
.field {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  background:
    radial-gradient(90vmin circle at 92% 2%, var(--glow), transparent 70%),
    radial-gradient(70vmin circle at 4% 86%, var(--glow-lilac), transparent 70%), var(--canvas);
}
.screen {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  height: 100%;
  min-height: 0;
}
.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Type roles */
.hero { font-size: 26px; line-height: 32px; font-weight: 700; letter-spacing: -0.3px; }
.page-title { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.2px; }
.bar-title { font-size: 20px; line-height: 26px; font-weight: 600; letter-spacing: -0.15px; }
.title-m { font-size: 16px; line-height: 22px; font-weight: 600; letter-spacing: -0.1px; }
.title-s { font-size: 14px; line-height: 20px; font-weight: 600; }
.body-l { font-size: 16px; line-height: 24px; letter-spacing: -0.1px; }
.body-m { font-size: 14px; line-height: 20px; }
.body-s { font-size: 13px; line-height: 18px; }
.label-l { font-size: 14px; line-height: 20px; font-weight: 600; }
.label-m { font-size: 12px; line-height: 16px; font-weight: 500; }
.label-s { font-size: 11px; line-height: 14px; font-weight: 500; letter-spacing: 0.05px; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.danger { color: var(--danger); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { text-align: center; }

.icon { width: 24px; height: 24px; fill: currentColor; flex: none; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex: none;
  position: relative;
}
.icon-btn:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 0 4px;
  flex: none;
  position: relative;
}
.topbar .title {
  position: absolute;
  left: 56px;
  right: 56px;
  text-align: center;
  pointer-events: none;
}
.topbar .spacer { flex: 1; }
.wordmark { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.wordmark img { width: 40px; height: 40px; }
.wordmark span {
  font-family: "Manrope", Roboto, system-ui, sans-serif;
  font-weight: 800;
  font-size: 29px;
  line-height: 1.2;
  letter-spacing: 0.006em;
  white-space: nowrap;
}
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
:root[data-theme="dark"] .logo-light { display: none; }
.loading-line { height: 3px; background: var(--panel); overflow: hidden; flex: none; }
.loading-line::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  background: var(--accent);
  animation: slide 1.1s ease-in-out infinite;
}
@keyframes slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(260%); }
}

/* Bottom navigation: the floating pill */
.nav {
  flex: none;
  display: flex;
  margin: 4px 16px calc(8px + env(safe-area-inset-bottom));
  height: 80px;
  border-radius: 40px;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-top-color: var(--edge-lit);
  box-shadow: var(--shadow-floating);
}
.nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
}
.nav .pill {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 32px;
  border-radius: 16px;
  transition: background 0.2s;
}
.nav .mark {
  width: 28px;
  height: 28px;
  background: currentColor;
  -webkit-mask: url("/assets/beanon_logo_black.svg") center / contain no-repeat;
  mask: url("/assets/beanon_logo_black.svg") center / contain no-repeat;
}
.nav [aria-selected="true"] { color: var(--ink); }
.nav [aria-selected="true"] .pill { background: var(--accent); color: var(--on-accent); }
.nav [aria-selected="true"] .label-s { font-weight: 600; }
.nav [aria-selected="true"] .icon { transform: scale(1.1); }
.nav .count { position: absolute; top: -8px; right: 2px; }
.count {
  min-width: 22px;
  height: 22px;
  padding: 2px 7px;
  border-radius: 11px;
  background: var(--badge);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  font-weight: 700;
  text-align: center;
}

/* Glass panels */
.card {
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-top-color: var(--edge-lit);
  border-radius: 20px;
  box-shadow: var(--shadow-raised);
}
.card.floating { box-shadow: var(--shadow-floating); }
.statement {
  background: radial-gradient(120% 90% at 90% 0%, rgba(138, 86, 247, 0.35), transparent 60%), var(--statement);
  border: 1px solid var(--statement-edge);
  color: var(--on-statement);
  border-radius: 32px;
  padding: 24px;
  box-shadow: 0 10px 34px rgba(110, 59, 234, 0.3);
}
.statement .muted { color: var(--on-statement-muted); }
.statement .accent { color: var(--statement-accent); }
.tint-card { background: var(--tint); border-radius: 20px; padding: 16px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
}
.btn.primary {
  background: var(--action);
  color: #fff;
  box-shadow: var(--shadow-action), inset 0 1px 0 rgba(255, 255, 255, 0.38);
}
.btn.primary:active { filter: brightness(0.86); transform: scale(0.98); }
.btn.outline { border: 1px solid var(--line); color: var(--accent); }
.btn.text { color: var(--accent); padding: 0 12px; }
.btn.destructive { border: 1px solid var(--danger); color: var(--danger); }
.btn.paper { background: #fff; color: #6d20f5; }
.btn.block { width: 100%; }
.btn:disabled { background: var(--panel); color: var(--muted); border: 1px solid var(--muted); box-shadow: none; cursor: default; }

/* Chats list */
.list { padding: 8px var(--gutter); display: flex; flex-direction: column; gap: 8px; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px var(--gutter);
  padding: 0 16px;
  height: 56px;
  border-radius: 28px;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  box-shadow: var(--shadow-paper);
}
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; }
.search input::placeholder { color: var(--muted); }
.row {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: 12px 16px;
  text-align: left;
}
.row.ended { opacity: 0.56; }
.row .main { flex: 1; min-width: 0; margin-left: 16px; }
.row .line { display: flex; align-items: center; min-height: 20px; }
.row .line + .line { margin-top: 4px; }
.row .time { margin-left: auto; padding-left: 8px; flex: none; color: var(--muted); }
.row .time.unread { color: var(--accent); font-weight: 600; }
.row .small { width: 16px; height: 16px; margin-left: 4px; }
.row .tick { width: 14px; height: 14px; margin-right: 4px; color: var(--muted); }
.row .tick.read { color: var(--accent); }
.row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 8px; flex: none; }
.row .count { margin-left: 10px; flex: none; }
.star { color: var(--muted); }
.star.on { color: var(--favorite); }
.star .icon { width: 22px; height: 22px; }

.avatar {
  position: relative;
  flex: none;
  border-radius: 50%;
  background: var(--lilac);
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar .online {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid var(--paper);
}

.empty { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 48px 24px; text-align: center; }
.disc {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--tint);
  border: 1px solid var(--paper-edge);
  color: var(--accent);
}
.disc .icon { width: 48px; height: 48px; }

/* Conversation */
.chat-header { display: flex; align-items: center; min-height: 64px; padding: 0 4px; flex: none; }
.chat-header .who { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 8px 0; text-align: left; }
.chat-header .status { min-height: 18px; display: flex; align-items: center; gap: 4px; }
.chat-header .status .live { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin: 0 6px; }
.messages { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; }
.day {
  align-self: center;
  margin: 8px 0;
  padding: 4px 12px;
  border-radius: 12px;
  background: var(--tint);
  color: var(--muted);
}
.event { align-self: center; padding: 12px 24px; text-align: center; color: var(--muted); }
.msg { display: flex; flex-direction: column; gap: 3px; max-width: min(320px, 82%); align-self: flex-start; align-items: flex-start; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.bubble {
  padding: 9px 13px;
  border-radius: 22px 22px 22px 8px;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-top-color: var(--edge-lit);
  box-shadow: var(--shadow-paper);
  font-size: 16px;
  line-height: 24px;
  letter-spacing: -0.1px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: left;
  cursor: default;
}
.msg.joins .bubble { border-top-left-radius: 8px; }
.msg.mine .bubble { border-radius: 22px 22px 8px 22px; background: var(--bubble-out); border: 0; box-shadow: none; }
.msg.mine.joins .bubble { border-top-right-radius: 8px; }
.bubble.media { padding: 0; background: none; border: 0; box-shadow: none; }
.bubble.media img { display: block; width: min(320px, 70vw); border-radius: 14px; object-fit: cover; background: var(--panel); }
.bubble .placeholder { display: grid; place-items: center; width: min(320px, 70vw); aspect-ratio: 1.3; border-radius: 14px; background: var(--panel); color: var(--muted); }
.bubble .caption { font-size: 14px; line-height: 20px; padding: 5px 4px; }
.bubble .once { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.quote {
  display: flex;
  flex-direction: column;
  margin-bottom: 6px;
  padding: 7px 10px;
  border-radius: 10px;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.quote .text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; align-items: center; gap: 3px; padding: 1px 3px; color: var(--muted); }
.meta .icon { width: 12px; height: 12px; }
.meta .read { color: var(--accent); }
.reactions { padding: 3px 8px; border-radius: 12px; background: var(--panel); font-size: 14px; }
.more-history { align-self: center; margin: 8px 0; }

.strip { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; background: var(--tint); flex: none; }
.strip .body { flex: 1; min-width: 0; }
.composer { display: flex; align-items: flex-end; padding: 8px 10px; gap: 4px; flex: none; }
.composer .field-box {
  flex: 1;
  min-width: 0;
  display: flex;
  min-height: 48px;
  padding: 10px 8px 10px 16px;
  border-radius: 22px;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-top-color: var(--edge-lit);
  box-shadow: var(--shadow-raised);
}
.composer textarea {
  flex: 1;
  border: 0;
  outline: 0;
  resize: none;
  background: none;
  font-size: 16px;
  line-height: 22px;
  max-height: 110px;
  padding: 3px 0;
  caret-color: var(--accent);
}
.composer textarea::placeholder { color: var(--muted); }
.send {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--action);
  color: #fff;
  box-shadow: var(--shadow-action);
  flex: none;
}
.send .icon { width: 20px; height: 20px; }
.send:disabled { background: var(--panel); color: var(--muted); box-shadow: none; cursor: default; }
.ended-panel { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: none; }
.ended-panel .statement { border-radius: 28px; }

/* Sheets, dialogs and the message menu */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--scrim);
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.scrim.middle { align-items: center; padding: 24px; }
.sheet {
  width: 100%;
  max-width: 640px;
  max-height: 88%;
  overflow-y: auto;
  padding: 12px 24px calc(24px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background: var(--paper);
  border-top: 1px solid var(--edge-lit);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sheet::before { content: ""; align-self: center; width: 32px; height: 4px; border-radius: 2px; background: var(--accent); opacity: 0.6; }
.dialog {
  width: 100%;
  max-width: 560px;
  padding: 24px;
  border-radius: 32px;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-top-color: var(--edge-lit);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.dialog input,
.dialog textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: none;
  font-size: 16px;
  outline: 0;
}
.dialog input:focus,
.dialog textarea:focus { border-color: var(--accent); }
.menu { display: flex; flex-direction: column; }
.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 0;
  text-align: left;
}
.action-row .tile,
.tile {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--on-tint);
  flex: none;
}
.tile .icon { width: 20px; height: 20px; }
.action-row.danger .tile { color: var(--danger); }
.action-row .text { flex: 1; min-width: 0; }
.reaction-bar {
  display: flex;
  align-self: center;
  gap: 4px;
  padding: 4px;
  border-radius: 28px;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  box-shadow: var(--shadow-floating);
}
.reaction-bar button { width: 48px; height: 48px; border-radius: 50%; font-size: 22px; }

/* Profile */
.page { padding: var(--gutter); display: flex; flex-direction: column; gap: 16px; }
.hero-card { display: flex; flex-direction: column; gap: 16px; }
.hero-card .who { display: flex; align-items: center; gap: 16px; }
.hero-card .ring { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; background: var(--statement-accent); flex: none; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-tag { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 16px; background: var(--tint); color: var(--on-tint); }
.pill-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.group { display: flex; flex-direction: column; gap: 8px; }
.settings-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px; width: 100%; text-align: left; }
.settings-row .text { flex: 1; min-width: 0; }
.settings-row > .icon { width: 20px; height: 20px; color: var(--muted); }
.switch { position: relative; width: 52px; height: 32px; border-radius: 16px; border: 2px solid var(--muted); background: var(--canvas); flex: none; }
.switch::after { content: ""; position: absolute; top: 6px; left: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform 0.15s; }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { background: var(--on-accent); transform: translateX(20px) scale(1.4); }
.theme-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice { padding: 12px 4px; border-radius: 20px; background: var(--paper); border: 1px solid var(--paper-edge); text-align: center; }
.choice[aria-pressed="true"] { background: var(--tint); border: 2px solid var(--accent); }
.mood-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.mood-grid .choice .emoji { font-size: 26px; line-height: 32px; display: block; }
.mood-pill { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; min-height: 48px; padding: 0 16px; border-radius: 24px; background: var(--tint); color: var(--on-tint); font-weight: 600; }

/* Sign-in */
.signin { justify-content: center; align-items: center; padding: 24px; gap: 24px; text-align: center; overflow-y: auto; }
.signin .statement { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.signin .google { min-height: 44px; display: flex; justify-content: center; }
.signin .steps { margin: 0; padding-left: 20px; }
.notice { padding: 12px 16px; border-radius: 14px; background: var(--tint); color: var(--on-tint); }
.notice.error { background: color-mix(in srgb, var(--error) 12%, transparent); color: var(--error); }
.toast {
  position: fixed;
  left: 50%;
  bottom: 112px;
  transform: translateX(-50%);
  z-index: 20;
  max-width: min(560px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--statement);
  color: #fff;
  box-shadow: var(--shadow-floating);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- Text size (Appearance): Small .85, Device default 1, Large 1.15, XL 1.3 ---- */
body { zoom: var(--text-scale, 1); }

/* ---- Chips, fields ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
}
.chip .icon { width: 18px; height: 18px; }
.chip[aria-pressed="true"] { background: var(--tint); color: var(--on-tint); border: 1.5px solid var(--accent); }
.chip:disabled { opacity: 0.5; cursor: default; }
.input,
.select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 16px;
  outline: 0;
  resize: vertical;
}
.input:focus,
.select:focus { border-color: var(--accent); }
.select { width: auto; padding: 8px 12px; }
.number {
  width: 100%;
  border: 0;
  outline: 0;
  background: none;
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
input[type="range"] { accent-color: var(--accent); }
.premium-tag { padding: 2px 8px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 700; vertical-align: middle; }
.panel-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 20px; background: var(--panel); }
.row .main > .body-l { display: block; }
.mood-tag { display: inline-block; margin-top: 4px; padding: 4px 12px; border-radius: 14px; background: var(--tint); color: var(--on-tint); }
.btn.tall { min-height: 56px; border-radius: 28px; }
.btn .icon { width: 20px; height: 20px; }
.bell-count { position: absolute; top: 4px; right: 0; }
.chat-header button.who { cursor: pointer; }

/* ---- Discover ---- */
.discover { min-height: 100%; justify-content: space-between; padding-top: 8px; gap: 16px; }
.search-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.search-card .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mood-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 49px;
  max-width: 60%;
  padding: 8px 12px;
  border-radius: 25px;
  background: rgba(18, 10, 38, 0.75);
  border: 1px solid rgba(200, 182, 255, 0.7);
  color: #fff;
}
.mood-chip .icon { width: 18px; height: 18px; color: var(--statement-accent); }
.search-card .art {
  position: relative;
  align-self: center;
  display: grid;
  place-items: center;
  width: min(44%, 280px);
  min-width: 168px;
  aspect-ratio: 1;
  margin: 8px 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(200, 182, 255, 0.34), rgba(138, 86, 247, 0.12) 60%, transparent 72%);
  color: var(--statement-accent);
}
.search-card .art img { width: 86%; height: 86%; object-fit: contain; border-radius: 50%; }
.search-card .art .icon { width: 112px; height: 112px; }
.search-card .art.drifting img,
.search-card .art.drifting .icon { animation: drift 3.2s ease-in-out infinite; }
.search-card .art.drifting::after {
  content: "";
  position: absolute;
  inset: -4%;
  border-radius: 50%;
  border: 2px solid rgba(200, 182, 255, 0.5);
  animation: ring 1.8s ease-out infinite;
}
@keyframes drift {
  50% { transform: translateY(-8px); }
}
@keyframes ring {
  from { transform: scale(0.86); opacity: 0.9; }
  to { transform: scale(1.12); opacity: 0; }
}
.shout { font-weight: 800; }
.shout em { font-style: italic; }
.search-card .rule { width: 72px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--statement-accent), transparent); }

/* ---- Media: hidden previews, the viewer, the send preview ---- */
.media-open { position: relative; display: block; border-radius: 14px; overflow: hidden; }
.media-open img.blurred { filter: blur(24px); transform: scale(1.1); }
.media-open .veil { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(9, 5, 26, 0.35); text-align: center; padding: 8px; }
.viewer {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(#160c30, #05030e);
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
}
.viewer-bar { display: flex; align-items: center; gap: 4px; min-height: 64px; padding: 0 4px; flex: none; }
.viewer-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 8px; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; -webkit-user-drag: none; }
.viewer-caption { flex: none; max-height: 140px; overflow-y: auto; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); text-align: center; }
.viewer-send { display: flex; align-items: center; gap: 8px; padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); flex: none; }
.caption-field { flex: 1; min-width: 0; height: 48px; padding: 0 16px; border-radius: 22px; border: 0; outline: 0; background: #1c1433; color: #fff; font-size: 16px; }
.caption-field::placeholder { color: #bbb0ce; }
.once-toggle { width: 48px; height: 48px; border-radius: 50%; border: 2px solid #bbb0ce; color: #fff; flex: none; }
.once-toggle[aria-pressed="true"] { background: #6d20f5; border-color: #6d20f5; }
.viewer .send { background: #6d20f5; }

/* ---- Fit the device: no page scroll, screens size to the viewport ---------------------------
   Only lists and long forms scroll, inside their own area. Discover, sign-in and the conversation
   always fit: their flexible part (the artwork, the message list) takes what height is left. */
html,
body { overflow: hidden; overscroll-behavior: none; }
.field { height: 100vh; height: 100dvh; }
.screen { padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.scroll,
.sheet { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--accent) 30%, transparent) transparent; }
img, svg { max-width: 100%; }

.discover { height: 100%; min-height: 0; }
.discover > * { flex: none; }
.discover > .search-card { flex: 1 1 auto; min-height: min-content; } /* never smaller than its words */
.search-card .art {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  min-height: 0; /* the artwork is what gives way when height is short */
  max-height: 300px;
  aspect-ratio: 1;
  margin: 4px 0;
  overflow: hidden;
}
.search-card > :not(.art) { flex: none; }

.signin { justify-content: safe center; }

/* Short screens (landscape phones, small laptops, a browser with its keyboard open) */
@media (max-height: 760px) {
  .nav { height: 68px; margin-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .topbar, .chat-header { min-height: 56px; }
  .hero { font-size: 22px; line-height: 27px; }
  .btn.tall { min-height: 50px; }
  .discover { gap: 10px; padding-bottom: 10px; }
  .search-card { padding: 14px; gap: 6px; }
  .mood-chip { min-height: 40px; }
}
@media (max-height: 600px) {
  .nav { height: 56px; }
  .nav .label-s { display: none; }
  .hero { font-size: 19px; line-height: 23px; }
  .search-card .rule { display: none; }
  .wordmark img { width: 32px; height: 32px; }
  .wordmark span { font-size: 24px; }
  .signin { gap: 14px; padding: 14px; }
  .empty { padding: 20px 16px; gap: 10px; }
  .disc { width: 72px; height: 72px; }
  .disc .icon { width: 34px; height: 34px; }
}

/* Narrow screens */
@media (max-width: 380px) {
  :root { --gutter: 12px; }
  .nav { margin-left: 8px; margin-right: 8px; }
  .nav .pill { width: 56px; }
  .wordmark span { font-size: 25px; }
  .bar-title { font-size: 18px; }
  .row { padding: 10px 12px; }
  .row .main { margin-left: 12px; }
  .messages { padding: 8px; }
  .sheet { padding-left: 16px; padding-right: 16px; }
  .theme-tiles { gap: 6px; }
  .mood-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
}

/* Wide screens: the same phone layout, as in the app, set as a column on the field. */
@media (min-width: 700px) {
  .screen { max-width: 680px; border-left: 1px solid var(--paper-edge); border-right: 1px solid var(--paper-edge); }
  .msg { max-width: min(420px, 70%); }
  .bubble.media img, .bubble .placeholder { width: min(360px, 60vw); }
  .scrim { align-items: center; padding: 24px; }
  .sheet { border-radius: 28px; max-height: 84%; max-width: 560px; }
  .viewer { align-items: center; }
  .viewer-bar, .viewer-send, .viewer-caption { width: 100%; max-width: 900px; }
}

/* Short screens: the shortcut rows become single lines and the hero words run on, so the
   whole of Discover still fits. Nothing is ever clipped: the artwork shrinks first. */
@media (max-height: 760px) {
  .discover .settings-row { min-height: 44px; padding-top: 4px; padding-bottom: 4px; }
  .discover .settings-row .label-m { display: none; }
  .discover .settings-row .tile { width: 30px; height: 30px; }
  .discover .settings-row .avatar { width: 30px !important; height: 30px !important; }
  .discover > .group:first-child { gap: 6px; }
}
@media (max-height: 640px) {
  .shout br { display: none; }
  .discover .btn.outline:not(.block) { min-height: 40px; }
}
/* Wide but short (a laptop window): artwork beside the words instead of above them. */
@media (min-width: 600px) and (max-height: 900px) {
  .search-card { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr auto auto 1fr; column-gap: 24px; align-items: center; }
  .search-card .head { grid-column: 1 / -1; grid-row: 1; }
  .search-card .art { grid-column: 1; grid-row: 2 / 6; width: clamp(88px, 24vh, 220px); height: auto; max-height: none; flex: none; }
  .search-card > .hero { grid-column: 2; grid-row: 3; }
  .search-card > .rule { grid-column: 2; grid-row: 4; align-self: start; }
  .search-card > .body-m { grid-column: 2; grid-row: 4; align-self: start; }
  .search-card > .rule + .body-m { grid-row: 5; }
}
/* Very short and wide (a phone on its side): shortcuts side by side, the two buttons in a row. */
@media (max-height: 540px) and (min-width: 600px) {
  .discover > .group:first-child { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
  .discover .settings-row > .icon { display: none; }
  .discover .settings-row .text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .discover > .group:last-child { flex-direction: row; align-items: center; }
  .discover > .group:last-child > .btn.block { flex: 1; width: auto; }
  .discover > .group:last-child > #filters,
  .discover > .group:last-child > #countdown { flex: none; max-width: 40%; }
  .search-card { padding: 10px 14px; }
  .search-card .art { width: clamp(56px, 20vh, 120px); }
  .mood-chip { min-height: 34px; padding: 4px 10px; }
  .nav { height: 48px; margin-top: 0; }
  .topbar { min-height: 48px; }
}
