/* Phone shell: the Game Center on a phone. One hand, big targets, the action always in the thumb zone.
   --me is the player's own color. hub-phone.js sets it on <body> once they hold a seat, and it tints the whole phone.
   Plates are lit from the top-left: a bright edge on the cut corner, a wash of the owner's color coming off one side,
   a faint sheen from above. There are no outlines; light does the separating.
   The shell owns the bar, joining, the lobby and the host drawer; each game's own phone.css draws its screens. */

:root:has(body.phone) { overscroll-behavior-y: none; }

body.phone {
  --me: var(--cyan-rgb);
  height: auto; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
  font-size: 16px;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
/* The stage light: one static layer behind everything, in the player's color. Painted once, never animated. */
body.phone::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(78% 34% at 50% -8%, rgba(var(--me), 0.34), transparent 74%),
    radial-gradient(130% 46% at 50% 0%, rgba(var(--stage-light-rgb), 0.42), transparent 72%),
    radial-gradient(100% 26% at 50% 106%, rgba(var(--me), 0.14), transparent 72%);
}
body.is-out::before { opacity: 0.4; }

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  width: 100%; max-width: 540px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + var(--sp-3)) var(--sp-4) 6px;
}
.mark { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; font-size: var(--ph-xs); text-transform: var(--caps); letter-spacing: calc(0.14em * var(--track)); color: var(--ink-3); white-space: nowrap; }
.mark-grid { width: 16px; height: 16px; }
.mark-grid rect { fill: none; stroke: var(--cyan); stroke-width: 1.6; opacity: 0.7; }
.mark-grid rect.g { stroke: var(--gold); fill: rgba(var(--gold-rgb), 0.35); opacity: 1; }
/* A role tag (Out, Psychic, On the bomb) sits under the name: beside it, with the host's crown, it cut the name to a letter. */
.me {
  display: grid; grid-template-columns: 10px minmax(0, 1fr); align-items: center; column-gap: 9px; row-gap: 4px; min-width: 0; max-width: 64%;
  padding: var(--sp-2) 14px var(--sp-2) var(--sp-3);
  font-weight: 700; font-size: var(--ph-base); line-height: 1.1; text-transform: var(--caps); color: var(--ink-title);
  background: linear-gradient(90deg, rgba(var(--me), 0.36), rgba(var(--me), 0.1));
  box-shadow: var(--rim);
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
}
.me:empty { display: none; }
.me i { width: 10px; height: 10px; flex: none; background: rgb(var(--pc)); box-shadow: 0 0 10px 1px rgba(var(--pc), calc(0.9 * var(--glow))); }
.me span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me em { grid-column: 2; justify-self: start; padding: 1px 6px; font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: calc(0.06em * var(--track)); color: var(--red-soft); background: rgba(var(--red-rgb), 0.22); }
.me em.team { color: rgb(var(--tag)); background: rgba(var(--tag), 0.16); }
body.is-out .me { filter: grayscale(0.85); }

.app {
  flex: 1; width: 100%; max-width: 540px; margin: 0 auto;
  display: flex; flex-direction: column; gap: var(--sp-5);
  padding: var(--sp-3) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom));
  /* A headline slamming in from 1.45x is wider than the phone for a moment. Unclipped, the browser widens the page to
     fit it and the whole screen zooms out, and stays that way until the next touch. */
  overflow-x: clip;
}
/* The dock carries its own safe-area padding, so the page gives up its bottom padding when one is present. The dock
   is the last thing on its screen, so scrolled to the end nothing sits under it; a field the phone scrolls to (the
   keyboard's Next, a focus) still has to land above it, hence the scroll padding. */
.app:has(.dock) { padding-bottom: 0; }
html:has(.app .dock) { scroll-padding-bottom: calc(64px + var(--sp-5) + 14px + env(safe-area-inset-bottom)); }
.connecting { margin: auto; color: var(--ink-2); font-size: var(--ph-base); }

.screen { display: flex; flex-direction: column; gap: var(--sp-4); flex: 1; min-width: 0; }
.screen.center { justify-content: center; text-align: center; }
.push { margin-top: auto; display: flex; flex-direction: column; gap: var(--sp-3); }

/* One confident headline per screen, tight tracking. Titles are white and heavy; body text sits a clear step down in
   cool grey, so the eye finds the title first. A section heading is a smaller title, not a grey label. */
h1, h2 { margin: 0; font-weight: 700; text-transform: var(--caps); line-height: 1.02; color: var(--ink-title); }
h1 { font-size: var(--ph-h1); letter-spacing: -0.015em; text-wrap: balance; overflow-wrap: anywhere; }
h1.hero { font-size: var(--ph-hero); line-height: 0.9; letter-spacing: -0.03em; }
h2 { font-size: var(--ph-base); font-weight: 600; letter-spacing: calc(0.02em * var(--track)); color: var(--ink-2); }
/* The hub's section headings; a game's own h2 keeps the quieter grey label above. */
.hub-app h2 { margin-top: var(--sp-2); font-size: var(--ph-md); font-weight: 700; letter-spacing: calc(0.05em * var(--track)); color: var(--ink-title); }
.lede { margin: 0; color: var(--ink-2); font-size: var(--ph-base); line-height: 1.4; text-wrap: pretty; }
.who { color: var(--pc-hex, var(--ink)); }
.hero .who { text-shadow: 0 0 0.45em rgba(var(--pc, var(--me)), calc(0.6 * var(--glow))); }

/* Each player's color, lightened enough to read as text on the dark plates. */
.row, .tile, .game-plate { --pc-lite: rgb(var(--pc)); }
@supports (color: color-mix(in srgb, red, blue)) {
  .row, .tile, .game-plate { --pc-lite: color-mix(in srgb, rgb(var(--pc)) 60%, var(--ink-title)); }
}

/* Shared plate geometry. Every beveled plate takes its cut from --bevel and its lit edge (--lip) from the same number,
   so the highlight sits exactly on the diagonal. */
.row, .tile, .sheet, .offline, .game-plate, .game-thumb, .play-chip, .wait, .host-btn, .swatch, .drawer-sheet, .ctl, .crest, .stat, .seg, .cup-card, .ask-card, .ask-host, .me-card {
  --b: calc(var(--bevel) * 0.7071);
  --lip: linear-gradient(135deg, rgba(255, 255, 255, var(--lip-a, 0.4)) var(--b), rgba(255, 255, 255, 0) calc(var(--b) + 1.5px));
  clip-path: polygon(var(--bevel) 0, 100% 0, 100% calc(100% - var(--bevel)), calc(100% - var(--bevel)) 100%, 0 100%, 0 var(--bevel));
}
/* A clipped plate would crop its own focus ring, so the ring takes the plate's square while it is focused. */
.row:focus-visible { clip-path: none; }

/* A group of plates casts one shadow on the floor: a clipped plate can't cast its own (see --lift-1 in tokens.css).
   .lift does the same for a plate that stands alone. */
.hub-app .list, .drawer .list, .lift, .ctl-grid { filter: var(--lift-1); }

