/* One-screen pass-the-phone app: a week grid dominates, the pass button sits at thumb height. */
:root {
  --bg: #eef0f6;
  --surface: #ffffff;
  --ink: #171a2b;
  --muted: #5d6280;
  --line: #d5d8e6;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --gone: #e3e5ee;
  --yes: #15803d;
  --yes-soft: #dcf2e3;
  --font-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12141f; --surface: #1c1f2e; --ink: #eceef7; --muted: #9aa0bf; --line: #2e3247;
    --accent: #f97316; --accent-ink: #1a0d04; --gone: #161825; --yes: #4ade80; --yes-soft: #163222; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12141f; --surface: #1c1f2e; --ink: #eceef7; --muted: #9aa0bf; --line: #2e3247;
  --accent: #f97316; --accent-ink: #1a0d04; --gone: #161825; --yes: #4ade80; --yes-soft: #163222; color-scheme: dark;
}
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); box-sizing: border-box; }
html, body { height: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 17px; line-height: 1.45;
}
.app {
  max-width: 480px; margin: 0 auto; min-height: 100%;
  padding-inline: 16px; padding-block: 20px 28px;
  display: flex; flex-direction: column; gap: 18px; box-sizing: border-box;
}
.brand { font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand small { font-family: var(--font-body); font-weight: 400; font-size: 14px; color: var(--muted); letter-spacing: 0; text-align: right; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 12px; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; box-sizing: border-box; min-width: 0;
}
.label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; }
.row .num { width: 1.6em; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.icon-btn { background: transparent; color: var(--muted); width: 40px; height: 40px; flex: none; font-size: 22px; line-height: 1; }
.icon-btn:hover { color: var(--accent); }
.ghost { background: transparent; color: var(--accent); font-weight: 700; padding: 8px 0; align-self: flex-start; }
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; padding: 18px 16px; font-size: 18px; width: 100%; }
.hint { font-size: 14px; color: var(--muted); }
.error { font-size: 14px; color: var(--accent); min-height: 1.2em; }

/* turn */
.who { font-family: var(--font-display); font-weight: 800; font-size: clamp(38px, 12vw, 58px); line-height: 1; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.who-sub { color: var(--muted); margin-top: 6px; }
.week { display: grid; gap: 6px; }
.week .head { font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: 0.06em; overflow-wrap: anywhere; }
.week .day { font-variant-numeric: tabular-nums; font-weight: 700; align-self: center; line-height: 1.15; }
.week .day span { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.week .day.weekend { color: var(--accent); }
.cell {
  min-height: 48px; background: var(--surface); border: 1.5px solid var(--line); color: var(--ink);
  font-size: 14px; display: flex; align-items: center; justify-content: center; padding: 4px; min-width: 0;
}
.cell.mine { background: transparent; border: 1.5px dashed var(--accent); color: var(--accent); font-weight: 700; }
.cell.gone { background: var(--gone); border-color: transparent; color: var(--muted); cursor: default; font-size: 13px; }
.cell.gone:focus-visible { outline: none; }
.count { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.count b { color: var(--ink); }
.table { display: flex; flex-wrap: wrap; gap: 6px; }
.seat { font-size: 14px; padding: 4px 10px; border-radius: 999px; border: 1.5px dashed var(--line); color: var(--muted); }
.seat.ok { border-style: solid; border-color: var(--yes); background: var(--yes-soft); color: var(--ink); }
.seat.ok::before { content: "✓ "; color: var(--yes); font-weight: 700; }
.seat.now { border-style: solid; border-color: var(--accent); color: var(--ink); font-weight: 700; }
.foot { display: flex; justify-content: space-between; align-items: center; }
.foot button { background: transparent; color: var(--muted); padding: 8px 0; font-size: 15px; }
.foot button:disabled { opacity: 0.35; cursor: default; }
.notice { background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 15px; }

/* done */
.done-head { font-family: var(--font-display); font-weight: 800; font-size: clamp(30px, 9vw, 42px); line-height: 1.05; letter-spacing: -0.03em; text-wrap: balance; }
.options { display: flex; flex-direction: column; gap: 8px; }
.option { background: var(--surface); border: 1.5px solid var(--line); color: var(--ink); padding: 14px 16px; text-align: left; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.option .d { font-weight: 700; }
.option .p { color: var(--muted); }
.option.sel { border-color: var(--yes); background: var(--yes-soft); }
.option.sel .p { color: var(--ink); }
.stack { display: flex; flex-direction: column; gap: 10px; }

@media (prefers-reduced-motion: no-preference) {
  .enter { animation: enter 220ms ease-out; }
  @keyframes enter { from { transform: translateY(8px); opacity: 0.4; } to { transform: none; opacity: 1; } }
}

/* own-phone mode and reversed picking */
.cell.yes { background: var(--yes-soft); border-color: var(--yes); color: var(--yes); font-weight: 700; }
.cell.x { background: var(--gone); border-color: transparent; color: var(--muted); }
.cell.x.yes { border: 1.5px dashed var(--yes); }
.cell:disabled { cursor: default; }
.modes { display: flex; flex-direction: column; gap: 10px; }
.pill { font-family: var(--font-body); font-size: 13px; font-weight: 400; letter-spacing: 0; padding: 3px 10px; border-radius: 999px; border: 1.5px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.live { border-color: var(--yes); color: var(--ink); }
.pill.bad { border-color: var(--accent); color: var(--accent); }
.bar { display: flex; gap: 8px; align-items: center; }
.bar button { background: transparent; color: var(--accent); font-weight: 700; padding: 4px 0; font-size: 15px; }
.qr { background: #ffffff; padding: 8px; border-radius: 12px; width: min(100%, 340px); margin-inline: auto; box-sizing: border-box; }
.qr svg { display: block; width: 100%; height: auto; }
.linkbox { font-family: ui-monospace, Menlo, monospace; font-size: 12px; word-break: break-all; user-select: all; background: var(--surface); padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); color: var(--muted); }
.people { display: flex; flex-direction: column; gap: 8px; }
.person { background: var(--surface); border: 1.5px solid var(--line); color: var(--ink); padding: 16px; font-size: 20px; font-weight: 700; text-align: left; display: flex; justify-content: space-between; align-items: center; }
.person span { font-size: 14px; font-weight: 400; color: var(--muted); }
.me-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.me-line button { background: transparent; color: var(--muted); font-size: 15px; padding: 4px 0; }
.wait { text-align: center; color: var(--muted); font-size: 15px; }
.center { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.cell { flex-direction: column; gap: 2px; }
.cell .ini { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); line-height: 1.1; overflow-wrap: anywhere; }
.cell.yes .ini { color: var(--yes); }
.words { font-family: var(--font-display); font-weight: 800; font-size: clamp(26px, 8vw, 34px); line-height: 1.15; letter-spacing: -0.01em; text-align: center; text-wrap: balance; user-select: all; }
.join { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.join .secondary { width: auto; padding: 10px 18px; font-size: 16px; }
.lang { background: transparent; color: var(--muted); font-family: var(--font-body); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; padding: 4px 10px; border: 1.5px solid var(--line); border-radius: 999px; }
.person:disabled { opacity: 0.5; cursor: default; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 4px; }
.stepper span { font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }
.stepper small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.stepper button { background: transparent; color: var(--accent); font-size: 26px; line-height: 1; width: 44px; height: 44px; }
.stepper button:disabled { color: var(--line); cursor: default; }
.cell.past { background: transparent; border-style: dashed; opacity: 0.45; }
.setup { display: flex; flex-direction: column; gap: 18px; }
