/* Impostor — "Modern Dark" design system.
   Near-black ground, opaque graphite panels, hairline separation, white primary
   actions, mono labels/numbers. Mint is used ONLY for live / selected states.
   Type scale: body 16 / secondary 14 / meta 12 (+ display sizes for headings).
   Spacing: 8pt grid for layout gaps, 4pt grid for micro gaps.
   Widths: narrow ≤ 767.98px (one column), medium ≥ 768px (two columns),
   wide: the page body is capped at --vp-wide. */

:root {
  --ground: #050505;
  --panel: #0e0e0e;
  --panel-2: #161616;
  --hairline: #222222;
  --hairline-2: #303030;
  --step-done: #55585c;
  --bright: #f2f2f2;
  --read: #a6a9ad;
  --meta: #8a8d91;
  --dim: #96999d;
  --live: #3fd6c6;
  --crew: #5cc8ff;      /* team colour: crew (light blue) */
  --imp: #ff5a5f;       /* team colour: impostor (red) */
  --inverse-ink: #0a0a0a;

  --face: "Geist", "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", "SFMono-Regular", Menlo, monospace;

  --gutter: 48px;
  --gap: 24px;
  --vp-wide: 1280px;
  --r-panel: 6px;
  --r-pill: 999px;
  --hair: 1px;
  --hit: 44px;          /* WCAG 2.1 AA touch target */

  --dur-fast: 150ms;    /* small fades (check marks, tooltips) */
  --dur-exit: 200ms;
  --dur-enter: 300ms;
  --ease-enter: ease-out;
  --ease-exit: ease-in;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--ground);
  color: var(--read);
  font-family: var(--face);
  font-size: 16px; line-height: 1.5; letter-spacing: 0;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body { min-height: 100dvh; position: relative; }
body.locked { overflow: hidden; }
/* one static pool of white light across the top (no color) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(58% 42% at 50% -12%, rgba(255, 255, 255, 0.05), transparent 62%);
}

#app { padding: 0 16px 64px; }

::selection { background: rgba(63, 214, 198, 0.24); color: var(--bright); }

/* ---------- Layout ----------
   DOM: .page > .col-side (brand, aside.side, aside.side.tips)
              + .col-main (section.phase, main.main)
   Narrow: one column in the order brand → phase → side → main → tips
   (the .col-* wrappers use display:contents, so their children are .page items).
   Medium+: sticky left column (brand, side, tips), right column (phase, main).
   Only .page carries the width cap. */
.page { max-width: var(--vp-wide); margin: 0 auto; display: flex; flex-direction: column; gap: var(--gap); padding-top: calc(env(safe-area-inset-top) + 16px); }
.col-side, .col-main { display: contents; }
.brand { order: 1; }
.phase { order: 2; }
.side { order: 3; }
.main { order: 4; }
.side.tips { order: 5; } /* supporting info: below the content on phones */
.side, .main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

@media (min-width: 768px) {
  #app { display: flex; flex-direction: column; min-height: 100dvh; padding: 0 32px 64px; }
  /* margin:auto centers both axes; collapses to 0 (scroll from top) when taller than the viewport */
  .page { width: 100%; margin: auto; display: grid; grid-template-columns: minmax(256px, 320px) minmax(0, 1fr); gap: var(--gutter); align-items: start; padding: 32px 0 0; }
  .col-side, .col-main { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
  .col-side { position: sticky; top: 32px; }
  .side, .main { gap: var(--gap); }
}

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; border-radius: var(--r-panel); flex: none; display: grid; place-items: center; font-size: 20px; background: var(--panel); border: var(--hair) solid var(--hairline); }
.brand-name { font-family: var(--face); font-weight: 500; font-size: 20px; line-height: 1.2; letter-spacing: -0.01em; color: var(--bright); }
.brand .online { margin-left: auto; }
.online { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--meta); }
.online .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.online.off .dot { background: var(--hairline-2); }
.online-lbl { text-transform: lowercase; letter-spacing: 0.02em; }