/* Player rows */
.list { display: flex; flex-direction: column; gap: var(--sp-2); }
.row {
  --pc: 160, 170, 190;
  --bevel: 10px;
  --wash: 0.28;
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  width: 100%; min-height: 64px; padding: 10px 14px; text-align: left;
  background:
    var(--lip),
    radial-gradient(80% 150% at 0% 50%, rgba(var(--pc), var(--wash)), transparent 72%),
    var(--plate-sheen),
    var(--surface-3);
  box-shadow: var(--rim), var(--shade);
  transition: transform 280ms var(--spring), filter 160ms var(--ease-out);
}
.row.has-rm { padding-right: var(--sp-1); gap: var(--sp-3); }
button.row:active:not(:disabled) { transform: translateY(2px) scale(0.975); transition-duration: 50ms, 160ms; transition-timing-function: ease-out; }
button.row:hover:not(:disabled) { filter: brightness(1.15); }
.row:disabled { opacity: 0.45; }
.row.you { --wash: 0.5; box-shadow: var(--rim-hi), inset 0 -3px 0 rgb(var(--pc)); }
/* The hub's player lists lead with each player's doodle (GC.avatar) instead of a color dot. */
.row:has(> .avatar) { grid-template-columns: 40px minmax(0, 1fr) auto; }
.row > .avatar { width: 40px; height: 40px; }
.sw { width: 12px; height: 12px; background: rgb(var(--pc)); box-shadow: 0 0 12px 1px rgba(var(--pc), calc(0.85 * var(--glow))); }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-name { font-weight: 700; font-size: var(--ph-md); color: var(--ink-title); text-transform: var(--caps); line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-cat { font-size: var(--ph-sm); font-weight: 600; color: var(--pc-lite); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A name and the person's level chip on one line (hub-phone.js lobby roster); in a narrow tile the chip drops under
   the name rather than squeezing it. */
.row-line { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; max-width: 100%; }
.row-level {
  flex: none; padding: 0 6px; border-radius: var(--radius); font-family: var(--mono); font-size: var(--ph-xs); font-weight: 800;
  line-height: 1.5; color: var(--ink-2); background: var(--surface-1); box-shadow: inset 0 0 0 1px var(--line);
}
.row-tag { font-size: var(--ph-sm); font-weight: 600; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.row-tag.ready { color: var(--green); }
.row-tag.on { color: var(--cyan); }
.row-tools { display: flex; align-items: center; gap: 2px; }
.row .edit-btn { width: 48px; height: 48px; display: grid; place-items: center; font-size: var(--ph-lg); color: var(--ink-2); }
.edit-btn:focus-visible, .rm-btn:focus-visible { outline-offset: -4px; }

/* Your tile: the podium plate. Your name is lit by your own color, with a strip of it along the base. */
.tile {
  --pc: 160, 170, 190;
  --bevel: 16px;
  --lip-a: 0.5;
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 26px var(--sp-5) var(--sp-5);
  background:
    var(--lip),
    radial-gradient(120% 120% at 50% -10%, rgba(var(--pc), 0.55), rgba(var(--pc), 0.12) 62%),
    var(--plate-sheen),
    var(--surface-0);
  box-shadow: var(--rim-hi);
}
.tile::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: rgb(var(--pc)); box-shadow: 0 -12px 26px 2px rgba(var(--pc), calc(0.5 * var(--glow)));
}
.tile-name { font-size: var(--ph-name); font-weight: 700; text-transform: var(--caps); line-height: 0.98; letter-spacing: -0.025em; color: var(--ink-title); overflow-wrap: anywhere; text-wrap: balance; text-shadow: 0 4px 28px rgba(var(--pc), calc(0.65 * var(--glow))); }
.tile-cat { font-size: var(--ph-md); font-weight: 600; color: var(--pc-lite); }

.form { display: flex; flex-direction: column; gap: var(--sp-2); }
.form label { font-size: var(--ph-sm); font-weight: 600; color: var(--ink-2); }
.form label:not(:first-child) { margin-top: var(--sp-2); }
.form .pair { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2); }
.field { font-size: var(--ph-md); }

.btn.big { min-height: 64px; font-size: var(--ph-lg); text-transform: var(--caps); letter-spacing: calc(0.03em * var(--track)); width: 100%; --bevel: 14px; }
.link { align-self: center; display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 48px; padding: 0 var(--sp-3); color: var(--ink-2); font-weight: 600; text-decoration: underline; text-decoration-color: rgba(var(--cyan-rgb), 0.5); text-underline-offset: 4px; }

/* Action docks ride the bottom edge while a screen scrolls, and sit at the bottom even on short screens. */
.dock {
  position: sticky; bottom: 0; z-index: 5;
  margin: auto calc(var(--sp-4) * -1) 0;
  padding: var(--sp-5) var(--sp-4) calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(var(--obsidian-rgb), 0), rgba(var(--obsidian-rgb), 0.92) 40%, var(--obsidian));
}
/* A lobby's Start bar sits on the bottom edge even when the lobby is short. When it is off it is a solid grey plate,
   not a see-through gold one with the rows showing behind it, and its words ("2 more phones to start") fit on one
   line. Other games' docks keep their own off look. */
.start-dock { margin-top: auto; }
.start-dock .btn:disabled {
  --bg: var(--surface-3); --fg: var(--ink-2); --face: linear-gradient(var(--bg), var(--bg)); --sheen: 0.06; --edge: 0.3;
  opacity: 1; filter: none; box-shadow: var(--rim);
}
.start-dock .btn.big:disabled { font-size: var(--ph-md); }
/* A pause note rides in the dock above its button, on solid ground, so the dock never slides over it. */
.dock > p { margin: 0 0 10px; }
.dock:has(> p) { background: linear-gradient(180deg, rgba(var(--obsidian-rgb), 0), var(--obsidian) 22px); }

/* Game lobbies (GC.startDock, GC.howtoLink and GC.rulesFold in common.js): the How to play link tucks under the
   pitch, and the folded rules are one quiet row until someone opens them. */
.lobby-howto { align-self: flex-start; margin: calc(var(--sp-3) * -1) 0 0 calc(var(--sp-3) * -1); }
/* The host's one setting (GC.settingLine), tucked under the pitch like How to play: the value reads as a title, and
   Change keeps the link's full-height tap target without pushing the line apart. The words are one span, so the gap
   only sits before Change. A label the page scrolled to and focused (GC.showSetting) needs no focus ring. */
.setting-line {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--sp-1);
  margin: calc(var(--sp-3) * -1) 0 0; font-size: var(--ph-base); line-height: 1.3; color: var(--ink-2);
}
.setting-line b { font-weight: 700; color: var(--ink-title); overflow-wrap: anywhere; }
.setting-line .link { align-self: auto; padding: 0 var(--sp-2); }
label[tabindex="-1"]:focus { outline: none; }
.rules-fold { display: flex; flex-direction: column; gap: var(--sp-3); }
.rules-toggle {
  display: flex; align-items: center; gap: var(--sp-2); min-height: 48px; width: 100%; text-align: left;
  font-size: var(--ph-base); font-weight: 600; letter-spacing: calc(0.04em * var(--track)); text-transform: var(--caps); color: var(--ink-2);
  border-top: 1px solid rgba(var(--cyan-rgb), 0.18);
}
.rules-toggle .ico { color: var(--cyan); }
.rules-toggle .rules-chev { margin-left: auto; color: var(--ink-3); transition: rotate 200ms var(--ease-out); }
.rules-toggle[aria-expanded="true"] .rules-chev { rotate: 90deg; }

