/* Host phone controller: "cut-and-paste gig zine" (see DESIGN.md).
   Tokens, fonts and kit classes come from /shared/theme.css.

   A remote control held in one hand in a dim room: ink canvas, paper slips
   for fields and labels, flat colour blocks for identity (category, player),
   Anton for numbers, calm Bricolage for everything you read. 48px+ targets.

   Surfaces set a small set of context variables (--fg, --field-bg, ...), so
   the same buttons and fields work on the ink canvas and on paper sheets. */

:root {
  --pad-l: max(16px, env(safe-area-inset-left));
  --pad-r: max(16px, env(safe-area-inset-right));
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --top-h: 60px;
  --dock-h: 0px;

  /* Torn top edge for paper that slides up (sheets, in-play dock). Fixed px
     heights so the tear looks the same however tall the paper is. */
  --torn-top: polygon(0 7px, 3% 3px, 7% 8px, 11% 2px, 15% 6px, 19% 1px, 23% 7px, 27% 3px, 31% 9px, 35% 4px, 39% 7px, 43% 1px, 47% 6px, 51% 3px, 55% 8px, 59% 2px, 63% 6px, 67% 3px, 71% 9px, 75% 4px, 79% 7px, 83% 2px, 87% 6px, 91% 3px, 95% 8px, 100% 4px, 100% 100%, 0 100%);
}

/* Ink context (default). */
:root, .ctx-ink, .music-row {
  --fg: var(--paper);
  --fg-dim: var(--paper-dim);
  --fg-mute: var(--paper-mute);
  --rule: rgba(246, 243, 236, 0.13);
  --raise: var(--ink-2);
  --raise-hi: var(--ink-3);
  --field-bg: var(--paper);
  --field-fg: var(--ink);
  --field-border: var(--paper);
  --field-ph: #6f6c73;
  --quiet-bg: var(--paper);
  --quiet-fg: var(--ink);
  --quiet-border: var(--paper);
  --ghost-fg: var(--paper);
  --ghost-border: rgba(246, 243, 236, 0.36);
  --danger-fg: #f07a86;
  --btn-shadow: 3px 4px 0 #000;
  --focus: var(--lemon);
  --press: var(--ink-3);
  --ok-fg: #a8ddcf;
}

/* Paper context: sheets, the in-play dock, slips with controls on them. */
.ctx-paper, .sheet, .dock, .resume, .all-played {
  --fg: var(--ink);
  --fg-dim: #56535b;
  --fg-mute: #7a7780;
  --rule: rgba(24, 24, 28, 0.15);
  --raise: var(--paper-2);
  --raise-hi: #d8d1c3;
  --field-bg: #fffdf8;
  --field-fg: var(--ink);
  --field-border: var(--ink);
  --field-ph: #77747c;
  --quiet-bg: transparent;
  --quiet-fg: var(--ink);
  --quiet-border: var(--ink);
  --ghost-fg: var(--ink);
  --ghost-border: rgba(24, 24, 28, 0.32);
  --danger-fg: #b02f3e;
  --btn-shadow: var(--stuck);
  --focus: var(--ink);
  --press: var(--paper-2);
  --ok-fg: #2c7a66;
  color: var(--fg);
}

html { background: var(--ink); }

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 17px;
  line-height: 1.4;
  color: var(--fg);
  background: var(--ink);
  overscroll-behavior-y: none;
}

body.has-sheet { overflow: hidden; }
/* A sheet or the in-play panel is up: the page behind stays put (ui.js lockScroll). */
html.scroll-locked, html.scroll-locked body { overflow: hidden; }
.dock-scrim, .sheet-backdrop { touch-action: none; }

h1, h2, h3, p { margin: 0; }

:focus-visible { outline-color: var(--focus); }

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

.noscript { padding: 24px; }

/* Screen gutters */
.library-body, .editor, .setup, .game, main.empty {
  max-width: 720px;
  margin: 0 auto;
  padding-left: var(--pad-l);
  padding-right: var(--pad-r);
  padding-bottom: calc(40px + var(--safe-b));
}

/* ------------------------------------------------------------------------ */
/* Icons and buttons                                                        */
/* ------------------------------------------------------------------------ */

.icon { display: inline-flex; flex: none; width: 24px; height: 24px; }
.icon svg { width: 100%; height: 100%; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: 2px solid transparent;
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: transform 0.1s var(--ease-out), box-shadow 0.1s var(--ease-out), background-color 0.15s;
}
.btn .icon { width: 20px; height: 20px; margin-left: -2px; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* Primary: a lemon block stuck down with a hard shadow; presses flat on tap. */
.btn-primary {
  background: var(--lemon);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: var(--btn-shadow);
}
.btn-primary:active:not([disabled]),
.btn-quiet:active:not([disabled]),
.btn-danger-solid:active:not([disabled]) {
  transform: translate(3px, 4px);
  box-shadow: 0 0 0 transparent;
}

/* Secondary: a paper slip on ink, an ink outline on paper. */
.btn-quiet {
  background: var(--quiet-bg);
  color: var(--quiet-fg);
  border-color: var(--quiet-border);
  box-shadow: var(--btn-shadow);
}

/* Tertiary: outline only. */
.btn-ghost {
  background: transparent;
  color: var(--ghost-fg);
  border: 1.5px solid var(--ghost-border);
}
.btn-ghost:active:not([disabled]) { background: var(--press); }

.btn-danger {
  background: transparent;
  color: var(--danger-fg);
  border: 2px solid currentColor;
}
.btn-danger:active:not([disabled]) { background: var(--press); }
.btn-danger-solid {
  background: var(--red);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: var(--btn-shadow);
}

.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 56px; font-size: 19px; }
.btn-sm { min-height: 48px; padding: 0 12px; font-size: 15px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  touch-action: manipulation;
}
.icon-btn:active:not([disabled]) { background: var(--press); }
.icon-btn[disabled] { opacity: 0.25; cursor: default; }
.icon-btn-quiet { color: var(--fg-dim); }

