/* Cord of Three — design system. Dark, warm, editorial. Big type for ages 18–90. */
:root {
  --bg: #120f17;
  --bg2: #1a1522;
  --surface: #211b2b;
  --surface2: #2a2236;
  --line: rgba(255, 240, 225, 0.12);
  --text: #f7efe6;
  --muted: #bfb2c4;
  --faint: #8c7f93;
  --amber: #f4a259;
  --coral: #ee6c62;
  --teal: #5bb8c9;
  --violet: #a993ff;
  --sage: #8fd3a4;
  --gold: #e9c46a;
  --ok: #8fd3a4;
  --no: #ee6c62;
  --accent: var(--amber);
  --radius: 22px;
  --radius-lg: 30px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(1200px 700px at 10% -10%, rgba(238, 108, 98, 0.16), transparent 60%),
    radial-gradient(900px 600px at 110% 10%, rgba(169, 147, 255, 0.12), transparent 60%),
    radial-gradient(900px 700px at 50% 120%, rgba(244, 162, 89, 0.10), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 12px; }

#app { min-height: 100%; display: flex; flex-direction: column; }
.screen {
  flex: 1; width: 100%; max-width: 640px; margin: 0 auto;
  padding: calc(18px + var(--safe-t)) 18px calc(24px + var(--safe-b));
  display: flex; flex-direction: column; gap: 18px;
  animation: screenIn .35s ease both;
}
.no-anim, .no-anim .card, .no-anim .tile, .no-anim .banner { animation: none !important; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── type ── */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.wordmark { font-family: var(--serif); font-size: clamp(38px, 11vw, 72px); font-weight: 500; letter-spacing: -0.03em; line-height: .95; white-space: nowrap; }
.wordmark em { font-style: italic; color: var(--amber); }
.tagline { color: var(--muted); font-size: 19px; margin-top: 8px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12.5px; font-weight: 700; color: var(--faint); }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.center { text-align: center; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }

/* ── buttons ── */
.btn {
  appearance: none; border: 0; border-radius: 999px;
  min-height: 56px; padding: 14px 26px;
  background: var(--surface2); color: var(--text);
  font-weight: 700; font-size: 18px; letter-spacing: .01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .12s ease, background .2s ease, opacity .2s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--amber), var(--coral)); color: #1b1016; box-shadow: 0 10px 30px rgba(238, 108, 98, .3); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.quiet { background: transparent; min-height: 44px; padding: 8px 14px; color: var(--muted); font-weight: 600; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn .sub { display: block; font-weight: 500; font-size: 14px; opacity: .75; }
.icon-btn { appearance: none; border: 0; background: var(--surface2); width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; }

/* ── home ── */
.home-hero { padding: 7vh 4px 2vh; }
.home-actions { display: flex; flex-direction: column; gap: 12px; }
.big-choice {
  text-align: left; border-radius: var(--radius); padding: 20px 22px; border: 1.5px solid var(--line);
  background: var(--surface); display: flex; gap: 16px; align-items: center; width: 100%;
}
.big-choice .ico { font-size: 30px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--surface2); flex: none; }
.big-choice b { display: block; font-size: 19px; }
.big-choice span { color: var(--muted); font-size: 15px; }
.big-choice.hot { background: linear-gradient(135deg, rgba(244,162,89,.18), rgba(238,108,98,.14)); border-color: rgba(244,162,89,.45); }
.footer-links { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: auto; }

/* ── form fields ── */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-weight: 700; font-size: 15px; color: var(--muted); }
.input {
  width: 100%; min-height: 58px; border-radius: 18px; border: 1.5px solid var(--line);
  background: var(--bg2); padding: 14px 18px; font-size: 20px; outline: none;
}
.input:focus { border-color: var(--accent); }
.code-input { text-transform: uppercase; letter-spacing: .4em; text-align: center; font-family: var(--serif); font-size: 34px; font-weight: 600; }
.seg { display: flex; background: var(--bg2); border-radius: 18px; padding: 5px; gap: 4px; border: 1.5px solid var(--line); }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 14px; min-height: 48px; font-weight: 700; color: var(--muted); padding: 6px 8px; font-size: 16px; }
.seg button[aria-pressed="true"] { background: var(--surface2); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--accent); }