.note { margin: 0; font-size: var(--ph-sm); color: var(--ink-3); line-height: 1.4; text-align: center; text-wrap: balance; }

.sheet {
  --bevel: 12px;
  display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4);
  background: var(--lip), linear-gradient(180deg, rgba(var(--cyan-rgb), 0.12), rgba(var(--surface-glass-rgb), 0.9) 60%), var(--stage);
  box-shadow: var(--rim), var(--shade);
}
.sheet-row { display: flex; gap: var(--sp-2); }
.sheet-row .btn { flex: 1; }

.offline {
  --bevel: 8px;
  position: fixed; z-index: 20; left: 50%; top: calc(env(safe-area-inset-top) + 60px); transform: translateX(-50%); margin: 0;
  padding: 10px 18px; font-weight: 700; color: var(--on-lemon); background: var(--lip), var(--lemon); white-space: nowrap;
}
.offline[hidden] { display: none; }

/* A secret card on a phone that slept or lost the room may be a round old, so until the server answers again
   (hub-phone.js marks the body stale) its face is covered and it can't be turned over. data-secret holds the line
   it shows meanwhile. */
body.stale [data-secret] { pointer-events: none; }
body.stale [data-secret] > * { visibility: hidden; }
body.stale [data-secret]::after {
  content: attr(data-secret);
  position: absolute; inset: 0; margin: auto; width: max-content; height: max-content; max-width: calc(100% - 40px);
  padding: 10px var(--sp-4); font-size: var(--ph-base); font-weight: 700; text-transform: var(--caps); letter-spacing: calc(0.02em * var(--track)); color: var(--ink-2);
  background: rgba(var(--obsidian-rgb), 0.88); box-shadow: inset 0 0 0 1px rgba(var(--pc, var(--cyan-rgb)), 0.4);
}

/* Remove sits beside edit; the first tap arms it, the second removes. */
.rm-btn { min-width: 48px; height: 48px; padding: 0 10px; display: grid; place-items: center; font-size: var(--ph-md); font-weight: 700; color: var(--ink-3); }
.rm-btn.armed { color: var(--ink-title); background: var(--red); font-size: var(--ph-sm); text-transform: var(--caps); }
.rm-btn:disabled { opacity: 0.35; }

@keyframes slam { from { opacity: 0; transform: scale(1.45); } to { opacity: 1; transform: none; } }

/* Finale, shared by every game: the champion under a gold light, then your numbers. */
.finale { gap: var(--sp-5); }
.champ { --pc: var(--gold-rgb); position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); padding: var(--sp-2) 0 var(--sp-1); text-align: center; }
.champ::before { content: ''; position: absolute; z-index: -1; left: -16px; right: -16px; top: -28px; height: 260px; background: radial-gradient(closest-side, rgba(var(--gold-rgb), 0.3), transparent); pointer-events: none; }
.crest {
  --bevel: 16px; --lip-a: 0.9;
  width: 84px; height: 84px; display: grid; place-items: center; font-size: 44px; color: var(--on-gold);
  background: var(--lip), var(--gold-metal);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -3px 0 rgba(var(--gold-shade-rgb), 0.45);
  animation: slam 600ms var(--spring) backwards;
}
.champ-name { margin: 0; font-size: clamp(42px, 14vw, 66px); font-weight: 700; text-transform: var(--caps); line-height: 0.95; letter-spacing: -0.025em; color: rgb(var(--pc)); text-wrap: balance; overflow-wrap: anywhere; text-shadow: 0 6px 34px rgba(var(--pc), calc(0.55 * var(--glow))); }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); }
.stat {
  --bevel: 8px;
  padding: var(--sp-3) 14px; text-align: left;
  background: var(--lip), var(--plate-sheen), var(--surface-2);
  box-shadow: var(--rim), var(--shade);
}
.stat b { display: block; font-family: var(--mono); font-size: var(--ph-2xl); color: var(--ink-title); font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { font-size: var(--ph-sm); color: var(--ink-2); }
.stat.first b { color: var(--gold); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- Game Center shell ---------- */

/* One of the two stages is on screen: the hub (join, lobby) or the current game's own screens. */
.app[hidden] { display: none; }
.game-root { flex: 1; min-width: 0; display: flex; flex-direction: column; }
body.drawer-open { overflow: hidden; }

/* The bar: what's on, who you are, and the host's crown. The game's name may take two lines but never loses a word
   (beside a long player name it read "HIGHER OR LOW..."), so your own name, which you know, gives up the room first. */
.mark { flex: 1 1 0; min-width: min-content; }
.mark span { white-space: normal; line-height: 1.15; text-wrap: balance; }
/* On the narrowest phones the logo gives its room to the names: "WAVELENGTH" left a three-letter name one letter. */
@media (max-width: 340px) { .mark-grid { display: none; } }
.bar-end { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; max-width: 76%; }
.bar-end .me { max-width: none; }
.host-btn {
  --bevel: 9px; --lip-a: 0.85;
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 13px 0 11px;
  font-weight: 700; font-size: var(--ph-sm); text-transform: var(--caps); letter-spacing: calc(0.04em * var(--track)); color: var(--on-gold);
  background: var(--lip), var(--gold-metal);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -2px 0 rgba(var(--gold-shade-rgb), 0.45);
  transition: transform 280ms var(--spring), filter 160ms var(--ease-out);
}
.host-btn .ico { font-size: var(--ph-md); }
.bar.tight .host-btn { padding: 0 11px; }
.bar.tight .host-btn span { display: none; }
.host-btn.claim { --lip-a: 0.35; color: var(--gold); background: var(--lip), rgba(var(--gold-rgb), 0.12); box-shadow: inset 0 -2px 0 rgba(var(--gold-rgb), 0.55); }
.host-btn:active { transform: translateY(1px) scale(0.96); transition-duration: 50ms, 160ms; }
.host-btn[hidden] { display: none; }

/* A clipped control would crop its own focus ring, so the ring takes the square while it is focused. */
.host-btn:focus-visible, .swatch:focus-visible, .ctl:focus-visible, .tile-edit:focus-visible { clip-path: none; }

.form .label { font-size: var(--ph-sm); font-weight: 600; color: var(--ink-2); margin-top: var(--sp-2); }

/* Color swatches: twelve lit chips, two rows. The one you hold carries a check; colors someone else holds are dimmed and struck through. */
.swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--sp-2); }
.swatch {
  --bevel: 9px; --lip-a: 0.55;
  aspect-ratio: 1; min-height: 44px; display: grid; place-items: center; font-size: var(--ph-xl); color: var(--obsidian);
  background: var(--lip), linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 55%), rgb(var(--pc));
  box-shadow: var(--shade);
  transition: transform 280ms var(--spring);
}
.swatch .ico { stroke-width: 3; }
.swatch:active:not(:disabled) { transform: scale(0.9); transition-duration: 50ms; }
.swatch[aria-checked="true"] { box-shadow: inset 0 0 0 3px var(--obsidian), inset 0 0 0 5px rgba(255, 255, 255, 0.92); }
.swatch:disabled {
  background:
    linear-gradient(to top right, transparent calc(50% - 2px), var(--obsidian) calc(50% - 2px), var(--obsidian) calc(50% + 2px), transparent calc(50% + 2px)),
    linear-gradient(rgba(var(--obsidian-rgb), 0.6), rgba(var(--obsidian-rgb), 0.6)), rgb(var(--pc));
  box-shadow: none;
}