.stack { display: grid; gap: 12px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.center { text-align: center; }

a.btn { text-decoration: none; }

/* ------------------------------------------------------------------------ */
/* Vinyl mark (halftone record)                                             */
/* ------------------------------------------------------------------------ */

.vinyl {
  --size: 40px;
  position: relative;
  display: inline-block;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 34%, rgba(246, 243, 236, 0.1) 34.5% 35.5%, transparent 36% 52%, rgba(246, 243, 236, 0.08) 52.5% 53.5%, transparent 54%),
    radial-gradient(rgba(246, 243, 236, 0.14) 0.9px, transparent 1.3px) 0 0 / 4px 4px,
    var(--ink);
  box-shadow: 0 0 0 2px var(--paper);
}
.vinyl-label {
  position: absolute;
  inset: 32%;
  border-radius: 50%;
  background: var(--lemon);
}
.vinyl-label::after {
  content: '';
  position: absolute;
  inset: 40%;
  border-radius: 50%;
  background: var(--ink);
}
.vinyl-xs { --size: 28px; }
.vinyl-sm { --size: 48px; }
.vinyl-lg { --size: 132px; margin: 0 auto 8px; }
.vinyl.is-spinning { animation: spin 3.2s linear infinite; }
.vinyl.is-spinning .vinyl-label { background: conic-gradient(var(--red) 0 22%, var(--lemon) 22% 100%); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------------ */
/* Top bar                                                                  */
/* ------------------------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 25; /* above the in-play scrim and dock, so the pill and menu stay usable */
  background: var(--ink);
  border-bottom: 2px solid var(--ink-3);
  padding-top: var(--safe-t);
}
.topbar-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  max-width: 720px;
  min-height: var(--top-h);
  margin: 0 auto;
  padding: 0 calc(var(--pad-r) - 8px) 0 calc(var(--pad-l) - 8px);
}
.topbar-title {
  min-width: 0;
  font-family: var(--font-poster);
  font-size: 24px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-home .topbar-inner { padding-left: var(--pad-l); }
.topbar-home .topbar-right { margin-left: auto; }

.brand { display: flex; align-items: center; min-width: 0; padding: 6px 0; }
.brand .ransom { font-size: 21px; }
.brand .ransom-ch { padding: 0.08em 0.1em 0.03em; }

.save-state {
  padding: 2px 8px;
  margin-right: 8px;
  font-family: var(--font-type);
  font-size: 14px;
  background: var(--mint);
  color: var(--ink);
}
.save-state.is-pending { background: var(--paper-2); }
.save-state.is-error { background: var(--red); }

.game-titles { display: grid; justify-items: start; gap: 5px; line-height: 1.1; min-width: 0; max-width: 100%; }
.game-title {
  max-width: 100%;
  font-family: var(--font-poster);
  font-size: 21px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-sub {
  font-family: var(--font-type);
  font-size: 13px;
  text-transform: none;
  padding: 1px 6px;
  background: var(--paper);
  color: var(--ink);
}

/* ------------------------------------------------------------------------ */
/* Connection pill: a small block                                           */
/* ------------------------------------------------------------------------ */

.pill-btn {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 4px;
  border: 0;
  background: none;
  cursor: pointer;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 10px;
  border: 2px solid var(--fg-mute);
  border-radius: var(--r-block);
  background: transparent;
  color: var(--fg-dim);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.pill-dot { width: 8px; height: 8px; background: currentColor; flex: none; }
.pill.is-ok { background: var(--mint); border-color: var(--mint); color: var(--ink); }
.pill.is-warn { background: var(--lemon); border-color: var(--lemon); color: var(--ink); }
.pill.is-warn .pill-dot { animation: blink 1.4s ease-in-out infinite; }
.pill.is-off .pill-dot { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.pill-code {
  font-family: var(--font-poster);
  font-weight: 400;
  font-size: 15px;
  letter-spacing: 0.1em;
  line-height: 1;
}

@keyframes blink { 50% { opacity: 0.3; } }

/* Narrow phones: the colour plus the code is enough in the top bar. */
@media (max-width: 380px) {
  .topbar .pill:has(.pill-code) .pill-text { display: none; }
}

/* ------------------------------------------------------------------------ */
/* Type                                                                     */
/* ------------------------------------------------------------------------ */

.screen-title {
  font-family: var(--font-poster);
  font-weight: 400;
  font-size: 36px;
  line-height: 0.95;
  text-transform: uppercase;
  letter-spacing: 0.005em;
  overflow-wrap: anywhere;
}

.section { padding: 26px 0; border-top: 2px dashed var(--rule); }
.section-first { border-top: 0; padding-top: 22px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-title {
  font-family: var(--font-poster);
  font-weight: 400;
  font-size: 28px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.section-count {
  font-family: var(--font-type);
  font-size: 14px;
  color: var(--fg-dim);
  text-align: right;
}
.section-hint { font-size: 15px; color: var(--fg-dim); margin: -4px 0 14px; }

/* Answer-field switches: set apart from the explanation below them. */
.answer-settings {
  margin-bottom: 16px;
  padding: 4px 14px;
  background: var(--ink-2);
  border-left: 6px solid var(--lemon);
}

/* ------------------------------------------------------------------------ */
/* Form controls                                                            */
/* ------------------------------------------------------------------------ */

/* Labels are typed slips. */
.field-label {
  display: inline-block;
  margin-bottom: 10px;
  padding: 2px 8px;
  font-family: var(--font-type);
  font-size: 15px;
  background: var(--paper);
  color: var(--ink);
  transform: rotate(-1deg);
}

/* Inputs are paper slips with ink text. */
.input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid var(--field-border);
  border-radius: var(--r-ctl);
  background: var(--field-bg);
  color: var(--field-fg);
  font-family: var(--font-ui);
  font-size: 17px; /* 16px+ stops iOS zooming in */
  line-height: 1.3;
  transition: box-shadow 0.12s, border-color 0.12s;
}
.input::placeholder { color: var(--field-ph); opacity: 1; }
.input:focus { outline: none; box-shadow: 0 0 0 3px var(--lemon); }
.ctx-paper .input:focus, .sheet .input:focus, .dock .input:focus { box-shadow: 3px 4px 0 var(--ink); }
.input[disabled] { opacity: 0.55; }
.input-lg { min-height: 56px; font-size: 20px; font-weight: 650; }
.textarea { resize: vertical; min-height: 76px; }
.field-error { color: var(--danger-fg); font-size: 15px; font-weight: 650; margin-top: 6px; }
.field-error:empty { display: none; }

/* Switch: a square-cut slider, mint when on. */
.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 8px 0;
  cursor: pointer;
}
.switch-text { display: grid; gap: 2px; }
.switch-label { font-weight: 700; }
.switch-hint { font-size: 14px; color: var(--fg-dim); }
.switch input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 56px;
  height: 32px;
  margin: 0;
  border: 2px solid var(--fg-dim);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.switch input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  background: var(--fg-dim);
  transition: transform 0.18s var(--ease-out), background-color 0.15s;
}
.switch input:checked { background: var(--mint); border-color: var(--fg); }
.switch input:checked::after { transform: translateX(24px); background: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }

/* Swatch (player colour) */
.swatch {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 30px;
  border-radius: var(--r-block);
  background: var(--c, transparent);
  box-shadow: 0 0 0 1.5px var(--ink);
}
.swatch.is-empty { box-shadow: inset 0 0 0 2px var(--fg-mute); }
.swatch-lg { width: 20px; height: 44px; }

/* Small typed tag ("Double"). */
.tag {
  flex: none;
  padding: 1px 6px;
  border-radius: var(--r-block);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-type);
  font-size: 13px;
}

/* ------------------------------------------------------------------------ */
/* Toasts: typed slips                                                      */
/* ------------------------------------------------------------------------ */

#toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(16px + var(--safe-b) + var(--dock-h));
  z-index: 60;
  display: flex;
  justify-content: center;
  padding: 0 var(--pad-r) 0 var(--pad-l);
  pointer-events: none;
}
body.has-sheet #toasts { bottom: calc(16px + var(--safe-b)); }
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  min-height: 56px;
  padding: 4px 4px 4px 14px;
  border: 2px solid var(--ink);
  border-left: 10px solid var(--ink);
  border-radius: var(--r-block);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-type);
  font-size: 16px;
  pointer-events: auto;
  box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.55);
  animation: rise 0.22s var(--ease-out);
}
.toast-msg { flex: 1; min-width: 0; padding: 8px 0; }
.toast.is-danger { border-left-color: var(--red); }
.toast.is-ok { border-left-color: var(--mint); }
.toast-action {
  flex: none;
  min-width: 72px;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-ctl);
  background: var(--ink);
  color: var(--lemon);
  font-family: var(--font-ui);
  font-weight: 800;
  cursor: pointer;
}