/* ── sheets / modal ── */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(8, 6, 12, .66); backdrop-filter: blur(6px); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease; }
.sheet { width: 100%; max-width: 640px; background: var(--bg2); border-radius: 30px 30px 0 0; padding: 22px 20px calc(24px + var(--safe-b)); max-height: 92vh; overflow: auto; border-top: 1px solid var(--line); animation: up .3s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; gap: 16px; }
.sheet .grab { width: 44px; height: 5px; border-radius: 4px; background: var(--line); margin: -6px auto 2px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }

/* ── lobby ── */
.code-card { background: var(--surface); border-radius: var(--radius-lg); padding: 22px; display: flex; gap: 18px; align-items: center; border: 1px solid var(--line); }
.code-big { font-family: var(--serif); font-size: 46px; letter-spacing: .14em; font-weight: 600; line-height: 1; }
.qr { background: #fbf6ef; border-radius: 16px; padding: 8px; width: 116px; height: 116px; flex: none; }
.qr svg, .qr img { width: 100%; height: 100%; display: block; }
.people { display: flex; flex-direction: column; gap: 10px; }
.person { display: flex; gap: 12px; align-items: center; background: var(--surface); padding: 12px 14px; border-radius: 18px; border: 1px solid var(--line); }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--surface2); font-size: 22px; flex: none; position: relative; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--surface); background: var(--faint); }
.avatar .dot.on { background: var(--sage); }
.person.empty { border-style: dashed; color: var(--faint); }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode {
  text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 20px; padding: 14px; min-height: 108px;
  display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden;
}
.mode b { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.mode span { color: var(--muted); font-size: 14px; line-height: 1.3; }
.mode .glyph { font-size: 22px; }
.mode[aria-pressed="true"] { border-color: var(--deck, var(--amber)); background: color-mix(in srgb, var(--deck, var(--amber)) 14%, var(--surface)); }
.mode.wide { grid-column: span 2; min-height: 0; flex-direction: row; align-items: center; gap: 14px; }
.deck-mindmeld { --deck: var(--amber); }
.deck-deep { --deck: var(--teal); }
.deck-sync { --deck: var(--violet); }
.deck-team { --deck: var(--sage); }
.deck-mix { --deck: var(--coral); }

.teams { display: flex; flex-direction: column; gap: 10px; }
.team { background: var(--surface); border-radius: 20px; padding: 14px; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.team.mine { border-color: var(--amber); }
.team-head { display: flex; align-items: center; gap: 10px; }
.team-head b { font-family: var(--serif); font-size: 19px; flex: 1; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px 6px 6px; background: var(--surface2); border-radius: 999px; font-weight: 600; font-size: 15px; }
.chip .avatar { width: 28px; height: 28px; font-size: 15px; }

/* ── ritual ── */
.ritual { align-items: center; justify-content: center; text-align: center; }
.heart-pad {
  width: min(70vw, 300px); aspect-ratio: 1; border-radius: 50%; border: 0; position: relative;
  background: radial-gradient(circle at 50% 40%, var(--surface2), var(--surface));
  display: grid; place-items: center; touch-action: none; user-select: none; -webkit-user-select: none;
  box-shadow: 0 0 0 1px var(--line), var(--shadow);
  transition: transform .2s ease, box-shadow .3s ease;
}
.heart-pad svg { width: 52%; height: 52%; }
.heart-pad .heart-fill { transition: opacity .3s ease; }
.heart-pad.me { transform: scale(.96); box-shadow: 0 0 0 3px var(--amber), 0 0 60px rgba(244, 162, 89, .35); }
.heart-pad.both { box-shadow: 0 0 0 4px var(--coral), 0 0 110px rgba(238, 108, 98, .6); animation: beat .8s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(.96); } 30% { transform: scale(1.02); } 50% { transform: scale(.97); } }
.ritual-status { display: flex; gap: 18px; justify-content: center; }
.ritual-status .who { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 15px; }
.ritual-status .who.on { color: var(--text); }
.ritual-status .who.on .avatar { box-shadow: 0 0 0 3px var(--amber); }

/* ── game chrome ── */
.topbar { display: flex; align-items: center; gap: 10px; }
.progress { flex: 1; height: 6px; border-radius: 6px; background: var(--surface2); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--coral)); border-radius: 6px; transition: width .5s ease; }
.score-pill { background: var(--surface2); border-radius: 999px; padding: 8px 14px; font-weight: 800; font-size: 15px; display: flex; gap: 6px; align-items: center; }