/* ---------- Icon button + tooltip (hover after a short delay, keyboard focus at once) ---------- */
.icon-btn { position: relative; width: var(--hit); height: var(--hit); flex: none; display: grid; place-items: center; padding: 0; border-radius: var(--r-panel); background: transparent; border: var(--hair) solid var(--hairline); color: var(--read); cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }
.tip { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; white-space: nowrap; background: var(--panel-2); border: var(--hair) solid var(--hairline-2); border-radius: var(--r-panel); color: var(--bright); font-family: var(--face); font-size: 14px; line-height: 1.2; font-weight: 400; opacity: 0; pointer-events: none; transition: opacity var(--dur-exit) var(--ease-exit); }
.icon-btn:focus-visible .tip { opacity: 1; transition: opacity var(--dur-fast) var(--ease-enter); }
kbd { font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--meta); padding: 0 4px; border: var(--hair) solid var(--hairline-2); border-radius: 4px; }

/* ---------- Phase header (step, title, what's happening, your move, what's next) ---------- */
.phase { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stepper { display: flex; flex-direction: column; gap: 8px; }
.step-label { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--meta); }
.step-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--live); flex: none; }
.step-bar { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.seg { height: 4px; border-radius: 2px; background: var(--hairline-2); }
.seg.done { background: var(--step-done); }
.seg.now { background: var(--bright); }

.guide { background: var(--panel); border: var(--hair) solid var(--hairline); border-radius: var(--r-panel); }
.g-row { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; }
.g-row + .g-row { border-top: var(--hair) solid var(--hairline); }
.g-k { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--meta); }
.g-row.act .g-k { color: var(--bright); }
.g-row.act .g-k::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--live); }
.g-v { font-size: 16px; line-height: 1.5; letter-spacing: -0.005em; color: var(--read); }
.g-row.act .g-v { color: var(--bright); }
.g-v b, .subtitle b, .st-text b, .waiting b { color: var(--bright); font-weight: 500; }

/* ---------- Panels & type ---------- */
.group, .reveal, .pcard, .status-card, .turn-card { background: var(--panel); border: var(--hair) solid var(--hairline); border-radius: var(--r-panel); }
.hd { padding: 0; }
.large-title { font-family: var(--face); font-size: clamp(28px, 6vw, 40px); font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; margin: 0; color: var(--bright); overflow-wrap: anywhere; }
.subtitle { margin: 8px 0 0; color: var(--read); font-size: 16px; line-height: 1.5; letter-spacing: -0.005em; max-width: 65ch; }
.group-label { display: block; margin: 0 0 8px; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--meta); letter-spacing: 0.08em; text-transform: uppercase; }
.section { display: flex; flex-direction: column; }
.footnote { margin: 12px 0 0; font-size: 14px; line-height: 1.5; color: var(--meta); letter-spacing: -0.005em; }
.footnote.center { text-align: center; }