@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ------------------------------------------------------------------------ */
/* Sheets: paper with a torn top                                            */
/* ------------------------------------------------------------------------ */

.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 12, 0.82);
  animation: fade 0.18s ease-out;
}
.sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 20px - var(--safe-t));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px var(--pad-r) calc(24px + var(--safe-b)) var(--pad-l);
  background: var(--paper);
  clip-path: var(--torn-top);
  animation: rise 0.24s var(--ease-out);
}
.sheet:focus { outline: none; }
.sheet-head {
  position: sticky;
  top: -10px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 -8px 4px 0;
  padding: 16px 0 8px;
  background: var(--paper);
}
.sheet-title {
  font-family: var(--font-poster);
  font-weight: 400;
  font-size: 28px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}
.sheet-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.sheet-text { color: var(--fg-dim); font-size: 16px; }
.sheet-subtitle {
  justify-self: start;
  margin-top: 12px;
  padding: 2px 8px;
  font-family: var(--font-type);
  font-weight: 400;
  font-size: 16px;
  background: var(--ink);
  color: var(--paper);
}
.sheet-subtitle.first { margin-top: 0; }
.sheet-foot { padding-top: 12px; border-top: 2px dashed var(--rule); margin-top: 4px; }

@media (min-width: 600px) {
  .sheet-wrap { align-items: center; }
  .sheet { max-height: min(720px, calc(100dvh - 48px)); }
}

/* Menu items (list in sheets) */
.menu-list { display: grid; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 60px;
  padding: 10px 6px;
  border: 0;
  border-top: 1.5px dashed var(--rule);
  background: none;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}
.menu-item:first-child { border-top: 0; }
.menu-item:active { background: var(--press); }
.menu-item .icon { color: var(--fg-dim); }
.menu-item-text { display: grid; gap: 2px; }
.menu-item-label { font-weight: 700; }
.menu-item-hint { font-size: 14px; color: var(--fg-dim); }
.menu-item.is-danger, .menu-item.is-danger .icon { color: var(--danger-fg); }