.card {
  background: linear-gradient(170deg, var(--surface2), var(--surface));
  border-radius: var(--radius-lg); padding: 24px 22px; border: 1px solid var(--line);
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 14px;
  animation: cardIn .5s cubic-bezier(.2,.8,.2,1) both;
}
.card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--deck, var(--amber)); opacity: .9; }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) rotate(-1deg) scale(.98); } to { opacity: 1; transform: none; } }
.card-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.deck-tag { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--deck, var(--amber)); }
.deck-tag::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.lvl { display: flex; gap: 3px; }
.lvl i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.lvl i.on { background: var(--deck, var(--amber)); }
.prompt { font-family: var(--serif); font-size: clamp(25px, 6.6vw, 34px); line-height: 1.18; font-weight: 500; letter-spacing: -0.01em; }
.prompt.long { font-size: clamp(22px, 5.6vw, 29px); }
.followup { font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--muted); border-left: 3px solid var(--deck, var(--amber)); padding-left: 14px; }
.step-label { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.step-label .n { width: 26px; height: 26px; border-radius: 50%; background: var(--surface2); display: grid; place-items: center; font-size: 13px; color: var(--text); }
.step-label.guess { color: var(--deck, var(--amber)); }

/* options */
.options { display: grid; gap: 10px; }
.options.two { grid-template-columns: 1fr 1fr; }
.opt {
  appearance: none; border: 1.5px solid var(--line); background: var(--bg2); border-radius: 18px;
  padding: 14px 16px; min-height: 58px; text-align: left; font-weight: 650; font-size: 18px;
  display: flex; align-items: center; gap: 12px; transition: transform .12s, border-color .15s, background .15s;
}
.opt:active { transform: scale(.98); }
.opt[aria-pressed="true"] { border-color: var(--deck, var(--amber)); background: color-mix(in srgb, var(--deck, var(--amber)) 18%, var(--bg2)); }
.opt .emo { font-size: 30px; width: 40px; text-align: center; flex: none; }
.opt .swatch { width: 40px; height: 40px; border-radius: 12px; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.options.visual { grid-template-columns: 1fr 1fr; }
.options.visual .opt { flex-direction: column; text-align: center; justify-content: center; min-height: 118px; gap: 8px; font-size: 16px; }
.options.visual .opt .emo { font-size: 44px; width: auto; }
.options.visual .opt .swatch { width: 100%; height: 56px; }
.opt.whois { flex-direction: column; justify-content: center; text-align: center; min-height: 150px; font-size: 20px; }
.opt.whois .avatar { width: 64px; height: 64px; font-size: 34px; }

/* slider */
.slider-wrap { padding: 18px 4px 4px; }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; border-radius: 10px; background: linear-gradient(90deg, var(--teal), var(--violet), var(--coral)); outline: none; touch-action: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 44px; height: 44px; border-radius: 50%; background: var(--text); border: 5px solid var(--bg); box-shadow: 0 4px 16px rgba(0,0,0,.5); }
.range::-moz-range-thumb { width: 36px; height: 36px; border-radius: 50%; background: var(--text); border: 5px solid var(--bg); }
.range-labels { display: flex; justify-content: space-between; margin-top: 12px; gap: 12px; font-weight: 700; font-size: 15px; color: var(--muted); }
.range-labels span:last-child { text-align: right; }
.scale-viz { position: relative; height: 40px; margin: 6px 0; }
.scale-viz .bar { position: absolute; left: 0; right: 0; top: 17px; height: 6px; border-radius: 4px; background: var(--surface2); }
.scale-viz .mark { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; font-size: 12px; font-weight: 800; }
.scale-viz .mark i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--bg); margin-top: 6px; }

