/* Strangely — warm paper + tangerine. One column everywhere so phone and desktop feel the same. */
:root {
  --bg: #f6f1ea;
  --surface: #fffdf9;
  --surface-2: #f1ebe2;
  --ink: #1c1917;
  --ink-2: #6b635a;
  --line: #e6ddd1;
  --brand: #f0532c;
  --brand-ink: #ffffff;
  --brand-soft: #fde3da;
  --accent: #1f7a6d;
  --accent-soft: #d8efea;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --btn-ink: #1c1917;
  --btn-ink-fg: #fffdf9;
  --shadow: 0 1px 2px rgba(40, 30, 20, .05), 0 10px 30px rgba(40, 30, 20, .07);
  --radius: 24px;
  --blob-a: #ff7a45;
  --blob-b: #ff3d7f;
  --blob-c: #ffc24b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14110f; --surface: #1d1916; --surface-2: #28221e; --ink: #f3ede6; --ink-2: #b1a79c;
    --line: #362f29; --brand: #ff6b45; --brand-ink: #1a0d08; --brand-soft: #3d2118;
    --accent: #3fc1ad; --accent-soft: #163631; --btn-ink: #f3ede6; --btn-ink-fg: #14110f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14110f; --surface: #1d1916; --surface-2: #28221e; --ink: #f3ede6; --ink-2: #b1a79c;
  --line: #362f29; --brand: #ff6b45; --brand-ink: #1a0d08; --brand-soft: #3d2118;
  --accent: #3fc1ad; --accent-soft: #163631; --btn-ink: #f3ede6; --btn-ink-fg: #14110f;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; max-width: 100%; overflow-x: hidden; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100dvh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
kbd { font: 12px ui-monospace, monospace; padding: 1px 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 0; top: -60px; background: var(--brand); color: var(--brand-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 8px; inset-inline-start: 8px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---------- header ---------- */
.hdr { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px max(16px, calc((100% - 760px) / 2)); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.wordmark { display: inline-flex; align-items: center; gap: 8px; font: 800 22px/1 'Bricolage Grotesque', Inter, sans-serif; letter-spacing: -.03em; color: var(--ink); text-decoration: none; }
.mark { display: inline-flex; align-items: flex-end; gap: 3px; height: 22px; padding: 4px 5px; border-radius: 8px; background: var(--brand); }
.mark i { width: 3px; border-radius: 2px; background: #fff; }
.mark i:nth-child(1) { height: 7px; } .mark i:nth-child(2) { height: 14px; } .mark i:nth-child(3) { height: 10px; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
.live-pill b { font-variant-numeric: tabular-nums; }
.live-pill .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(22,163,74,.5); animation: live 2s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 7px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
.hdr-nav { margin-inline-start: auto; display: flex; gap: 4px; }
.hdr-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 8px 10px; border-radius: 12px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink); }
.hdr-btn:hover { background: var(--surface-2); }
.badge { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; display: grid; place-items: center; font-weight: 700; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); }

/* ---------- common ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.btn { border: 0; border-radius: 14px; padding: 10px 16px; cursor: pointer; font-weight: 600; transition: transform .08s, background .15s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.sm { padding: 7px 12px; font-size: 14px; }
.btn.big { width: 100%; padding: 14px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font-weight: 600; font-size: 13px; }
.chip-btn { border: 1px solid var(--ink); background: var(--ink); color: var(--bg); border-radius: 99px; padding: 6px 14px; font-weight: 600; font-size: 13px; cursor: pointer; }
.chip-btn.ghost { background: transparent; color: var(--ink); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-weight: 600; font-size: 14px; }
input:not([type=checkbox]), select, textarea { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 99px; cursor: pointer; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); font-weight: 600; }
.add-row { display: flex; gap: 8px; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.meter div { height: 100%; width: 0; background: var(--good); transition: width .08s; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; accent-color: var(--brand); }
.preflight { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.pf { display: inline-flex; align-items: center; gap: 6px; }
.pf i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.pf[data-s="ok"] i { background: var(--good); }
.pf[data-s="fail"] i { background: var(--bad); }
.pf[data-s="checking"] i { background: var(--warn); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------- shell: one column, same on phone and desktop ---------- */
.shell { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 14px 16px 8px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- call card ---------- */
.stage { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 18px 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; overflow: hidden; contain: paint; }
.banner { align-self: stretch; padding: 9px 12px; border-radius: 14px; background: #fde68a; color: #3b2a00; font-size: 14px; text-align: center; }
.invite-banner { align-self: stretch; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 8px 12px; border-radius: 14px; background: var(--accent-soft); font-size: 14px; }
.invite-banner b { font-family: ui-monospace, monospace; letter-spacing: .08em; }

.portal { position: relative; width: 230px; height: 190px; display: grid; place-items: center; flex: none; }
.portal > * { grid-area: 1 / 1; }
.blob { width: 100%; height: 100%; background: radial-gradient(circle at 30% 30%, var(--blob-c), transparent 55%), linear-gradient(135deg, var(--blob-a), var(--blob-b)); border-radius: 58% 42% 55% 45% / 48% 58% 42% 52%; animation: morph 9s ease-in-out infinite; box-shadow: 0 18px 50px color-mix(in srgb, var(--blob-b) 30%, transparent); }
@keyframes morph {
  0%, 100% { border-radius: 58% 42% 55% 45% / 48% 58% 42% 52%; transform: rotate(0); }
  33% { border-radius: 42% 58% 38% 62% / 60% 40% 60% 40%; transform: rotate(8deg); }
  66% { border-radius: 50% 50% 62% 38% / 40% 55% 45% 60%; transform: rotate(-6deg); }
}
.greet { position: relative; z-index: 1; font: 800 42px/1.1 'Bricolage Grotesque', 'Noto Naskh Arabic', 'Noto Sans Devanagari', Inter, sans-serif; color: #fff; letter-spacing: -.02em; text-align: center; padding: 0 10px; transition: opacity .35s, transform .35s; text-shadow: 0 2px 12px rgba(0,0,0,.12); }
.greet.out { opacity: 0; transform: translateY(8px); }
.radar { position: relative; z-index: 1; width: 100%; height: 100%; display: none; }
.radar span { position: absolute; inset: 8%; border-radius: 50%; border: 3px solid var(--blob-b); opacity: 0; animation: ping 2.2s infinite; }
.radar span:nth-child(2) { animation-delay: 1.1s; }
@keyframes ping { from { transform: scale(.4); opacity: .8; } to { transform: scale(1.15); opacity: 0; } }
.avatar { display: none; position: relative; width: 64px; height: 64px; border-radius: 22px; background: linear-gradient(135deg, var(--blob-a), var(--blob-b)); color: #fff; place-items: center; font: 800 28px 'Bricolage Grotesque', sans-serif; }
.avatar .ring { position: absolute; inset: -6px; border-radius: 26px; border: 3px solid var(--good); opacity: 0; transition: opacity .12s, transform .12s; }
.avatar.speaking .ring { opacity: 1; transform: scale(1.03); }
@media (prefers-reduced-motion: reduce) { .blob, .radar span, .live-pill .pulse { animation: none; } .radar span { opacity: .3; } }

.state { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.state h2 { font-family: 'Bricolage Grotesque', Inter, sans-serif; margin: 0; font-size: 24px; letter-spacing: -.02em; }
.tagline { margin: 0; font: 800 clamp(26px, 5vw, 34px)/1.1 'Bricolage Grotesque', Inter, sans-serif; letter-spacing: -.03em; }
.tagline em { font-style: normal; color: var(--brand); }
.peer-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.peer-name { font: 700 20px 'Bricolage Grotesque', Inter, sans-serif; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.tag { font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); font-weight: 600; }
.friend-tag { background: var(--brand-soft); color: var(--brand); }
.call-meta { display: flex; align-items: center; gap: 10px; }
.timer { font: 600 16px ui-monospace, SFMono-Regular, monospace; font-variant-numeric: tabular-nums; }
.quality { display: inline-flex; gap: 3px; align-items: flex-end; height: 14px; }
.quality i { width: 4px; border-radius: 1px; background: var(--line); }
.quality i:nth-child(1) { height: 25%; } .quality i:nth-child(2) { height: 50%; } .quality i:nth-child(3) { height: 75%; } .quality i:nth-child(4) { height: 100%; }
.quality[data-q="4"] i { background: var(--good); }
.quality[data-q="3"] i:nth-child(-n+3) { background: var(--good); }
.quality[data-q="2"] i:nth-child(-n+2) { background: var(--warn); }
.quality[data-q="1"] i:nth-child(1) { background: var(--bad); }

.cta { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 8px; }
.big-btn { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 18px; padding: 16px 20px; font: 700 18px 'Bricolage Grotesque', Inter, sans-serif; cursor: pointer; transition: transform .08s, box-shadow .15s; }
.big-btn.go { background: var(--btn-ink); color: var(--btn-ink-fg); box-shadow: 0 8px 22px rgba(28,25,23,.22); }
.big-btn.go:hover { box-shadow: 0 10px 28px rgba(240,83,44,.35); }
.big-btn.go svg { transition: transform .15s; }
.big-btn.go:hover svg { transform: translateX(3px); }
.big-btn:active { transform: scale(.98); }
.big-btn.quiet { background: transparent; border: 2px solid var(--line); color: var(--ink); }
.adult-line { max-width: 420px; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 14px; padding: 9px 12px; }
.adult-line.nudge { animation: nudge .45s; outline: 2px solid var(--warn); color: var(--ink); }
@keyframes nudge { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* dock: compact call controls */
.dock { display: none; align-items: stretch; gap: 6px; padding: 6px; border-radius: 22px; background: var(--surface-2); max-width: 100%; }
.dk { border: 0; background: transparent; border-radius: 16px; min-width: 58px; padding: 8px 6px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; color: var(--ink); }
.dk:hover:not(:disabled) { background: var(--surface); }
.dk:disabled { opacity: .35; cursor: not-allowed; }
.dk-lbl { font-size: 11px; font-weight: 600; white-space: nowrap; }
.dk .slash { opacity: 0; }
.dk[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.dk[aria-pressed="true"] .slash { opacity: 1; }
#keepBtn[aria-pressed="true"] { background: var(--brand); color: #fff; }
#keepBtn[aria-pressed="true"] path { fill: currentColor; }
#keepBtn.pulse { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--brand-soft); } }
#reportBtn:hover:not(:disabled) { color: var(--bad); }
.dk.next { flex-direction: row; gap: 6px; padding: 0 18px; background: var(--brand); color: var(--brand-ink); font: 700 16px 'Bricolage Grotesque', Inter, sans-serif; margin-inline-start: 4px; }
.dk.next:hover { background: var(--brand) !important; filter: brightness(1.06); }
.dk.next.end { background: var(--bad); color: #fff; }
.dk.next.end .ico-next { display: none; }
.kudos-menu { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 520px; }
.kudos-menu button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: 13px; }
.kudos-menu button:hover { border-color: var(--brand); color: var(--brand); }
.switch-row { display: none; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.switch-row input { appearance: none; width: 34px; height: 20px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch-row input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch-row input:checked { background: var(--accent); }
.switch-row input:checked::after { transform: translateX(14px); }
.ptt { width: 100%; padding: 14px; border-radius: 16px; border: 2px dashed var(--accent); background: var(--accent-soft); font-weight: 600; cursor: pointer; user-select: none; touch-action: none; }
.ptt.active { background: var(--accent); color: #fff; border-style: solid; }

.call-extras { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.exchange { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--accent-soft); border-radius: 16px; padding: 10px 14px; }
.exchange b { display: block; font-size: 17px; }
.ex-timer { font: 600 18px ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.captions { background: var(--ink); color: var(--bg); border-radius: 14px; padding: 10px 14px; min-height: 54px; font-size: 16px; line-height: 1.4; }
.cap-line.interim { opacity: .6; }
.icebreaker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; background: var(--brand-soft); border-radius: 16px; padding: 10px 14px; text-align: center; }
.icebreaker p { margin: 0; font-weight: 600; flex: 1 1 220px; }
.ib-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); font-weight: 700; }
.reactions { display: flex; gap: 6px; justify-content: center; }
.reactions button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; width: 40px; height: 40px; font-size: 20px; cursor: pointer; transition: transform .1s; }
.reactions button:hover { transform: scale(1.15); }
.floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.floater { position: absolute; bottom: 30%; font-size: 36px; animation: floatUp 1.8s ease-out forwards; }
@keyframes floatUp { from { transform: translateY(0) scale(.6); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(-220px) scale(1.2); opacity: 0; } }
.rate { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-top: 6px; }
.rate-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; width: 44px; height: 44px; font-size: 20px; cursor: pointer; }
.rate-btn.picked { background: var(--accent-soft); border-color: var(--accent); }
.rate.done .rate-btn:not(.picked) { opacity: .4; }

/* preferences */
.prefs { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 16px; }
.goal { border: 0; background: transparent; border-radius: 12px; padding: 9px 6px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.goal b { font-weight: 600; }
.goal.on { background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.vibe-row { display: flex; align-items: center; gap: 10px; }
.vibe-lbl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); flex: none; }
.vibes { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.vibes::-webkit-scrollbar { display: none; }
.vibe { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; }
.vibe.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pref-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; }
.pref { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: start; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 7px 12px; cursor: pointer; min-width: 0; font-size: 14px; font-weight: 600; }
.pref small { font-size: 11px; font-weight: 600; color: var(--ink-2); }
.pref > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pref select { border: 0; padding: 0; background: transparent; font-weight: 600; box-shadow: none; cursor: pointer; }
.pref-more { justify-content: center; align-items: center; padding: 0 14px; }

.extras-grid { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-card { background: var(--surface-2); border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.mini-card p { margin: 0; }
.mini-card.daily p { font: 600 16px/1.35 'Bricolage Grotesque', Inter, sans-serif; }
.mini-card.quiet { background: var(--brand-soft); }
.fineprint { margin: 0; text-align: center; font-size: 12px; color: var(--ink-2); }

/* states */
.stage[data-state="searching"] .blob { animation-duration: 3s; }
.stage[data-state="searching"] .radar { display: block; }
.stage[data-state="searching"] .greet { font-size: 30px; }
.stage[data-state="connected"] { padding: 14px; gap: 10px; }
.stage[data-state="connected"] .portal { width: auto; height: auto; }
.stage[data-state="connected"] .blob, .stage[data-state="connected"] .greet { display: none; }
.stage[data-state="connected"] .avatar { display: grid; }
.stage[data-state="connected"] .dock { display: flex; }
.stage[data-state="connected"] .switch-row, .stage[data-state="ended"] .switch-row { display: inline-flex; }
.stage[data-state="connected"] .prefs, .stage[data-state="connected"] .extras-grid, .stage[data-state="connected"] .fineprint, .stage[data-state="connected"] .cta { display: none; }
.stage[data-state="searching"] .prefs { display: none; }
.stage[data-state="connected"] .adult-line, .stage[data-state="searching"] .adult-line { display: none; }
.stage[data-state="ended"] .portal { height: 120px; width: 150px; }
.stage[data-state="ended"] .greet { font-size: 28px; }
.stage[data-state="ended"] .extras-grid { display: none; }

/* ---------- room: tools + chat ---------- */
.room { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.room-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 16px 0; font-family: 'Bricolage Grotesque', Inter, sans-serif; font-size: 17px; }
body[data-state="connected"] .room { min-height: 62dvh; }
.tool-area { margin: 10px 10px 0; border: 1px solid var(--line); border-radius: 18px; display: flex; flex-direction: column; background: var(--surface); }
.tool-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); }
.tool-title { font-weight: 700; white-space: nowrap; }
.tool-status { flex: 1; font-size: 13px; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-close { width: 32px; height: 32px; }
.tool-body { overflow: auto; padding: 12px; }
.tool-row { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-height: 140px; max-height: 60dvh; }
.chat-log:empty::before { content: attr(data-empty); margin: auto; max-width: 380px; text-align: center; color: var(--ink-2); font-size: 14px; }
.msg { max-width: 80%; padding: 8px 12px; border-radius: 18px; background: var(--surface-2); word-wrap: break-word; }
.msg.mine { align-self: flex-end; background: var(--ink); color: var(--bg); border-bottom-right-radius: 6px; }
.msg.theirs { align-self: flex-start; border-bottom-left-radius: 6px; }
.sys { align-self: center; font-size: 12px; color: var(--ink-2); text-align: center; padding: 4px 0; }
.typing { padding: 0 16px 4px; font-size: 12px; color: var(--ink-2); }
.tray { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; border-top: 1px solid var(--line); scrollbar-width: thin; }
.tray-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 6px 11px; cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; }
.tray-btn:hover { background: var(--surface-2); }
.tray-btn[aria-disabled="true"] { opacity: .55; }
.tray-btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tray-ico { font-size: 16px; }
.chat-form { display: flex; gap: 8px; padding: 8px 12px 12px; }
.kudos-shelf { display: flex; flex-wrap: wrap; gap: 6px; }
.kudos-shelf span { padding: 6px 11px; border-radius: 99px; background: var(--brand-soft); font-size: 13px; font-weight: 600; }

/* ---------- tools ---------- */
.chess { display: grid; grid-template-columns: repeat(8, 1fr); width: min(100%, 420px); aspect-ratio: 1; margin: 0 auto; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.sq { border: 0; padding: 0; display: grid; place-items: center; cursor: pointer; position: relative; aspect-ratio: 1; }
.sq.light { background: #eeeed2; } .sq.dark { background: #769656; }
.sq.last { box-shadow: inset 0 0 0 100px rgba(255, 214, 10, .35); }
.sq.sel { box-shadow: inset 0 0 0 100px rgba(240, 83, 44, .45); }
.sq.dot::after { content: ''; width: 28%; height: 28%; border-radius: 50%; background: rgba(0,0,0,.25); }
.sq.cap::after { content: ''; position: absolute; inset: 4%; border-radius: 50%; border: 4px solid rgba(0,0,0,.28); }
.pc { font-size: clamp(22px, 5.4vw, 42px); line-height: 1; font-family: 'Segoe UI Symbol', 'Noto Sans Symbols 2', 'DejaVu Sans', serif; font-variant-emoji: text; user-select: none; }
.pc.w { color: #fff; text-shadow: 0 0 2px #000, 0 1px 2px #000; }
.pc.b { color: #111; }
.read-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-bottom: 10px; }
.read-pick { text-align: start; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.read-pick small { color: var(--ink-2); font-size: 12px; }
.read-paste { resize: vertical; }
.tool-read h4 { margin: 0 0 8px; font-family: 'Bricolage Grotesque', serif; font-size: 20px; }
.read-page { white-space: pre-wrap; font: 18px/1.65 Georgia, 'Noto Naskh Arabic', serif; background: #fbf7ee; color: #2a2419; border-radius: 12px; padding: 16px 18px; max-width: 64ch; margin: 0 auto; }
.doodle { width: 100%; max-width: 640px; display: block; margin: 0 auto; aspect-ratio: 10 / 7; background: #fff; border-radius: 12px; border: 1px solid var(--line); touch-action: none; cursor: crosshair; }
.palette { display: flex; gap: 5px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; }
.swatch.on { outline: 3px solid var(--brand); outline-offset: 1px; }
.ttt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: min(100%, 270px); margin: 0 auto; }
.cell { aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font: 700 44px 'Bricolage Grotesque', sans-serif; cursor: pointer; }
.cell.win { background: var(--brand-soft); border-color: var(--brand); }
.c4 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; width: min(100%, 380px); margin: 0 auto; background: #1d4ed8; padding: 8px; border-radius: 12px; }
.hole { aspect-ratio: 1; border-radius: 50%; border: 0; background: #e8eefc; cursor: pointer; }
.hole.r { background: #e11d48; } .hole.y { background: #facc15; }
.hole.win { box-shadow: 0 0 0 3px #fff; }
.rps-hands, .rps-reveal { display: flex; justify-content: center; align-items: center; gap: 14px; }
.rps-hand { font-size: 44px; width: 86px; height: 86px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.rps-hand.on { background: var(--brand-soft); border-color: var(--brand); }
.rps-reveal span { font-size: 64px; }
.wyr-q, .trivia-q { font-weight: 700; font-size: 18px; text-align: center; margin: 0 0 10px; }
.wyr-opt, .trivia-opt { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: start; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 12px 14px; cursor: pointer; font-size: 15px; margin-bottom: 6px; }
.wyr-opt:disabled, .trivia-opt:disabled { cursor: default; }
.wyr-opt.on, .trivia-opt.on { border-color: var(--brand); background: var(--brand-soft); }
.trivia-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.trivia-opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--surface)); }
.trivia-opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
.wyr-opt small, .trivia-opt small { font-size: 12px; font-weight: 700; color: var(--brand); white-space: nowrap; }
.qcard { font: 700 22px/1.4 'Bricolage Grotesque', Inter, sans-serif; text-align: center; background: linear-gradient(135deg, var(--brand-soft), var(--accent-soft)); border-radius: 18px; padding: 34px 22px; }
.wc-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 40px; }
.wc-word { padding: 5px 12px; border-radius: 99px; background: var(--surface-2); font-weight: 600; }
.wc-word.mine { background: var(--brand-soft); }
.wc-input { max-width: 220px; }
.dice-big { font-size: 64px; text-align: center; line-height: 1.2; min-height: 80px; }
.dice-log { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; color: var(--ink-2); text-align: center; }
.focus-clock { font: 700 64px ui-monospace, SFMono-Regular, monospace; text-align: center; font-variant-numeric: tabular-nums; color: var(--brand); }
.focus-clock[data-mode="break"] { color: var(--accent); }
.notes { min-height: 220px; resize: vertical; font-size: 15px; line-height: 1.5; }
.tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: start; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px; cursor: pointer; }
.tool-card:hover { border-color: var(--brand); }
.tool-card-ico { font-size: 26px; }
.tool-card small { color: var(--ink-2); font-size: 12px; }

/* ---------- footer ---------- */
.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; padding: 14px 16px 22px; font-size: 13px; }
.foot a { color: var(--ink-2); }

/* ---------- drawers & modals ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20,15,10,.45); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100%); background: var(--surface); z-index: 30; padding: 16px; overflow-y: auto; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer h3 { margin: 0; font-family: 'Bricolage Grotesque', sans-serif; font-size: 22px; }
.friends { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.friends li { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; }
.friends .fdot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.friends .fdot.on { background: var(--good); }
.friends .fdot.busy { background: var(--warn); }
.friends .fname { flex: 1; font-weight: 600; }
.friends .fname small { display: block; font-weight: 400; color: var(--ink-2); }
.toggle { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.toggle input { margin-top: 4px; accent-color: var(--brand); width: 18px; height: 18px; }
.toggle small { display: block; color: var(--ink-2); font-size: 12px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats div { border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.stats b { display: block; font: 700 22px 'Bricolage Grotesque', sans-serif; }
.stats span { font-size: 12px; color: var(--ink-2); }
.modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 40; background: rgba(20,15,10,.45); padding: 16px; }
.modal-card { padding: 20px; width: min(420px, 100%); display: flex; flex-direction: column; gap: 12px; }
.modal-card h3 { margin: 0; }
.reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reasons button { padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: start; font-size: 14px; }
.reasons button:hover { border-color: var(--bad); color: var(--bad); }
.toasts { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(440px, calc(100% - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 14px; border-radius: 16px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 14px; animation: rise .2s ease-out; }
.toast .btn { padding: 6px 10px; font-size: 13px; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------- RTL + scripts ---------- */
html[dir="rtl"] body { font-family: 'Noto Naskh Arabic', Inter, system-ui, sans-serif; }
html[dir="rtl"] .state h2, html[dir="rtl"] .drawer h3, html[dir="rtl"] .tagline { font-family: 'Noto Naskh Arabic', 'Bricolage Grotesque', sans-serif; }
html[lang="hi"] body { font-family: 'Noto Sans Devanagari', Inter, system-ui, sans-serif; }
html[lang="hi"] .state h2, html[lang="hi"] .tagline { font-family: 'Noto Sans Devanagari', 'Bricolage Grotesque', sans-serif; }
html[dir="rtl"] .msg.mine { align-self: flex-start; border-radius: 18px 18px 18px 6px; }
html[dir="rtl"] .msg.theirs { align-self: flex-end; border-radius: 18px 18px 6px 18px; }
html[dir="rtl"] .drawer { right: auto; left: 0; border-left: 0; border-right: 1px solid var(--line); }
html[dir="rtl"] .big-btn svg, html[dir="rtl"] .dk.next svg { transform: scaleX(-1); }
html[dir="rtl"] .badge { right: auto; left: 2px; }

/* ---------- small screens: same layout, tighter spacing ---------- */
@media (max-width: 640px) {
  .hdr { padding: 8px 12px; gap: 8px; }
  .hdr-lbl { display: none; }
  .hdr-btn { padding: 8px; }
  .wordmark { font-size: 20px; }
  .live-pill { padding: 4px 9px; font-size: 12px; }
  .live-pill [data-i18n="hereNow"] { display: none; }
  .shell { padding: 10px 10px 6px; gap: 10px; }
  .stage { padding: 16px 12px 14px; border-radius: 22px; }
  .portal { width: 190px; height: 150px; }
  .greet { font-size: 34px; }
  .dock { gap: 2px; padding: 4px; }
  .dk { min-width: 48px; padding: 7px 4px 5px; }
  .dk-lbl { font-size: 10px; }
  .dk.next { padding: 0 12px; font-size: 15px; }
  .extras-grid { grid-template-columns: 1fr; }
  .vibe-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .pref-row { grid-template-columns: 1fr 1fr auto; }
  .trivia-opts { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: 1fr; }
  .reasons { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .dk-lbl { display: none; }
  .dk { min-width: 42px; padding: 10px 4px; }
  .goal { font-size: 13px; }
}