/* ------------------------------------------------------------------------ */
/* Library                                                                  */
/* ------------------------------------------------------------------------ */

.library-body { padding-top: 18px; display: grid; gap: 18px; }

.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
}

/* "The TV is ready" notice: a typed slip. */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-block);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-type);
  font-size: 16px;
  box-shadow: var(--btn-shadow);
  border-left: 8px solid var(--mint);
}
.notice .icon { color: var(--ink); margin-top: 1px; }
.code-inline {
  display: inline-block;
  padding: 0 5px;
  font-family: var(--font-poster);
  font-size: 1.15em;
  letter-spacing: 0.1em;
  line-height: 1.2;
  background: var(--lemon);
  color: var(--ink);
}

/* Game in progress: a paper scrap with a spinning record. */
.resume {
  display: grid;
  gap: 14px;
  padding: 18px 16px 16px;
  border-radius: var(--r-block);
  background: var(--paper);
  box-shadow: 4px 5px 0 var(--lemon);
}
.resume-text { display: flex; align-items: center; gap: 14px; min-width: 0; }
.resume-kicker {
  justify-self: start;
  display: inline-block;
  padding: 1px 6px;
  font-family: var(--font-type);
  font-size: 14px;
  background: var(--ink);
  color: var(--paper);
}
.resume-title {
  margin-top: 4px;
  font-family: var(--font-poster);
  font-size: 26px;
  line-height: 1;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.resume-meta { margin-top: 2px; font-family: var(--font-type); font-size: 15px; color: var(--fg-dim); }

/* Quizzes: colour-blocked scraps. --c / --c-ink are set per row. */
.quiz-list { list-style: none; margin: 0; padding: 6px 0 0; display: grid; gap: 22px; }
.quiz-row {
  display: grid;
  gap: 14px;
  padding: 20px 16px 16px;
  border-radius: var(--r-block);
  background-color: var(--c, var(--pink));
  color: var(--c-ink, var(--ink));
  --fg: var(--c-ink, var(--ink));
  --press: rgba(0, 0, 0, 0.14);
  --btn-shadow: var(--stuck);
}
.quiz-row.taped::before { left: 22%; }
.quiz-row:nth-child(even).taped::before { left: 78%; transform: translateX(-50%) rotate(5deg); }
.quiz-row-text { display: grid; gap: 8px; min-width: 0; position: relative; z-index: 2; }
.quiz-name {
  font-family: var(--font-poster);
  font-weight: 400;
  font-size: 32px;
  line-height: 0.95;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.quiz-players { justify-self: start; }
.quiz-players .typestrip { font-size: 14px; background: var(--ink); color: var(--paper); }
.quiz-players { transform: rotate(-1.5deg); transform-origin: left; }

.quiz-cats { font-size: 15px; overflow-wrap: anywhere; }
.quiz-cats .typestrip { line-height: 1.9; }
.quiz-cats.is-empty .typestrip { color: #5e5b63; font-style: italic; }
.quiz-actions { display: flex; gap: 10px; position: relative; z-index: 2; }
.quiz-actions .btn { border-color: var(--ink); }
.quiz-actions .btn-quiet { background: var(--paper); color: var(--ink); }
.quiz-play { flex: 1; }
.quiz-row .icon-btn { color: var(--c-ink, var(--ink)); }

.library-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 12px;
  padding-top: 6px;
}

/* Empty states */
.empty { display: grid; gap: 14px; text-align: center; padding-top: 28px; max-width: 420px; margin: 0 auto; width: 100%; }
main.empty { padding-top: 64px; }
.empty-title {
  font-family: var(--font-poster);
  font-weight: 400;
  font-size: 40px;
  line-height: 0.95;
  text-transform: uppercase;
}
.empty-text { color: var(--fg-dim); margin-bottom: 8px; }
.empty-art {
  position: relative;
  justify-self: center;
  display: grid;
  place-items: center;
  width: min(62vw, 230px);
  aspect-ratio: 1;
  margin: 8px 0 10px;
  background-color: var(--pink);
  transform: rotate(-3deg);
  box-shadow: 5px 6px 0 var(--violet);
}
.empty-art .zs { display: grid; place-items: center; width: 82%; aspect-ratio: 1; transform: rotate(5deg); }
.empty-art .zs svg, .empty-art .zs img { width: 100%; height: 100%; object-fit: contain; }
.empty-art .zs.is-drawn svg { filter: drop-shadow(3px 0 0 #fff) drop-shadow(-3px 0 0 #fff) drop-shadow(0 3px 0 #fff) drop-shadow(0 -3px 0 #fff) drop-shadow(4px 6px 0 rgba(0, 0, 0, 0.3)); }

/* ------------------------------------------------------------------------ */
/* Editor                                                                   */
/* ------------------------------------------------------------------------ */

.player-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.player-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 48px 48px;
  align-items: center;
  gap: 6px;
}
.player-row .swatch { margin-right: 4px; }
.add-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding-left: 24px; }

/* Category tabs: the number is always a block of the column colour; the
   chosen tab is filled with it. --c / --c-ink are set per tab. */
.tabs {
  display: flex;
  gap: 8px;
  margin: 0 calc(-1 * var(--pad-r)) 0 calc(-1 * var(--pad-l));
  padding: 4px var(--pad-r) 12px var(--pad-l);
  overflow-x: auto;
  scrollbar-width: none;
  scroll-padding: 0 var(--pad-l);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  max-width: 180px;
  min-height: 48px;
  padding: 0 14px 0 8px;
  border: 2px solid var(--ink-3);
  border-radius: var(--r-ctl);
  background: var(--ink-2);
  color: var(--paper-dim);
  font-weight: 700;
  cursor: pointer;
}
.tab-num {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: var(--r-block);
  background: var(--c, var(--paper));
  color: var(--c-ink, var(--ink));
  font-family: var(--font-poster);
  font-size: 16px;
  font-weight: 400;
}
.tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-name.is-empty { font-style: italic; font-weight: 500; }
.tab[aria-selected='true'] {
  background: var(--c, var(--paper));
  border-color: var(--ink);
  color: var(--c-ink, var(--ink));
  box-shadow: 3px 4px 0 #000;
}
.tab[aria-selected='true'] .tab-num { background: var(--ink); color: var(--paper); }

.cat-panel {
  padding: 16px 0 0;
  border-top: 6px solid var(--cat, var(--paper));
}
.card-list { list-style: none; margin: 16px 0 0; padding: 0; }
.card-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  padding: 16px 0;
  border-top: 1.5px dashed var(--rule);
}
/* Points in Anton on a block of the category colour. */
.card-pts {
  align-self: start;
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 0 2px;
  border-radius: var(--r-block);
  background: var(--cat, var(--lemon));
  color: var(--cat-ink, var(--ink));
  font-family: var(--font-poster);
  font-size: 24px;
  line-height: 1;
}
.card-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }

/* Bonus on a card: a typed slip, with a red burst once it has one. */
.bonus-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  max-width: 100%;
  min-height: 48px;
  padding: 0 14px 0 10px;
  border: 1.5px dashed var(--ghost-border);
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--fg-dim);
  font-family: var(--font-type);
  font-size: 15px;
  cursor: pointer;
}
.bonus-chip .icon { width: 18px; height: 18px; }
.bonus-chip.has-bonus {
  padding-left: 4px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 3px 4px 0 #000;
}
.bonus-chip-emoji {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  font-size: 17px;
  line-height: 1;
}
.bonus-chip-emoji.burst { background: var(--red); }
.bonus-chip-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cat-nav { display: flex; justify-content: space-between; gap: 10px; padding-top: 8px; }

.bonus-tools { display: grid; gap: 14px; }
.bonus-summary { color: var(--fg-dim); }

.editor-foot { padding-top: 8px; }

/* Bonus picker */
.preset-list { display: grid; gap: 8px; }
.preset {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 8px 12px 8px 8px;
  border: 2px solid var(--ink);
  border-radius: var(--r-ctl);
  background: #fffdf8;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.preset:active { background: var(--paper-2); }
.preset[aria-pressed='true'] { background: var(--lemon); box-shadow: var(--stuck); }
.preset-emoji {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  font-size: 22px;
  line-height: 1;
  background: var(--red);
  clip-path: var(--burst);
}
.preset-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.preset-title { font-weight: 800; }
.preset-desc { font-size: 14px; color: var(--fg-dim); }
.preset[aria-pressed='true'] .preset-desc { color: var(--ink); }

.custom-bonus { display: grid; gap: 8px; }
.custom-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; }
.emoji-input { text-align: center; font-size: 22px; padding: 6px; }

/* Scatter */
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--ink);
  font-weight: 650;
  cursor: pointer;
}
.chip[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.stepper-label { display: grid; gap: 2px; }
.stepper-controls { display: flex; align-items: center; gap: 6px; }
.stepper-btn { width: 52px; padding: 0; font-size: 24px; }
.stepper-value { min-width: 40px; text-align: center; font-family: var(--font-poster); font-size: 30px; line-height: 1; }

/* ------------------------------------------------------------------------ */
/* Setup                                                                    */
/* ------------------------------------------------------------------------ */

.setup { padding-bottom: calc(160px + var(--safe-b)); }
.setup-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0;
}
.setup-head .btn { flex: none; }

.problems {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--r-block);
  border-left: 8px solid var(--red);
  background: var(--paper);
  color: var(--ink);
  --fg: var(--ink);
  --quiet-bg: transparent; --quiet-fg: var(--ink); --quiet-border: var(--ink);
  --btn-shadow: var(--stuck);
}
.problems-title { font-family: var(--font-type); font-size: 17px; }
.problems ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.problems .btn { justify-self: start; margin-top: 4px; }

.connect { display: grid; gap: 12px; }
.connect-status { display: grid; justify-items: start; gap: 8px; }
.connect-hint { color: var(--fg-dim); font-size: 15px; }
.code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
/* The TV code: a big Anton slip. */
.code-input {
  min-height: 72px;
  padding: 4px 8px 4px calc(8px + 0.3em);
  font-family: var(--font-poster);
  font-size: 40px;
  line-height: 1;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
}
.code-input::placeholder { color: #cbc5b8; }
.connect-btn { min-height: 72px; min-width: 112px; }

.start-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  padding: 14px var(--pad-r) calc(12px + var(--safe-b)) var(--pad-l);
  background: var(--ink);
  border-top: 2px solid var(--ink-3);
}
.start-bar-inner { display: grid; gap: 8px; max-width: 720px; margin: 0 auto; }
.start-hint { font-family: var(--font-type); font-size: 14px; color: var(--fg-dim); text-align: center; }

/* ------------------------------------------------------------------------ */
/* Game control                                                             */
/* ------------------------------------------------------------------------ */

.game { padding-top: 14px; padding-bottom: calc(32px + var(--safe-b) + var(--dock-h)); display: grid; gap: 16px; }