/* rank */
.rank-list { display: flex; flex-direction: column; gap: 8px; position: relative; touch-action: none; }
.rank-item { display: flex; align-items: center; gap: 12px; background: var(--bg2); border: 1.5px solid var(--line); border-radius: 16px; padding: 10px 10px 10px 14px; min-height: 58px; font-weight: 650; user-select: none; -webkit-user-select: none; touch-action: none; }
.rank-item .num { font-family: var(--serif); font-size: 22px; color: var(--deck, var(--amber)); width: 22px; }
.rank-item .lbl { flex: 1; }
.rank-item .grip { font-size: 22px; color: var(--faint); padding: 8px; cursor: grab; }
.rank-item.dragging { box-shadow: 0 14px 40px rgba(0,0,0,.5); border-color: var(--deck, var(--amber)); z-index: 2; position: relative; background: var(--surface2); }

/* waiting */
.waiting { display: flex; align-items: center; gap: 14px; background: var(--surface); padding: 16px; border-radius: 20px; border: 1px dashed var(--line); }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

/* hold-to-reveal */
.hold-btn { position: relative; overflow: hidden; }
.hold-btn .fillbar { position: absolute; inset: 0; background: rgba(255,255,255,.35); transform-origin: left; transform: scaleX(0); }
.hold-btn span { position: relative; }

/* reveal */
.reveal-grid { display: grid; gap: 10px; }
.duel { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--bg2); border-radius: 18px; padding: 14px; border: 1.5px solid var(--line); display: flex; flex-direction: column; gap: 6px; animation: pop .45s cubic-bezier(.2,1.4,.4,1) both; }
.tile:nth-child(2) { animation-delay: .12s; }
.tile .who { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tile .val { font-family: var(--serif); font-size: 21px; line-height: 1.2; word-break: break-word; }
.prompt, .clue-big, .draw-word, .clues li, .chip, .team-head b, .seen-as span, .person b { overflow-wrap: anywhere; }
.tile .val .emo { font-size: 28px; margin-right: 4px; }
.tile.hit { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--bg2)); }
.tile.miss { border-color: color-mix(in srgb, var(--no) 60%, transparent); }
.verdict { font-weight: 800; font-size: 14px; }
.verdict.hit { color: var(--ok); } .verdict.miss { color: var(--no); }
@keyframes pop { from { opacity: 0; transform: scale(.85) translateY(8px); } to { opacity: 1; transform: none; } }
.banner { text-align: center; font-family: var(--serif); font-size: 26px; padding: 6px; animation: pop .5s both; }
.banner .pts { display: inline-block; background: var(--ok); color: #10251a; border-radius: 999px; padding: 2px 12px; font-family: var(--sans); font-weight: 800; font-size: 16px; margin-left: 8px; vertical-align: middle; }
.rank-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rank-compare ol { margin: 0; padding: 0 0 0 22px; display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 16px; }
.rank-compare li.same { color: var(--ok); }

.bottom-bar { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-top: 6px; }
.ready-note { text-align: center; font-size: 14px; color: var(--muted); min-height: 20px; }

/* reactions */
.react-bar { display: flex; justify-content: center; gap: 4px; }
.react-bar button { border: 0; background: transparent; font-size: 26px; padding: 6px 8px; border-radius: 12px; transition: transform .1s; }
.react-bar button:active { transform: scale(1.3); }
.float-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.floater { position: absolute; bottom: -60px; font-size: 44px; animation: floatUp 2.6s ease-out forwards; display: flex; flex-direction: column; align-items: center; }
.floater small { font-size: 12px; font-weight: 700; background: rgba(0,0,0,.5); padding: 2px 8px; border-radius: 99px; margin-top: 2px; font-family: var(--sans); }
@keyframes floatUp { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { opacity: 1; transform: translateY(-80px) scale(1.1); } 100% { transform: translateY(-75vh) scale(1); opacity: 0; } }

/* canvas / draw */
.draw-wrap { position: relative; background: #f7f1e8; border-radius: 22px; overflow: hidden; aspect-ratio: 1; touch-action: none; box-shadow: var(--shadow); }
.draw-wrap canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.draw-word { text-align: center; font-family: var(--serif); font-size: 30px; }
.palette { display: flex; gap: 5px; align-items: center; justify-content: center; flex-wrap: nowrap; }
.palette .sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; }
.palette .sw[aria-pressed="true"] { border-color: var(--text); }
.palette .wd { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface2); display: grid; place-items: center; }
.palette .wd i { background: var(--text); border-radius: 50%; display: block; }
.palette .wd[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--text); }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; }
.timer.low { color: var(--coral); }