/* ---------- Grouped list ---------- */
.group { overflow: hidden; }
.cell { position: relative; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 12px 16px; }
.cell + .cell { border-top: var(--hair) solid var(--hairline); }
.cell .nm { flex: 1; min-width: 0; font-size: 16px; font-weight: 400; color: var(--bright); letter-spacing: -0.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell .you { color: var(--meta); }
.ord { flex: none; width: 16px; text-align: right; font-family: var(--mono); font-size: 12px; color: var(--meta); }

/* ---------- Avatars (neutral graphite) ---------- */
.avatar { width: 36px; height: 36px; border-radius: var(--r-panel); flex: none; display: grid; place-items: center; background: var(--panel-2); border: var(--hair) solid var(--hairline); color: var(--read); font-family: var(--mono); font-size: 12px; font-weight: 500; }
.avatar.lg { width: 52px; height: 52px; font-size: 16px; }

.badge { flex: none; font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; padding: 4px 8px; border-radius: var(--r-pill); background: var(--panel-2); color: var(--meta); border: var(--hair) solid var(--hairline); }
.badge.imp { color: var(--bright); border-color: var(--hairline-2); }
.badge.admin { color: var(--read); }

/* ---------- Inputs + inline validation ---------- */
.field { padding: 0 !important; }
.field input { width: 100%; border: none; background: transparent; font: inherit; font-size: 16px; color: var(--bright); padding: 12px 16px; min-height: 52px; }
.field input::placeholder { color: var(--dim); }
.field input:focus { outline: none; }
.group:focus-within { border-color: var(--hairline-2); }
.group.invalid { border-color: var(--bright); }
.field-error { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--bright); }
.field-error.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; font-family: var(--face); font-weight: 500; font-size: 16px; line-height: 1.5; letter-spacing: -0.005em; border: var(--hair) solid transparent; border-radius: var(--r-pill); padding: 12px 24px; min-height: 48px; cursor: pointer; text-align: center; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.filled { background: var(--bright); color: var(--inverse-ink); border-color: var(--bright); }
.btn.secondary { background: transparent; color: var(--bright); border-color: var(--hairline-2); }
.btn.plain { background: transparent; color: var(--read); border-color: transparent; min-height: var(--hit); }
.btn.small { width: auto; align-self: flex-start; min-height: var(--hit); padding: 8px 16px; font-size: 14px; }
/* DOM order: primary first. Row: primary on the right. Narrow: stacked, primary on top. */
.btn-row { display: flex; flex-direction: row-reverse; gap: 12px; }
.btn-row > .btn { flex: 1; }
@media (max-width: 767.98px) { .btn-row { flex-direction: column; gap: 8px; } }
.force { display: flex; flex-direction: column; }
.invite { margin-top: 12px; }
.force .footnote { margin-top: 0; }

/* primary action of the step: stays on screen while the content scrolls */
.actions { position: sticky; bottom: 0; z-index: 5; display: flex; flex-direction: column; gap: 8px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--ground); }
.actions .footnote, .actions .field-error { margin: 0; }
/* room list: joining is as likely as creating, so "Załóż pokój" stays in the flow */
.actions.inline { position: static; padding: 0; background: transparent; }

.btn:focus-visible, .icon-btn:focus-visible, .field input:focus-visible, .segmented button:focus-visible, .select .cell[data-id]:focus-visible, .sheet-body:focus-visible { outline: 2px solid var(--bright); outline-offset: 2px; }

.voted-note { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; color: var(--bright); font-size: 16px; text-align: center; }
.voted-note svg { width: 20px; height: 20px; flex: none; color: var(--live); }

/* ---------- Segmented (select) ---------- */
.segmented { display: flex; flex-wrap: wrap; background: var(--panel); border: var(--hair) solid var(--hairline); border-radius: 28px; padding: 4px; gap: 4px; } /* 28px = pill for one row, rounded box when many options wrap */
.segmented button { flex: 1 0 var(--hit); position: relative; border: none; background: transparent; font-family: var(--mono); font-weight: 400; font-size: 18px; line-height: 1.5; color: var(--meta); padding: 12px 0; border-radius: var(--r-pill); cursor: pointer; }
.segmented button.on { background: var(--panel-2); color: var(--bright); }
.segmented button.on::after { content: ""; position: absolute; top: 8px; right: 12px; width: 6px; height: 6px; border-radius: 50%; background: var(--live); }