/* Board mirror: the TV poster in miniature. Columns in the category colours
   (--c / --c-ink per cell), ink gutters, Anton points. */
.board {
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
  gap: 4px;
}
.board-cat {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  align-self: end;
  overflow: hidden;
  margin-bottom: 2px;
  padding: 0 2px 5px;
  border-bottom: 5px solid var(--c, var(--paper));
  font-family: var(--font-type);
  font-size: 12px;
  line-height: 1.15;
  text-align: center;
  color: var(--paper);
  overflow-wrap: anywhere;
  hyphens: auto;
}
.tile {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 54px;
  padding: 0;
  border: 0;
  border-radius: var(--r-block);
  background: var(--c, var(--paper));
  color: var(--c-ink, var(--ink));
  font-family: var(--font-poster);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s var(--ease-out), opacity 0.2s;
}
.tile.is-open { background-image: var(--dots); background-size: var(--dots-size); }
.tile:active:not([disabled]) { transform: scale(0.94); }
.tile[disabled] { cursor: default; }
/* In play: lifted off the page, ink and paper rings. */
.tile.is-active {
  z-index: 2;
  transform: rotate(-4deg) scale(1.06);
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--paper), 5px 7px 0 6px #000;
  animation: nudge 1.8s ease-in-out infinite;
}
/* Played: a paper scrap, with the winner's colour as a mark. */
.tile.is-done {
  background: var(--paper-2);
  color: rgba(24, 24, 28, 0.5);
}
.tile.is-done .tile-pts { font-size: 15px; }
.tile.is-done::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  height: 8px;
  background: var(--winner, transparent);
  box-shadow: 0 0 0 1.5px var(--ink);
  transform: rotate(-2deg);
}
.tile.is-done.is-nobody {
  background: transparent;
  color: var(--paper-mute);
  box-shadow: inset 0 0 0 1.5px var(--ink-3);
}
.tile.is-done.is-nobody::after { display: none; }
.tile.is-done.is-nobody .tile-pts { text-decoration: line-through 2px; }
.board.is-locked .tile.is-open { opacity: 0.35; }
.tile-bonus {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 15px;
  height: 15px;
  background: var(--red);
  clip-path: var(--burst);
}
.tile.is-open .tile-bonus, .tile.is-active .tile-bonus { box-shadow: none; }
.tile.is-done .tile-bonus { background: var(--ink); opacity: 0.45; }

@keyframes nudge { 50% { transform: rotate(-2deg) scale(1.06); } }

.all-played {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: var(--r-block);
  background: var(--paper);
  box-shadow: 4px 5px 0 var(--lemon);
}
.all-played-text { font-family: var(--font-type); font-size: 19px; }

.undo-row { display: flex; align-items: center; gap: 12px; }
.undo-row .btn { flex: none; }
.undo-what { font-family: var(--font-type); font-size: 14px; color: var(--fg-dim); min-width: 0; overflow-wrap: anywhere; }

/* Scores: one colour block per player (--c / --c-ink per row). */
.scores { padding-bottom: 0; }
.score-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.score-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 0 16px 0 10px;
  border: 0;
  border-radius: var(--r-block);
  background: var(--c, var(--paper));
  color: var(--c-ink, var(--ink));
  text-align: left;
  cursor: pointer;
  transition: transform 0.1s var(--ease-out);
}
.score-row:active { transform: scale(0.98); }
.score-row .swatch { display: none; }
.score-rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-block);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-poster);
  font-size: 18px;
  line-height: 1;
}
.score-name { font-weight: 800; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-pts { font-family: var(--font-poster); font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; }

/* Final: a mini podium list. */
.final { display: grid; gap: 14px; padding-top: 10px; }
.final-list { margin-top: 6px; gap: 8px; }
.final-list li { position: relative; }
.final-row { min-height: 60px; }
.final-list li:nth-child(1) .final-row { min-height: 88px; box-shadow: 5px 6px 0 var(--paper); }
.final-list li:nth-child(2) .final-row { min-height: 72px; width: 94%; }
.final-list li:nth-child(3) .final-row { min-height: 66px; width: 88%; }
.final-list li:nth-child(n+4) .final-row { width: 82%; }
.final-list li:first-child .score-name { font-size: 23px; }
.final-list li:first-child .score-pts { font-size: 44px; }
.final-list li:first-child .final-row { grid-template-columns: 38px minmax(0, 1fr) auto; }
.final-list li:first-child .score-rank { width: 38px; height: 38px; font-size: 24px; }
.final-crown {
  position: absolute;
  top: -20px;
  left: -6px;
  z-index: 2;
  width: 46px;
  transform: rotate(-16deg);
  pointer-events: none;
}
.final-crown svg { display: block; width: 100%; height: auto; filter: drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff) drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff); }

/* In-play dock: a paper sheet sliding up with a torn top. */
.dock-scrim {
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(10, 10, 12, 0.7);
  animation: fade 0.2s ease-out;
}
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 19;
  max-height: calc(100dvh - var(--safe-t) - var(--top-h) - 12px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px var(--pad-r) calc(16px + var(--safe-b)) var(--pad-l);
  background: var(--paper);
  clip-path: var(--torn-top);
  animation: rise 0.24s var(--ease-out);
}
.dock-inner { display: grid; gap: 14px; max-width: 720px; margin: 0 auto; }