/* spectrum dial */
.dial { width: 100%; max-width: 440px; margin: 0 auto; display: block; touch-action: none; user-select: none; }
.spec-labels { display: flex; justify-content: space-between; gap: 12px; font-family: var(--serif); font-size: 20px; margin-top: -6px; }
.spec-labels span:last-child { text-align: right; }
.clue-big { text-align: center; font-family: var(--serif); font-size: 38px; font-style: italic; color: var(--violet); }

/* clues (split / riddle) */
.clues { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.clues li { background: var(--bg2); border-radius: 14px; padding: 12px 14px; border-left: 4px solid var(--deck, var(--sage)); font-size: 17px; }
.secret-note { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); font-weight: 600; }

/* clock */
.clock-btn { width: min(64vw, 260px); aspect-ratio: 1; border-radius: 50%; border: 0; margin: 10px auto; display: grid; place-items: center; font-family: var(--serif); font-size: 32px; font-weight: 600; background: radial-gradient(circle at 40% 35%, var(--surface2), var(--surface)); box-shadow: 0 0 0 2px var(--line), var(--shadow); touch-action: manipulation; }
.clock-btn.running { box-shadow: 0 0 0 4px var(--violet), 0 0 70px rgba(169,147,255,.35); animation: breathe 2s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.03); } }
.timeline { position: relative; height: 96px; margin: 14px 8px 4px; }
.timeline .bar { position: absolute; left: 0; right: 0; top: 46px; height: 4px; background: rgba(255,255,255,.16); border-radius: 3px; }
.timeline .tick { position: absolute; top: 4px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; font-size: 13px; font-weight: 800; white-space: nowrap; }
.timeline .tick i { width: 3px; height: 30px; border-radius: 2px; margin-top: 2px; }
.timeline .tick.below { top: 34px; }
.timeline .tick.below i { height: 26px; margin: 0 0 2px; }