/* ---------- Role reveal ---------- */
.reveal { padding: 24px; text-align: center; position: relative; overflow: hidden; }
.reveal::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(70% 70% at 50% -10%, rgba(255, 255, 255, 0.045), transparent 70%); }
.reveal > * { position: relative; }
.reveal .kicker { font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; color: var(--meta); margin-bottom: 12px; }
.reveal .hero-word { font-family: var(--face); font-size: clamp(36px, 8vw, 48px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; margin: 0; color: var(--bright); word-break: break-word; }
.reveal .sub { margin-top: 16px; font-size: 14px; color: var(--read); }
.reveal .sub.out { margin-top: 8px; color: var(--bright); }
/* team colour: you see at a glance which side you are on */
.reveal.crew { border-color: var(--crew); }
.reveal.imp { border-color: var(--imp); }
.reveal.crew .kicker { color: var(--crew); font-weight: 500; }
.reveal.imp .kicker { color: var(--imp); font-weight: 500; }
.announce-title.crew { color: var(--crew); }
.announce-title.imp { color: var(--imp); }
.badge.imp { color: var(--imp); border-color: var(--imp); }
@media (max-width: 767.98px) {
  /* role as a reminder (clue / vote / result): slim card so the action stays on screen */
  .reveal.compact { padding: 12px 16px; text-align: left; }
  .reveal.compact .kicker { margin-bottom: 4px; }
  .reveal.compact .hero-word { font-size: 28px; }
  .reveal.compact .sub:not(.out) { display: none; }
}

.spec-facts { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.spec-facts .sf { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 12px; background: var(--panel-2); border: var(--hair) solid var(--hairline); border-radius: var(--r-panel); }
.spec-facts .sf .k { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--meta); }
.spec-facts .sf .v { font-weight: 400; text-align: right; color: var(--bright); }

/* ---------- Status card ---------- */
.status-card { padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.status-card .st-top { font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--meta); }
.st-text { margin: 0; font-size: 14px; line-height: 1.6; color: var(--read); }
.how-list { margin: 0 0 8px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.5; color: var(--read); }
.how-list li::marker { font-family: var(--mono); color: var(--meta); }

/* ---------- Turn card + timer ring ---------- */
.turn-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px; }
.turn-card.mine { border-color: var(--hairline-2); }
.turn-card > .btn { align-self: stretch; }
.turn-who { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.turn-input { align-self: stretch; display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.turn-label { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--meta); }
.turn-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--live); }
.turn-name { font-family: var(--face); font-size: 24px; font-weight: 500; line-height: 1.2; letter-spacing: -0.02em; text-align: center; color: var(--bright); overflow-wrap: anywhere; }
.ring { position: relative; width: 112px; height: 112px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.ring .track { stroke: var(--hairline); }
.ring .prog { stroke: var(--bright); stroke-linecap: round; }
.ring.low .prog { stroke: var(--read); }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 36px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: var(--bright); }
@media (min-width: 768px) { .ring { width: 128px; height: 128px; } .ring .num { font-size: 40px; } }
@media (max-width: 767.98px) {
  /* not my turn: one slim row "Teraz pisze · Ewa ······ (12)" */
  .turn-card.watch { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 12px 16px; }
  .turn-card.watch .turn-who { align-items: flex-start; gap: 4px; }
  .turn-card.watch .turn-name { font-size: 18px; text-align: left; }
  .turn-card.watch .ring { width: 56px; height: 56px; }
  .turn-card.watch .ring .num { font-size: 20px; }
  .turn-card.watch > .btn { flex-basis: 100%; }
}