/* Category and points on a block of the category colour (--cat / --cat-ink). */
.dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-block);
  background-color: var(--cat, var(--lemon));
  background-image: var(--dots);
  background-size: var(--dots-size);
  color: var(--cat-ink, var(--ink));
}
.dock-head-text { display: grid; justify-items: start; gap: 6px; min-width: 0; }
.dock-cat {
  font-family: var(--font-poster);
  font-weight: 400;
  font-size: 30px;
  line-height: 0.95;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.dock-note {
  padding: 1px 6px;
  font-family: var(--font-type);
  font-size: 14px;
  background: var(--paper);
  color: var(--ink);
}
.dock-pts { font-family: var(--font-poster); font-size: 52px; line-height: 0.9; }
.dock.is-resolved .dock-pts { display: none; }

/* Bonus: a red block with a starburst. */
.bonus-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px 14px 10px;
  border-radius: var(--r-block);
  background: var(--red);
  color: var(--ink);
}
.bonus-emoji {
  display: grid;
  place-items: center;
  flex: none;
  width: 58px;
  height: 58px;
  font-size: 26px;
  line-height: 1;
  background: var(--lemon);
  clip-path: var(--burst);
  transform: rotate(-8deg);
}
.bonus-box > div { display: grid; justify-items: start; gap: 4px; min-width: 0; }
.bonus-label {
  padding: 1px 6px;
  font-family: var(--font-type);
  font-size: 13px;
  background: var(--ink);
  color: var(--paper);
}
.bonus-title { font-family: var(--font-poster); font-size: 26px; line-height: 1; text-transform: uppercase; }
.bonus-text { font-size: 16px; line-height: 1.3; padding: 3px 6px; background: var(--paper); color: var(--ink); }

/* Answer: typed slips. */
.answer { display: grid; justify-items: start; gap: 4px; padding: 2px 0; }
.answer-label { font-family: var(--font-type); font-size: 13px; padding: 1px 6px; background: var(--ink); color: var(--paper); }
.answer-title,
.answer-artist {
  max-width: 100%;
  padding: 2px 8px;
  border: 1.5px solid var(--ink);
  background: #fffdf8;
  font-family: var(--font-type);
  overflow-wrap: anywhere;
}
.answer-title { font-size: 21px; line-height: 1.25; transform: rotate(-0.6deg); }
.answer-artist { font-size: 16px; }
.answer.is-empty { display: block; font-family: var(--font-type); font-size: 15px; color: var(--fg-dim); }

.dock-label { font-family: var(--font-poster); font-size: 22px; line-height: 1; text-transform: uppercase; margin-bottom: -4px; }
.award-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
/* Award: a big block in the player's colour (--c), text in inkOn(colour) (--c-ink). */
.award-btn {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 76px;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  border-radius: var(--r-ctl);
  background: var(--c);
  color: var(--c-ink, var(--ink));
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: var(--stuck);
  transition: transform 0.1s var(--ease-out), box-shadow 0.1s var(--ease-out);
}
.award-btn:active { transform: translate(3px, 4px); box-shadow: 0 0 0 transparent; }
.award-name { font-family: var(--font-poster); font-size: 25px; line-height: 1; overflow-wrap: anywhere; }
.award-pts { font-family: var(--font-type); font-size: 14px; }
.award-grid:has(> :only-child) { grid-template-columns: 1fr; }

.dock-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.dock-hint { font-family: var(--font-type); font-size: 14px; color: var(--fg-dim); text-align: center; margin-top: -4px; }

/* Result: the winner's colour block (--c / --c-ink when someone got it). */
.result {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--r-block);
  background: var(--c, var(--paper-2));
  color: var(--c-ink, var(--ink));
}
.result .swatch { display: none; }
.result-text { flex: 1; font-family: var(--font-poster); font-size: 28px; line-height: 1; text-transform: uppercase; overflow-wrap: anywhere; }
.result-pts { font-family: var(--font-poster); font-size: 40px; line-height: 0.9; }