.inkblot { width: 100%; max-width: 380px; aspect-ratio: 1; margin: 0 auto; display: block; border-radius: 22px; background: #f5eee4; }

/* end */
.end-hero { text-align: center; padding: 24px 0 6px; }
.end-hero .title { font-family: var(--serif); font-size: clamp(32px, 9vw, 46px); line-height: 1.05; font-style: italic; }
.big-num { font-family: var(--serif); font-size: 76px; line-height: 1; font-weight: 600; background: linear-gradient(135deg, var(--amber), var(--coral)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface); border-radius: 20px; padding: 16px; border: 1px solid var(--line); }
.stat b { font-family: var(--serif); font-size: 30px; display: block; }
.seen-as { display: flex; flex-wrap: wrap; gap: 8px; }
.seen-as span { background: color-mix(in srgb, var(--gold) 18%, var(--surface2)); color: var(--gold); padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 15px; }
.saved-list { display: flex; flex-direction: column; gap: 8px; }
.saved-list div { background: var(--surface); border-radius: 16px; padding: 12px 14px; font-family: var(--serif); font-size: 18px; border: 1px solid var(--line); }
.leader { display: flex; flex-direction: column; gap: 8px; }
.leader .rowx { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 16px; padding: 12px 16px; }
.leader .rowx b { flex: 1; font-family: var(--serif); font-size: 20px; }
.leader .rowx .place { font-family: var(--serif); font-size: 24px; color: var(--gold); width: 28px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 999px; font-weight: 700; z-index: 80; box-shadow: var(--shadow); animation: up .25s ease; max-width: 90vw; text-align: center; }
.conn-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 70; background: var(--coral); color: #1b1016; text-align: center; font-weight: 800; padding: calc(6px + var(--safe-t)) 10px 6px; font-size: 14px; }

/* menu */
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-list .btn { justify-content: flex-start; border-radius: 18px; }

/* help */
.help h3 { font-size: 22px; margin-top: 6px; }
.help p { margin: 4px 0 10px; color: var(--muted); }

/* ═════════ BIG SCREEN (display) ═════════ */
body.tv { font-size: clamp(18px, 1.5vw, 30px); }
body.tv .screen { max-width: none; padding: 3vh 4vw; gap: 3vh; }
.tv-lobby { display: grid; grid-template-columns: 1.1fr 1fr; gap: 4vw; align-items: center; flex: 1; }
.tv-join { display: flex; flex-direction: column; gap: 2.4vh; }
.tv-code { font-family: var(--serif); font-size: clamp(60px, 9vw, 180px); letter-spacing: .12em; line-height: 1; font-weight: 600; }
.tv-qr { background: #fbf6ef; border-radius: 2vw; padding: 1.2vw; width: clamp(200px, 22vw, 440px); aspect-ratio: 1; }
.tv-qr svg { width: 100%; height: 100%; display: block; }
.tv-url { color: var(--muted); font-size: 1.1em; }
.tv-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18vw), 1fr)); gap: 1.4vw; }
.tv-teams .team { padding: 1.4vw; }
body.tv .prompt { font-size: clamp(36px, 4.2vw, 90px); }
body.tv .card { padding: 4vh 4vw; max-width: 1400px; margin: 0 auto; width: 100%; }
.tv-status { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22vw), 1fr)); gap: 1.4vw; }
.tv-status .team { font-size: .9em; }
.tv-canvases { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 28vw), 1fr)); gap: 1.6vw; }
.tv-canvases .draw-wrap { max-height: 58vh; aspect-ratio: 1; margin: 0 auto; width: 100%; max-width: 58vh; }
.tv-top { display: flex; justify-content: space-between; align-items: center; gap: 2vw; }
.tv-top .wordmark { font-size: clamp(30px, 3vw, 60px); }
.tv-corner-code { font-family: var(--serif); font-size: 1.4em; letter-spacing: .1em; color: var(--muted); }

