/* ═══════════════════════════════════════════════════════════════════
   SPELLA CUE · Stage <-> FOH cue room (/cue/)
   Standalone, phone-first, full screen. A tool first: the colour is the
   message (red = not ready, green = ready), everything else stays dark
   and out of the way. Tokens follow static/css/site.css.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --bg: #0a0710;
  --bg-2: #0f0a17;
  --panel: #150e1f;
  --panel-2: #1b1228;
  --line: rgba(230, 230, 230, 0.10);
  --line-strong: rgba(230, 230, 230, 0.18);
  --text: #e6e6e6;
  --muted: #a396b5;
  --faint: #877a99;
  --green: #7ddc3f;
  --green-hi: #9ef060;
  --purple: #9b5cf6;
  --orange: #ff7a2e;
  --gold: #d9a441;
  --red: #ef4444;
  --grad: linear-gradient(100deg, var(--green-hi), var(--purple) 50%, #ffa04d);

  /* State colours: saturated, readable across a dark room. */
  --yes: #9ef060;
  --yes-2: #8ad94e;
  --yes-ink: #0a0710;
  --no: #d81f2d;
  --no-ink: #ffffff;

  --display: 'Cinzel', Georgia, 'Times New Roman', serif;
  --ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

/* Dim colours (menu): same meaning, a third of the light spill at FOH. */
html.dim {
  --yes: #3d7a1f;
  --yes-2: #346b1a;
  --yes-ink: #ffffff;
  --no: #7c111b;
  --no-ink: #ffffff;
}