/* Player sheet */
.score-adjust { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.score-adjust .btn { font-size: 20px; font-variant-numeric: tabular-nums; }
.big-score {
  min-width: 96px;
  text-align: center;
  font-family: var(--font-poster);
  font-size: 46px;
  line-height: 1;
}

/* Tablet and up: give the board more room */
@media (min-width: 600px) {
  .tile { min-height: 72px; font-size: 28px; }
  .board-cat { font-size: 14px; }
  .award-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------------------ */
/* Spotify                                                                  */
/* ------------------------------------------------------------------------ */

/* Editor: link field on a card */
.sp-field { position: relative; display: grid; gap: 4px; }
.sp-field-icon {
  position: absolute;
  left: 14px;
  top: 14px;
  color: var(--field-ph);
  pointer-events: none;
}
.sp-field-icon .icon { width: 18px; height: 18px; }
.sp-input { padding-left: 42px; }
.sp-input.is-busy { opacity: 0.6; }
.sp-error:empty { display: none; }

/* Linked song: the cover as a small taped photo on an ink scrap. */
.sp-linked {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  grid-template-areas: 'cover text remove' 'cover start start';
  align-items: center;
  gap: 6px 12px;
  padding: 12px 4px 10px 10px;
  border-radius: var(--r-block);
  background: var(--ink-2);
  border: 1.5px solid var(--ink-3);
}
.cover-wrap {
  display: block;
  flex: none;
  width: 46px;
  height: 46px;
  background: #fff;
  padding: 3px;
  transform: rotate(-3deg);
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.4);
}
.cover-wrap.taped::before { width: 30px; height: 11px; top: -6px; }
.sp-cover, .music-cover {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--ink-3);
  color: var(--paper-dim);
}
.sp-cover .icon, .music-cover .icon { width: 20px; height: 20px; }
.sp-linked .cover-wrap { grid-area: cover; }
.sp-linked-text { grid-area: text; display: grid; min-width: 0; }
.sp-linked-title { font-size: 15px; font-weight: 800; color: var(--ok-fg); text-decoration: underline; text-underline-offset: 3px; }
.sp-linked-album {
  font-family: var(--font-type);
  font-size: 13px;
  color: var(--paper-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-start { grid-area: start; display: flex; align-items: center; gap: 8px; white-space: nowrap; font-family: var(--font-type); font-size: 14px; color: var(--paper-dim); }
.start-input { width: 64px; min-height: 40px; padding: 4px 6px; font-size: 16px; text-align: center; }
.sp-remove { grid-area: remove; width: 48px; height: 48px; color: var(--paper-dim); }

/* Game: playback row in the in-play dock (an ink cassette label on the paper). */
.music-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  gap: 10px 14px;
  padding: 14px 12px 12px 12px;
  border-radius: var(--r-block);
  background: var(--ink);
  color: var(--paper);
  border-left: 6px solid var(--mint);
}
.music-row.has-error { border-left-color: var(--red); }
.music-row .cover-wrap { width: 48px; height: 48px; }
.music-text { display: grid; gap: 1px; min-width: 0; }
.music-status { font-size: 15px; font-weight: 750; line-height: 1.25; overflow-wrap: anywhere; }
.music-row.has-error .music-status { color: var(--danger-fg); font-weight: 650; font-size: 14px; }
.music-sub { font-family: var(--font-type); font-size: 13px; color: var(--paper-dim); }
.music-link { color: var(--ok-fg); justify-self: start; text-underline-offset: 3px; }
button.music-link { padding: 0; border: 0; background: none; text-align: left; text-decoration: underline; cursor: pointer; }
.music-actions, .music-open { grid-column: 2; justify-self: start; }
.music-actions { display: flex; gap: 8px; align-items: center; }
.music-btn { min-height: 48px; padding: 0 16px; }
.music-icon { min-height: 48px; min-width: 48px; padding: 0; }
.music-open { min-height: 48px; padding: 0 12px; font-size: 15px; }

/* Settings sheet */
.spotify-sheet { display: grid; gap: 12px; }
.sheet-row { align-items: center; margin-top: 8px; margin-bottom: 0; }
.sheet-row .sheet-subtitle { margin-top: 0; }
.device.is-selected { background: var(--paper-2); box-shadow: inset 6px 0 0 var(--mint); padding-left: 14px; }
.device.is-selected .menu-item-label { font-weight: 800; }
.device.is-selected .icon { color: var(--ink); }
.topbar-spotify { min-height: 40px; padding: 0 12px; font-size: 15px; }

/* ------------------------------------------------------------------------ */
/* Drag to reorder                                                          */
/* ------------------------------------------------------------------------ */

.card-song {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
  border-radius: var(--r-block);
}

/* Handle: a little grip slip. */
.drag-handle {
  display: grid;
  align-self: stretch;
  flex: none;
  place-items: center;
  width: 34px;
  min-height: 48px;
  margin: 0;
  padding: 0;
  border: 1.5px dashed var(--ink-3);
  border-radius: var(--r-block);
  background: var(--ink-2);
  color: var(--paper-dim);
  cursor: grab;
  touch-action: none; /* the handle drags; the rest of the page still scrolls */
  -webkit-user-select: none;
  user-select: none;
}
.drag-handle svg { width: 22px; height: 22px; }
.drag-handle:active { cursor: grabbing; color: var(--ink); background: var(--lemon); border-color: var(--ink); }

/* Lifted while dragging; the others glide out of the way. */
.is-dragging {
  position: relative;
  z-index: 5;
  background: var(--ink-3);
  box-shadow: 0 0 0 2px var(--lemon), 6px 10px 0 rgba(0, 0, 0, 0.6);
  transition: box-shadow 0.15s;
}
.is-dragging .drag-handle { color: var(--ink); background: var(--lemon); border-color: var(--ink); }
.is-shifting { transition: transform 0.18s var(--ease-out); }
body.is-sorting { -webkit-user-select: none; user-select: none; cursor: grabbing; }

.drag-hint { margin: 12px 0 0; font-size: 14px; }
.section-action { min-height: 40px; padding: 0 12px; font-size: 15px; align-self: center; }

/* Reorder categories sheet: each row a block of its column colour (--c / --c-ink). */
.reorder-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.reorder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 4px 14px 4px 6px;
  border: 2px solid var(--ink);
  border-radius: var(--r-block);
  background: var(--c, var(--paper-2));
  color: var(--c-ink, var(--ink));
}
.reorder-item .drag-handle { background: rgba(255, 255, 255, 0.28); border-color: currentColor; color: inherit; }
.reorder-item .drag-handle:active, .reorder-item.is-dragging .drag-handle { background: var(--ink); color: var(--paper); }
.reorder-item.is-dragging { background: var(--c, var(--paper-2)); box-shadow: var(--lifted); }
.reorder-name { min-width: 0; font-family: var(--font-poster); font-size: 22px; line-height: 1.1; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reorder-name.is-empty { font-family: var(--font-type); text-transform: none; font-size: 17px; font-style: italic; }
.reorder-item .tab-num { background: var(--ink); color: var(--paper); }

/* ------------------------------------------------------------------------ */
/* Reduced motion: no spinning, no nudging, no tilting on tap.              */
/* ------------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .vinyl.is-spinning, .tile.is-active, .pill.is-warn .pill-dot { animation: none; }
  .btn:active, .award-btn:active, .tile:active, .score-row:active { transform: none !important; }
}