/* Your tile in the Game Center: the edit corner sits on the plate itself. */
.tile-sub { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--ph-base); font-weight: 600; color: var(--pc-lite); }
.tile-sub .ico { color: var(--gold); }
.tile-edit {
  --bevel: 8px;
  position: absolute; top: 10px; right: 10px; width: 48px; height: 48px; display: grid; place-items: center; font-size: var(--ph-lg); color: var(--ink);
  background: rgba(var(--obsidian-rgb), 0.4);
  clip-path: polygon(var(--bevel) 0, 100% 0, 100% calc(100% - var(--bevel)), calc(100% - var(--bevel)) 100%, 0 100%, 0 var(--bevel));
}
.tile:has(.tile-edit) .tile-name { padding-right: 44px; }
/* The host's plate as one line: swatch, name, crown and the edit corner, so the shelf below starts high. */
.tile.strip {
  --bevel: 10px;
  flex-direction: row; align-items: center; gap: var(--sp-3); min-height: 56px; padding: var(--sp-1) var(--sp-1) var(--sp-1) var(--sp-4);
}
.tile.strip::after { height: 3px; }
.tile.strip .tile-name { flex: 1; min-width: 0; padding-right: 0; font-size: var(--ph-lg); line-height: 1.1; text-shadow: 0 2px 16px rgba(var(--pc), calc(0.65 * var(--glow))); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.strip .tile-sub { flex: none; font-size: var(--ph-sm); text-transform: var(--caps); letter-spacing: calc(0.04em * var(--track)); }
.tile.strip .tile-edit { position: static; flex: none; }

.h2-count { color: var(--ink-3); font-family: var(--mono); font-weight: 700; margin-left: var(--sp-2); }
.row-tag.host { color: var(--gold); }
/* A game lobby's seats without a phone, folded into one quiet line under the rows of the phones that are here. */
.away-line { margin: 0; padding: 0 var(--sp-1); font-size: var(--ph-sm); color: var(--ink-3); line-height: 1.4; text-wrap: pretty; overflow-wrap: anywhere; }

/* Game plates: the cover, the name, whether enough phones are here, the rules and a play chip. The whole plate is the
   target, so the chip is a quiet cyan socket that lights when pressed: gold stays for the one big button on a screen.
   Plates stay about 72px tall so five or more fit on a phone under the host's strip. The rules and the chip take
   columns of their own only when they are there. */
.game-plate {
  --bevel: 12px;
  position: relative;
  display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-auto-flow: column; grid-auto-columns: auto; align-items: center; gap: 10px;
  width: 100%; min-height: 72px; padding: var(--sp-2) 6px var(--sp-2) var(--sp-3); text-align: left;
  background:
    var(--lip),
    radial-gradient(100% 160% at 0% 50%, rgba(var(--cyan-rgb), 0.24), transparent 72%),
    var(--plate-sheen),
    var(--surface-4);
  box-shadow: var(--rim), inset 0 -2px 0 rgba(var(--cyan-rgb), 0.55);
  transition: transform 280ms var(--spring), filter 160ms var(--ease-out);
}
.game-plate:not(.off):has(.plate-go:active) { transform: translateY(2px) scale(0.975); transition-duration: 50ms, 160ms; transition-timing-function: ease-out; }
.game-plate:not(.off):has(.plate-go:active) .play-chip { color: var(--on-cyan); background: var(--lip), var(--cyan-metal); }
.game-plate.off .plate-go { cursor: not-allowed; }
.game-plate.off .play-chip { color: var(--ink-3); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.55); }
/* The play button covers the whole plate; only the rules button sits above it. */
.plate-go { display: flex; flex-direction: column; gap: 2px; min-width: 0; text-align: left; }
.plate-go::after { content: ''; position: absolute; inset: 0; }
.plate-go:focus-visible { outline: none; }
.game-plate:has(.plate-go:focus-visible) { clip-path: none; outline: 3px solid var(--cyan); outline-offset: 3px; }
.plate-rules {
  position: relative; z-index: 1;
  width: 40px; height: 48px; display: grid; place-items: center; color: var(--cyan);
}
.plate-rules .ico { font-size: var(--ph-xl); }
.plate-rules:active { color: var(--ink); }
.plate-rules:focus-visible { outline-offset: -3px; }
.game-thumb { --bevel: 7px; display: block; aspect-ratio: 642 / 342; overflow: hidden; background: var(--surface-sunk); }
.game-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* A capture (GC.shelfArt) fills the picture to its edges, so the look's inner edge on .game-thumb is drawn again on top
   of it rather than hidden under it. */
.game-thumb:has(> img.shot) { position: relative; }
.game-thumb:has(> img.shot)::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inherit; pointer-events: none; }
.game-thumb .art-mark { display: grid; place-items: center; height: 100%; font-size: var(--ph-2xl); font-weight: 700; color: var(--cyan); }
.game-plate .game-thumb .art-mark { font-size: var(--ph-lg); }
.game-title { font-weight: 700; font-size: var(--ph-md); color: var(--ink-title); text-transform: var(--caps); line-height: 1.05; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.game-fit { font-size: var(--ph-sm); font-weight: 600; color: var(--cyan); }
.game-fit.warn { color: var(--ink-3); }
/* On the narrowest phones "Needs 4 phones, 2 here" would wrap and make its plate taller than the rest. */
@media (max-width: 389px) { .game-fit { font-size: var(--ph-xs); } }
.play-chip {
  --bevel: 10px; --lip-a: 0.3;
  width: 34px; height: 34px; display: grid; place-items: center; font-size: var(--ph-base); color: var(--cyan);
  background: var(--lip), var(--surface-sunk);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(var(--cyan-rgb), 0.35);
}

/* Waiting on the host: their crown and their name in their own color. */
.wait {
  --bevel: 14px; --pc: var(--gold-rgb);
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-5);
  background:
    var(--lip),
    radial-gradient(110% 140% at 0% 0%, rgba(var(--pc), 0.22), transparent 70%),
    var(--plate-sheen),
    var(--surface-3);
  box-shadow: var(--rim), inset 0 -2px 0 rgba(var(--pc), 0.5);
}
.wait > .ico { font-size: var(--ph-2xl); color: var(--gold); }
.wait-line { margin: 0; font-size: var(--ph-xl); font-weight: 700; color: var(--ink-title); text-transform: var(--caps); line-height: 1.08; text-wrap: balance; overflow-wrap: anywhere; }
.wait .note { text-align: left; }
.wait .btn { margin-top: var(--sp-2); }