/* ---------- Clue list ---------- */
.cell.now { background: var(--panel-2); }
.clue-word { font-family: var(--mono); font-size: 14px; color: var(--bright); max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clue-now { font-family: var(--mono); font-size: 12px; letter-spacing: 0.03em; color: var(--live); }
.clue-wait, .clue-skip { font-family: var(--mono); font-size: 12px; color: var(--dim); }

/* ---------- Vote tally ---------- */
.cand-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cand-main .nm { flex: 0 0 auto; }
.cand-word { font-family: var(--mono); font-size: 14px; color: var(--bright); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cand-word.none { color: var(--dim); }
.voters { font-size: 14px; color: var(--meta); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcount { flex: none; min-width: 24px; height: 24px; padding: 0 8px; display: inline-grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--bright); background: var(--panel-2); border: var(--hair) solid var(--hairline); border-radius: var(--r-pill); }
.select .cell { cursor: pointer; }
.select .cell.sel { background: var(--panel-2); }
/* resting affordance on clickable rows: empty circle (square when several may be picked) */
.pick { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; border: var(--hair) solid var(--hairline-2); }
.select.multi .pick { border-radius: 4px; }
.pick .check { width: 16px; height: 16px; color: var(--live); opacity: 0; transition: opacity var(--dur-fast) var(--ease-exit); }
.select .cell.sel .pick { border-color: var(--live); }
.select .cell.sel .pick .check { opacity: 1; transition: opacity var(--dur-fast) var(--ease-enter); }

/* ---------- Player grid ---------- */
.pgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 768px) { .pgrid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); } }
.pcard { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 12px; text-align: center; position: relative; }
.pcard.gone { opacity: 0.45; }
.pcard .pname { font-size: 14px; font-weight: 400; color: var(--bright); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .pstatus { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--meta); }

/* ---------- Rooms (list, password, room card) ---------- */
.lock { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 8px; vertical-align: -4px; color: var(--bright); }
.lock svg { width: 18px; height: 18px; }
.room-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cell.room .nm { flex: 0 0 auto; display: flex; align-items: center; }
.room-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-meta { font-size: 14px; line-height: 1.5; color: var(--meta); overflow-wrap: anywhere; }
.cell.room > .btn.small { align-self: center; flex: none; }
.cell.room-pw { flex-direction: column; align-items: stretch; gap: 12px; background: var(--panel-2); }
.cell.room-pw .group { background: var(--ground); }
.room-title { display: flex; align-items: center; min-width: 0; font-size: 20px; font-weight: 500; line-height: 1.25; letter-spacing: -0.01em; color: var(--bright); overflow-wrap: anywhere; }
.room-card .field-error { margin: 0; }
.room-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.room-actions .btn-row { flex-direction: column; gap: 8px; } /* narrow side column: always stacked */
.room-actions .section .group-label { margin-top: 4px; }
.how-list .lock { margin-right: 0; width: 16px; height: 16px; vertical-align: -3px; }
.how-list .lock svg { width: 14px; height: 14px; }

/* ---------- Key / value rows (facts, summary) ---------- */
.cell.kv { justify-content: space-between; }
.kv .k { flex: none; font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--meta); }
.kv .v { font-weight: 400; text-align: right; color: var(--bright); overflow-wrap: anywhere; }

/* ---------- Spinner / waiting ---------- */
.ios-spin { width: 24px; height: 24px; color: var(--hairline-2); animation: ios-rot 0.8s steps(8, end) infinite; }
@keyframes ios-rot { to { transform: rotate(360deg); } }
.waiting { text-align: center; color: var(--read); padding: 32px 16px; }
.waiting .ios-spin { margin: 0 auto 16px; display: block; }
/* first connection: appear only if it takes longer than 150 ms (no flash on fast loads) */
#connecting { animation: appear 1ms linear 150ms both; }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Toast (top, so it never covers the sticky action) ---------- */
.toast { position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top)); transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--panel); border: var(--hair) solid var(--hairline-2); color: var(--bright); padding: 12px 20px; border-radius: var(--r-pill); font-size: 14px; text-align: center; opacity: 0; pointer-events: none; transition: opacity var(--dur-exit) var(--ease-exit); z-index: 120; }
.toast.show { opacity: 1; transition: opacity var(--dur-enter) var(--ease-enter); }

