/* Music quiz. One stylesheet for the operator console and the audience screen.
   Look: a Saturday-night gameshow. Midnight blue stage, marquee bulbs, gold for questions, teal for answers.
   No remote fonts or images: this has to work with no internet. The two fonts (Anton for titles, Outfit
   for everything else) are files in the project's fonts folder, free to use under the Open Font License.
   If they ever fail to load, titles fall back to Impact, which every Mac and Windows PC already has. */

@font-face { font-family: "Anton"; src: url("../fonts/anton-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Outfit"; src: url("../fonts/outfit-variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --night: #07061c;
  --night-2: #15133a;
  --night-3: #2b2866;
  --cream: #fff6e0;
  --cream-dim: #c9c4f2;
  --marigold: #ffc83d;
  --gold-deep: #ffb81c;
  --coral: #e0352b;
  --coral-text: #ff8a80;   /* red that stays readable as small text on the dark stage */
  --teal: #5ee6d6;
  --line: rgba(255, 246, 224, 0.18);
  --display: "Anton", Impact, "Haettenschweiler", "Arial Narrow Bold", "Franklin Gothic Bold", sans-serif;
  --body: "Outfit", "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--night);
  color: var(--cream);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
}
[hidden] { display: none !important; }
kbd {
  font: inherit; font-size: 0.8em; padding: 0.05em 0.45em; border-radius: 5px;
  border: 1px solid currentColor; opacity: 0.8;
}
code { background: var(--night-3); padding: 0.1em 0.4em; border-radius: 5px; font-size: 0.9em; }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }

/* ---------- Operator console ---------- */

.bar {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--night-2);
}
.brand { display: flex; align-items: center; gap: 0.9rem; }
.brand-disc {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  background:
    radial-gradient(circle, var(--night) 0 9%, var(--marigold) 10% 34%, transparent 35%),
    repeating-radial-gradient(circle, #050510 0 2px, #1b1a33 2px 4px);
  box-shadow: 0 0 0 2px var(--marigold);
}
.bar h1 { font-family: var(--display); font-weight: 400; font-size: 1.7rem; margin: 0; line-height: 1.2; letter-spacing: 0.04em; text-transform: uppercase; }
.sub { margin: 0; color: var(--cream-dim); font-size: 0.9rem; }
.host-line { margin: 0; color: var(--marigold); font-weight: 700; font-size: 0.9rem; letter-spacing: 0.2em; text-transform: uppercase; }
.host-line:empty { display: none; }
.demo-note { color: var(--teal); font-weight: 600; }
.demo-note[hidden] { display: none; }
.bar-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--cream);
  background: var(--night-3); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.6rem 1rem; min-height: 46px;
}
.btn:hover { border-color: var(--marigold); }
.btn:disabled { opacity: 0.45; cursor: default; border-color: var(--line); }
.btn-quiet { background: transparent; }
.btn-stop { background: #3a0f14; color: var(--cream); border: 2px solid var(--coral-text); font-size: 1.05rem; padding-inline: 1.3rem; }
.btn-stop:hover { border-color: var(--cream); }
label.btn:focus-within { outline: 3px solid var(--marigold); outline-offset: 2px; }

.tabs { display: flex; gap: 0.4rem; margin: 1.1rem 1.25rem 0; padding: 0.35rem; width: fit-content; max-width: calc(100% - 2.5rem); border-radius: 14px; background: var(--night-2); overflow-x: auto; }
.tabs button {
  font: inherit; font-weight: 700; font-size: 1.05rem; letter-spacing: 0.05em; color: var(--cream); cursor: pointer;
  background: transparent; border: 0; border-radius: 10px; min-height: 48px; padding: 0 1.6rem; white-space: nowrap;
}
.tabs button[aria-selected="true"] { background: var(--marigold); color: #1a1033; }
.tabs #tab-a[aria-selected="true"] { background: var(--teal); color: #06202b; }
.badge:not(:empty) {
  display: inline-block; white-space: nowrap; margin-left: 0.4rem; padding: 0 0.5rem; border-radius: 999px;
  background: var(--coral); color: var(--cream); font-size: 0.8rem;
}

.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 30vw); gap: 1.25rem; padding: 1.25rem; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .side { order: -1; position: static; max-height: none; overflow: visible; } }
.side { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 0.6rem; max-height: calc(100vh - 4rem); overflow-y: auto; }
.side > * { flex: none; margin: 0; }
.side > .help { font-size: 0.82rem; line-height: 1.35; }
.switches { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.6rem; }   /* side by side when there are two and room for both */
.switches .switch { gap: 0.5rem; padding-inline: 0.7rem; font-size: 0.9rem; line-height: 1.15; text-align: left; }
.side > .preview-wrap { flex: 0 1 auto; min-height: 120px; }   /* the preview gives up height first when the window is short */   /* never taller than the window: everything in it can be reached, clear of the pinned footer */
.btn-welcome { width: 100%; }
/* A percentage bar: how much of the music is ready */
.meter { position: relative; height: 30px; border-radius: 999px; overflow: hidden; background: var(--night); border: 1px solid var(--line); }
.meter-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--marigold), var(--teal)); opacity: 0.55; transition: width 0.4s ease; }
.meter[data-full="1"] .meter-fill { background: var(--teal); opacity: 0.4; }
.meter-text { position: relative; display: grid; place-items: center; height: 100%; font-size: 0.85rem; font-weight: 700; color: var(--cream); letter-spacing: 0.03em; }
.card .meter { margin: 0.8rem 0 0; }
.meter-gap { margin-top: 0.7rem; }
.meter-gap .meter-fill { transition: width 0.22s linear; }
@media (max-width: 900px) { .side { position: static; max-height: none; overflow: visible; } }
.help a { color: var(--marigold); }
.help { color: var(--cream-dim); font-size: 0.92rem; margin: 0 0 0.8rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

/* The 40 buttons */
.pads { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 1.1rem; }
.pad {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; padding: 0.4rem; cursor: pointer;
  font: inherit; color: var(--cream);
  background: linear-gradient(180deg, #2b2478, #1a1650); border: 2px solid var(--marigold); border-radius: 16px;
  box-shadow: inset 0 2px 0 rgba(255, 246, 224, 0.16);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
/* Fitted to the window (console.js, fitConsole): the buttons share out the height that is left */
.pads.fit { gap: 11px; }
.pads.fit .pad { aspect-ratio: auto; height: var(--pad-h, 104px); }
.pads.fit .pad .num { font-size: min(2.9rem, calc(var(--pad-h, 104px) * 0.4)); }
.pads.fit .pad .flag { bottom: min(0.45rem, calc(var(--pad-h, 104px) * 0.05)); font-size: 0.62rem; }
.pad:hover { border-color: var(--cream); transform: translateY(-2px); }
/* Questions: on hover the number dissolves to the song's artwork, title and artist, and back again on leaving.
   One slow fade each way, never repeating (see the flashing rule at the top). */
.pad .peek {
  position: absolute; inset: 0; border-radius: 14px; overflow: hidden; pointer-events: none;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; padding: 0.3rem 0.25rem; text-align: center;
  background: #14123a center / cover no-repeat;
  opacity: 0; transition: opacity 0.45s ease;
}
.pad .peek::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7, 6, 28, 0.05) 30%, rgba(7, 6, 28, 0.88) 78%); }
.pad .peek b, .pad .peek i { position: relative; font-style: normal; color: var(--cream); line-height: 1.15; overflow: hidden; text-shadow: 0 1px 2px #000; }
.pad .peek b { font-size: 0.66rem; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pad .peek i { font-size: 0.6rem; color: var(--marigold); white-space: nowrap; text-overflow: ellipsis; }
.pad:hover .peek, .pad:focus-visible .peek { opacity: 1; }
.pad:active { transform: scale(0.96); }
.pad .num { font-family: var(--display); font-size: 2.9rem; line-height: 1.1; color: var(--cream); }
.pads[data-kind="a"] .pad { background: linear-gradient(180deg, #0f4a63, #0b2c4a); border-color: var(--teal); }
.pads[data-kind="a"] .pad:hover { border-color: var(--cream); }
.pad .meta { display: none; }
.pad .flag { position: absolute; left: 0; right: 0; bottom: 0.45rem; text-align: center; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.pad[data-music="no"] .flag::after { content: "no music"; color: var(--coral-text); }
.pad[data-played="1"], .pads[data-kind="a"] .pad[data-played="1"] { background: #0e0d2b; border-color: var(--night-3); box-shadow: none; }
.pad[data-played="1"] .num { color: #8f8bc4; }
.pad[data-played="1"][data-music="yes"] .flag::after { content: "played"; color: #8f8bc4; }
.pad[data-active="1"], .pads[data-kind="a"] .pad[data-active="1"] {
  border-color: transparent; background: var(--coral);
  box-shadow: 0 0 0 4px rgba(224, 53, 43, 0.4);
  animation: pulse 1s ease-in-out infinite alternate;
}
/* The outline of the square on air is a progress ring: it starts at the top, travels clockwise,
   and closes as the song ends (--ring-p). Its colour drifts gold to teal like the pills (--ring-c). */
.pad[data-active="1"]::before {
  content: ""; position: absolute; inset: -4px; border-radius: 19px; padding: 5px; pointer-events: none;
  background: conic-gradient(from 0deg, var(--ring-c, var(--marigold)) var(--ring-p, 0%), rgba(255, 246, 224, 0.28) var(--ring-p, 0%));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.pad[data-active="1"] .num { color: var(--cream); }
.pad[data-active="1"] .flag::after { content: "on air" !important; color: var(--cream) !important; }
@keyframes pulse { to { box-shadow: 0 0 0 9px rgba(224, 53, 43, 0.14); } }

.btn-next {
  justify-content: center; font-family: var(--display); font-weight: 400; font-size: 1.7rem; letter-spacing: 0.08em; text-transform: uppercase;
  min-height: 66px; border-radius: 16px;
  background: var(--marigold); color: #1a1033; border-color: transparent; box-shadow: 0 6px 0 #b8860b;
}
.btn-next:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #b8860b; }
.btn-next:disabled { box-shadow: none; }
.btn-next:hover { border-color: var(--cream); }
.btn-next:disabled { background: var(--night-3); color: var(--cream-dim); }
.tracks .hiddenname { color: var(--cream-dim); font-style: normal; letter-spacing: 0.08em; }

/* Now playing */
.preview-wrap { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; }
.preview-wrap > div { width: 100%; height: 100%; }
.now { background: var(--night-2); border: 1px solid var(--line); border-radius: 14px; padding: 0.7rem 1rem; }
.now-title { font-family: var(--display); font-size: 1.6rem; letter-spacing: 0.05em; text-transform: uppercase; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4rem; padding: 0; margin: 0.6rem 0 0; }
/* Each pill is its own mute button. Hover (or tab to it) and its name gives way to what a click will do:
   "Mute", or "Turn on" when it is already muted. */
.steps li { position: relative; cursor: pointer; user-select: none; }
.steps li::after { content: attr(data-hover); position: absolute; inset: 0; display: none; place-items: center; font-weight: 700; color: var(--cream); }
.steps li {
  text-align: center; white-space: nowrap; overflow: hidden;
  padding: 0.25rem 0.3rem; border-radius: 999px; border: 1px solid var(--line);
  color: var(--cream-dim); font-size: 0.88rem; font-weight: 600;
}
/* Each pill fills from the left as its part of the sequence plays (--p), in a colour that drifts gold to teal (--c) */
.steps li { background: linear-gradient(to right, color-mix(in srgb, var(--c, var(--marigold)) 55%, transparent) var(--p, 0%), transparent var(--p, 0%)); }
.steps li.on { color: var(--cream); border-color: var(--c, var(--marigold)); }
.steps li.skip { opacity: 0.35; text-decoration: line-through; }   /* not used this time, e.g. no voice when the host reads the answer */
.steps li.was { color: var(--cream); border-color: color-mix(in srgb, var(--c, var(--cream-dim)) 60%, transparent); }
.steps li:hover, .steps li:focus-visible { opacity: 1; text-decoration: none; border-color: var(--marigold); }
.steps li:hover .lbl, .steps li:focus-visible .lbl { visibility: hidden; }
.steps li:hover::after, .steps li:focus-visible::after { display: grid; }
.steps li:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }
.now-note { margin: 0.6rem 0 0; color: var(--coral-text); font-weight: 600; font-size: 0.92rem; }
.now-note:empty { display: none; }

/* Settings */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0.9rem; }
.stack { display: grid; gap: 0.9rem; align-content: start; }
.card { background: var(--night-2); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem; }
.card h2, .table-title { font-family: var(--display); font-weight: 400; font-size: 1.35rem; letter-spacing: 0.05em; text-transform: uppercase; margin: 0 0 0.5rem; }
.table-title { margin-top: 1.5rem; }
.card h3 { font-size: 1rem; margin: 0.9rem 0 0.5rem; color: var(--marigold); }
.card p { margin: 0 0 0.8rem; color: var(--cream-dim); font-size: 0.95rem; }
.summary { margin-top: 0.8rem !important; color: var(--cream) !important; font-weight: 600; }
.problems { margin: 0; padding-left: 1.1rem; color: var(--coral-text); font-size: 0.92rem; }
.problems:empty { display: none; }
/* A part of the sequence is muted: said plainly above the number buttons, so it cannot be missed on the night */
.warn { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0 0 0.7rem; padding: 0.5rem 0.8rem; border-radius: 12px;
  background: #3a0f14; border: 2px solid var(--coral-text); color: var(--cream); font-weight: 700; }
.warn[hidden] { display: none; }
.warn .btn { min-height: 36px; padding: 0.2rem 0.8rem; margin-left: auto; }
/* Settings: the Ready check */
.ready { margin-bottom: 0.9rem; }
.ready .summary { margin: 0 0 0.5rem !important; }
.ready-list { list-style: none; margin: 0 0 0.8rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 0.3rem 1.2rem; font-size: 0.95rem; }
.ready-list li { display: flex; gap: 0.5rem; color: var(--cream); }
.ready-list li[data-ok="no"] { color: var(--coral-text); font-weight: 600; }
.ready-list li[data-ok="info"] { color: var(--cream-dim); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-bottom: 0.9rem; }
.fields .pct { color: var(--cream); font-weight: 700; margin-left: 0.3rem; }   /* the slider's value, as a percentage */
.fields label { display: grid; gap: 0.3rem; font-size: 0.9rem; color: var(--cream-dim); }
input[type="number"] {
  font: inherit; color: var(--cream); background: var(--night); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.45rem 0.6rem; width: 100%; min-height: 42px;
}
input[type="range"] { accent-color: var(--marigold); width: 100%; min-height: 42px; }
.check { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.9rem; font-size: 0.95rem; }
.check input { width: 22px; height: 22px; accent-color: var(--marigold); }

.table-wrap { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 14px; }
input[type="text"] {
  font: inherit; color: var(--cream); background: var(--night); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.45rem 0.6rem; width: 100%; min-height: 42px;
}
.more { border-top: 1px solid var(--line); padding: 0.55rem 0 0; margin-top: 0.55rem; }
.more summary, .songs > summary { cursor: pointer; font-weight: 600; color: var(--cream); }
.more p { margin: 0.5rem 0 0.6rem; }
.sfx-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.sfx-row b { width: 5.5rem; color: var(--marigold); }
.sfx-row .btn { min-height: 38px; padding: 0.3rem 0.7rem; font-size: 0.88rem; }
.sfx-row .summary { margin: 0 !important; font-weight: 400; color: var(--cream-dim) !important; font-size: 0.88rem; }
.songs { margin-top: 0.9rem; background: var(--night-2); border: 1px solid var(--line); border-radius: 14px; padding: 0.8rem 1.1rem; }
.songs > summary { font-family: var(--display); font-weight: 400; font-size: 1.35rem; letter-spacing: 0.05em; text-transform: uppercase; }
.songs[open] > summary { margin-bottom: 0.8rem; }
.songs .help { margin: 0.7rem 0 0; }
/* Auto-play mode: a switch. Knob left and grey is off; knob right and teal is on. */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; min-height: 44px; padding: 0.3rem 0.9rem; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--cream-dim); background: var(--night-2); border: 1px solid var(--line); border-radius: 12px; }
.switch[hidden] { display: none; }
.switch-track { flex: none; position: relative; width: 58px; height: 30px; border-radius: 999px; background: #3a3860; border: 1px solid var(--line); }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #9c98c4; }
/* The switch only glides once someone has touched the page, so it is never caught half-way as the page opens */
.console-page.touched .switch-track { transition: background 0.2s; }
.console-page.touched .switch-knob { transition: left 0.2s, background 0.2s; }
.switch[aria-checked="true"] { color: var(--cream); border-color: var(--teal); }
.switch[aria-checked="true"] .switch-track { background: var(--teal); border-color: transparent; }
.switch[aria-checked="true"] .switch-knob { left: 30px; background: #06202b; }
.switch:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }
.saved { color: var(--teal); font-weight: 600; font-size: 0.92rem; }
.cloud { width: min(34rem, calc(100vw - 2rem)); max-height: 86vh; background: var(--night-2); color: var(--cream); border: 2px solid var(--marigold); border-radius: 16px; padding: 1.2rem 1.3rem; }
.cloud textarea { width: 100%; font: inherit; font-size: 0.92rem; color: var(--cream); background: var(--night); border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.6rem; resize: vertical; }
.cloud textarea:focus-visible { outline: 3px solid var(--marigold); outline-offset: 1px; }
.paste-order { margin: 0.6rem 0 0; }
.paste-order .check { margin: 0; }
.paste-preview { margin: 0.4rem 0 0.8rem; padding-left: 1.6rem; font-size: 0.9rem; color: var(--cream-dim); }
.paste-preview:empty { display: none; }
.paste-preview b { color: var(--cream); font-weight: 600; }
.cloud::backdrop { background: rgba(7, 6, 28, 0.75); }
.cloud h2 { font-family: var(--display); font-weight: 400; font-size: 1.4rem; letter-spacing: 0.05em; text-transform: uppercase; margin: 0 0 0.8rem; }
.cloud-list { list-style: none; margin: 0.6rem 0; padding: 0; max-height: 44vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.cloud-list:empty { display: none; }
.cloud-item { display: block; width: 100%; text-align: left; font: inherit; color: var(--cream); background: none; border: 0; border-bottom: 1px solid var(--line); padding: 0.6rem 0.8rem; min-height: 44px; cursor: pointer; }
.cloud-item:hover:not(:disabled) { background: var(--night-3); }
.cloud-count { padding: 0.6rem 0.8rem; color: var(--cream-dim); }
/* The footer stays at the bottom of the browser window, however far the page is scrolled */
.credit-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; text-align: right;
  pointer-events: none;   /* the strip never swallows a click meant for something under it */
  padding: 0.3rem 1.25rem; color: rgba(255, 246, 224, 0.42); font-size: 0.75rem; letter-spacing: 0.08em;
  background: rgba(7, 6, 28, 0.88); border-top: 1px solid rgba(255, 246, 224, 0.07);   /* faded, so it does not pull the eye from the console */
}
.credit-foot a { pointer-events: auto; color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.credit-foot a:hover, .credit-foot a:focus-visible { color: var(--marigold); }
.console-page .layout { padding-bottom: 2.6rem; }   /* room for the footer, so it never covers the last row */
.tracks { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.tracks th { text-align: left; color: var(--cream-dim); font-weight: 600; padding: 0.4rem 0.6rem; background: var(--night-3); position: sticky; top: 0; z-index: 1; }
.tracks td { padding: 0.2rem 0.6rem; border-top: 1px solid var(--line); vertical-align: middle; }
.tracks input { min-height: 34px; padding: 0.2rem 0.5rem; }
.tracks .edit { display: flex; flex-wrap: wrap; gap: 0.3rem; min-width: 16rem; }
.tracks .edit input { flex: 1 1 9rem; width: auto; }
.tracks .edit input[type="number"] { flex: 0 0 5rem; }
.tracks td.ok { color: var(--teal); font-weight: 600; }
.tracks td.n { font-family: var(--display); color: var(--marigold); font-size: 1.15rem; }
.tracks .artist { color: var(--cream-dim); }
.tracks .file { max-width: 22rem; overflow-wrap: anywhere; }
.tracks .ok { color: var(--teal); font-weight: 600; }
.tracks .bad, .tracks .none { color: var(--coral-text); font-weight: 600; }
.tracks .none a { color: var(--cream-dim); font-weight: 400; margin-left: 0.5rem; }
.tracks input[type="number"] { width: 5.5rem; }
.tracks .btn { min-height: 34px; padding: 0.2rem 0.6rem; font-size: 0.85rem; }
.tracks .acts { white-space: nowrap; display: flex; gap: 0.4rem; }

/* ---------- The stage (audience screen and console preview) ---------- */

.screen-page { overflow: hidden; }
.screen-page #stage { position: fixed; inset: 0; }
/* Full screen: an icon in the top right corner, seen only while the mouse is moving over the screen */
.fs-hint {
  position: fixed; right: 0.8rem; top: 0.8rem; z-index: 5; cursor: pointer;
  width: 46px; height: 46px; display: grid; place-items: center; padding: 0;
  color: var(--cream); background: rgba(7, 6, 28, 0.78); border: 1px solid var(--line); border-radius: 12px;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.fs-hint svg { width: 24px; height: 24px; }
.screen-page[data-mouse="1"] .fs-hint, .fs-hint:focus-visible { opacity: 1; pointer-events: auto; }
.screen-page:not([data-mouse="1"]) { cursor: none; }

.stage {
  container-type: size; position: relative; overflow: hidden; isolation: isolate;
  color: var(--cream); background: var(--night);
  display: grid; grid-template-rows: auto 1fr auto;
  --accent: var(--marigold); --accent-2: var(--coral);
}
.stage[data-mode="answer"] { --accent: var(--teal); --accent-2: var(--marigold); }
/* --u is 1% of the height of the biggest 16:9 picture that fits, so the layout keeps its shape on any screen. */
.stage > * { --u: min(1cqh, 0.5625cqw); }

/* Backdrop: a pool of light on the stage, two spotlights, and a slow sunburst */
.backdrop {
  position: absolute; inset: 0; z-index: -1; overflow: hidden;
  background: radial-gradient(ellipse 62% 72% at 30% 52%, #2b1f8f 0%, #130f4a 48%, var(--night) 100%);
  transition: background 0.6s;
}
.stage[data-mode="idle"] .backdrop { background: radial-gradient(ellipse 70% 62% at 50% 40%, #2b1f8f 0%, #130f4a 46%, var(--night) 100%); }
.stage[data-mode="answer"] .backdrop { background: radial-gradient(ellipse 62% 72% at 72% 52%, #0e5e73 0%, #0c2b52 46%, var(--night) 100%); }
.rays {
  position: absolute; left: 30%; top: 52%; width: calc(var(--u) * 240); aspect-ratio: 1; translate: -50% -50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 246, 224, 0.04) 0 7.5deg, transparent 7.5deg 15deg);
  -webkit-mask-image: radial-gradient(circle, #000 0, transparent 62%); mask-image: radial-gradient(circle, #000 0, transparent 62%);
  animation: spin 90s linear infinite;
}
.stage[data-mode="idle"] .rays { left: 50%; top: 46%; }
.stage[data-mode="answer"] .rays { left: 72%; }
.stage[data-phase="music"] .rays { animation-duration: 28s; }
/* Spotlights: two beams, fixed in place. They do not move. */
.orb {
  position: absolute; top: calc(var(--u) * -12); width: calc(var(--u) * 52); height: calc(var(--u) * 135);
  background: linear-gradient(180deg, rgba(255, 246, 224, 0.17), rgba(255, 246, 224, 0));
  clip-path: polygon(43% 0, 57% 0, 100% 100%, 0 100%); transform-origin: 50% 0;
}
.orb-a { left: 12%; transform: rotate(20deg); }
.orb-b { right: 12%; transform: rotate(-20deg); }
@keyframes spin { to { transform: rotate(360deg); } }
/* Welcome picture only: a huge record behind the quiz name */
.bigdisc {
  display: none; position: absolute; left: 50%; top: 47%; width: calc(var(--u) * 104); aspect-ratio: 1; translate: -50% -50%;
  border-radius: 50%; opacity: 0.55;
  background: repeating-radial-gradient(circle, #0b0a1f 0 0.7%, #15133a 0.7% 1%);
  box-shadow: 0 0 0 calc(var(--u) * 0.4) rgba(255, 184, 28, 0.35);
}
.stage[data-mode="idle"] .bigdisc { display: block; }

/* The frame of marquee bulbs */
.marquee {
  --b: calc(var(--u) * 3.9);
  position: absolute; inset: calc(var(--u) * 2); z-index: 0; pointer-events: none;
  --bulb: radial-gradient(circle, #fff1c2 0 22%, var(--gold-deep) 26% 36%, transparent 40%);
  background:
    var(--bulb) top left / var(--b) var(--b) space no-repeat,
    var(--bulb) bottom left / var(--b) var(--b) space no-repeat,
    var(--bulb) top left / var(--b) var(--b) no-repeat space,
    var(--bulb) top right / var(--b) var(--b) no-repeat space;
  filter: drop-shadow(0 0 calc(var(--u) * 0.8) var(--gold-deep));
  /* Steady, like the bulbs round a dressing-room mirror: every bulb lit, none of them moving or pulsing. */
}

/* Notes that rise while the music plays */
.notes { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.notes span {
  position: absolute; left: var(--x); bottom: calc(var(--u) * -12); opacity: 0;
  font-size: calc(var(--u) * 7 * var(--s)); color: var(--accent);
}
.stage[data-phase="music"] .notes span { animation: rise var(--d) linear var(--delay) infinite; }
@keyframes rise {
  0% { transform: translateY(0) rotate(-12deg); opacity: 0; }
  12% { opacity: 0.45; }
  100% { transform: translateY(calc(var(--u) * -125)) rotate(18deg); opacity: 0; }
}

/* Top bar: the quiz name with the host under it, and the count */
.stage-top {
  display: flex; justify-content: space-between; align-items: center; gap: calc(var(--u) * 3);
  padding: calc(var(--u) * 6.6) calc(var(--u) * 8) 0; position: relative; z-index: 1;
}
.top-title { font-weight: 700; font-size: calc(var(--u) * 2.8); letter-spacing: 0.26em; text-transform: uppercase; color: var(--marigold); line-height: 1.3; }
.top-host { font-weight: 600; font-size: calc(var(--u) * 2.2); letter-spacing: 0.26em; text-transform: uppercase; color: var(--cream-dim); line-height: 1.4; }
.stage[data-mode="idle"] .top-left { visibility: hidden; }   /* the welcome picture carries both in large type */
.top-count:not(:empty) {
  padding: calc(var(--u) * 0.6) calc(var(--u) * 3); border-radius: 999px;
  border: calc(var(--u) * 0.3) solid var(--marigold); color: var(--cream);
  font-family: var(--display); font-size: calc(var(--u) * 3.9); letter-spacing: 0.08em; line-height: 1.3; font-variant-numeric: tabular-nums;
}
.stage-main {
  display: grid; grid-template-columns: calc(var(--u) * 66) 1fr; align-items: center;
  gap: calc(var(--u) * 6); padding: 0 calc(var(--u) * 11); min-height: 0; position: relative; z-index: 1;
}
.stage[data-mode="idle"] .stage-main { grid-template-columns: 1fr; }
.stage[data-mode="idle"] .deck { display: none; }

/* The record deck */
.deck { position: relative; width: calc(var(--u) * 52); aspect-ratio: 1; justify-self: center; }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); z-index: 1; }
.ring circle { fill: none; stroke-width: 2.6; }
.ring-bg { stroke: rgba(255, 246, 224, 0.14); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; transition: stroke 0.3s; }
.stage[data-hurry="1"] .ring-fg { stroke: var(--coral-text); }
.stage[data-mode="idle"] .ring, .stage[data-mode="answer"] .ring, .stage[data-extended="1"] .ring { opacity: 0; }
.vinyl {
  position: absolute; inset: 6%; border-radius: 50%; z-index: 1;
  background:
    conic-gradient(from 20deg, rgba(255,255,255,0.16), transparent 12%, transparent 38%, rgba(255,255,255,0.11) 50%, transparent 62%, transparent 88%, rgba(255,255,255,0.16)),
    repeating-radial-gradient(circle, #050510 0 0.5%, #1b1a33 0.5% 1%);
  box-shadow: 0 calc(var(--u) * 2) calc(var(--u) * 6) rgba(0, 0, 0, 0.55);
  animation: spin 1.8s linear infinite; animation-play-state: paused;
}
/* A pale mark on the record, so the turning is easy to see from the back of the room */
.vinyl::after {
  content: ""; position: absolute; left: 50%; top: 9%; width: 2.6%; height: 13%; translate: -50% 0;
  border-radius: 999px; background: rgba(255, 246, 224, 0.6);
}
.stage[data-phase="music"] .vinyl { animation-play-state: running; }
.stage[data-paused="1"] .vinyl { animation-play-state: paused; }
.label {
  position: absolute; inset: 33%; border-radius: 50%; display: grid; place-items: center; z-index: 1;
  background: var(--coral); color: var(--cream); box-shadow: 0 0 0 calc(var(--u) * 0.5) var(--marigold);
}
/* Sized to sit well inside the label, with room above and below, so no browser clips the top of the digits. */
.label-text { font-family: var(--display); font-size: calc(var(--u) * 9.5); line-height: 1.5; font-variant-numeric: tabular-nums; }
.stage[data-hurry="1"] .label { animation: beat 1s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.14); } }
/* Tone arm: swings onto the record when the music starts */
.arm {
  position: absolute; right: 1%; top: -3%; width: 5%; height: 52%; transform-origin: 50% 8%; transform: rotate(-24deg); z-index: 2;
  transition: transform 0.9s cubic-bezier(0.3, 1.3, 0.5, 1);
  background: linear-gradient(90deg, #9c967f, #ede7d2 45%, #9c967f); border-radius: 999px;
  box-shadow: 0 calc(var(--u) * 0.8) calc(var(--u) * 2) rgba(0, 0, 0, 0.5);
}
.arm::before { content: ""; position: absolute; left: -70%; top: -6%; width: 240%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1c2, #b98a12); }
.arm::after { content: ""; position: absolute; left: -40%; bottom: -4%; width: 180%; height: 16%; border-radius: 18%; background: var(--marigold); }
.stage[data-phase="music"] .arm { transform: rotate(9deg); }
/* The player's base: gloss black with a gold edge */
.plinth {
  position: absolute; inset: -5% -12% -5% -5%; border-radius: calc(var(--u) * 4);
  background: linear-gradient(145deg, #23204f, #0b0a1f); border: calc(var(--u) * 0.4) solid var(--marigold);
  box-shadow: 0 calc(var(--u) * 4) calc(var(--u) * 9) rgba(0, 0, 0, 0.6), inset 0 calc(var(--u) * 0.3) 0 rgba(255, 246, 224, 0.18);
}
.plinth::after {   /* speed dial */
  content: ""; position: absolute; right: 4%; bottom: 5%; width: 7%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0 30%, #050510 32%); box-shadow: 0 0 0 calc(var(--u) * 0.3) var(--marigold);
}

/* Answer round: no player. A big sleeve flips over to show the artwork and the record slides out behind it. */
.stage[data-mode="answer"] .stage-main { grid-template-columns: 1fr calc(var(--u) * 66); }
.stage[data-mode="answer"] .deck { order: 2; }
.stage[data-mode="answer"] .plinth, .stage[data-mode="answer"] .arm { display: none; }
.stage[data-mode="answer"] .vinyl, .stage[data-mode="answer"] .label { translate: -4% 0; transition: translate 1s cubic-bezier(0.2, 1, 0.3, 1) 0.5s; }
.stage[data-mode="answer"][data-reveal="1"] .vinyl, .stage[data-mode="answer"][data-reveal="1"] .label { translate: 24% 0; }
.stage[data-mode="answer"] .label { overflow: hidden; background: var(--teal); color: #06202b; }
.stage[data-mode="answer"][data-phase="music"] .label { animation: spin 1.8s linear infinite; }
.stage[data-mode="answer"][data-paused="1"] .label { animation-play-state: paused; }
.label-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.sleeve { position: absolute; left: -12%; top: 4%; width: 92%; aspect-ratio: 1; rotate: -3deg; perspective: calc(var(--u) * 220); display: none; z-index: 2; }
.stage[data-mode="answer"] .sleeve { display: block; }
.sleeve-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 0.9s cubic-bezier(0.3, 1.25, 0.4, 1); }
.stage[data-reveal="1"] .sleeve-inner { transform: rotateY(180deg); }
.stage[data-mode="answer"]:not([data-reveal="1"])[data-phase="sfx"] .sleeve-inner { animation: wobble 0.6s ease-in-out infinite alternate; }
@keyframes wobble { from { transform: rotate(-2.2deg) scale(1.01); } to { transform: rotate(2.2deg) scale(1.04); } }
.sleeve-face {
  position: absolute; inset: 0; border-radius: calc(var(--u) * 1.4); overflow: hidden;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  border: calc(var(--u) * 0.5) solid var(--marigold);
  box-shadow: 0 calc(var(--u) * 4) calc(var(--u) * 9) rgba(0, 0, 0, 0.65);
}
.sleeve-front {
  display: grid; place-items: center; font-family: var(--display); font-size: calc(var(--u) * 30); color: var(--marigold);
  background: repeating-linear-gradient(135deg, #1d3f63 0 calc(var(--u) * 3), #17355a calc(var(--u) * 3) calc(var(--u) * 6));
}
.sleeve-back { transform: rotateY(180deg); background: var(--night-2); }
.sleeve-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Drawn sleeve, used when the music file carries no artwork. Colour changes with the question number. */
.sleeve-made {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: calc(var(--u) * 1.5);
  background:
    radial-gradient(circle at 50% 50%, transparent 0 22%, rgba(255,246,224,0.12) 22% 23%, transparent 23% 34%, rgba(255,246,224,0.12) 34% 35%, transparent 35% 46%, rgba(255,246,224,0.12) 46% 47%, transparent 47%),
    linear-gradient(150deg, hsl(calc(var(--hue, 30) * 1deg) 78% 52%), hsl(calc((var(--hue, 30) + 70) * 1deg) 70% 28%));
  color: var(--cream);
}
.sleeve-made-note { font-size: calc(var(--u) * 20); line-height: 1; }
.sleeve-made-num { font-family: var(--display); font-size: calc(var(--u) * 5); letter-spacing: 0.08em; text-transform: uppercase; }

/* The magic of the reveal: the sleeve flashes and leaps, rays burst out behind it, and stars sparkle round it */
.stage[data-reveal="1"] .sleeve { animation: flash 1.3s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
@keyframes flash {
  0% { scale: 0.72; filter: brightness(1.3); }
  45% { scale: 1.1; filter: brightness(1.15); }
  100% { scale: 1; filter: none; }
}
.burst {
  display: none; position: absolute; left: -46%; top: -30%; width: 160%; aspect-ratio: 1; border-radius: 50%; z-index: 0; pointer-events: none;
  background: repeating-conic-gradient(rgba(255, 200, 61, 0.6) 0 6deg, rgba(255, 200, 61, 0) 6deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 28%, transparent 68%); mask-image: radial-gradient(circle, #000 28%, transparent 68%);
}
.stage[data-reveal="1"] .burst { display: block; opacity: 0.6; animation: burstin 1.4s ease-out, spin 26s linear 1.4s infinite; }
@keyframes burstin { from { transform: scale(0.15) rotate(-60deg); opacity: 0; } 40% { opacity: 1; } to { transform: scale(1) rotate(0); opacity: 0.6; } }
.spark {
  display: none; position: absolute; width: 11%; aspect-ratio: 1; z-index: 3; pointer-events: none; background: var(--cream);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}
.stage[data-reveal="1"] .spark { display: block; animation: sparkle 2.6s ease-in-out infinite both; }
.spark-1 { left: -20%; top: -4%; }
.spark-2 { left: 70%; top: -9%; width: 8%; background: var(--marigold); animation-delay: 0.55s !important; }
.spark-3 { left: -24%; top: 82%; width: 7%; background: var(--teal); animation-delay: 1.1s !important; }
.spark-4 { left: 78%; top: 90%; width: 10%; animation-delay: 1.65s !important; }
.spark-5 { left: 28%; top: -14%; width: 6%; background: var(--teal); animation-delay: 0.2s !important; }
@keyframes sparkle {
  0%, 100% { transform: scale(0) rotate(0); opacity: 0; }
  45% { transform: scale(1) rotate(90deg); opacity: 1; }
  70% { transform: scale(0.4) rotate(140deg); opacity: 0.5; }
}

/* Words */
.stage-text { min-width: 0; position: relative; padding-left: calc(var(--u) * 10); }   /* clear of the player's base and tone arm */
.stage[data-mode="answer"] .stage-text { padding-left: 0; padding-right: calc(var(--u) * 2); }
.stage[data-mode="idle"] .stage-text { padding: 0; display: grid; justify-items: center; text-align: center; }
.kicker { font-family: var(--display); font-size: calc(var(--u) * 8.5); color: var(--accent); line-height: 1.15; letter-spacing: 0.22em; text-transform: uppercase; }
.stage[data-last="1"] .kicker { font-size: calc(var(--u) * 5); letter-spacing: 0.14em; }   /* "The last question" is longer than "Question" */
.stage[data-mode="idle"] .kicker { font-family: var(--body); font-weight: 700; font-size: calc(var(--u) * 3.6); letter-spacing: 0.34em; margin-bottom: calc(var(--u) * 1.5); }
.stage[data-reveal="1"] .kicker {
  display: inline-block; font-size: calc(var(--u) * 5.2); letter-spacing: 0.16em; margin-bottom: calc(var(--u) * 2.5);
  padding: calc(var(--u) * 0.3) calc(var(--u) * 3); border-radius: calc(var(--u) * 1.1); background: var(--teal); color: #06202b;
}
.bignum {
  font-family: var(--display); font-size: calc(var(--u) * 50); line-height: 1.02; letter-spacing: 0.01em;
  text-shadow: 0 calc(var(--u) * 1.1) 0 var(--gold-deep), 0 calc(var(--u) * 2.2) 0 #b8321e, 0 calc(var(--u) * 5) calc(var(--u) * 10) rgba(0, 0, 0, 0.6);
}
.stage[data-mode="answer"] .bignum { text-shadow: 0 calc(var(--u) * 1.1) 0 var(--teal), 0 calc(var(--u) * 2.2) 0 #0b6b74, 0 calc(var(--u) * 5) calc(var(--u) * 10) rgba(0, 0, 0, 0.6); }
.stage[data-mode="idle"] .bignum {
  font-size: calc(var(--u) * 29); line-height: 0.98; letter-spacing: 0.02em; text-transform: uppercase;
  text-shadow: 0 calc(var(--u) * 0.85) 0 var(--gold-deep), 0 calc(var(--u) * 1.7) 0 #b8321e, 0 calc(var(--u) * 4) calc(var(--u) * 8) rgba(0, 0, 0, 0.6);
}
.stage[data-mode="idle"][data-biglong="1"] .bignum { font-size: calc(var(--u) * 17); }   /* a longer quiz title */
.stage[data-mode="idle"][data-biglong="2"] .bignum { font-size: calc(var(--u) * 11); }
.bignum:empty { display: none; }
/* "Good luck!" after the last question: the welcome picture with a wish in place of the quiz name.
   The year, the host credit and the instruction strip are left out. */
.stage[data-wish="1"] .year, .stage[data-wish="1"] .host, .stage[data-wish="1"] .status,
.stage[data-wish="2"] .year, .stage[data-wish="2"] .host, .stage[data-wish="2"] .status { display: none !important; }
.stage[data-wish="1"] .bignum { font-size: calc(var(--u) * 24) !important; animation: up 0.7s cubic-bezier(0.2, 1, 0.3, 1) both; }
.stage[data-wish="2"] .bignum { font-size: calc(var(--u) * 14) !important; animation: up 0.7s cubic-bezier(0.2, 1, 0.3, 1) both; }   /* a longer wish, e.g. "Thanks for playing!" */
.stage[data-wish="1"] .kicker, .stage[data-wish="2"] .kicker { animation: up 0.7s cubic-bezier(0.2, 1, 0.3, 1) both; }
.year { display: none; }
.stage[data-mode="idle"] .year:not(:empty) {
  display: block; margin-top: calc(var(--u) * 3.4); padding: 0 calc(var(--u) * 3.6); border-radius: 999px;
  background: var(--marigold); color: #1a1033; font-family: var(--display); font-size: calc(var(--u) * 5.2); letter-spacing: 0.12em; line-height: 1.35;
}
/* "Hosted by …": straight under the quiz name on the welcome picture, in the top bar once the quiz is running.
   It never follows the instruction, which has its own strip at the bottom. */
.host { display: none; }
.stage[data-mode="idle"] .host:not(:empty) {
  display: grid; justify-items: center; margin-top: calc(var(--u) * 2.6); position: relative; padding: 0 calc(var(--u) * 22);
}
.stage[data-mode="idle"] .host::before, .stage[data-mode="idle"] .host::after {
  content: ""; position: absolute; top: 55%; width: calc(var(--u) * 17); height: calc(var(--u) * 0.3);
}
.host::before { left: 0; background: linear-gradient(90deg, transparent, var(--marigold)); }
.host::after { right: 0; background: linear-gradient(90deg, var(--marigold), transparent); }
.host-by { font-weight: 600; font-size: calc(var(--u) * 2.5); letter-spacing: 0.4em; text-transform: uppercase; color: var(--cream-dim); }
.host-name { font-family: var(--display); font-size: calc(var(--u) * 7.6); line-height: 1.15; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.stage[data-phase="announce"] .bignum { animation: slam 0.55s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.stage[data-phase="announce"] .kicker { animation: slide 0.4s ease-out both; }
@keyframes slam { from { transform: scale(2.4) rotate(-6deg); opacity: 0; filter: blur(calc(var(--u) * 1)); } }
@keyframes slide { from { transform: translateX(calc(var(--u) * -6)); opacity: 0; } }

.stamp {
  position: absolute; right: calc(var(--u) * 2); top: 42%; display: none;
  font-family: var(--display); font-size: calc(var(--u) * 8); letter-spacing: 0.06em; text-transform: uppercase; color: var(--cream); background: var(--coral);
  padding: calc(var(--u) * 0.4) calc(var(--u) * 3); border: calc(var(--u) * 0.5) solid var(--cream); border-radius: calc(var(--u) * 1.4);
  transform: rotate(-5deg); white-space: nowrap;
}
.stage[data-mode="question"][data-phase="done"] .stamp { display: inline-block; animation: stampin 0.4s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes stampin { from { transform: rotate(-5deg) scale(3); opacity: 0; } }

.reveal { display: none; }
.stage[data-reveal="1"] .reveal { display: block; }
.r-title {
  font-family: var(--display); font-size: calc(var(--u) * 13.5); line-height: 1.06; letter-spacing: 0.01em; text-transform: uppercase; text-wrap: balance;
  text-shadow: 0 calc(var(--u) * 0.7) 0 var(--gold-deep), 0 calc(var(--u) * 3) calc(var(--u) * 7) rgba(0, 0, 0, 0.6);
}
.r-title[data-long="1"] { font-size: calc(var(--u) * 8.4); }
.r-title[data-long="1"] ~ .r-artist { font-size: calc(var(--u) * 5.2); margin-top: calc(var(--u) * 1.6); }
.r-title[data-long="1"] ~ .r-year { margin-top: calc(var(--u) * 1.6); }
.r-artist { font-size: calc(var(--u) * 6.2); font-weight: 700; color: var(--teal); margin-top: calc(var(--u) * 2.4); line-height: 1.2; text-wrap: balance; }
.r-year {
  display: inline-block; font-family: var(--display); font-size: calc(var(--u) * 4.6); letter-spacing: 0.1em; margin-top: calc(var(--u) * 2.5);
  padding: 0 calc(var(--u) * 2.8); border-radius: 999px; border: calc(var(--u) * 0.3) solid var(--marigold); color: var(--marigold); line-height: 1.4;
}
.r-year:empty { display: none; }
.stage[data-reveal="1"] .r-title { animation: up 0.6s cubic-bezier(0.2, 1, 0.3, 1) 0.6s both; }
.stage[data-reveal="1"] .r-artist { animation: up 0.6s cubic-bezier(0.2, 1, 0.3, 1) 0.9s both; }
.stage[data-reveal="1"] .r-year { animation: up 0.6s cubic-bezier(0.2, 1, 0.3, 1) 1.2s both; }
@keyframes up { from { transform: translateY(calc(var(--u) * 6)); opacity: 0; } }

/* Foot: the bars, then the instruction on its own strip */
.stage-foot { position: relative; z-index: 1; padding: 0 calc(var(--u) * 8) calc(var(--u) * 6.4); }
.bars { display: flex; align-items: flex-end; gap: calc(var(--u) * 1.1); height: calc(var(--u) * 7); padding: 0 calc(var(--u) * 2); }
.bars span {
  flex: 1; height: var(--h); border-radius: calc(var(--u) * 0.6) calc(var(--u) * 0.6) 0 0; transform-origin: bottom; transform: scaleY(0.06);
  background: linear-gradient(to top, var(--accent-2), var(--accent)); transition: transform 0.4s;
}
.stage[data-phase="music"] .bars span { animation: bounce var(--d) ease-in-out var(--delay) infinite alternate; }
.stage[data-phase="sfx"] .bars span { animation: bounce 0.5s ease-in-out var(--delay) infinite alternate; }
.stage[data-paused="1"] .bars span, .stage[data-paused="1"] .notes span { animation-play-state: paused; }
@keyframes bounce { from { transform: scaleY(0.12); } to { transform: scaleY(1); } }
.status {
  display: grid; place-items: center; height: calc(var(--u) * 7.8); border-radius: calc(var(--u) * 1.6);
  background: rgba(7, 6, 28, 0.8); border: calc(var(--u) * 0.3) solid rgba(255, 200, 61, 0.55);
  font-weight: 600; font-size: calc(var(--u) * 3.6); letter-spacing: 0.08em; color: var(--cream);
}
.status:empty { visibility: hidden; }
/* Auto-play gap after a question: a line of encouragement sits where the bars were */
.nudge {
  display: none; position: absolute; left: 0; right: 0; bottom: calc(var(--u) * 15.6); text-align: center;
  font-family: var(--display); font-size: calc(var(--u) * 5); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--marigold); text-shadow: 0 calc(var(--u) * 0.5) 0 #b8321e, 0 calc(var(--u) * 1.6) calc(var(--u) * 3) rgba(0, 0, 0, 0.6);
}
.stage[data-next="1"] .nudge:not(:empty) { display: block; animation: up 0.5s cubic-bezier(0.2, 1, 0.3, 1) both; }
.stage[data-next="1"] .bars { visibility: hidden; }
/* Auto-play countdown: the strip fills from the left, and is full at the moment the next one starts */
.status { position: relative; overflow: hidden; isolation: isolate; }
.stage[data-next="1"] .status { border-color: var(--teal); animation: none !important; }
.stage[data-next="1"] .status::before {
  content: ""; position: absolute; inset: 0 auto 0 0; z-index: -1; width: var(--next, 0%);
  background: linear-gradient(90deg, rgba(255, 200, 61, 0.5), rgba(94, 230, 214, 0.6)); transition: width 0.12s linear;
}
/* The maker's plate, set into the bottom row of bulbs, at the right */
.credit {
  position: absolute; right: calc(var(--u) * 7); bottom: calc(var(--u) * 2.2); white-space: nowrap;
  padding: calc(var(--u) * 0.7) calc(var(--u) * 2.4); border-radius: 999px; background: var(--night);
  font-size: calc(var(--u) * 1.5); font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: var(--cream-dim);
}
.stage[data-mode="answer"]:not([data-reveal="1"]) .status { animation: throb 1.2s ease-in-out infinite alternate; }
@keyframes throb { from { opacity: 0.75; } to { opacity: 1; } }

/* ---------- In step with the sound: voice, then sound effect, then music ---------- */

/* Voice ("Question 7" / "Answer 7"): the number alone, in the middle of the stage. No player yet. */
.stage[data-mode="question"][data-phase="announce"] .stage-main,
.stage[data-mode="question"][data-phase="sfx"] .stage-main,
.stage[data-mode="answer"][data-phase="announce"] .stage-main { grid-template-columns: 1fr; }
.stage[data-mode="question"][data-phase="announce"] .deck,
.stage[data-mode="question"][data-phase="sfx"] .deck,
.stage[data-mode="answer"][data-phase="announce"] .deck { display: none; }
.stage[data-mode="question"][data-phase="announce"] .stage-text,
.stage[data-mode="question"][data-phase="sfx"] .stage-text,
.stage[data-mode="answer"][data-phase="announce"] .stage-text { padding: 0; display: grid; justify-items: center; text-align: center; }
.stage[data-phase="announce"] .backdrop, .stage[data-mode="question"][data-phase="sfx"] .backdrop { background: radial-gradient(ellipse 62% 72% at 50% 52%, #2b1f8f 0%, #130f4a 48%, var(--night) 100%); }
/* Until the answer is revealed, the number sits centred under the word "Answer". */
.stage[data-mode="answer"]:not([data-reveal="1"]) .stage-text { display: grid; justify-items: center; text-align: center; }
/* Wide letter-spacing leaves a gap after the last letter; this puts the same gap in front, so the word is truly centred. */
.stage[data-mode="answer"]:not([data-reveal="1"]) .kicker,
.stage[data-mode="question"][data-phase="announce"] .kicker,
.stage[data-mode="question"][data-phase="sfx"] .kicker { text-indent: 0.22em; }
.stage[data-last="1"][data-phase="announce"] .kicker, .stage[data-last="1"][data-phase="sfx"] .kicker { text-indent: 0.14em; }
.stage[data-mode="answer"][data-phase="announce"] .backdrop { background: radial-gradient(ellipse 62% 72% at 50% 52%, #0e5e73 0%, #0c2b52 46%, var(--night) 100%); }
.stage[data-phase="announce"] .rays, .stage[data-mode="question"][data-phase="sfx"] .rays { left: 50%; }

/* Sound effect: rings of light drift out, the number swells, the spotlights sweep, the stage brightens once.
   SAFE FOR PHOTOSENSITIVE EPILEPSY: nothing on the stage flashes or strobes. The rule for any change here:
   no brightness or opacity change repeats faster than once a second, and nothing that covers a large part
   of the screen changes brightness on a loop at all. Quick movement is done with size and position only. */
.shock { display: none; position: absolute; left: 50%; top: 54%; width: calc(var(--u) * 46); aspect-ratio: 1; translate: -50% -50%; }
.stage[data-mode="answer"] .shock { left: 70%; top: 52%; }
.stage[data-phase="sfx"] .shock { display: block; }
.shock span {
  position: absolute; inset: 0; border-radius: 50%; border: calc(var(--u) * 0.9) solid var(--accent); opacity: 0;
  animation: ringout 2.4s ease-out infinite;
}
.shock span:nth-child(2) { animation-delay: 0.8s; border-color: var(--cream); }
.shock span:nth-child(3) { animation-delay: 1.6s; }
@keyframes ringout { from { transform: scale(0.35); opacity: 0.6; } to { transform: scale(2.7); opacity: 0; } }
.stage[data-phase="sfx"] .bignum { animation: thump 0.6s ease-in-out infinite alternate; }
@keyframes thump { from { transform: scale(1); } to { transform: scale(1.09); } }
.stage[data-phase="sfx"] .backdrop { animation: glow 1.6s ease-out both; }   /* one slow lift in brightness, never a pulse */
@keyframes glow { from { filter: brightness(1); } to { filter: brightness(1.18); } }
.stage[data-phase="sfx"] .rays { animation-duration: 6s; }

/* Music: the player slides in with the record already turning and the arm dropping, so the picture moves
   the moment the song is heard. Nothing here waits for anything else. */
.stage[data-mode="question"][data-phase="music"] .deck { animation: deckin 0.35s cubic-bezier(0.2, 1.1, 0.4, 1) both; }
@keyframes deckin { from { transform: translateX(calc(var(--u) * -70)) rotate(-14deg); opacity: 0; } }
.stage[data-mode="question"][data-phase="music"] .stage-text { animation: textin 0.5s cubic-bezier(0.2, 1, 0.3, 1) both; }
@keyframes textin { from { transform: translateX(calc(var(--u) * -24)); } }
.stage[data-mode="question"][data-phase="music"] .arm { animation: armon 0.4s cubic-bezier(0.3, 1.3, 0.5, 1) both; }
@keyframes armon { from { transform: rotate(-24deg); } to { transform: rotate(9deg); } }
.stage[data-paused="1"] .shock span, .stage[data-paused="1"] .bignum, .stage[data-paused="1"] .backdrop, .stage[data-paused="1"] .orb, .stage[data-paused="1"] .marquee { animation-play-state: paused; }

/* Paused: a plain badge at the top of the stage, so it is clear the picture is being held */
.stage[data-paused="1"]::after {
  content: "Paused"; position: absolute; left: 50%; top: calc(var(--u) * 9); translate: -50% 0; z-index: 6;
  padding: calc(var(--u) * 1) calc(var(--u) * 3.4); border-radius: 999px; background: rgba(7, 6, 28, 0.9);
  border: calc(var(--u) * 0.3) solid var(--cream); color: var(--cream);
  font-family: var(--display); font-size: calc(var(--u) * 4.2); letter-spacing: 0.18em; text-transform: uppercase;
}

/* Confetti on the reveal */
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.confetti span {
  position: absolute; left: var(--x); top: calc(var(--u) * -4); width: calc(var(--u) * 1.5); height: calc(var(--u) * 2.6); border-radius: calc(var(--u) * 0.3);
  animation: fall var(--d) cubic-bezier(0.3, 0.2, 0.6, 1) var(--delay) both;
}
@keyframes fall {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translate(calc(var(--u) * var(--sway)), calc(var(--u) * 112)) rotate(var(--r)); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .stage *, .pad[data-active="1"] { animation: none !important; transition: none !important; }
  .stage[data-phase="music"] .bars span { transform: scaleY(0.6); }
  .confetti, .burst, .spark { display: none !important; }
}