/* Host drawer: a sheet that rises over the phone. Everything that changes the room for everyone lives here. */
.drawer { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; }
.drawer[hidden] { display: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(var(--obsidian-rgb), 0.74); animation: fade-in 200ms var(--ease-out); }
.drawer-sheet {
  --bevel: 18px; --lip-a: 0.45;
  position: relative; width: 100%; max-width: 540px; margin: 0 auto; max-height: 90vh; max-height: 90dvh;
  overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom));
  background:
    var(--lip),
    radial-gradient(120% 50% at 50% 0%, rgba(var(--gold-rgb), 0.16), transparent 70%),
    linear-gradient(180deg, var(--surface-3), var(--surface-0) 46%);
  box-shadow: var(--rim-hi);
  animation: sheet-up 320ms var(--ease-out);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.drawer-head h2 { display: inline-flex; align-items: center; gap: var(--sp-2); margin: 0; font-size: var(--ph-lg); font-weight: 700; color: var(--ink-title); }
.drawer-head h2 .ico { color: var(--gold); font-size: var(--ph-lg); }
.icon-btn { width: 48px; height: 48px; display: grid; place-items: center; font-size: var(--ph-lg); color: var(--ink-2); }
.drawer h3 { margin: var(--sp-2) 0 0; font-size: var(--ph-base); font-weight: 700; text-transform: var(--caps); letter-spacing: calc(0.05em * var(--track)); color: var(--ink-title); }

.now { display: flex; flex-direction: column; gap: 2px; }
.now-name { margin: 0; font-size: var(--ph-h1); color: var(--ink-title); font-weight: 700; text-transform: var(--caps); line-height: 1; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.now-status { margin: 0; font-size: var(--ph-base); font-weight: 600; color: var(--cyan); }
.now-status.warn { color: var(--lemon); }

/* The controls: big two-up plates, each saying what it does. Ones that undo the room arm first and turn red. */
.ctl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.ctl {
  --bevel: 12px; --lip-a: 0.35; --tone: var(--cyan-rgb);
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-1); min-width: 0; min-height: 96px; padding: 14px; text-align: left;
  background: var(--lip), linear-gradient(180deg, rgba(var(--tone), 0.16), rgba(var(--tone), 0.04)), var(--plate-sheen), var(--surface-3);
  box-shadow: var(--rim), inset 0 -2px 0 rgba(var(--tone), 0.55);
  transition: transform 280ms var(--spring), filter 160ms var(--ease-out);
}
.ctl:active:not(:disabled) { transform: translateY(2px) scale(0.97); transition-duration: 50ms, 160ms; }
.ctl .ico { font-size: var(--ph-xl); color: rgb(var(--tone)); margin-bottom: 2px; }
.ctl b { font-size: var(--ph-md); color: var(--ink-title); font-weight: 700; text-transform: var(--caps); line-height: 1.08; overflow-wrap: anywhere; }
.ctl span { font-size: var(--ph-sm); font-weight: 500; color: var(--ink-2); line-height: 1.3; }
.ctl.hold { --tone: var(--lemon-rgb); }
.ctl.go { --tone: var(--green-rgb); }
.ctl.wide { grid-column: 1 / -1; min-height: 0; }
.ctl.armed { --tone: 255, 255, 255; background: var(--lip), var(--red); box-shadow: var(--rim-hi); }
.ctl.armed span { color: var(--red-pale); }

/* Music on the TV: one switch with three stops, the lit one in cyan. */
.seg {
  --bevel: 10px; --lip-a: 0.3;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-1); padding: var(--sp-1);
  background: var(--lip), var(--surface-sunk);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(var(--cyan-rgb), 0.2);
}
.seg button {
  min-height: 48px; font-size: var(--ph-base); font-weight: 700; text-transform: var(--caps); letter-spacing: calc(0.04em * var(--track)); color: var(--ink-2);
  transition: color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
.seg button[aria-checked='true'] { color: var(--obsidian); background: var(--cyan); }
.seg button:focus-visible { outline-offset: -3px; }
/* Five looks share one row, so their names drop the shout to fit a narrow phone. */
.seg.looks { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.seg.looks button { padding: 0 2px; font-size: var(--ph-sm); text-transform: none; letter-spacing: 0; }
/* Narrator voice picker: columns scale to the configured voices, keeping natural voice names. */
.seg.voices { grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); }
.seg.voices button { text-transform: none; letter-spacing: 0; }
.seg button:disabled { opacity: 0.42; cursor: not-allowed; }

/* Profiles in the host drawer: a newer profile with an older one's name points at it in gold, a profile's tools open
   under its row, and Merge's two choices show the two names and the two drawings side by side. */
.row-tag.same { color: var(--gold); white-space: nowrap; }
.prof-tools { padding: var(--sp-3); }
.prof-tools .ctl-grid, .prof-tools .list { filter: none; }
.merge-pick button { text-transform: none; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 var(--sp-2); }
.merge-pick .avatar { width: 36px; height: 36px; vertical-align: middle; }

/* Closing runs the opening backwards and quicker: the sheet drops away and the shade lifts. Taps already reach the page. */
.drawer.closing { pointer-events: none; }
.drawer.closing .drawer-scrim { animation: fade-out 220ms ease-in forwards; }
.drawer.closing .drawer-sheet { animation: sheet-down 240ms cubic-bezier(0.5, 0, 0.75, 0) forwards; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }

/* How to play: the TV's pages on every seated phone. A full sheet over the game; the host's page-turner rides the
   bottom edge under the thumb, and everyone else gets a line saying who turns them. */
.howto {
  position: fixed; inset: 0; z-index: 19;
  overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 14px) max(16px, calc((100% - 508px) / 2)) 0;
  background:
    radial-gradient(90% 28% at 50% 0%, rgba(var(--cyan-rgb), 0.17), transparent 72%),
    radial-gradient(120% 40% at 50% 0%, rgba(var(--stage-light-rgb), 0.4), transparent 72%),
    var(--obsidian);
  animation: fade-in 220ms var(--ease-out);
}
.howto[hidden] { display: none; }
.howto:focus, .howto:focus-visible { outline: none; }
.howto.closing { pointer-events: none; animation: fade-out 200ms ease-in forwards; }
body.howto-open { overflow: hidden; }