* { box-sizing: border-box; }
html.cue-html, body.cue { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body.cue {
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* The room is one fixed screen: no scrolling, no rubber band, no
   pull-to-refresh, no text selection or long-press callouts. */
html.cue-room, html.cue-room body { overflow: hidden; overscroll-behavior: none; height: 100%; }
html.cue-room body {
  position: fixed;
  inset: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

:where(.cue) button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;          /* no double-tap zoom */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
:where(.cue) input { font: inherit; font-size: 18px; }   /* >= 16px: no iOS focus zoom */
:where(.cue) input, .share-url, .code-line b {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
.cue :focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
.cue [hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── The split screen ─────────────────────────────────────────────────
   Portrait: the other person on top, you at the bottom (near your thumb).
   Landscape / desktop: them left, you right. The strip with your last
   message gets its own row above the bar, so it never covers a half. */
.app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  background: var(--bg);
}
.half-them { grid-row: 1; grid-column: 1; }
.half-me { grid-row: 2; grid-column: 1; }
.sentbar { grid-row: 3; grid-column: 1 / -1; }
.bar { grid-row: 4; grid-column: 1 / -1; }
.both { grid-row: 1 / 3; grid-column: 1 / -1; }
.topbar { grid-row: 1; grid-column: 1 / -1; }

@media (orientation: landscape) {
  .app { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto; }
  .half-them { grid-row: 1; grid-column: 1; }
  .half-me { grid-row: 1; grid-column: 2; }
  .sentbar { grid-row: 2; }
  .bar { grid-row: 3; }
  .both { grid-row: 1; grid-column: 1 / -1; }
}

/* The colour flips instantly: a red-to-green fade passes through mud. */
.half {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  text-align: center;
  background: var(--no);
  color: var(--no-ink);
}
.half.is-ready { background: var(--yes); color: var(--yes-ink); }
.half-them { box-shadow: inset 0 -3px 0 var(--bg); }
.half-me { display: block; width: 100%; height: 100%; touch-action: none; }
@media (orientation: landscape) {
  .half-them { box-shadow: inset -3px 0 0 var(--bg); }
}

/* Each half's content box. Text is sized from the box (container query
   units), so small phones and landscape never collide with the pills or
   the BOTH READY banner. */
.half-in {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px calc(var(--sar) + 12px) 10px calc(var(--sal) + 12px);
  container-type: size;
}
.half-them .half-in { padding-top: calc(var(--sat) + 56px); }
@media (orientation: landscape) {
  .half .half-in { padding-top: calc(var(--sat) + 56px); }
  .half-them .half-in { padding-right: 12px; }
  .half-me .half-in { padding-left: 12px; }
}
.half-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.half-role {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(48px, 16vmin, 140px);
  line-height: 0.92;
  letter-spacing: 0.04em;
  padding-left: 0.04em;
}
.half-sub {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.32em;
  padding-left: 0.32em;
  opacity: 0.8;
}
.half-state {
  margin-top: 2px;
  font-weight: 900;
  font-size: clamp(26px, 8vmin, 66px);
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
@supports (container-type: size) {
  .half-role { font-size: clamp(40px, min(24cqh, 34cqw), 160px); }
  .half-state { font-size: clamp(22px, min(10.5cqh, 13cqw), 72px); }
}
.presence {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  min-height: 38px;
  padding: 0 15px;
  border-radius: 999px;
  background: rgba(10, 7, 16, 0.78);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.dot { flex: none; width: 11px; height: 11px; border-radius: 50%; background: #7d7787; }
[data-p="on"] .dot { background: var(--green-hi); box-shadow: 0 0 10px var(--green-hi); }
[data-p="weak"] .dot, [data-p="bg"] .dot { background: var(--gold); }
.invite {
  margin-top: 6px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  border: 2px solid currentColor;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.you {
  margin-bottom: 2px;
  padding: 6px 9px 6px 12px;
  border-radius: 999px;
  background: #0a0710;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.22em;
}
.hint {
  margin-top: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px dashed currentColor;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.14em;
  white-space: nowrap;
}
@container (max-height: 300px) {
  .half-sub { display: none; }
  .hint { margin-top: 4px; padding: 7px 13px; font-size: 13px; }
  .presence { margin-top: 2px; min-height: 34px; font-size: 14px; }
  .you { padding: 4px 7px 4px 10px; font-size: 12px; }
}
@container (max-height: 200px) {
  .you { display: none; }
  .hint { margin-top: 2px; padding: 4px 10px; font-size: 11px; letter-spacing: 0.08em; border-width: 1.5px; }
}
.half-me.nudge .hint { animation: nudge 0.45s ease-in-out 2; }
@keyframes nudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* Hold-to-flip: a disc of the next colour grows from the finger; when it
   reaches the far corner (HOLD_MS in cue.js) the half flips. */
.hold-fill {
  position: absolute;
  z-index: 0;
  left: var(--px, 50%);
  top: var(--py, 50%);
  width: calc(var(--r, 600px) * 2);
  height: calc(var(--r, 600px) * 2);
  margin: calc(var(--r, 600px) * -1) 0 0 calc(var(--r, 600px) * -1);
  border-radius: 50%;
  background: var(--yes);
  transform: scale(0);
  /* The colour swap waits for the collapse, so after a flip the disc shrinks
     in the colour of the half it sits on (no bullseye). A new press cancels
     the wait (.holding has no background transition). */
  transition: transform 0.16s ease-out, background-color 0s linear 0.16s;
  pointer-events: none;
}
.half-me.is-ready .hold-fill { background: var(--no); }
.half-me.holding .hold-fill { transform: scale(1); transition: transform var(--hold, 420ms) linear; }
/* A white flash marks every flip: yours (confirmation) and theirs (so the
   change catches the eye). */
.half-flash {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.half.flashing .half-flash { animation: flash 0.5s ease-out; }
@keyframes flash { from { opacity: 0.92; } to { opacity: 0; } }

/* Both green: the whole screen is the message. */
.app.is-both .half { background: var(--yes); color: var(--yes-ink); animation: breathe 2.6s ease-in-out 3; }
.app.is-both .half-them { box-shadow: none; }
@keyframes breathe { 0%, 100% { background-color: var(--yes); } 50% { background-color: var(--yes-2); } }
.both {
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  pointer-events: none;
}
.app.is-both .both { display: flex; }
.both span {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(30px, min(11vmin, 9vw), 104px);
  line-height: 1;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: var(--green-hi);
  background: #0a0710;
  padding: 0.24em 0.55em 0.2em;
  border-radius: 20px;
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.4);
}
html.dim .both span { color: #b8f58a; }
.app.is-both .hint { display: none; }
@media (orientation: landscape) {
  /* side-by-side halves: the banner sits along the bottom, clear of both */
  .both { align-items: flex-end; padding-bottom: 16px; }
  .app.is-both .half-in { padding-bottom: 96px; }
}
@media (orientation: landscape) and (max-height: 430px) {
  .app.is-both .presence, .app.is-both .you, .app.is-both .half-sub { display: none; }
  .app.is-both .half-in { padding-bottom: 74px; }
  .both span { font-size: clamp(24px, 9vmin, 56px); }
}

/* ── Top pills: your connection + the set clock ── */
.topbar {
  z-index: 5;
  align-self: start;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: calc(var(--sat) + 10px) calc(var(--sar) + 12px) 0 calc(var(--sal) + 12px);
  pointer-events: none;
}
.pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(10, 7, 16, 0.8);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.conn[data-c="ok"] .dot { background: var(--green-hi); box-shadow: 0 0 9px var(--green-hi); }
.conn[data-c="slow"] .dot { background: var(--gold); }
.conn[data-c="down"] .dot { background: #ff4d5a; animation: blink 1s steps(2, jump-none) infinite; }
.conn[data-c="down"] { color: #ffd0d4; }
@keyframes blink { 50% { opacity: 0.25; } }
.setpill { margin-left: auto; font-family: var(--mono); font-size: 17px; letter-spacing: 0.02em; }
.setpill[data-s="warn"] { color: #ffd27a; }
.setpill[data-s="hot"] { color: #ffb070; box-shadow: inset 0 0 0 2px var(--orange); }
.setpill[data-s="over"] { color: #fff; background: #a3121d; }

/* ── Last message you sent, and whether it landed ── */
.sentbar {
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px calc(var(--sar) + 10px) 8px calc(var(--sal) + 16px);
  background: #120c1b;
  border-top: 1px solid var(--line-strong);
  color: #fff;
  text-align: left;
  font-weight: 800;
}
.sentbar[data-st="seen"] { background: #1b1430; }
.sentbar[data-st="got"] { background: #15290e; border-top-color: rgba(158, 240, 96, 0.5); }
.sentbar[data-st="fail"] { background: #33090f; border-top-color: #ff5a67; }
.sb-to { flex: none; font-size: 12px; letter-spacing: 0.16em; color: var(--muted); }
.sb-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.sb-st {
  flex: none;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 14px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.sentbar[data-st="seen"] .sb-st { background: #2d2050; color: #e2d5ff; }
.sentbar[data-st="got"] .sb-st { background: var(--green-hi); color: #0a0710; }
.sentbar[data-st="fail"] .sb-st { background: #ff4d5a; color: #fff; }

/* ── Bottom bar ── */
.bar {
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.2fr) 56px;
  gap: 8px;
  padding: 8px calc(var(--sar) + 10px) calc(var(--sab) + 8px) calc(var(--sal) + 10px);
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.bar-btn {
  min-height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.bar-btn .ic { font-size: 20px; letter-spacing: 0; }
.bar-cues { background: linear-gradient(160deg, #2e1755, #1b1228); border-color: rgba(155, 92, 246, 0.7); }
.bar-btn:active { filter: brightness(1.35); }
.burger, .burger::before, .burger::after { display: block; width: 22px; height: 3px; border-radius: 2px; background: currentColor; }
.burger { position: relative; }
.burger::before, .burger::after { content: ''; position: absolute; left: 0; }
.burger::before { top: -7px; }
.burger::after { top: 7px; }

/* ── Sheets (bottom drawers) ──────────────────────────────────────────
   --kb / --vvh come from visualViewport in cue.js, so a sheet with a
   focused input sits above the iOS keyboard instead of behind it. */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(4, 2, 8, 0.64); }
.sheet {
  position: fixed;
  z-index: 41;
  left: 0;
  right: 0;
  bottom: var(--kb, 0px);
  max-height: calc(var(--vvh, 100dvh) - var(--sat) - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 0 calc(var(--sar) + 16px) calc(var(--sab) + 22px) calc(var(--sal) + 16px);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.55);
  animation: sheet-in 0.18s ease-out;
}
@keyframes sheet-in { from { transform: translateY(32px); } }
@media (min-width: 720px) {
  .sheet { left: 50%; right: auto; width: 620px; margin-left: -310px; }
}
.sheet-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 12px;
  background: var(--panel);
}
.sheet-head h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: 0.05em; }
.sheet-x {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  font-size: 19px;
}
.sheet-lead { margin: 0 0 14px; color: var(--muted); font-size: 16px; line-height: 1.45; }
.grp {
  margin: 20px 0 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Free text */
.say { display: flex; gap: 8px; }
.say input {
  flex: 1;
  min-width: 0;
  height: 58px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: #fff;
}
.say input::placeholder, .join-row input::placeholder { color: var(--faint); }
.say input:focus, .at-row input:focus, .join-row input:focus, .share-url:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(155, 92, 246, 0.35);
}
.say-btn {
  flex: none;
  height: 58px;
  padding: 0 22px;
  border-radius: 16px;
  background: var(--purple);
  color: #0a0710;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.say-count { margin: 6px 4px 0; text-align: right; color: var(--faint); font-size: 14px; }

/* Preset cues: only your role's set is shown. */
.cue-set { display: none; }
html[data-role="stage"] .cue-set[data-for="stage"],
html[data-role="foh"] .cue-set[data-for="foh"] { display: block; }
.cue-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .cue-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cue-btn {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  padding: 12px 12px 12px 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  border-radius: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: #fff;
  text-align: left;
  font-weight: 900;
  font-size: 18px;
  line-height: 1.08;
  letter-spacing: 0.02em;
}
.cue-btn::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--stripe, var(--tone)); }
.cue-btn .ic { font-size: 21px; line-height: 1; }
.cue-btn .lb { overflow-wrap: normal; word-break: normal; hyphens: manual; }
.cue-btn:active { background: var(--tone); color: var(--tone-ink); }

/* Tones: the colour of a takeover tells you the kind of cue at a glance. */
.tone-hype, [data-tone="hype"] { --tone: #ff7a2e; --tone-ink: #0a0710; }
.tone-music, [data-tone="music"],
.tone-fx, [data-tone="fx"],
.tone-vibe, [data-tone="vibe"] { --tone: #b48cff; --tone-ink: #0a0710; }
.tone-go, [data-tone="go"] { --tone: #9ef060; --tone-ink: #0a0710; }
.tone-hold, [data-tone="hold"],
.tone-time, [data-tone="time"] { --tone: #e8b54d; --tone-ink: #0a0710; }
.tone-urgent, [data-tone="urgent"] { --tone: #ec2436; --tone-ink: #ffffff; }
.tone-care, [data-tone="care"],
.tone-text, [data-tone="text"] { --tone: #efedf5; --tone-ink: #0a0710; }
.tone-dark, [data-tone="dark"] { --tone: #000000; --tone-ink: #ffffff; --stripe: #ffffff; }

/* Log */
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.log li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-size: 15px;
}
.log .t { font-family: var(--mono); color: var(--faint); font-size: 13px; }
.log .x { min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.log .x small { display: block; font-size: 12px; font-weight: 800; letter-spacing: 0.14em; color: var(--muted); }
.log .s { font-size: 13px; font-weight: 800; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
.log .s.ok { color: var(--green-hi); }
.log .s.bad { color: #ff7b85; }
.log .empty { display: block; color: var(--faint); grid-template-columns: none; }

/* Countdown sheet */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  min-height: 50px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 0.12em;
}
.chip[aria-checked="true"] { background: var(--purple); border-color: var(--purple); color: #0a0710; }
.cd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cd-btn {
  min-height: 108px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
}
.cd-btn b { font-size: 48px; font-weight: 900; line-height: 1; color: #fff; }
.cd-btn span { font-size: 13px; font-weight: 800; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); }
.cd-btn:active { background: var(--purple); }
.wide {
  display: block;
  width: 100%;
  min-height: 60px;
  margin-top: 14px;
  border-radius: 16px;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.danger { background: #3a0d14; border: 1px solid #ff5a67; color: #fff; }

/* Set clock sheet */
.clock-now { margin: 0 0 4px; font-size: 16px; line-height: 1.45; color: var(--muted); }
.clock-now b { display: block; color: #fff; font-size: 17px; }
.clock-now b span { font-family: var(--mono); font-size: 34px; line-height: 1.15; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tile {
  min-height: 82px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.tile b { font-size: 30px; line-height: 1.1; letter-spacing: 0; color: #fff; }
.at-row { display: flex; gap: 8px; }
.at-row input {
  flex: 1;
  min-width: 0;
  height: 58px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: #fff;
  font-size: 20px;
  color-scheme: dark;
}
.tile-btn {
  min-height: 58px;
  padding: 0 20px;
  border-radius: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tile-btn.ghost { color: var(--muted); }
.adj { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.adj .tile-btn { padding: 0 8px; }

/* Menu */
.menu { display: grid; gap: 8px; }
.menu-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 0 18px;
  border-radius: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.03em;
  text-align: left;
  text-decoration: none;
}
.menu-btn .ic { flex: none; width: 26px; font-size: 20px; text-align: center; }
.menu-btn[aria-pressed="true"] { border-color: rgba(155, 92, 246, 0.85); }
.menu-status { margin: 14px 2px 0; color: var(--faint); font-size: 14px; line-height: 1.55; }

/* Invite */
.qr-box {
  width: fit-content;
  min-width: 220px;
  min-height: 220px;
  margin: 2px auto 14px;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: #fff;
}
.qr-box canvas { display: block; image-rendering: pixelated; }
.qr-fallback { max-width: 220px; margin: 0; text-align: center; color: #0a0710; font-weight: 700; }
.share-url {
  width: 100%;
  height: 54px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: #fff;
  font-family: var(--mono);
  font-size: 16px;
}
.share-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin-top: 10px; }
.code-line { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 15px; }
.code-line b { color: #fff; font-size: 18px; letter-spacing: 0.06em; }

/* ── DJ or VJ? (first question, full screen) ── */
.pick {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: none;
  flex-direction: column;
  gap: 14px;
  padding: calc(var(--sat) + 18px) calc(var(--sar) + 16px) calc(var(--sab) + 16px) calc(var(--sal) + 16px);
  background: radial-gradient(120% 60% at 50% 0%, rgba(155, 92, 246, 0.2), transparent 62%), var(--bg);
}
html:not([data-role]) .pick, .pick.open { display: flex; }
.pick-brand {
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}
.pick-q {
  margin: 0;
  text-align: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(26px, 7.4vw, 46px);
  line-height: 1.12;
  text-wrap: balance;
}
.pick-opts { flex: 1; min-height: 0; display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (orientation: landscape) {
  .pick-opts { grid-template-rows: minmax(0, 1fr); grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.pick-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 28px;
  color: #fff;
}
.pick-dj { background: linear-gradient(160deg, #2d1556, #160d26); border: 2px solid var(--purple); }
.pick-vj { background: linear-gradient(160deg, #4b200c, #1d0f0a); border: 2px solid var(--orange); }
.pick-btn b { font-family: var(--display); font-weight: 800; font-size: clamp(76px, 24vmin, 170px); line-height: 0.95; letter-spacing: 0.05em; padding-left: 0.05em; }
.pick-btn span { font-size: 16px; font-weight: 800; letter-spacing: 0.28em; text-transform: uppercase; opacity: 0.85; }
.pick-btn:active { filter: brightness(1.3); }
.pick-btn em {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(10, 7, 16, 0.85);
  font-style: normal;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.pick-btn em::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--green-hi); box-shadow: 0 0 8px var(--green-hi); }
.pick-cancel {
  align-self: center;
  min-height: 50px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* ── Incoming message: full-screen takeover until GOT IT ── */
.takeover {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: calc(var(--sat) + 14px) calc(var(--sar) + 16px) calc(var(--sab) + 16px) calc(var(--sal) + 16px);
  background: var(--tone, #efedf5);
  color: var(--tone-ink, #0a0710);
}
.to-flash { position: absolute; inset: 0; background: var(--flash, #fff); opacity: 0; pointer-events: none; }
/* The flash never hides the words: dark text flashes against white,
   white text against black, light cards flash orange. */
.takeover[data-tone="urgent"] { --flash: #000; }
.takeover[data-tone="care"], .takeover[data-tone="text"] { --flash: #ff7a2e; }
.takeover[data-tone="dark"] { --flash: #6d28d9; }
.takeover.alerting .to-flash { animation: to-flash 1.1s linear; }
@keyframes to-flash { 0% { opacity: 1; } 18% { opacity: 0; } 40% { opacity: 0.95; } 58% { opacity: 0; } 100% { opacity: 0; } }
.to-head { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.to-from {
  padding: 9px 16px;
  border-radius: 999px;
  background: #0a0710;
  color: #fff;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.16em;
}
.takeover[data-tone="dark"] .to-from { background: #fff; color: #000; }
.to-age { padding: 7px 13px; border-radius: 999px; border: 2px solid currentColor; font-weight: 900; font-size: 15px; letter-spacing: 0.1em; }
.to-main {
  position: relative;
  flex: 1;
  min-height: 34%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  overflow: hidden;
}
.to-icon { flex: none; font-size: clamp(40px, 11vmin, 92px); line-height: 1.05; }
.to-text { margin: 0; max-width: 100%; font-weight: 900; line-height: 0.98; overflow-wrap: normal; word-break: normal; hyphens: none; }
.to-text.free { line-height: 1.08; }
.to-text.squeeze { overflow-wrap: anywhere; }
.to-more { position: relative; list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 30%; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.to-more li.more-n { background: none; border: 2px dashed currentColor; text-align: center; letter-spacing: 0.08em; }
.to-more li { padding: 9px 13px; border-radius: 12px; background: rgba(10, 7, 16, 0.16); font-weight: 800; font-size: 15px; }
.takeover[data-tone="dark"] .to-more li, .takeover[data-tone="urgent"] .to-more li { background: rgba(255, 255, 255, 0.16); }
.to-ack {
  position: relative;
  flex: none;
  min-height: 104px;
  border-radius: 24px;
  background: #0a0710;
  color: #fff;
  font-weight: 900;
  font-size: clamp(26px, 7.4vw, 40px);
  letter-spacing: 0.06em;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}
.takeover[data-tone="dark"] .to-ack { background: #fff; color: #000; }
.to-ack:active { filter: brightness(1.6); }

/* ── Synced countdown ── */
.count {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  padding: calc(var(--sat) + 16px) calc(var(--sar) + 16px) calc(var(--sab) + 16px) calc(var(--sal) + 16px);
  background: #050308;
  color: #fff;
}
.count-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.count-label { font-weight: 900; font-size: clamp(24px, 7vw, 40px); letter-spacing: 0.12em; }
.count-by { color: var(--muted); font-weight: 800; font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase; text-align: right; }
.count-num {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#cd-num {
  display: inline-block;
  font-weight: 900;
  font-size: 50vmin;
  line-height: 0.9;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.count.arming #cd-num { opacity: 0.3; }
.count.final #cd-num { color: var(--orange); }
#cd-num.pop { animation: pop 0.3s ease-out; }
@keyframes pop { from { transform: scale(1.1); } to { transform: scale(1); } }
.count.go { background: var(--green-hi); color: #0a0710; }
.count.go .count-by, .count.go .count-sync { color: rgba(10, 7, 16, 0.7); }
.count-bar { height: 10px; margin: 8px 0 16px; border-radius: 99px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.count.go .count-bar { background: rgba(10, 7, 16, 0.15); }
.count-bar i { display: block; height: 100%; background: currentColor; transform-origin: left center; transform: scaleX(var(--p, 1)); }
.count-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.count-sync { color: var(--faint); font-size: 14px; font-weight: 700; }
.count-x {
  min-height: 60px;
  padding: 0 26px;
  border-radius: 16px;
  background: #2a0c12;
  border: 1px solid #ff5a67;
  color: #fff;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.count.go .count-x { background: #0a0710; border-color: #0a0710; }

/* ── Room closed / toasts ── */
.gone {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: var(--bg);
}
.gone h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 32px; }
.gone p { margin: 0; max-width: 420px; color: var(--muted); font-size: 17px; line-height: 1.5; }
.gone form { width: min(420px, 100%); }
.toasts {
  position: fixed;
  z-index: 95;
  left: 12px;
  right: 12px;
  top: calc(var(--sat) + 58px);
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: 560px;
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(21, 14, 31, 0.97);
  border: 1px solid var(--line-strong);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.2s ease-out;
}
.toast.bad { border-color: #ff5a67; }
.toast.warn { border-color: var(--gold); }
.toast.good { border-color: var(--green-hi); }
@keyframes toast-in { from { transform: translateY(-10px); opacity: 0; } }
.noscript { position: fixed; inset: auto 0 0 0; z-index: 99; margin: 0; padding: 16px; background: #a3121d; color: #fff; text-align: center; font-weight: 800; }

/* ── Landing + missing pages ── */
body[data-page="landing"], body[data-page="missing"] {
  min-height: 100vh;
  min-height: 100svh;
  background: radial-gradient(120% 50% at 50% 0%, rgba(155, 92, 246, 0.18), transparent 60%), var(--bg);
}
.land { width: min(560px, calc(100% - 32px)); margin: 0 auto; padding: calc(var(--sat) + 30px) 0 calc(var(--sab) + 44px); }
.land-mark { display: block; width: 168px; height: auto; margin: 0 auto 18px; filter: drop-shadow(0 0 24px rgba(155, 92, 246, 0.35)); }
.eyebrow { margin: 0 0 6px; text-align: center; font-size: 13px; font-weight: 800; letter-spacing: 0.28em; text-transform: uppercase; color: var(--muted); }
.land h1 {
  margin: 0 0 12px;
  text-align: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(40px, 11vw, 64px);
  line-height: 1.05;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.land-missing h1 { font-size: clamp(32px, 9vw, 52px); }
.lead { margin: 0 0 26px; text-align: center; color: var(--muted); font-size: 17px; line-height: 1.55; }
.big-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 84px;
  border-radius: 22px;
  background: linear-gradient(100deg, var(--green-hi), #c2f79a);
  color: #0a0710;
  font-weight: 900;
  font-size: 21px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow: 0 10px 34px rgba(125, 220, 63, 0.3);
}
.big-btn:active { filter: brightness(0.92); }
.join { margin-top: 28px; }
.join label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.join-row { display: flex; gap: 8px; }
.join-row input {
  flex: 1;
  min-width: 0;
  height: 60px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: #fff;
  font-family: var(--mono);
  font-size: 19px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.join-btn {
  flex: none;
  height: 60px;
  padding: 0 24px;
  border-radius: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: #fff;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.err { margin: 10px 2px 0; color: #ff8f97; font-weight: 700; line-height: 1.45; }
.recent { margin-top: 28px; }
.recent h2, .how-h { margin: 0 0 10px; font-size: 13px; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.recent ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.recent a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 66px;
  padding: 0 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}
.recent a .c { font-family: var(--mono); font-size: 16px; letter-spacing: 0.04em; }
.recent a .m { color: var(--muted); font-size: 14px; white-space: nowrap; }
.how { list-style: none; counter-reset: s; margin: 30px 0 0; padding: 0; display: grid; gap: 10px; }
.how li {
  counter-increment: s;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 16px;
  line-height: 1.4;
}
.how li::before {
  content: counter(s);
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--grad);
  color: #0a0710;
  font-weight: 900;
}
.fine { margin: 22px 0 0; text-align: center; color: var(--faint); font-size: 14px; line-height: 1.55; }
.land-back { margin: 18px 0 0; text-align: center; }
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.04em;
}

@media (prefers-reduced-motion: reduce) {
  .cue *, .cue *::before, .cue *::after { animation: none !important; transition: none !important; }
  /* The hold disc is feedback, not decoration: keep it. */
  .half-me.holding .hold-fill { transition: transform var(--hold, 420ms) linear !important; }
}

/* ── QA fixes + invite (Nov 2026) ── */
/* iOS ignores user-scalable=no: no pinch / double-tap zoom on the fixed
   room UI (taps still work; sheets and the cue list keep their scrolling). */
.app, .takeover, .count, .pick, .gone { touch-action: none; }

/* After a reload the phone keeps sound locked until a tap: say so. */
.sound-pill {
  margin-left: 8px;
  margin-right: auto;
  background: var(--gold);
  color: #0a0710;
  font-size: 12px;
  letter-spacing: 0.08em;
  animation: pill-pulse 1.6s ease-in-out 4;
}
.sound-pill span { font-size: 15px; }
@keyframes pill-pulse { 50% { box-shadow: 0 0 0 6px rgba(242, 196, 109, 0.28); } }
@media (max-width: 360px) { .sound-pill { font-size: 11px; padding: 0 10px; } }

/* Invite: texting the link is the main way to share it. */
.share-sms {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 12px;
  background: var(--green-hi);
  border-color: transparent;
  color: #0a0710;
  text-decoration: none;
}
.share-sms:active { filter: brightness(0.92); }

/* This phone lost the server: the other half is only "last known". */
.app.stale .half-them .half-in { opacity: 0.5; }
.app.stale .half-them { background-image: repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.16) 0 14px, transparent 14px 28px); }
.log li[data-retry] { cursor: pointer; }