@media (min-width: 900px) and (min-height: 600px) {
  .screen { max-width: 700px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* In-game: action buttons sit right under the card; reactions/ready live at the bottom. */
#footer { margin-top: auto; }
.screen:has(#footer) > .bottom-bar:not(#footer) { margin-top: 0; }

/* Text size preference (menu → Text size). zoom scales the whole phone UI, including touch targets. */
body.text-l .screen { zoom: 1.12; }
body.text-xl .screen { zoom: 1.25; }
body.text-l .sheet, body.text-xl .sheet { font-size: 1.12em; }

/* ═════════ Roadmap features ═════════ */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* one-tap lock with undo */
.undo-bar { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; background: var(--surface2); border-radius: 18px; padding: 8px 8px 8px 16px; font-weight: 700; animation: pop .25s both; }
.undo-bar .undo-fill { position: absolute; inset: 0; background: color-mix(in srgb, var(--deck, var(--amber)) 30%, transparent); transform-origin: left; animation: undoFill 1.6s linear forwards; }
.undo-bar > *:not(.undo-fill) { position: relative; }
@keyframes undoFill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* shared 3-2-1 reveal */
.countdown { font-family: var(--serif); font-size: 120px; line-height: 1; text-align: center; color: var(--deck, var(--amber)); min-height: 130px; animation: beat .87s ease-in-out infinite; }
.countdown.small-cd { font-size: 3em; min-height: 0; }

/* converge */
.converge { display: flex; flex-direction: column; gap: 6px; }
.converge .row { justify-content: center; }
.converge .chip { padding: 6px 14px; font-family: var(--serif); font-size: 18px; }

/* poll histogram */
.histo { display: flex; flex-direction: column; gap: 10px; }
.hrow { display: grid; grid-template-columns: minmax(0, 1.2fr) 2fr auto; gap: 12px; align-items: center; }
.hlabel { font-weight: 700; }
.hbar { height: 26px; background: var(--surface2); border-radius: 8px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--coral)); border-radius: 8px; animation: grow 1s cubic-bezier(.2,.8,.2,1) both; transform-origin: left; }
.hrow.mine .hlabel::after { content: '  ← you'; color: var(--muted); font-weight: 600; font-size: .85em; }
.hval { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 3em; text-align: right; }
@keyframes grow { from { transform: scaleX(0); } }
.deck-poll { --deck: var(--gold); }

/* blind architect */
.blueprint { background: #f7f1e8; border-radius: 16px; overflow: hidden; aspect-ratio: 1; }
.blueprint.big { max-width: 420px; width: 100%; margin: 0 auto; }
.blueprint-svg { width: 100%; height: 100%; display: block; }
.stars { display: flex; justify-content: center; gap: 8px; margin-top: 6px; }
.star { border: 0; background: var(--surface2); width: 58px; height: 58px; border-radius: 50%; font-size: 26px; color: var(--muted); }
.star.on { color: var(--gold); background: color-mix(in srgb, var(--gold) 22%, var(--surface2)); }

/* tilt */
.tilt-gauge { width: 100%; max-width: 380px; display: block; margin: 0 auto; }

/* photo roulette */
.photo { width: 100%; max-height: 52vh; object-fit: contain; border-radius: 16px; background: var(--bg2); display: block; }
label.btn { cursor: pointer; }

/* voice notes */
.voice { display: flex; flex-direction: column; gap: 10px; }
.voice audio { width: 100%; }
.rec-on { animation: pulse 1.2s ease-in-out infinite; }

/* host bar (couples' night host on their phone) */
.host-bar { display: flex; gap: 8px; align-items: center; justify-content: center; background: var(--surface); border: 1px dashed var(--line); border-radius: 18px; padding: 6px 10px; }
.host-bar .btn { min-height: 42px; padding: 6px 14px; font-size: 15px; }

/* tonight's card */
.daily { background: linear-gradient(150deg, color-mix(in srgb, var(--teal) 16%, var(--surface)), var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 8px; display: flex; flex-direction: column; gap: 8px; }
.daily:empty { display: none; }
.daily-q { font-family: var(--serif); font-size: 22px; line-height: 1.25; }

/* map of us */
.map-of-us { background: linear-gradient(160deg, color-mix(in srgb, var(--coral) 14%, var(--surface)), var(--surface)); border-radius: var(--radius-lg); border: 1px solid var(--line); padding: 22px; display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.map-of-us h2 { font-size: 26px; }
.learned { display: flex; gap: 14px; align-items: flex-start; animation: pop .5s both; }
.learned:nth-child(4) { animation-delay: .15s; } .learned:nth-child(5) { animation-delay: .3s; }
.learned .num { font-family: var(--serif); font-size: 30px; color: var(--coral); line-height: 1; min-width: 22px; }
.learned .val { font-family: var(--serif); font-size: 21px; margin: 2px 0; }
.missions .tile .row { flex-wrap: wrap; }
.mission-btn { background: color-mix(in srgb, var(--gold) 20%, var(--surface2)); }

/* TV spotlight */
.tv-status .team.spotlight { grid-column: 1 / -1; border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 50%, transparent), var(--shadow); font-size: 1.15em; }

/* ═════════ Light theme (Theme: Light / Auto in daylight) ═════════ */
body.light {
  --bg: #f6efe6; --bg2: #fffaf4; --surface: #fffdf9; --surface2: #f0e6da;
  --line: rgba(60, 35, 30, 0.14); --text: #231a20; --muted: #5f5058; --faint: #7d6d75;
  --amber: #c86a1c; --coral: #c8463c; --teal: #1d7f91; --violet: #6a52d8; --sage: #2f8a55; --gold: #a07610; --ok: #2f8a55; --no: #c8463c;
  --shadow: 0 14px 40px rgba(80, 50, 30, 0.14);
  color-scheme: light;
  background-image:
    radial-gradient(1200px 700px at 10% -10%, rgba(238, 108, 98, 0.12), transparent 60%),
    radial-gradient(900px 600px at 110% 10%, rgba(169, 147, 255, 0.10), transparent 60%);
}
body.light .btn.primary { color: #fff; }
body.light .tile.hit { background: color-mix(in srgb, var(--ok) 10%, var(--bg2)); }
body.light .heart-pad svg path:first-child { stroke: var(--text); }
body.light .toast { background: var(--text); color: var(--bg); }
body.light .seen-as span { color: #7a5a08; }
body.light [stroke="#f7efe6"] { stroke: var(--text); }
body.light circle[fill="#f7efe6"] { fill: var(--text); }

/* ═════════ Status strip: who's doing what, whose move it is ═════════ */
#topbar { display: flex; flex-direction: column; gap: 8px; }
.strip { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; transition: box-shadow .3s; }
.strip.mine { border-color: color-mix(in srgb, var(--amber) 55%, var(--line)); }
.strip.nudged { box-shadow: 0 0 0 3px var(--coral); animation: beat .8s ease-in-out 3; }
.who-row { display: flex; align-items: center; gap: 8px; }
.who { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1; }
.who .avatar { width: 30px; height: 30px; font-size: 16px; flex: none; }
.who .avatar .dot { width: 11px; height: 11px; border-width: 2px; }
.who-name { font-weight: 800; font-size: 14px; white-space: nowrap; }
.who-state { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-state.ok { color: var(--sage); font-weight: 700; }
.who-state.busy { color: var(--amber); }
.who-state.busy::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 5px; border-radius: 50%; background: currentColor; animation: pulse 1.2s ease-in-out infinite; vertical-align: middle; }
.who-state.off { color: var(--faint); font-style: italic; }
.who-sep { width: 1px; height: 22px; background: var(--line); flex: none; }
.now { font-size: 15px; font-weight: 600; color: var(--muted); line-height: 1.3; }
.strip.mine .now { color: var(--text); }
.strip.mine .now b { color: var(--amber); }
.ready-note.strong { color: var(--text); font-weight: 700; font-size: 15px; }
.ready-note.strong span { color: var(--amber); font-family: var(--serif); font-size: 18px; }

/* in-round typed channel */
.chat-wrap { display: flex; flex-direction: column; gap: 8px; }
.chat { display: flex; flex-direction: column; gap: 6px; max-height: 34vh; overflow: auto; padding: 2px; }
.chat-msg { align-self: flex-start; max-width: 88%; background: var(--bg2); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 8px 12px; font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; animation: pop .3s both; }
.chat-msg.me { align-self: flex-end; background: color-mix(in srgb, var(--deck, var(--amber)) 22%, var(--bg2)); border-radius: 16px 16px 4px 16px; }
.chat-who { display: block; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.chat-row { align-items: stretch; }
.chat-in { min-height: 48px; font-size: 16px; padding: 10px 14px; flex: 1; min-width: 0; resize: none; }
.chat-row .btn { min-height: 48px; padding: 8px 16px; }

/* ═════════ Small phones (iPhone 13 mini / SE-class: 375×812 and narrower) ═════════ */
@media (max-width: 390px) {
  .screen { padding-left: 14px; padding-right: 14px; gap: 14px; }
  .card { padding: 18px 16px; gap: 12px; }
  .prompt { font-size: clamp(22px, 6.2vw, 28px); }
  .prompt.long { font-size: clamp(19px, 5.2vw, 24px); }
  .opt { min-height: 52px; padding: 11px 14px; font-size: 17px; }
  .btn { min-height: 52px; font-size: 17px; padding: 12px 20px; }
  .score-pill { padding: 6px 10px; font-size: 14px; }
  .icon-btn { width: 42px; height: 42px; }
  .who-name { font-size: 13px; }
  .who-state { font-size: 12px; }
  .clue-big { font-size: 30px; }
  .code-big { font-size: 38px; }
  .qr { width: 100px; height: 100px; }
  .wordmark { font-size: clamp(34px, 10.4vw, 52px); }
}
@media (max-height: 700px) {
  .home-hero { padding-top: 3vh; }
  .heart-pad { width: min(56vw, 240px); }
}