.howto-head { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3); }
.howto-thumb { width: 76px; }
.howto-kicker { margin: 0; display: flex; align-items: center; gap: 6px; font-size: var(--ph-sm); font-weight: 600; color: var(--cyan); }
.howto-name { margin: 2px 0 0; font-size: var(--ph-xl); color: var(--ink-title); font-weight: 700; text-transform: var(--caps); line-height: 1.05; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.howto-head .icon-btn { margin-right: -8px; }
.howto-goal { margin: var(--sp-3) 0 0; font-size: var(--ph-base); line-height: 1.4; color: var(--ink-2); text-wrap: pretty; }

/* The pages as tiles: cyan for the ones read, gold for this one, an outline for what's left. */
.howto-track { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.howto-tiles { display: flex; gap: 5px; }
.howto-tiles i { width: 14px; height: 14px; box-shadow: inset 0 0 0 2px rgba(var(--cyan-rgb), 0.32); }
.howto-tiles i.done { background: rgba(var(--cyan-rgb), 0.34); box-shadow: inset 0 0 0 2px rgba(var(--cyan-rgb), 0.8); }
.howto-tiles i.on { background: var(--gold); box-shadow: 0 0 10px rgba(var(--gold-rgb), calc(0.55 * var(--glow))); }
.howto-count { font-family: var(--mono); font-size: var(--ph-sm); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }

.howto-page { flex: 1; display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-5) 0 var(--sp-6); }
.howto-where { margin: 0; display: flex; align-items: center; gap: var(--sp-2); font-size: var(--ph-sm); font-weight: 600; color: var(--cyan); }
.howto-where .ico { font-size: 19px; }
.howto-body { font-size: var(--ph-md); color: var(--ink); }
.howto-items { margin: var(--sp-2) 0 0; display: flex; flex-direction: column; gap: var(--sp-4); }
.howto-item { position: relative; padding: 2px 0 2px 16px; }
.howto-item::before { content: ''; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px; background: rgb(var(--tone)); box-shadow: 0 0 10px rgba(var(--tone), calc(0.5 * var(--glow))); }
.howto-item dt { font-size: var(--ph-base); font-weight: 700; text-transform: var(--caps); line-height: 1.1; color: rgb(var(--tone)); }
.howto-item dd { margin: var(--sp-1) 0 0; font-size: var(--ph-sm); line-height: 1.35; color: var(--ink-2); }

.howto-dock {
  position: sticky; bottom: 0; z-index: 1;
  margin: 0 -16px; padding: 18px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(var(--obsidian-rgb), 0), rgba(var(--obsidian-rgb), 0.94) 34%, var(--obsidian));
}
.howto-nav { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); }
.howto-nav.two { grid-template-columns: 76px minmax(0, 1fr); }
.howto-dock .note { padding: 8px 0 4px; }

/* The title card while a game opens: its name lands like the TV's sting. */
.starting h1.hero { animation: slam 560ms var(--spring) both; }

/* The language switch: two stops, EN and ES. On the join form it sits small at the top right, out of the name's way. */
.seg.lang, .seg.duo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lang-row { display: flex; justify-content: flex-end; }
.lang-row .seg.lang { width: 9.5rem; }
.lang-row .seg.lang button { min-height: 40px; font-size: var(--ph-sm); }

/* ---------- doodle pad ---------- */

/* Draw yourself: three thumb strokes on a tile of your color, Undo and Clear beside it. The drawing is kept at 120 by
   120 (hub.js cleanDoodle) but shown bigger, so a thumb has room. touch-action stops the page scrolling under the pen. */
.doodle { display: flex; flex-direction: column; gap: var(--sp-2); }
.doodle-row { display: flex; align-items: center; gap: var(--sp-3); }
.doodle-pad { width: 168px; height: 168px; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; box-shadow: var(--rim), var(--shade); }
.doodle-pad.full { cursor: default; }
.doodle-tools { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.doodle-tools .btn { min-height: 48px; justify-content: flex-start; gap: 8px; }

/* ---------- the intro ---------- */

/* The host's Skip Intro (hub-phone.js renderIntroSkip), under the bar while a game's intro plays on the TV: one wide
   gold button above the game's lobby, in reach of the thumb that just launched it. */
.intro-skip { width: 100%; max-width: 540px; margin: 0 auto; padding: var(--sp-2) var(--sp-4) 0; animation: intro-skip-in 260ms var(--ease-out); }
.intro-skip[hidden] { display: none; }
.intro-skip .btn { width: 100%; min-height: 52px; gap: 8px; }
@keyframes intro-skip-in { from { opacity: 0; transform: translateY(-0.5em); } }
@media (prefers-reduced-motion: reduce) { .intro-skip { animation: none; } }

/* ---------- reactions and awards ---------- */

/* The reaction strip (hub-phone.js renderReacts) rides the foot of the phone during reveals, scoreboards and the
   finale: five big targets in the thumb zone. A game's own dock sits on top of it rather than under it. */
.reacts {
  position: sticky; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--sp-2);
  width: 100%; max-width: 540px; margin: 0 auto;
  padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(var(--obsidian-rgb), 0), rgba(var(--obsidian-rgb), 0.92) 30%, var(--obsidian));
}
.reacts[hidden] { display: none; }
body.reacting .app { padding-bottom: var(--sp-3); }
body.reacting .dock { bottom: calc(56px + 2 * var(--sp-3) + env(safe-area-inset-bottom)); padding-bottom: var(--sp-3); }
.react {
  display: grid; place-items: center; min-height: 56px; border: 0; border-radius: var(--radius);
  color: rgb(var(--me)); background: var(--surface-2); box-shadow: var(--rim);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.react .ico { width: 30px; height: 30px; }
.react:active { background: var(--surface-3); }
.react.pop { animation: react-pop 260ms var(--ease-out); }
@keyframes react-pop { 40% { transform: scale(1.18); background: rgba(var(--me), 0.3); } }
@media (prefers-reduced-motion: reduce) { .react.pop { animation: none; } }

/* The night's awards (hub-phone.js renderAward), at the top of the finale once the TV shows them: your own award
   large, in your color, then the three. */
.award-card {
  width: 100%; max-width: 540px; margin: 0 auto; padding: var(--sp-2) var(--sp-4) 0;
  display: flex; flex-direction: column; gap: var(--sp-3);
  animation: award-card-in 420ms var(--ease-out);
}
.award-card[hidden] { display: none; }
.aw-mine {
  padding: var(--sp-4); border-radius: var(--radius); text-align: center;
  background: linear-gradient(160deg, rgba(var(--pc, var(--gold-rgb)), 0.4), rgba(var(--pc, var(--gold-rgb)), 0.08) 70%), var(--surface-2);
  box-shadow: var(--rim), var(--lift-1);
}
.aw-kicker, .aw-head { margin: 0; font-size: var(--ph-xs); font-weight: 700; text-transform: var(--caps); letter-spacing: calc(0.14em * var(--track)); color: var(--ink-2); }
.aw-name { margin: var(--sp-1) 0 0; font-family: var(--display); font-size: var(--ph-h1); line-height: 1.05; color: var(--gold-text); text-transform: var(--caps); }
.aw-why { margin: var(--sp-2) 0 0; font-size: var(--ph-base); color: var(--ink); }
.aw-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.aw-list li { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-2); border-radius: var(--radius); background: var(--surface-1); box-shadow: var(--rim); }
.aw-list li.you { background: linear-gradient(90deg, rgba(var(--pc, var(--gold-rgb)), 0.24), rgba(var(--pc, var(--gold-rgb)), 0) 70%), var(--surface-1); }
.aw-list p { margin: 0; min-width: 0; display: flex; flex-direction: column; }
.aw-title { font-weight: 700; font-size: var(--ph-base); color: var(--gold-text); text-transform: var(--caps); }
.aw-player { font-weight: 700; font-size: var(--ph-sm); color: rgb(var(--pc, var(--gold-rgb))); }
.aw-line { font-size: var(--ph-sm); color: var(--ink-2); }
@keyframes award-card-in { from { opacity: 0; transform: translateY(-0.6em); } }
@media (prefers-reduced-motion: reduce) { .award-card { animation: none; } }