/* ---------- Announcement (phase change, full screen, tap to skip) ---------- */
.announce { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 32px 24px 96px; background: var(--ground); opacity: 0; cursor: pointer; transition: opacity var(--dur-exit) var(--ease-exit); }
.announce.in { opacity: 1; transition: opacity var(--dur-enter) var(--ease-enter); }
.announce-inner { max-width: 560px; text-align: center; opacity: 0; transform: translateY(8px); transition: opacity var(--dur-exit) var(--ease-exit), transform var(--dur-exit) var(--ease-exit); }
.announce.in .announce-inner { opacity: 1; transform: none; transition: opacity var(--dur-enter) var(--ease-enter), transform var(--dur-enter) var(--ease-enter); }
.announce-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--meta); margin-bottom: 16px; }
.announce-title { font-family: var(--face); font-size: clamp(32px, 9vw, 56px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; color: var(--bright); overflow-wrap: anywhere; }
.announce-sub { margin: 16px auto 0; max-width: 65ch; font-size: 16px; line-height: 1.5; color: var(--read); }
.announce-detail { margin: 24px 0 0; font-size: 16px; line-height: 1.5; color: var(--bright); }
.announce-foot { margin: 16px 0 0; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--read); }
.announce-foot.live { color: var(--live); }
.announce-bar { position: absolute; left: 50%; bottom: calc(64px + env(safe-area-inset-bottom)); width: min(176px, 50vw); height: 2px; transform: translateX(-50%); background: var(--hairline); border-radius: 2px; overflow: hidden; }
.announce-bar span { display: block; height: 100%; background: var(--meta); transform-origin: left center; animation: announce-bar linear forwards; }
@keyframes announce-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.announce-hint { position: absolute; left: 0; right: 0; bottom: calc(32px + env(safe-area-inset-bottom)); text-align: center; font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--meta); }

/* ---------- Rules sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0.66); opacity: 0; transition: opacity var(--dur-exit) var(--ease-exit); }
.sheet-backdrop.in { opacity: 1; transition: opacity var(--dur-enter) var(--ease-enter); }
.sheet { width: 100%; max-width: 560px; max-height: 88dvh; display: flex; flex-direction: column; background: var(--panel); border: var(--hair) solid var(--hairline-2); border-bottom: none; border-radius: 12px 12px 0 0; padding-bottom: env(safe-area-inset-bottom); transform: translateY(24px); transition: transform var(--dur-exit) var(--ease-exit); }
.sheet-backdrop.in .sheet { transform: none; transition: transform var(--dur-enter) var(--ease-enter); }
@media (min-width: 768px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-bottom: var(--hair) solid var(--hairline-2); border-radius: var(--r-panel); max-height: 82dvh; }
}
.sheet-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 24px; border-bottom: var(--hair) solid var(--hairline); }
.sheet-hd h2 { margin: 0; font-size: 20px; font-weight: 500; line-height: 1.2; letter-spacing: -0.01em; color: var(--bright); }
.sheet-body { overflow: auto; padding: 8px 24px 32px; overscroll-behavior: contain; }
.rules h3 { margin: 24px 0 8px; font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--meta); }
.rules p { margin: 0; }
.rules p, .rules li { font-size: 16px; line-height: 1.6; color: var(--read); }
.rules b { color: var(--bright); font-weight: 500; }
.rules ol, .rules ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.rules li::marker { font-family: var(--mono); color: var(--meta); }

/* hover is an extra, never the only way: every action also works by tap / keyboard */
@media (hover: hover) and (pointer: fine) {
  .btn.filled:hover { background: #ffffff; border-color: #ffffff; }
  .btn.secondary:hover { border-color: var(--read); }
  .btn.plain:hover { color: var(--bright); }
  .icon-btn:hover { color: var(--bright); border-color: var(--hairline-2); }
  .icon-btn:hover .tip { opacity: 1; transition: opacity var(--dur-fast) var(--ease-enter) 400ms; }
  .segmented button:not(.on):hover { color: var(--read); }
  .select .cell[data-id]:hover { background: var(--panel-2); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .ios-spin { animation: none; } /* static loader — the text says what we wait for */
  .announce-bar { display: none; }
}