/* Level up! (hub-phone.js levelUp): your own card from the TV's beat, dropped over the top of whatever is on, until the
   TV's goes or you tap it away. */
.level-card {
  position: fixed; z-index: 25; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 56px);
  display: flex; justify-content: center; padding: 0 var(--sp-4); pointer-events: none;
}
.level-card[hidden] { display: none; }
.lv-card {
  pointer-events: auto; width: 100%; max-width: 420px; padding: var(--sp-4); border: 0; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); text-align: center; color: var(--ink); font: inherit;
  background: linear-gradient(160deg, rgba(var(--pc, var(--gold-rgb)), 0.42), rgba(var(--pc, var(--gold-rgb)), 0.1) 70%), var(--surface-2);
  box-shadow: var(--drop-1), var(--rim);
  animation: lv-in 480ms var(--ease-out) both;
}
.lv-head { display: flex; align-items: center; gap: 6px; margin: 0; font-family: var(--display); font-size: var(--ph-h1); line-height: 1.05; text-transform: var(--caps); color: var(--gold-text); }
.lv-head .ico { width: 0.9em; height: 0.9em; color: var(--gold); }
.lv-who { display: flex; align-items: center; gap: var(--sp-3); }
.lv-level { display: flex; flex-direction: column; align-items: flex-start; }
.lv-level b { font-family: var(--display); font-size: var(--ph-lg); color: var(--ink-title); text-transform: var(--caps); }
.lv-level span { font-size: var(--ph-base); font-weight: 700; color: var(--ink-2); }
.lv-badge { display: flex; align-items: center; gap: 6px; font-size: var(--ph-base); font-weight: 700; color: var(--gold-text); }
.lv-badge .ico { width: 1.2em; height: 1.2em; flex: none; color: var(--gold); }
@keyframes lv-in { from { opacity: 0; transform: translateY(-1em) scale(0.96); } }
@media (prefers-reduced-motion: reduce) { .lv-card { animation: none; } }
html.lite .lv-card { animation: none; }

/* ---------- getting back in ---------- */

/* A phone asking to be someone (hub-phone.js askScreen): their face and name, and the number big enough for the host
   to read from across the room, in the person's color. */
.ask-card {
  --bevel: 16px;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  padding: var(--sp-5) var(--sp-4);
  background: var(--lip), radial-gradient(90% 60% at 50% 0%, rgba(var(--pc), 0.32), transparent 72%), var(--plate-sheen), var(--surface-2);
  box-shadow: var(--rim), var(--shade);
}
.ask-card > .avatar { width: 96px; height: 96px; }
.ask-card .ask-name { margin: 0; font-size: var(--ph-lg); font-weight: 700; text-transform: var(--caps); color: var(--ink-title); overflow-wrap: anywhere; }
.ask-card .ask-num {
  margin: var(--sp-1) 0 0; font-family: var(--mono); font-size: clamp(96px, 34vw, 160px); font-weight: 800; line-height: 0.95;
  color: var(--gold-text); font-variant-numeric: tabular-nums; letter-spacing: calc(0.04em * var(--track));
}
.ask-show { margin: 0; font-size: var(--ph-md); font-weight: 700; color: var(--ink-title); }
.ask-sub { margin: 0; font-size: var(--ph-sm); color: var(--ink-2); }
.ask-left { margin: 0; font-size: var(--ph-sm); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ask-no { color: var(--red-soft); font-weight: 700; font-variant-numeric: tabular-nums; }

/* The host's request (hub-phone.js renderAsk): a card that slides up from the foot over the lobby or the game, with
   the same number, who it is and where the phone is, and No and OK under the thumb. No scrim: the game stays in view. */
.ask-card-host {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 0 var(--sp-3) calc(var(--sp-3) + env(safe-area-inset-bottom));
  pointer-events: none;
  filter: var(--lift-2); /* the clipped card can't cast its own shadow */
}
.ask-card-host[hidden] { display: none; }
.ask-host {
  --bevel: 16px; --lip-a: 0.45;
  pointer-events: auto;
  width: 100%; max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--lip), radial-gradient(100% 70% at 0% 0%, rgba(var(--pc), 0.3), transparent 70%), var(--plate-sheen), var(--surface-3);
  box-shadow: var(--rim-hi);
  animation: sheet-up 320ms var(--ease-out);
}
.ask-kicker { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin: 0; font-size: var(--ph-xs); font-weight: 700; text-transform: var(--caps); letter-spacing: calc(0.14em * var(--track)); color: var(--gold-text); }
.ask-more { color: var(--ink-2); letter-spacing: calc(0.06em * var(--track)); }
.ask-who { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3); }
.ask-who > .avatar { width: 64px; height: 64px; }
.ask-who p { margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ask-who .ask-name { font-size: var(--ph-lg); font-weight: 700; text-transform: var(--caps); color: var(--ink-title); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-where { display: inline-flex; align-items: center; gap: 6px; font-size: var(--ph-sm); font-weight: 600; color: var(--cyan); }
.ask-where.away { color: var(--lemon); }
.ask-where .ico { width: 1.1em; height: 1.1em; flex: none; }
.ask-who .ask-num { font-family: var(--mono); font-size: var(--ph-hero); font-weight: 800; line-height: 1; color: var(--gold-text); font-variant-numeric: tabular-nums; }
.ask-why { margin: 0; font-size: var(--ph-sm); color: var(--ink-2); }
.ask-btns { display: grid; grid-template-columns: 1fr 1.4fr; gap: var(--sp-2); }
.ask-btns .btn { min-height: 56px; }
@media (prefers-reduced-motion: reduce) { .ask-host { animation: none; } }

/* The Night Cup card in the lobby (hub-phone.js cupCard): your points tonight, your place, and who leads. */
.cup-card {
  --bevel: 10px;
  display: flex; flex-direction: column; gap: 4px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--lip), var(--plate-sheen), var(--surface-2);
  box-shadow: var(--rim), var(--shade);
}
.cup-kicker { display: flex; align-items: center; gap: var(--sp-2); margin: 0; font-size: var(--ph-xs); font-weight: 700; text-transform: var(--caps); letter-spacing: calc(0.14em * var(--track)); color: var(--gold-text); }
.cup-kicker .ico { width: 1.2em; height: 1.2em; color: var(--gold); }
.cup-mine { display: flex; align-items: baseline; gap: var(--sp-2); margin: 0; }
.cup-pts { font-family: var(--mono); font-size: var(--ph-2xl); font-weight: 800; line-height: 1; color: var(--ink-title); font-variant-numeric: tabular-nums; }
.cup-unit { font-size: var(--ph-sm); color: var(--ink-2); }
.cup-place { margin-left: auto; font-size: var(--ph-base); font-weight: 700; color: var(--ink-title); }
.cup-place.top { color: var(--gold-text); }
.cup-lead { margin: 0; font-size: var(--ph-sm); color: var(--ink-2); }

/* ---------- your profile (hub-phone.js meScreen) ---------- */

/* Your name on your plate and your doodle in the edit sheet open it: plain text that happens to be a button. */
.tile-me, .doodle-me { display: block; max-width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; text-align: left; text-shadow: inherit; overflow: inherit; text-overflow: inherit; white-space: inherit; cursor: pointer; }
.tile-me:active, .doodle-me:active { transform: translateY(1px); }
.me-screen { gap: var(--sp-3); }
.me-back { min-height: 44px; }
/* The level card: who, the level and title big, and the bar to the next level in your own color. */
.me-card {
  --pc: 160, 170, 190;
  --bevel: 14px;
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-4) var(--sp-5);
  background: var(--lip), radial-gradient(120% 120% at 50% -10%, rgba(var(--pc), 0.4), rgba(var(--pc), 0.08) 62%), var(--plate-sheen), var(--surface-2);
  box-shadow: var(--rim-hi), var(--shade);
}
.me-who { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.me-who > .avatar { width: 64px; height: 64px; }
.me-name { min-width: 0; font-size: var(--ph-xl); font-weight: 700; text-transform: var(--caps); color: var(--ink-title); overflow-wrap: anywhere; }
.me-level { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 var(--sp-3); margin: var(--sp-2) 0 0; }
.me-level b { font-size: var(--ph-h1); font-weight: 800; line-height: 1; text-transform: var(--caps); letter-spacing: -0.02em; color: var(--ink-title); }
.me-title { font-size: var(--ph-lg); font-weight: 700; text-transform: var(--caps); letter-spacing: calc(0.04em * var(--track)); color: var(--gold-text); }
.me-bar { height: 14px; border-radius: var(--radius); background: rgba(var(--obsidian-rgb), 0.55); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5); overflow: hidden; }
.me-bar i { display: block; height: 100%; min-width: 4px; background: rgb(var(--pc)); box-shadow: 0 0 14px rgba(var(--pc), calc(0.7 * var(--glow))); transition: width 600ms var(--ease-out); }
.me-next { margin: 0; font-size: var(--ph-sm); color: var(--ink-2); }
.me-best .row { grid-template-columns: minmax(0, 1fr) auto; }
.me-wins { font-family: var(--mono); font-size: var(--ph-md); font-weight: 800; color: var(--ink-title); font-variant-numeric: tabular-nums; }
/* Badges: the earned ones lit in gold with the day they came, the rest dim with how to get them. */
.row.badge { grid-template-columns: 32px minmax(0, 1fr); min-height: 56px; --pc: var(--gold-rgb); --wash: 0.3; }
.badge-ico { display: grid; place-items: center; font-size: var(--ph-lg); color: var(--gold); }
.badge-main { display: flex; flex-direction: column; min-width: 0; }
.badge-name { font-size: var(--ph-base); font-weight: 700; color: var(--ink-title); }
.badge-line { font-size: var(--ph-sm); color: var(--ink-2); }
.row.badge:not(.on) { --wash: 0; }
/* Only the name dims on a badge still to win: the line under it says how, so it stays full strength to read. */
.row.badge:not(.on) .badge-name { color: var(--ink-2); }
.row.badge:not(.on) .badge-ico { color: var(--ink-3); }
@media (prefers-reduced-motion: reduce) { .me-bar i { transition: none; } }

/* ---------- remote TV peek, PIN gate, and bot controls ---------- */

.tv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; flex: none;
  min-width: 44px; min-height: 40px; padding: 0 12px; border-radius: var(--radius);
  font-weight: 700; font-size: var(--ph-xs); text-transform: var(--caps); letter-spacing: calc(0.05em * var(--track));
  color: var(--cyan); background: var(--surface-3);
  box-shadow: var(--rim), inset 0 0 0 1px rgba(var(--cyan-rgb), 0.32);
}
.tv-btn[hidden] { display: none; }
.tv-btn[aria-expanded='true'] { background: var(--cyan-metal); color: var(--on-cyan); }
.tv-btn .ico { font-size: var(--ph-base); }

.tv-dock {
  width: 100%; max-width: 540px; margin: 0 auto;
  padding: var(--sp-2) var(--sp-4) 0;
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.tv-dock[hidden] { display: none; }
.tv-dock-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
}
.tv-dock-title {
  display: inline-flex; align-items: center; gap: 5px; margin: 0; white-space: nowrap; flex-shrink: 0;
  font-size: var(--ph-xs); font-weight: 700; text-transform: var(--caps); letter-spacing: calc(0.06em * var(--track));
  color: var(--cyan);
}
.tv-dock-actions { display: inline-flex; align-items: center; flex-wrap: nowrap; justify-content: flex-end; gap: 6px; min-width: 0; }
.tv-dock-link {
  display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 6px 10px; border-radius: var(--radius);
  font-size: var(--ph-xs); font-weight: 700; text-transform: var(--caps); letter-spacing: calc(0.03em * var(--track));
  white-space: nowrap;
  color: var(--ink); background: var(--surface-3); box-shadow: var(--rim); text-decoration: none;
  border: 0; cursor: pointer; touch-action: manipulation;
}
.tv-dock-sound[aria-pressed='true'] {
  color: var(--on-gold); background: var(--gold); box-shadow: var(--drop-1);
}
.tv-dock-sound[aria-pressed='false'] {
  color: var(--on-cyan); background: var(--cyan-metal); box-shadow: var(--rim);
}
.tv-dock-frame {
  position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius);
  background: var(--surface-sunk); box-shadow: var(--rim-hi), var(--lift-1);
}
.tv-dock-frame iframe { position: absolute; left: 0; top: 0; border: 0; display: block; transform-origin: 0 0; }
/* While typing on a phone with Live TV open, collapse the 16:9 video box without unmounting the iframe so TV audio
   keeps playing while the game's text field and submit buttons stay visible above the mobile keyboard. */
body.phone.tv-typing .tv-dock { padding-top: 2px; gap: 0; }
body.phone.tv-typing .tv-dock-frame {
  height: 0; aspect-ratio: auto; box-shadow: none; opacity: 0; pointer-events: none;
}

.watch-offer {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2); text-align: center;
  padding: var(--sp-2) var(--sp-3); font-size: var(--ph-sm); font-weight: 700;
  color: var(--cyan); text-decoration: none;
}
.watch-offer .ico { font-size: var(--ph-base); }

.pin-form { align-items: stretch; }
.pin-input { text-align: center; font-family: var(--mono); font-size: var(--ph-2xl); font-weight: 800; letter-spacing: calc(0.24em * var(--track)); }
.pin-err { margin: 0; font-size: var(--ph-sm); font-weight: 700; color: var(--red-soft); }

.row-tag.bot { color: var(--cyan); }
.game-bot-note { font-size: var(--ph-xs); font-weight: 600; color: var(--lemon); }
.seg.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.seg.five button { padding: 0 4px; font-size: var(--ph-sm); }
.remote-note { margin: 0; font-size: var(--ph-sm); color: var(--ink-2); line-height: 1.35; }
.remote-note.live { color: var(--cyan); font-weight: 700; }
.remote-url { width: 100%; min-height: 44px; padding: 8px 12px; font-family: var(--mono); font-size: var(--ph-xs); color: var(--ink); user-select: all; -webkit-user-select: all; }
