/* ADEERA ENCORE! shell: global tokens, every menu screen, results ceremony, HUD.
   cards.css (photocards/binder/unboxing) and cafe.css (fan cafe) sit on top of this. */

:root {
  --night: #160b2e;
  --stage: #2e1257;
  --hot: #ff4fa3;
  --lav: #b9a6ff;
  --mint: #5ef2d0;
  --butter: #ffe066;
  --sky: #7cc8ff;
  --text: #f6efff;
  --stick: #e9e3ff;
  --ink: #2a0f3d;
  --text-soft: rgba(246, 239, 255, 0.72);
  --text-dim: rgba(246, 239, 255, 0.5);
  --line: rgba(246, 239, 255, 0.14);
  --glass: rgba(22, 11, 46, 0.62);
  --cute: "Jua", ui-rounded, system-ui, sans-serif;
  --loud: "Black Han Sans", "Jua", Impact, sans-serif;
  --st: max(12px, env(safe-area-inset-top));
  --sb: max(12px, env(safe-area-inset-bottom));
  --sl: max(16px, env(safe-area-inset-left));
  --sr: max(16px, env(safe-area-inset-right));
  --pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --out: cubic-bezier(0.2, 0.7, 0.3, 1);
  --accent: var(--hot);     /* follows the focused album */
  --accent-2: var(--lav);
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  font-family: var(--cute);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(ellipse 70% 55% at 50% 0%, rgba(185, 166, 255, 0.28), transparent 70%),
    radial-gradient(ellipse 120% 60% at 50% 100%, rgba(255, 79, 163, 0.22), transparent 70%),
    linear-gradient(var(--night), var(--stage) 70%, #1c0a35);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

button,
input,
select { font: inherit; color: inherit; }

button { -webkit-tap-highlight-color: transparent; }

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 2px 6px 3px;
  font: 12px/1 var(--cute);
  color: inherit;
  text-align: center;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1.5px currentColor;
  opacity: 0.7;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--butter); outline-offset: 3px; }

#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  touch-action: none;
}

#app {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none; /* during play, touches fall through to the world canvas */
}

/* ---------- Screens ---------- */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: var(--st) var(--sr) var(--sb) var(--sl);
  overflow: hidden;
  pointer-events: auto;
}

.screen[hidden] { display: none; }

#scr-play { pointer-events: none; }

/* Menus get a soft scrim so text reads over the live crowd. */
#scr-title,
#scr-select,
#scr-daily,
#scr-settings,
#scr-results,
#scr-fail,
#scr-binder,
#scr-cafe {
  background:
    linear-gradient(180deg, rgba(22, 11, 46, 0.7) 0%, rgba(22, 11, 46, 0.12) 22%, rgba(22, 11, 46, 0.1) 55%, rgba(22, 11, 46, 0.78) 100%);
}

#scr-select {
  background: linear-gradient(180deg, rgba(22, 11, 46, 0.78) 0%, rgba(22, 11, 46, 0.3) 18%, rgba(22, 11, 46, 0.42) 40%, rgba(22, 11, 46, 0.8) 58%, rgba(22, 11, 46, 0.9) 100%);
}

/* Binder + cafe are dense pages: dim the live arena more so the stage bear and LED don't fight the text. */
#scr-binder,
#scr-cafe {
  background: linear-gradient(180deg, rgba(22, 11, 46, 0.84) 0%, rgba(22, 11, 46, 0.6) 28%, rgba(22, 11, 46, 0.62) 60%, rgba(22, 11, 46, 0.86) 100%);
}

.album-info,
.lockline { text-shadow: 0 1px 6px var(--night), 0 0 2px var(--night); }
.album-info .chip { text-shadow: none; }

#scr-daily,
#scr-settings,
#scr-binder,
#scr-cafe { background: linear-gradient(180deg, rgba(22, 11, 46, 0.82), rgba(22, 11, 46, 0.6) 40%, rgba(22, 11, 46, 0.86)); }

.scroller {
  flex: 1;
  min-height: 0;
  margin: 0 calc(-1 * var(--sr)) calc(-1 * var(--sb)) calc(-1 * var(--sl));
  padding: 4px var(--sr) var(--sb) var(--sl);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(185, 166, 255, 0.4) transparent;
}

.mount {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Broadcast header ---------- */

.bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  flex: none;
}

.onair {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px 0 9px;
  font: 14px/1 var(--loud);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(255, 79, 163, 0.2);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1.5px var(--hot), 0 0 16px rgba(255, 79, 163, 0.35);
  white-space: nowrap;
  flex: none;
}

.onair .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--hot);
  box-shadow: 0 0 10px var(--hot);
  animation: onair 1s steps(1) infinite;
}

.onair .kr { font: 13px/1 var(--cute); letter-spacing: 0; opacity: 0.8; }
.onair.is-standby { background: rgba(255, 224, 102, 0.12); box-shadow: inset 0 0 0 1.5px rgba(255, 224, 102, 0.7); }
.onair.is-standby .dot { background: #ff5a5a; box-shadow: 0 0 10px #ff5a5a; }
.onair.is-off { background: rgba(138, 127, 168, 0.18); box-shadow: inset 0 0 0 1.5px #8a7fa8; color: #cfc6e6; }
.onair.is-off .dot { background: #8a7fa8; box-shadow: none; animation: none; }

@keyframes onair { 50% { opacity: 0.25; } }

.seg {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.05;
}

.seg b {
  font: 17px/1.05 var(--loud);
  letter-spacing: 0.05em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 0 rgba(22, 11, 46, 0.55);
}

.seg span {
  font-size: 13px;
  color: var(--lav);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px 0 8px;
  font: 16px/1 var(--loud);
  color: var(--butter);
  background: rgba(22, 11, 46, 0.6);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1.5px rgba(255, 224, 102, 0.45);
  flex: none;
  font-variant-numeric: tabular-nums;
}

.wallet svg { width: 20px; height: 20px; }
.wallet.bump { animation: bump 0.4s var(--pop); }

@keyframes bump { 40% { transform: scale(1.18); } }

.back {
  width: 48px;
  height: 48px;
  margin-left: max(-6px, calc(env(safe-area-inset-left) - var(--sl))); /* -6px, but never into a landscape notch */
  padding: 0;
  display: grid;
  place-items: center;
  flex: none;
  color: #fff;
  background: rgba(22, 11, 46, 0.6);
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
}

.back svg { width: 22px; height: 22px; }
.back:hover { background: rgba(255, 79, 163, 0.32); }
.back:active { transform: scale(0.92); }

/* ---------- Buttons ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 22px;
  font: 18px/1 var(--cute);
  color: #fff;
  background: rgba(22, 11, 46, 0.62);
  border: 0;
  border-radius: 999px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.42), 0 6px 18px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, box-shadow 0.15s, opacity 0.2s;
  white-space: nowrap;
}

.btn:hover { background: rgba(255, 79, 163, 0.28); }
.btn:active { transform: scale(0.96); }
.btn[disabled],
.btn[aria-disabled="true"] { opacity: 0.45; cursor: default; transform: none; }
.btn kbd { margin-left: 2px; }
.btn small { font-size: 13px; opacity: 0.7; }
.btn svg { width: 22px; height: 22px; flex: none; }

.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2); -webkit-backdrop-filter: none; backdrop-filter: none; }
.btn.warn { color: #ffd0e6; box-shadow: inset 0 0 0 2px rgba(255, 79, 163, 0.7); }
.btn.warn.armed { color: var(--ink); background: var(--hot); box-shadow: 0 0 24px rgba(255, 79, 163, 0.6); }

/* The site's lightstick pill, scaled up into the game's main action. */
.btn.cta {
  min-height: 64px;
  padding: 0 30px 0 24px;
  overflow: hidden;
  font: 25px/1 var(--loud);
  letter-spacing: 0.05em;
  color: var(--ink);
  background: linear-gradient(135deg, var(--butter), #ffb3d6 55%, var(--hot));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.8), 0 0 28px rgba(255, 224, 102, 0.42), 0 10px 30px rgba(255, 79, 163, 0.5);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.btn.cta svg { width: 30px; height: 30px; transform: rotate(-12deg); filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.6)); }
.btn.cta:hover { background: linear-gradient(135deg, #fff08f, #ffc2de 55%, #ff66b0); box-shadow: inset 0 0 0 2px #fff, 0 0 40px rgba(255, 224, 102, 0.65), 0 10px 34px rgba(255, 79, 163, 0.65); }
.btn.cta kbd { opacity: 0.55; font-family: var(--cute); }
.btn.cta[disabled] {
  color: var(--butter);
  background: rgba(22, 11, 46, 0.72);
  box-shadow: inset 0 0 0 2px rgba(255, 224, 102, 0.55), 0 0 18px rgba(255, 224, 102, 0.15);
}

.btn.cta[disabled] svg { opacity: 0.5; filter: grayscale(1); }
.btn.cta[disabled]::after { display: none; }

.btn.cta::after {
  content: "";
  position: absolute;
  inset: -20% auto -20% -30%;
  width: 22%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  transform: skewX(-20deg) translateX(-200%);
  animation: shine 3.4s 1s infinite;
  pointer-events: none;
}

@keyframes shine {
  0%, 70% { transform: skewX(-20deg) translateX(-200%); }
  100% { transform: skewX(-20deg) translateX(700%); }
}

.mini-btn {
  min-width: 52px;
  min-height: 48px;
  padding: 0 12px;
  font: 15px/1 var(--loud);
  letter-spacing: 0.04em;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 0;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}

.mini-btn:hover { background: rgba(255, 79, 163, 0.3); }
.mini-btn:active { transform: scale(0.94); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  font: 13px/1 var(--loud);
  letter-spacing: 0.06em;
  color: var(--ink);
  background: var(--lav);
  border-radius: 999px;
  white-space: nowrap;
}

.chip.butter { background: var(--butter); }
.chip.hot { background: var(--hot); color: #fff; }
.chip.mint { background: var(--mint); }
.chip.ghost { color: #fff; background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.3); }
.chip svg { width: 14px; height: 14px; }

.eyebrow {
  margin: 0;
  font: 12px/1.2 var(--loud);
  letter-spacing: 0.14em;
  color: var(--lav);
  text-transform: uppercase;
}

.kr { font-family: var(--cute); }

/* Korean breaks between words, never mid-word (베개 요새, not 베 / 개 요새). */
.kr,
[lang="ko"] { word-break: keep-all; }

/* ---------- Panels ---------- */

.panel {
  position: relative;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(52, 22, 96, 0.82), rgba(22, 11, 46, 0.88));
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.13), 0 14px 40px rgba(8, 3, 20, 0.45);
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 22px;
  right: 22px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--hot), var(--lav), var(--mint), var(--sky));
  opacity: 0.9;
}

.card-h {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 10px;
  font: 15px/1 var(--loud);
  letter-spacing: 0.1em;
  color: #fff;
}

.card-h .kr { font-size: 13px; letter-spacing: 0; color: var(--lav); }

/* ---------- Wipe (350 ms diagonal palette stripes) ---------- */

.wipe {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  overflow: hidden;
  visibility: hidden;
}

.wipe.on { visibility: visible; pointer-events: auto; }

.wipe-band {
  position: absolute;
  left: -60vmax;
  top: 50%;
  width: calc(100vw + 120vmax);
  height: 116vmax;          /* just covers the viewport once rotated, so all five stripes show */
  margin-top: -58vmax;
  display: flex;
  flex-direction: column;
  transform: rotate(-24deg);
}

.wipe-band i {
  flex: 1;
  transform: translateX(-110%);
  box-shadow: inset 0 -4px 0 rgba(22, 11, 46, 0.22), inset 0 4px 0 rgba(255, 255, 255, 0.35);
}

.wipe-band i:nth-child(1) { background: var(--hot); }
.wipe-band i:nth-child(2) { background: var(--lav); }
.wipe-band i:nth-child(3) { background: var(--mint); }
.wipe-band i:nth-child(4) { background: var(--butter); }
.wipe-band i:nth-child(5) { background: var(--sky); }

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  z-index: 60;
  top: calc(var(--st) + 56px);
  left: 50%;
  width: min(92vw, 420px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

/* Phone results: news toasts float over the rival race, not over the grade + score. */
@media (max-width: 899px) {
  body[data-screen="results"] .toasts { top: 44%; }
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 9px 15px 10px 11px;
  font: 15px/1.25 var(--cute);
  color: #fff;
  background: linear-gradient(135deg, rgba(46, 18, 87, 0.96), rgba(22, 11, 46, 0.96));
  border-radius: 16px;
  box-shadow: inset 0 0 0 2px var(--toast, var(--hot)), 0 0 24px rgba(255, 79, 163, 0.35), 0 12px 30px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.45s var(--pop) both;
}

.toast b { font: 13px/1 var(--loud); letter-spacing: 0.1em; color: var(--toast, var(--hot)); display: block; margin-bottom: 3px; }
.toast svg { width: 26px; height: 26px; flex: none; }
.toast.out { animation: toast-out 0.3s ease-in both; }
.toast.butter { --toast: var(--butter); }
.toast.mint { --toast: var(--mint); }
.toast.sky { --toast: var(--sky); }
.toast.lav { --toast: var(--lav); }

@keyframes toast-in { from { transform: translateY(-24px) scale(0.9); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-16px); opacity: 0; } }

/* ---------- Bubble (the site's speech bubble) ---------- */

.bubble {
  position: relative;
  margin: 0;
  padding: 11px 18px 12px;
  font: 16px/1.35 var(--cute);
  color: #3a1a5c;
  text-align: center;
  background: #fff;
  border: 0;
  border-radius: 20px;
  box-shadow: 0 0 0 3px var(--hot), 0 0 24px rgba(255, 79, 163, 0.5);
}

.bubble::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -13px;
  margin-left: -9px;
  border-style: solid;
  border-width: 14px 9px 0 9px;
  border-color: #fff transparent transparent transparent;
  filter: drop-shadow(0 3px 0 var(--hot));
}

/* ---------- STANDBY ---------- */

#scr-standby {
  background:
    radial-gradient(ellipse 80% 50% at 50% 55%, rgba(124, 200, 255, 0.12), transparent 70%),
    linear-gradient(180deg, rgba(10, 4, 24, 0.92), rgba(22, 11, 46, 0.86) 60%, rgba(10, 4, 24, 0.95));
}

.standby-hit {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.standby-hit:focus-visible { outline-offset: -12px; border-radius: 28px; }

.studio {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: min(96vw, 560px);
  height: min(82vw, 380px);
  margin-bottom: 22px;
}

.monitor {
  position: absolute;
  left: 8%;
  top: 0;
  width: 56%;
  aspect-ratio: 4 / 3;
  padding: 7%;
  border-radius: 18px;
  background: linear-gradient(160deg, #3a2a5c, #1d1238);
  box-shadow: inset 0 0 0 3px #4d3a78, inset 0 -6px 0 rgba(0, 0, 0, 0.35), 0 20px 40px rgba(0, 0, 0, 0.5);
  transform: rotate(-3deg);
}

.monitor::after {
  content: "";
  position: absolute;
  left: 38%;
  right: 38%;
  bottom: -18px;
  height: 18px;
  background: linear-gradient(#2a1d48, #160b2e);
  border-radius: 0 0 6px 6px;
}

.tally {
  position: absolute;
  top: -12px;
  right: 16%;
  width: 22px;
  height: 12px;
  border-radius: 6px 6px 0 0;
  background: #ff3b5c;
  box-shadow: 0 0 18px #ff3b5c, 0 0 40px rgba(255, 59, 92, 0.6);
  animation: tally 1.6s steps(1) infinite;
}

@keyframes tally { 60% { background: #5a1a2a; box-shadow: none; } }

.monitor-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: #0d0820;
  box-shadow: inset 0 0 24px rgba(124, 200, 255, 0.25);
}

.monitor-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 3px);
  pointer-events: none;
}

.colorbars {
  position: absolute;
  inset: 0 0 auto;
  height: 38%;
  display: flex;
  opacity: 0.55;
}

.colorbars i { flex: 1; }
.colorbars i:nth-child(1) { background: var(--stick); }
.colorbars i:nth-child(2) { background: var(--butter); }
.colorbars i:nth-child(3) { background: var(--mint); }
.colorbars i:nth-child(4) { background: var(--sky); }
.colorbars i:nth-child(5) { background: var(--lav); }
.colorbars i:nth-child(6) { background: var(--hot); }

.monitor-screen b {
  position: relative;
  margin-top: 26%;
  font: clamp(17px, 5.4vw, 34px)/1 var(--loud);
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 0 12px var(--sky), 0 0 2px #fff;
  animation: flicker 4s infinite;
}

.monitor-screen small {
  position: relative;
  margin-top: 6px;
  font-size: clamp(9px, 2.6vw, 13px);
  letter-spacing: 0.1em;
  color: var(--sky);
}

@keyframes flicker { 0%, 92%, 96%, 100% { opacity: 1; } 94% { opacity: 0.55; } }

.napper {
  position: absolute;
  right: 2%;
  bottom: 0;
  width: 46%;
}

.standby-bear {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 50% 90%;
  animation: breathe 3.6s ease-in-out infinite;
  filter: drop-shadow(0 0 22px rgba(255, 79, 163, 0.3));
}

@keyframes breathe { 50% { transform: scale(1.025, 0.975) translateY(2px); } }

.pillows {
  position: absolute;
  z-index: 1;
  left: -8%;
  right: -8%;
  bottom: -6%;
  height: 26%;
}

.pillows i {
  position: absolute;
  bottom: 0;
  width: 62%;
  height: 100%;
  border-radius: 46% 46% 40% 40%;
  background: linear-gradient(#d8ccff, var(--lav));
  box-shadow: inset 0 0 0 3px #fff, 0 10px 20px rgba(0, 0, 0, 0.35);
}

.pillows i:first-child { left: 0; transform: rotate(-4deg); }
.pillows i:last-child { right: 0; background: linear-gradient(#ffc7e3, #ff8fc6); transform: rotate(5deg); }

.zzz {
  position: absolute;
  z-index: 3;
  left: 52%;
  top: 2%;
  font: 26px/1 var(--loud);
  color: var(--lav);
  pointer-events: none;
}

.zzz i {
  position: absolute;
  font-style: normal;
  opacity: 0;
  text-shadow: 0 0 10px var(--lav);
  animation: zzz 3s ease-out infinite;
}

.zzz i:nth-child(2) { animation-delay: 1s; font-size: 32px; }
.zzz i:nth-child(3) { animation-delay: 2s; font-size: 40px; }

@keyframes zzz {
  0% { transform: translate(0, 10px) scale(0.6); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(30px, -60px) scale(1); opacity: 0; }
}

.enter-label {
  font: clamp(24px, 6.4vw, 34px)/1.1 var(--loud);
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 0 18px var(--hot), 0 0 4px var(--hot);
  animation: beckon 1.6s ease-in-out infinite;
}

.enter-sub { font-size: 15px; color: var(--text-soft); }

@keyframes beckon { 50% { opacity: 0.55; transform: scale(0.97); } }

.standby-line {
  min-height: 2.6em;
  margin: 0 auto 6px;
  max-width: 340px;
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
  color: var(--lav);
}

/* ---------- TITLE ---------- */

#scr-title { padding-bottom: 0; }

.logo {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: clamp(4px, 2.5vh, 30px);
  flex: none;
}

/* The site's neon LED letters. */
.name {
  margin: 0;
  font: 400 clamp(68px, 21vw, 150px)/0.95 var(--cute);
  letter-spacing: 0.04em;
  padding-left: 0.04em;
  transform: skewX(-7deg);
  color: #fff7fc;
  white-space: nowrap;
}

.name span {
  display: inline-block;
  transform-origin: 50% 85%;
  --glow: var(--hot);
  text-shadow: 0 0 0.04em #fff, 0 0 0.1em var(--glow), 0 0 0.28em var(--glow), 0 0 0.6em var(--glow);
  animation: drop 0.6s var(--pop) both, bob 2.4s ease-in-out 1.2s infinite;
}

.name span:nth-child(2) { --glow: var(--lav); animation-delay: 0.07s, 1.3s; }
.name span:nth-child(3) { --glow: var(--mint); animation-delay: 0.14s, 1.4s; }
.name span:nth-child(4) { --glow: var(--butter); animation-delay: 0.21s, 1.5s; }
.name span:nth-child(5) { --glow: var(--sky); animation-delay: 0.28s, 1.6s; }
.name span:nth-child(6) { --glow: var(--hot); animation-delay: 0.35s, 1.7s; }

@keyframes drop {
  from { transform: translateY(-0.5em) scale(1.4); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes bob { 50% { transform: translateY(-0.05em); } }

.ribbon {
  position: relative;
  margin-top: -0.1em;
  font-size: clamp(30px, 9vw, 64px);
  transform: skewX(-7deg) rotate(-3deg);
  animation: ribbon 0.5s var(--pop) 0.65s both;
}

.ribbon-text {
  display: block;
  padding: 0.08em 0.5em 0.1em;
  font: 1em/1 var(--loud);
  letter-spacing: 0.08em;
  color: var(--night);
  background: linear-gradient(180deg, #fff08f, var(--butter) 55%, #f5c842);
  border-radius: 6px;
  box-shadow: 0 0 0 3px #fff, 0 0 28px rgba(255, 224, 102, 0.65), 0 10px 26px rgba(0, 0, 0, 0.4);
}

.sticker {
  position: absolute;
  top: -0.42em;
  right: -0.9em;
  padding: 0.14em 0.36em 0.18em;
  font: 0.42em/1 var(--cute);
  color: #fff;
  background: var(--hot);
  border-radius: 9px;
  box-shadow: 0 0 0 3px #fff, 0 0 14px rgba(255, 79, 163, 0.8);
  transform: rotate(12deg);
  animation: sticker 0.4s var(--pop) 1.05s both;
}

@keyframes ribbon { from { transform: skewX(-7deg) rotate(-3deg) scale(2.2); opacity: 0; } }
@keyframes sticker { from { transform: rotate(40deg) scale(0); } }

.tagline {
  margin: 14px 0 0;
  max-width: 340px;
  padding: 5px 14px 6px;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
  color: var(--text);
  background: rgba(22, 11, 46, 0.84); /* sits on the stage's own ADEERA sign: keep it readable */
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(185, 166, 255, 0.18);
}

.title-bubble {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  margin: auto 0 22px;
  max-width: min(330px, 86vw);
  min-height: 46px;
  font-size: 15px;
  cursor: pointer;
  animation: bubble-in 0.4s var(--pop) 1.4s both;
}

.title-bubble:active { transform: scale(0.97); }
.title-bear { width: 40px; height: 40px; flex: none; margin: -4px 0 -4px -6px; }

@keyframes bubble-in { from { transform: scale(0.6); opacity: 0; } }

.title-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(100%, 420px);
  align-self: center;
  margin-bottom: 14px;
  flex: none;
}

.title-menu .cta { width: 100%; min-height: 70px; font-size: 30px; }

.fanchip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 8px 8px;
  text-align: left;
  color: inherit;
  background: rgba(22, 11, 46, 0.66);
  border: 0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1.5px rgba(185, 166, 255, 0.4);
  cursor: pointer;
}

.lv,
.lv-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: none;
  line-height: 1;
  color: var(--ink);
  background: linear-gradient(135deg, var(--mint), var(--sky));
  border-radius: 14px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7);
}

.lv small,
.lv-chip small { font: 11px/1 var(--cute); }
.lv b,
.lv-chip b { font: 21px/1 var(--loud); }

.fan-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.fan-meta b { font: 16px/1.1 var(--loud); letter-spacing: 0.03em; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fan-meta > span { font-size: 13px; color: var(--lav); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.xpbar {
  display: block;
  height: 6px;
  margin-top: 2px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
}

.xpbar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--mint), var(--sky));
  box-shadow: 0 0 8px var(--mint);
  transition: width 0.8s var(--out);
}

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tile {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 9px 12px;
  text-align: left;
  color: #fff;
  background: rgba(22, 11, 46, 0.62);
  border: 0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
}

.tile svg { grid-row: span 2; width: 28px; height: 28px; color: var(--tile, var(--lav)); filter: drop-shadow(0 0 6px var(--tile, var(--lav))); }
.tile-t { font: 14px/1.1 var(--loud); letter-spacing: 0.04em; }
.tile small { font-size: 12px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile:hover { background: rgba(46, 18, 87, 0.8); box-shadow: inset 0 0 0 2px var(--tile, var(--lav)); }
.tile:active { transform: scale(0.96); }
.tile:nth-child(1) { --tile: var(--mint); }
.tile:nth-child(2) { --tile: var(--lav); }
.tile:nth-child(3) { --tile: var(--hot); }
.tile:nth-child(4) { --tile: var(--sky); }

.pip {
  position: absolute;
  top: -7px;
  right: -4px;
  padding: 3px 7px 4px;
  font: 11px/1 var(--loud);
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--hot);
  border-radius: 8px;
  box-shadow: 0 0 0 2px #fff, 0 0 12px rgba(255, 79, 163, 0.8);
  transform: rotate(6deg);
  animation: pip 1.2s ease-in-out infinite;
}

.pip.done { background: var(--mint); color: var(--ink); animation: none; }

@keyframes pip { 50% { transform: rotate(6deg) scale(1.12); } }

.ticker {
  position: relative;
  flex: none;
  height: calc(34px + env(safe-area-inset-bottom));
  margin: 0 calc(-1 * var(--sr)) 0 calc(-1 * var(--sl));
  padding-bottom: env(safe-area-inset-bottom);
  overflow: hidden;
  background: linear-gradient(90deg, rgba(255, 79, 163, 0.9), rgba(176, 108, 255, 0.9));
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.4);
}

.ticker::before {
  content: "LIVE ●";
  position: absolute;
  z-index: 2;
  left: 0;
  top: 0;
  height: 34px;
  padding: 0 14px 0 var(--sl);
  display: flex;
  align-items: center;
  font: 14px/1 var(--loud);
  letter-spacing: 0.08em;
  color: var(--ink);
  background: var(--butter);
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}

.ticker-track {
  display: flex;
  width: max-content;
  height: 34px;
  align-items: center;
  font: 15px/1 var(--cute);
  color: #fff;
  white-space: nowrap;
  padding-left: 96px;
  animation: ticker 38s linear infinite;
}

.ticker-track span { padding-right: 2.4em; }

@keyframes ticker { to { transform: translateX(-50%); } }

/* ---------- SONG SELECT ---------- */

/* Scrolls when everything can't fit (landscape, 360 px Androids, the home-screen app's insets);
   the margins/padding bleed it to the screen edges like .scroller, and START docks at the bottom. */
.select-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0 calc(-1 * var(--sr)) calc(-1 * var(--sb)) calc(-1 * var(--sl));
  padding: 0 var(--sr) var(--sb) var(--sl);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.select-body::-webkit-scrollbar { display: none; }

/* A screen's main action stays in reach: it docks to the bottom edge when the page has to scroll. */
.cta-dock {
  position: sticky;
  z-index: 3;
  bottom: 0;
  flex: none;
  display: flex;
  justify-content: center;
  width: calc(100% + var(--sl) + var(--sr));
  margin: 0 calc(-1 * var(--sr)) 0 calc(-1 * var(--sl));
  padding: 14px var(--sr) 0 var(--sl);
  background: linear-gradient(180deg, rgba(22, 11, 46, 0), rgba(22, 11, 46, 0.92) 14px);
  pointer-events: none; /* the fade never eats taps meant for what scrolls under it */
}

.cta-dock > * { pointer-events: auto; }

#scr-select .cta-dock { margin-top: auto; }
/* covers the bottom inset strip under the docked button (it is the last thing on the page) */
#scr-select .cta-dock::after { content: ""; position: absolute; top: 100%; left: 0; right: 0; height: var(--sb); background: rgba(22, 11, 46, 0.92); }

.carousel-wrap {
  position: relative;
  width: calc(100% + var(--sl) + var(--sr));
  margin: 2px calc(-1 * var(--sr)) 0 calc(-1 * var(--sl));
  flex: none;
}

.carousel {
  --cover: min(76vw, 330px, 38vh);
  display: flex;
  gap: 14px;
  padding: 18px calc(50% - var(--cover) / 2) 26px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  perspective: 1000px;
  -webkit-overflow-scrolling: touch;
}

.carousel::-webkit-scrollbar { display: none; }

.album {
  position: relative;
  flex: 0 0 var(--cover);
  aspect-ratio: 1;
  padding: 0;
  scroll-snap-align: center;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transform: rotateY(var(--ry, 0deg)) scale(var(--s, 1));
  transform-style: preserve-3d;
  transition: transform 0.25s var(--out), filter 0.25s;
  filter: brightness(var(--b, 1));
}

/* The CD peeks out of the focused album. */
.album::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 5%;
  left: 5%;
  width: 90%;
  height: 90%;
  border-radius: 50%;
  background:
    radial-gradient(circle, #160b2e 0 7%, #d9d2ef 7.5% 9%, transparent 9.5%),
    conic-gradient(from 30deg, #cfc6ff, #ffd6ec, #c8fff2, #d6ecff, #fff3c4, #cfc6ff);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  transition: transform 0.45s var(--out);
}

.album.is-focus::before { transform: translateX(26%) rotate(140deg); }

.album-art {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 12px;
  background: var(--al-bg, #2e1257);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 40px var(--al-glow, rgba(255, 79, 163, 0.35));
}

.album-art canvas { display: block; width: 100%; height: 100%; }

.album.is-locked .album-art canvas { filter: blur(7px) saturate(0.6) brightness(0.55); transform: scale(1.12); }

.album-lock {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12%;
  text-align: center;
}

.album-lock svg { width: 30px; height: 30px; color: #fff; opacity: 0.85; }

.dday {
  padding: 6px 12px 7px;
  font: clamp(14px, calc(var(--cover, 300px) * 0.075), 26px)/1 var(--loud); /* sized to the cover: "D-1" never wraps off */
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--ink);
  background: var(--butter);
  border-radius: 6px;
  box-shadow: 0 0 0 3px #fff, 0 0 20px rgba(255, 224, 102, 0.6);
  transform: rotate(-6deg);
}

.album-lock p { margin: 4px 0 0; font-size: 14px; line-height: 1.3; color: #fff; text-shadow: 0 1px 6px var(--night); }

.album-best-badge {
  position: absolute;
  z-index: 3;
  top: -10px;
  right: -10px;
  min-width: 44px;
  height: 44px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  font: 20px/1 var(--loud);
  color: var(--ink);
  background: var(--butter);
  border-radius: 50%;
  box-shadow: 0 0 0 3px #fff, 0 6px 14px rgba(0, 0, 0, 0.4);
  transform: rotate(10deg);
}

.car-arrow {
  position: absolute;
  z-index: 4;
  top: 50%;
  width: 48px;
  height: 48px;
  margin-top: -28px;
  padding: 0;
  display: none;
  place-items: center;
  color: #fff;
  background: rgba(22, 11, 46, 0.7);
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45);
  cursor: pointer;
}

.car-arrow svg { width: 22px; height: 22px; }
.car-arrow.prev { left: var(--sl); }
.car-arrow.next { right: var(--sr); }
.car-arrow.next svg { transform: scaleX(-1); }
.car-arrow:hover { background: rgba(255, 79, 163, 0.4); }

.car-dots {
  display: flex;
  gap: 7px;
  margin-top: -14px;
  flex: none;
}

.car-dots i {
  width: 7px;
  height: 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.28);
  transition: width 0.25s, background 0.25s;
}

.car-dots i.on { width: 22px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.car-dots i.locked { background: rgba(255, 255, 255, 0.12); }

.album-info {
  width: 100%;
  max-width: 460px;
  text-align: center;
  flex: none;
}

.album-kind { margin: 0; font-size: 13px; letter-spacing: 0.06em; color: var(--accent-2); }

.album-name {
  margin: 2px 0 0;
  font: clamp(26px, 8vw, 36px)/1.05 var(--loud);
  letter-spacing: 0.05em;
  color: #fff;
  text-shadow: 0 0 18px var(--accent);
}

.album-name .kr { display: inline-block; font-size: 0.55em; letter-spacing: 0; white-space: nowrap; color: var(--accent-2); text-shadow: none; }

.track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 6px 0 0;
  font-size: 18px;
  color: #fff;
}

.track-note { color: var(--accent); }

.album-style { margin: 2px 0 0; font-size: 14px; color: var(--text-soft); }

.album-best {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 26px;
  margin: 8px 0 0;
  font-size: 14px;
}

.album-best .none { color: var(--text-dim); }

.diffs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 520px;
  flex: none;
}

.diff {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 60px;
  padding: 6px 2px;
  color: #fff;
  background: rgba(22, 11, 46, 0.62);
  border: 0;
  border-radius: 16px;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--dc) 55%, transparent);
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
}

.diff b { font: 14px/1 var(--loud); letter-spacing: 0.05em; }
.diff span { font-size: 13px; line-height: 1; color: var(--dc); }
.diff:active { transform: scale(0.95); }
.diff:hover { box-shadow: inset 0 0 0 2px var(--dc); }

.diff[aria-checked="true"] {
  color: var(--ink);
  background: var(--dc);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 22px color-mix(in srgb, var(--dc) 70%, transparent);
  transform: translateY(-2px);
}

.diff[aria-checked="true"] span { color: var(--ink); opacity: 0.8; }

.diff.is-locked { color: var(--text-dim); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.14); }
.diff.is-locked span { color: var(--text-dim); font-size: 11px; }
.diff.is-locked svg { position: absolute; top: -7px; left: 50%; width: 18px; height: 18px; margin-left: -9px; padding: 3px; border-radius: 50%; color: var(--text-soft); background: var(--night); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.18); } /* badge on the border, clear of long names like COMEBACK */
.diff.is-locked[aria-checked="true"] { color: #fff; background: rgba(255, 255, 255, 0.12); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5); }
.diff.is-locked[aria-checked="true"] span { color: var(--text-soft); }

.diff.d0 { --dc: var(--mint); }
.diff.d1 { --dc: var(--sky); }
.diff.d2 { --dc: var(--hot); }
.diff.d3 { --dc: #d7a6ff; }
.diff.d3[aria-checked="true"]:not(.is-locked) { background: linear-gradient(135deg, var(--lav), var(--hot) 60%, var(--butter)); }

.lockline {
  margin: 0;
  font-size: 14px;
  color: var(--butter);
  text-align: center;
  flex: none;
}

.lockline[hidden] { display: none; }

/* Fanchant guide (응원법): the agency-style cheat sheet for the focused album. */
.chant-guide {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  width: 100%;
  max-width: 520px;
  margin: 6px 0 0;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.2;
  border-radius: 18px;
  background: rgba(22, 11, 46, 0.55);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 45%, transparent);
  flex: none;
}

.chant-guide .eyebrow { grid-column: 1 / -1; margin-bottom: 2px; color: var(--accent-2); }
.chant-guide dt { font: 12px/1.5 var(--loud); letter-spacing: 0.1em; color: var(--text-dim); }
.chant-guide dd { margin: 0; color: #fff; font-family: var(--loud); letter-spacing: 0.04em; }
.chant-guide dd small { font: 13px var(--cute); letter-spacing: 0; color: var(--text-soft); }

#btn-start {
  width: min(100%, 420px);
  flex: none;
}

/* The cover sizes from the height actually left between the safe insets (38vh ignored them). */
@supports (height: 100dvh) {
  .carousel { --cover: min(76vw, 330px, calc((100dvh - var(--st) - var(--sb)) * 0.37)); }
}

/* ---------- PAUSE ---------- */

.overlay {
  z-index: 10;
  align-items: center;
  justify-content: center;
  background: rgba(10, 4, 24, 0.72);
  -webkit-backdrop-filter: blur(6px) saturate(0.7);
  backdrop-filter: blur(6px) saturate(0.7);
  animation: fade-in 0.2s both;
}

@keyframes fade-in { from { opacity: 0; } }

.pause-card {
  width: min(100%, 380px);
  padding: 26px 22px 22px;
  text-align: center;
  animation: pop-in 0.35s var(--pop) both;
}

@keyframes pop-in { from { transform: scale(0.85); opacity: 0; } }

.pause-h {
  margin: 8px 0 4px;
  font: 56px/1 var(--loud);
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 0 22px var(--lav);
}

.pause-say { margin: 0 0 20px; color: var(--text-soft); font-size: 15px; }
.pause-btns { display: flex; flex-direction: column; gap: 10px; }

/* ---------- FAIL ---------- */

#scr-fail { background: linear-gradient(180deg, rgba(10, 4, 24, 0.86), rgba(22, 11, 46, 0.72) 50%, rgba(10, 4, 24, 0.92)); }

/* Scrolls when it can't fit (landscape, small iPhones with Safari's bars); ENCORE / SONGS dock at the bottom. */
.fail-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 calc(-1 * var(--sr)) calc(-1 * var(--sb)) calc(-1 * var(--sl));
  padding: 0 var(--sr) var(--sb) var(--sl);
  text-align: center;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.fail-body::-webkit-scrollbar { display: none; }

.fail-nap { position: relative; width: min(42vw, 190px); flex: none; margin-top: auto; }
.fail-bear { display: block; width: 100%; height: auto; filter: drop-shadow(0 0 20px rgba(185, 166, 255, 0.35)) saturate(0.85); transform-origin: 50% 90%; animation: breathe 3.6s ease-in-out infinite; }

.fail-zzz {
  position: absolute;
  top: 18%;
  right: -2%;
  width: 80px;
  height: 60px;
  font: 30px/1 var(--loud);
  color: var(--lav);
}

.fail-zzz i { position: absolute; left: 20px; bottom: 0; font-style: normal; opacity: 0; animation: zzz 2.6s ease-out infinite; }
.fail-zzz i:nth-child(2) { animation-delay: 0.85s; font-size: 38px; }
.fail-zzz i:nth-child(3) { animation-delay: 1.7s; font-size: 46px; }

.fail-h {
  display: flex;
  flex-direction: column;
  margin: 0;
  font: clamp(30px, min(12.5vw, 9vh), 76px)/0.98 var(--loud); /* by width and height: 2 × 76 px ate landscape */
  letter-spacing: 0.04em;
  color: #e6dcff;
  text-shadow: 0 0 24px rgba(185, 166, 255, 0.55);
  transform: skewX(-7deg);
}

.fail-h span:last-child { color: var(--lav); }

.fail-kr { margin: 0; font-size: 15px; color: var(--text-dim); }

.fail-progress {
  width: min(100%, 420px);
  margin-top: 8px;
  padding: 16px 18px 14px;
  text-align: left;
}

.fail-bar-t { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin: 0 0 12px; }
.fail-bar-t b { font: 22px/1 var(--loud); letter-spacing: 0.04em; white-space: nowrap; }
.fail-bar-t span { font-size: 15px; color: var(--butter); }

.fail-track {
  position: relative;
  display: block;
  height: 14px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  overflow: visible;
}

.fail-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--hot), var(--lav));
  box-shadow: 0 0 12px rgba(255, 79, 163, 0.6);
  transition: width 1s var(--out);
}

.fail-ghost {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--butter);
  box-shadow: 0 0 8px var(--butter);
}

.fail-ghost::after {
  content: "best";
  position: absolute;
  bottom: -17px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--butter);
}

.fail-marks { position: absolute; inset: 0; }
.fail-marks i { position: absolute; top: 3px; bottom: 3px; width: 1px; background: rgba(255, 255, 255, 0.28); }

.fail-xp { margin: 16px 0 0; font-size: 14px; color: var(--text-soft); }
.fail-say { margin: 6px 0 0; max-width: 340px; font-size: 16px; color: var(--text-soft); min-height: 2.6em; }

.fail-btns {
  position: sticky;
  z-index: 3;
  bottom: 0;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: calc(100% + var(--sl) + var(--sr));
  margin: auto calc(-1 * var(--sr)) 0 calc(-1 * var(--sl));
  padding: 14px var(--sr) 0 var(--sl);
  background: linear-gradient(180deg, rgba(10, 4, 24, 0), rgba(10, 4, 24, 0.94) 14px);
}

.fail-btns::after { content: ""; position: absolute; top: 100%; left: 0; right: 0; height: var(--sb); background: rgba(10, 4, 24, 0.94); }
.fail-btns > .btn { width: min(100%, 420px); }
.fail-btns .cta { min-height: 76px; font-size: 32px; }

@media (max-height: 640px) {
  .fail-nap,
  .fail-kr { display: none; }
  .fail-h { margin-top: auto; }
}

/* ---------- RESULTS ---------- */

#scr-results { background: linear-gradient(180deg, rgba(22, 11, 46, 0.78), rgba(22, 11, 46, 0.5) 30%, rgba(22, 11, 46, 0.62) 60%, rgba(22, 11, 46, 0.9)); }

.fx {
  position: absolute;
  inset: 0;
  z-index: 6;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.res-grid {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0 calc(-1 * var(--sr)) calc(-1 * var(--sb)) calc(-1 * var(--sl));
  padding: 4px var(--sr) var(--sb) var(--sl);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.res-grid::-webkit-scrollbar { display: none; }
.res-col { display: flex; flex-direction: column; gap: 7px; }
.res-right { flex: 1 0 auto; }

.res-hero { padding: 11px 14px 12px; }

.res-song {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  min-width: 0;
  font-size: 15px;
  color: #fff;
}

.res-song > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.diff-tag {
  flex: none;
  padding: 3px 8px 4px;
  font: 12px/1 var(--loud);
  letter-spacing: 0.06em;
  color: var(--ink);
  background: var(--dc, var(--sky));
  border-radius: 6px;
}

.res-mods { display: flex; gap: 4px; flex: none; }

.res-hero-row { display: flex; align-items: center; gap: 14px; }

.res-grade {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  flex: none;
  border-radius: 20px;
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.18), transparent 70%), var(--gc, rgba(255, 255, 255, 0.08));
  box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, 0.75), 0 0 34px var(--gglow, transparent);
  opacity: 0;
}

.res-grade b {
  font: 56px/0.9 var(--loud);
  color: #fff;
  text-shadow: 0 3px 0 rgba(22, 11, 46, 0.5), 0 0 22px var(--gglow, transparent);
}

.res-grade span {
  position: absolute;
  bottom: -9px;
  padding: 4px 9px 5px;
  font: 12px/1 var(--loud);
  letter-spacing: 0.08em;
  color: var(--ink);
  background: var(--butter);
  border-radius: 6px;
  box-shadow: 0 0 0 2px #fff;
  white-space: nowrap;
  transform: rotate(-4deg);
}

.res-grade.g-splus { --gc: linear-gradient(135deg, #ffe066, #ff4fa3 55%, #b9a6ff); --gglow: rgba(255, 224, 102, 0.8); }
.res-grade.g-s { --gc: linear-gradient(135deg, #ff4fa3, #b06cff); --gglow: rgba(255, 79, 163, 0.75); }
.res-grade.g-a { --gc: linear-gradient(135deg, #5ef2d0, #7cc8ff); --gglow: rgba(94, 242, 208, 0.6); }
.res-grade.g-b { --gc: linear-gradient(135deg, #7cc8ff, #b9a6ff); --gglow: rgba(124, 200, 255, 0.5); }
.res-grade.g-c { --gc: linear-gradient(135deg, #8a7fa8, #5a4a80); --gglow: rgba(185, 166, 255, 0.35); }
.res-grade.g-a b,
.res-grade.g-b b { color: var(--ink); text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5); }

.res-grade.slam { opacity: 1; animation: slam 0.45s var(--pop) both; }

@keyframes slam {
  0% { transform: scale(2.6) rotate(-14deg); opacity: 0; }
  60% { transform: scale(0.92) rotate(2deg); opacity: 1; }
  100% { transform: none; opacity: 1; }
}

.res-score { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }

.res-score-n {
  font: clamp(32px, 10vw, 54px)/1 var(--loud);
  letter-spacing: 0.02em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 20px rgba(255, 79, 163, 0.55);
  white-space: nowrap;
}

.res-record {
  align-self: flex-start;
  max-width: 100%;
  padding: 4px 9px 5px;
  font: 13px/1 var(--loud);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.05em;
  color: var(--ink);
  background: linear-gradient(90deg, var(--butter), #ffb3d6);
  border-radius: 6px;
  box-shadow: 0 0 16px rgba(255, 224, 102, 0.6);
  transform: skewX(-7deg);
  animation: record 0.5s var(--pop) both, record-glow 1.2s ease-in-out 0.5s infinite;
}

.res-record[hidden] { display: none; }

@keyframes record { from { transform: skewX(-7deg) scale(0); } }
@keyframes record-glow { 50% { box-shadow: 0 0 28px rgba(255, 224, 102, 0.95); } }

.res-badges { display: flex; flex-wrap: wrap; gap: 5px; min-height: 0; }
.res-badges .chip { height: 22px; font-size: 12px; padding: 0 9px; }
.res-badges .chip { animation: pop-in 0.35s var(--pop) both; }

.res-score-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; }

.stamp {
  position: relative;
  z-index: 4;
  flex: none;
  white-space: nowrap;
  padding: 5px 10px 6px;
  font: 17px/1 var(--loud);
  letter-spacing: 0.08em;
  color: var(--hot);
  border-radius: 8px;
  box-shadow: inset 0 0 0 3px var(--hot);
  background: rgba(255, 79, 163, 0.08);
  transform: rotate(-8deg);
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 10px rgba(255, 79, 163, 0.6);
  mix-blend-mode: screen;
}

.stamp.is-fc { color: var(--mint); box-shadow: inset 0 0 0 3px var(--mint); background: rgba(94, 242, 208, 0.08); text-shadow: 0 0 10px rgba(94, 242, 208, 0.6); }
.stamp.is-ap { font-size: 14px; line-height: 0.95; text-align: center; padding: 5px 9px 6px; color: var(--butter); box-shadow: inset 0 0 0 3px var(--butter); background: rgba(255, 224, 102, 0.1); text-shadow: 0 0 12px rgba(255, 224, 102, 0.8); }
.stamp.slam { opacity: 1; animation: stamp 0.5s var(--pop) both; }

@keyframes stamp {
  0% { transform: rotate(-8deg) scale(3.2); opacity: 0; }
  55% { transform: rotate(-8deg) scale(0.9); opacity: 1; }
  100% { transform: rotate(-8deg) scale(1); opacity: 1; }
}

.res-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 14px;
  padding: 11px 14px 9px;
}

.judges { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }

.judges li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font: 13px/1.2 var(--loud);
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.2s, transform 0.25s var(--pop);
}

.judges li.on { opacity: 1; transform: none; }
.judges li b { font-variant-numeric: tabular-nums; color: #fff; }
.judges li .j-kr { font: 11px/1 var(--cute); letter-spacing: 0; opacity: 0.6; margin-left: 4px; }
.judges .j-pp { color: #fff; text-shadow: 0 0 8px var(--butter); }
.judges .j-pp::first-letter { color: var(--hot); }
.judges .j-p { color: #fff6cf; }
.judges .j-gr { color: var(--mint); }
.judges .j-gd { color: var(--lav); }
.judges .j-miss { color: #8a7fa8; }

.hist-wrap { display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }

.hist {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 56px;
  padding-bottom: 1px;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.25);
}

.hist::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.35);
}

.hist i {
  flex: 1;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--sky);
  transform-origin: 50% 100%;
  transform: scaleY(0);
  transition: transform 0.5s var(--out);
}

.hist i.late { background: var(--lav); }
.hist i.mid { background: #fff; box-shadow: 0 0 6px var(--butter); }
.hist.on i { transform: scaleY(1); }

.hist-axis { display: flex; justify-content: space-between; align-items: baseline; margin-top: 5px; font-size: 11px; letter-spacing: 0.06em; }
.hist-axis .eager { color: var(--sky); }
.hist-axis .sleepy { color: var(--lav); }
.hist-axis b { font: 12px/1 var(--loud); color: #fff; letter-spacing: 0.02em; }

.res-mini {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-soft);
}

.res-mini b { font: 12px/1 var(--loud); color: #fff; letter-spacing: 0.03em; }

.res-race { padding: 11px 14px 9px; }
.res-race .card-h { margin-bottom: 8px; }

.race { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }

.race li {
  position: relative;
  display: grid;
  grid-template-columns: 22px 100px 1fr 58px;
  align-items: center;
  gap: 8px;
  height: 19px;
  font-size: 13px;
}

.race .r-ico { width: 22px; height: 22px; }
.race .r-name { font: 12px/1 var(--loud); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.race .r-bar { position: relative; height: 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.race .r-bar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 6px; background: var(--rc, var(--lav)); box-shadow: 0 0 10px var(--rc, var(--lav)); }
.race .r-pts { font: 13px/1 var(--loud); text-align: right; font-variant-numeric: tabular-nums; color: #fff; }
.race li.you .r-name { color: var(--hot); }
.race li.you { --rc: linear-gradient(90deg, var(--hot), var(--butter)); }
.race li.you .r-bar i { background: linear-gradient(90deg, var(--hot), var(--butter)); box-shadow: 0 0 12px var(--hot); }
.race li.lead::after {
  content: "";
  position: absolute;
  left: -2px;
  top: -9px;
  width: 16px;
  height: 16px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 8l4.5 4L12 5l4.5 7L21 8l-2 11H5Z' fill='%23ffe066' stroke='%23fff' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E");
  transform: rotate(-16deg);
  animation: pop-in 0.35s var(--pop) both;
}

.race-place {
  min-height: 1.3em;
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.3;
  color: var(--text-soft);
}

.race-place b { font: 15px/1 var(--loud); letter-spacing: 0.04em; color: var(--butter); margin-right: 6px; }

.res-xp { padding: 10px 14px 11px; }

.xp-head { display: flex; align-items: center; gap: 10px; }
.xp-head .lv-chip { width: 38px; height: 38px; border-radius: 11px; }
.xp-head .lv-chip b { font-size: 17px; }
.xp-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.xp-title { min-width: 0; font: 15px/1.1 var(--loud); letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp-gain { font: 18px/1 var(--loud); color: var(--mint); font-variant-numeric: tabular-nums; }

.xp-track {
  position: relative;
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}

.xp-track i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--mint), var(--sky));
  box-shadow: 0 0 10px var(--mint);
}

.xp-parts { display: flex; flex-wrap: wrap; gap: 0 4px; margin: 7px 0 0; font-size: 12px; line-height: 1.4; color: var(--text-dim); }
.xp-parts span { white-space: nowrap; }
.xp-parts span + span::before { content: "· "; }

.res-say {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 4px;
}

.res-bear { width: 40px; height: 40px; flex: none; }
.res-say p { margin: 0; font-size: 14px; line-height: 1.25; color: #fff; text-shadow: 0 1px 8px var(--night); }

.res-tips { display: flex; flex-direction: column; gap: 6px; }
.res-tips:empty,
.res-tips:not(:has(> :not([hidden]))) { display: none; }

.goal-chip,
.offset-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 0;
  padding: 4px 6px 4px 10px;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  color: #fff;
  background: rgba(255, 224, 102, 0.1);
  border-radius: 14px;
  box-shadow: inset 0 0 0 1.5px rgba(255, 224, 102, 0.5);
  animation: pop-in 0.35s var(--pop) both;
}

.goal-chip[hidden],
.offset-chip[hidden] { display: none; }
.goal-chip > span,
.offset-chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.goal-chip { padding-right: 12px; }
/* NEXT may take two lines on a phone: its reward ("· +120 XP") is the point of the chip. */
.goal-chip > span { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.goal-chip::before { content: "NEXT"; flex: none; padding: 3px 6px 4px; font: 11px/1 var(--loud); letter-spacing: 0.08em; color: var(--ink); background: var(--butter); border-radius: 5px; }
.offset-chip { min-height: 48px; background: rgba(124, 200, 255, 0.1); box-shadow: inset 0 0 0 1.5px rgba(124, 200, 255, 0.5); justify-content: space-between; cursor: pointer; }
.offset-chip .mini-btn { flex: none; min-height: 38px; padding: 0 12px; font-size: 13px; color: var(--ink); background: var(--sky); box-shadow: none; }

.res-btns {
  position: sticky;
  z-index: 5;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  background: linear-gradient(180deg, transparent, rgba(22, 11, 46, 0.94) 22px);
  transition: opacity 0.3s, transform 0.3s var(--out);
}

.res-btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.res-btn-grid .cta { grid-column: 1 / -1; min-height: 64px; font-size: 30px; }
.res-btn-grid .btn:not(.cta) { min-height: 50px; }
.res-btns.is-waiting { opacity: 0; transform: translateY(14px); pointer-events: none; }

.res-reveal { opacity: 0; transform: translateY(10px); transition: opacity 0.35s, transform 0.4s var(--out); }
.res-reveal.on { opacity: 1; transform: none; }

.skip-hint {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: calc(var(--sb) + 6px);
  margin: 0;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-soft);
  background: rgba(22, 11, 46, 0.7);
  border-radius: 999px;
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity 0.3s;
  animation: beckon 1.6s ease-in-out infinite;
}

.skip-hint.off { opacity: 0; animation: none; }

/* Golden Pillow */
.trophy {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 45%, rgba(255, 224, 102, 0.28), rgba(22, 11, 46, 0.8) 60%);
  animation: fade-in 0.25s both;
}

.trophy[hidden] { display: none; }

.trophy-rays {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 180vmax;
  height: 180vmax;
  margin: -90vmax 0 0 -90vmax;
  background: repeating-conic-gradient(from 0deg, rgba(255, 224, 102, 0.22) 0 6deg, transparent 6deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0 18%, transparent 55%);
  mask: radial-gradient(circle, #000 0 18%, transparent 55%);
  animation: rays 12s linear infinite;
}

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

.pillow {
  position: relative;
  width: min(62vw, 300px);
  height: auto;
  filter: drop-shadow(0 0 30px rgba(255, 224, 102, 0.7)) drop-shadow(0 14px 20px rgba(0, 0, 0, 0.4));
  animation: pillow-drop 0.9s var(--pop) both;
}

.pillow .win { font: 54px/1 var(--loud); fill: var(--night); }
.pillow .plate { font: 8px/1 var(--loud); letter-spacing: 1px; fill: #fff6c4; }

@keyframes pillow-drop {
  0% { transform: translateY(-80vh) rotate(-20deg); }
  60% { transform: translateY(16px) rotate(4deg); }
  80% { transform: translateY(-8px) rotate(-1deg); }
  100% { transform: none; }
}

.trophy-t {
  position: relative;
  margin: 12px 0 0;
  font: clamp(28px, 8vw, 44px)/1 var(--loud);
  letter-spacing: 0.1em;
  color: var(--butter);
  text-shadow: 0 0 20px rgba(255, 224, 102, 0.8);
  animation: pop-in 0.4s var(--pop) 0.6s both;
}

.trophy-sub { position: relative; margin: 8px 0 0; font-size: 17px; color: #fff; animation: pop-in 0.4s var(--pop) 0.8s both; }

/* Level-up card */
.levelup {
  position: absolute;
  z-index: 9;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 4, 24, 0.7);
  perspective: 900px;
  animation: fade-in 0.2s both;
}

.levelup[hidden] { display: none; }

.levelup-card {
  width: min(86vw, 340px);
  padding: 26px 22px 22px;
  text-align: center;
  border-radius: 26px;
  background: linear-gradient(160deg, var(--mint), var(--sky) 45%, var(--lav));
  color: var(--ink);
  box-shadow: 0 0 0 4px #fff, 0 0 60px rgba(94, 242, 208, 0.6), 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: flip-in 0.7s var(--pop) both;
}

.levelup-card .eyebrow { color: var(--ink); opacity: 0.75; }
.levelup-n { display: block; font: 110px/0.95 var(--loud); text-shadow: 0 4px 0 rgba(255, 255, 255, 0.6); }
.levelup-t { margin: 4px 0 0; font: 22px/1.1 var(--loud); letter-spacing: 0.03em; }
.levelup-list { margin: 14px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.levelup-list li { padding: 7px 10px; background: rgba(255, 255, 255, 0.55); border-radius: 12px; }

@keyframes flip-in {
  0% { transform: rotateY(-180deg) scale(0.6); opacity: 0; }
  100% { transform: none; opacity: 1; }
}

.unbox-root {
  position: absolute;
  z-index: 9;
  inset: 0;
}

.unbox-root[hidden] { display: none; }

/* The unboxing has its own label + skip in that corner: the screen's header must not bleed through. */
.screen:has(> .unbox-root:not([hidden]):not(:empty)) > .bar { visibility: hidden; }

/* The results screen takes focus while the ceremony hides its buttons: no ring around the whole page. */
#scr-results:focus-visible { outline: none; }

/* ---------- TODAY'S STAGE ---------- */

.daily-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 8px 0 12px;
}

.streak-card { display: flex; align-items: center; gap: 18px; padding: 18px 18px 16px; }

.streak-num { display: flex; align-items: center; gap: 10px; }
.streak-num b { font: 64px/0.9 var(--loud); color: var(--butter); text-shadow: 0 0 22px rgba(255, 224, 102, 0.6); }
.streak-num span { font: 14px/1.05 var(--loud); letter-spacing: 0.08em; color: #fff; }

.streak-side { display: flex; flex-direction: column; gap: 6px; margin-left: auto; align-items: flex-end; text-align: right; }
.passes { display: flex; gap: 6px; }
.passes svg { width: 34px; height: 26px; }
.passes .empty { opacity: 0.22; filter: grayscale(1); }
.streak-note { margin: 0; font-size: 13px; line-height: 1.3; color: var(--text-soft); }

.cal-card { padding: 16px 16px 14px; }

.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 0;
  padding: 16px 0 0;
  list-style: none;
}

.daily-say { min-height: 44px; }
.daily-say p { font-size: 15px; }

.cal li {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  font: 13px/1 var(--loud);
  color: var(--text-dim);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.12);
}

.cal li small { position: absolute; top: -14px; font: 11px/1 var(--cute); color: var(--text-soft); }
.cal li svg { position: absolute; width: 74%; height: 74%; }
.cal li.done { color: transparent; background: rgba(255, 79, 163, 0.16); box-shadow: inset 0 0 0 2px var(--hot); }
.cal li.done svg { color: var(--hot); transform: rotate(-12deg); filter: drop-shadow(0 0 6px rgba(255, 79, 163, 0.7)); }
.cal li.pass { color: transparent; background: rgba(185, 166, 255, 0.14); box-shadow: inset 0 0 0 2px var(--lav); }
.cal li.pass svg { width: 70%; }
/* days before the first stage: dimmed cell, but the weekday letter above it stays readable (no opacity on the li) */
.cal li.before { color: rgba(246, 239, 255, 0.24); background: rgba(255, 255, 255, 0.022); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.055); }
.cal li.missed::after { content: ""; position: absolute; width: 50%; height: 2px; background: rgba(255, 255, 255, 0.2); transform: rotate(-35deg); }
.cal li.today { color: #fff; box-shadow: inset 0 0 0 2.5px var(--butter), 0 0 16px rgba(255, 224, 102, 0.5); animation: today 1.4s ease-in-out infinite; }
.cal li.today.done { color: transparent; animation: none; box-shadow: inset 0 0 0 2.5px var(--butter), 0 0 18px rgba(255, 79, 163, 0.6); }

@keyframes today { 50% { box-shadow: inset 0 0 0 2.5px var(--butter), 0 0 4px rgba(255, 224, 102, 0.2); } }

.cal li.stamped svg { animation: stamp-paw 0.5s var(--pop) both; }

@keyframes stamp-paw { 0% { transform: rotate(-12deg) scale(2.4); opacity: 0; } 100% { transform: rotate(-12deg) scale(1); opacity: 1; } }

.today-row { display: grid; grid-template-columns: 1fr; gap: 12px; }

.today-card { display: flex; align-items: center; gap: 14px; padding: 14px; }
.today-cover { width: 88px; height: 88px; flex: none; overflow: hidden; border-radius: 10px; box-shadow: 0 0 0 2px #fff, 0 8px 18px rgba(0, 0, 0, 0.4); }
.today-cover canvas { display: block; width: 100%; height: 100%; }
.today-meta { min-width: 0; }
.today-meta h3 { margin: 4px 0 2px; font: 20px/1.15 var(--cute); color: #fff; }
.today-album { margin: 0; font-size: 13px; color: var(--lav); }

.mod-card { padding: 14px 16px; }
.mod-card h3 { margin: 4px 0 2px; font: 22px/1.1 var(--loud); letter-spacing: 0.05em; color: var(--butter); text-shadow: 0 0 14px rgba(255, 224, 102, 0.5); }
.mod-desc { margin: 0 0 8px; font-size: 14px; color: var(--text-soft); }

.diffs.compact .diff { min-height: 52px; }

.daily-done { margin: 0; text-align: center; font-size: 14px; color: var(--mint); }
.daily-done[hidden] { display: none; }

#btn-daily { width: 100%; }
.next-in { margin: 0; text-align: center; font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* PLAY TODAY'S STAGE docks to the bottom of the scroller instead of hiding below the fold, and the
   difficulty row docks with it (on a 667 px phone the row sat hidden under the docked button).
   No full-width band when the daily fits (it sits mid-page): a night halo lifts the pill off what scrolls under it. */
#scr-daily .cta-dock { flex-direction: column; align-items: stretch; gap: 12px; padding-top: 0; background: none; }
#scr-daily .cta-dock .diffs { align-self: center; }

/* Phones under 820 px tall: the daily always scrolls, so the dock is stuck and gets the night band behind the row. */
@media (max-width: 899px) and (max-height: 820px) {
  #scr-daily .cta-dock { gap: 8px; padding-top: 12px; background: linear-gradient(180deg, rgba(22, 11, 46, 0), rgba(22, 11, 46, 0.92) 12px); }
  /* and the bottom inset strip under it (the scroller's padding), so scrolled content never shows beneath the stuck dock */
  #scr-daily .cta-dock::after { content: ""; position: absolute; top: 100%; left: 0; right: 0; height: var(--sb); background: rgba(22, 11, 46, 0.92); }
}
#btn-daily { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.8), 0 0 28px rgba(255, 224, 102, 0.42), 0 10px 30px rgba(255, 79, 163, 0.5), 0 0 0 10px rgba(22, 11, 46, 0.55), 0 -8px 28px 12px rgba(22, 11, 46, 0.75); }

@media (max-width: 480px) {
  #btn-daily { gap: 8px; padding: 0 14px; font-size: clamp(19px, 6vw, 25px); } /* the label ran into the pill's edge */
}

/* Most phones: tighter calendar and cards, so the daily fits with less scrolling. */
@media (max-height: 820px) {
  .daily-body { gap: 10px; padding-top: 4px; }
  .daily-say { min-height: 0; }
  .streak-card { padding: 12px 16px 10px; }
  .streak-num b { font-size: 52px; }
  .cal-card { padding: 12px 14px 10px; }
  .cal { gap: 5px; padding-top: 14px; }
  .cal li { font-size: 11px; }
  .today-card { padding: 10px 12px; }
  .today-cover { width: 64px; height: 64px; }
  .mod-card { padding: 10px 14px; }
}

/* ---------- MIC CHECK ---------- */

.settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 8px 0 12px;
}

.group { display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 14px; }
.group-h { margin: 0 0 2px; font: 13px/1 var(--loud); letter-spacing: 0.16em; color: var(--lav); }
.group.danger .group-h { color: var(--hot); }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.row-l { flex: none; width: 110px; font-size: 16px; line-height: 1.15; }
.row-l small { display: block; font-size: 12px; color: var(--text-dim); }
.row output { flex: none; min-width: 64px; text-align: right; font: 15px/1 var(--loud); font-variant-numeric: tabular-nums; color: #fff; }
.row.switch { justify-content: space-between; cursor: pointer; }
.row.switch .row-l { width: auto; }

.nudges { justify-content: flex-end; gap: 8px; min-height: 48px; }

input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 32px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--hot) 0 var(--fill, 50%), rgba(255, 255, 255, 0.14) var(--fill, 50%));
}

input[type="range"]::-moz-range-track { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.14); }
input[type="range"]::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--hot); }

input[type="range"]::-webkit-slider-thumb {
  width: 28px;
  height: 28px;
  margin-top: -10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px var(--hot), 0 0 14px rgba(255, 79, 163, 0.7);
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px var(--hot), 0 0 14px rgba(255, 79, 163, 0.7);
}

input[type="range"]:focus-visible { outline-offset: 2px; border-radius: 8px; }
input[type="range"]:disabled { opacity: 0.35; }

input[type="checkbox"][role="switch"] {
  position: relative;
  width: 56px;
  height: 32px;
  margin: 0;
  flex: none;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.25);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background 0.2s;
}

input[type="checkbox"][role="switch"]::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s var(--pop);
}

input[type="checkbox"][role="switch"]:checked { background: var(--mint); box-shadow: 0 0 14px rgba(94, 242, 208, 0.5); }
input[type="checkbox"][role="switch"]:checked::after { transform: translateX(24px); }

.seg-toggle {
  display: flex;
  margin-left: auto;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.2);
}

.seg-toggle button {
  min-width: 76px;
  min-height: 48px;
  padding: 0 14px;
  font: 14px/1 var(--loud);
  letter-spacing: 0.06em;
  color: var(--text-soft);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.seg-toggle button[aria-pressed="true"] { color: var(--ink); background: var(--lav); }
.seg-toggle.three button { min-width: 0; padding: 0 11px; font-size: 13px; }
.row.wrap { flex-wrap: wrap; row-gap: 6px; }

.btn.soundcheck {
  align-self: stretch;
  min-height: 58px;
  margin-top: 4px;
  font: 19px/1 var(--loud);
  letter-spacing: 0.06em;
  color: var(--ink);
  background: linear-gradient(135deg, var(--mint), var(--sky));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75), 0 0 22px rgba(94, 242, 208, 0.35);
}

.btn.soundcheck small { font: 13px/1 var(--cute); opacity: 0.75; }

.hint { margin: 0; font-size: 13px; line-height: 1.35; color: var(--text-dim); }

.keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }

.keycap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 64px;
  padding: 6px 2px;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border: 0;
  border-radius: 14px;
  box-shadow: inset 0 0 0 2px var(--kc, var(--lav)), inset 0 -4px 0 rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.1s;
}

.keycap b { font: 18px/1 var(--loud); letter-spacing: 0.02em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.keycap span { font-size: 11px; color: var(--kc, var(--lav)); }
.keycap:active { transform: translateY(2px); }
.keycap.listening { background: var(--kc); color: var(--ink); animation: beckon 0.8s ease-in-out infinite; }
.keycap.listening span { color: var(--ink); }

.credits { margin: 6px 0 0; text-align: center; font-size: 13px; color: var(--text-dim); }
.credits a { display: inline-block; margin: -14px 0; padding: 14px 6px; color: var(--lav); } /* 44 px tall to the thumb, same line height */

/* Soundcheck modal */
.modal {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr); /* the card can size to (and scroll inside) the viewport */
  place-items: center;
  padding: var(--st) var(--sr) var(--sb) var(--sl);
  background: rgba(10, 4, 24, 0.8);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade-in 0.2s both;
}

.modal[hidden] { display: none; }

.calib-card {
  width: min(100%, 420px);
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  animation: pop-in 0.35s var(--pop) both;
}

.calib-card > * { flex: none; } /* scroll, never squash the pad */

.calib-h { margin: 0; font: 36px/1 var(--loud); letter-spacing: 0.08em; color: #fff; text-shadow: 0 0 18px var(--mint); }
.calib-say { margin: 0; min-height: 2.6em; font-size: 15px; line-height: 1.3; color: var(--text-soft); }

.calib-pad {
  position: relative;
  display: grid;
  place-items: center;
  width: min(52vw, 200px);
  aspect-ratio: 1;
  margin: 6px 0;
  padding: 0;
  color: #fff;
  background: radial-gradient(circle, rgba(94, 242, 208, 0.18), rgba(22, 11, 46, 0.4) 70%);
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(94, 242, 208, 0.6);
  cursor: pointer;
  touch-action: none;
}

.calib-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--mint), 0 0 30px var(--mint);
  opacity: 0;
}

.calib-pad.tap { animation: tap 0.14s ease-out; }

@keyframes tap { 50% { transform: scale(0.94); } }

.calib-count { font: 34px/1 var(--loud); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }

.dotplot {
  position: relative;
  width: 100%;
  height: 56px;
  margin-top: 4px;
}

.dp-axis { position: absolute; left: 0; right: 0; top: 24px; height: 2px; background: rgba(255, 255, 255, 0.2); border-radius: 1px; }
.dp-zero { position: absolute; left: 50%; top: 10px; width: 2px; height: 30px; margin-left: -1px; background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.dp-med { position: absolute; top: 6px; width: 3px; height: 38px; margin-left: -1.5px; background: var(--butter); border-radius: 2px; box-shadow: 0 0 8px var(--butter); display: none; }
.dp-med.on { display: block; transition: left 0.4s var(--out); }
.dp-lab { position: absolute; bottom: 0; font-size: 11px; color: var(--text-dim); }
.dp-lab.l { left: 0; }
.dp-lab.c { left: 50%; transform: translateX(-50%); color: var(--mint); }
.dp-lab.r { right: 0; }
.dp-dots { position: absolute; inset: 0; }

.dp-dots i {
  position: absolute;
  top: 19px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--hot);
  box-shadow: 0 0 8px var(--hot);
  animation: pop-in 0.25s var(--pop) both;
}

.dp-dots i.warm { background: transparent; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4); }
.dp-dots i.out { background: transparent; box-shadow: inset 0 0 0 2px var(--hot); }

.calib-result { margin: 0; min-height: 1.4em; font: 17px/1.3 var(--cute); color: var(--butter); }
.calib-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; }
.calib-btns .btn { flex: 1 1 120px; }
.calib-btns [hidden] { display: none; }

/* ---------- HUD (hud.js) ---------- */

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: var(--cute);
}

.hud[hidden] { display: none; }

.hud-top {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 10px;
  padding-bottom: 14px;
  padding: var(--st) var(--sr) 0 var(--sl);
  min-height: calc(64px + env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(22, 11, 46, 0.78), rgba(22, 11, 46, 0));
}

.hud-pause {
  pointer-events: auto;
  width: 48px;
  height: 48px;
  margin-left: max(-6px, calc(env(safe-area-inset-left) - var(--sl))); /* -6px, but never into a landscape notch */
  padding: 0;
  display: grid;
  place-items: center;
  flex: none;
  color: #fff;
  background: rgba(22, 11, 46, 0.55);
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
  cursor: pointer;
  touch-action: manipulation;
}

.hud-pause svg { width: 20px; height: 20px; }
.hud-pause:active { transform: scale(0.92); }

.hud-left { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; padding-top: 2px; }
.hud-live { display: flex; align-items: center; gap: 7px; font: 12px/1 var(--loud); letter-spacing: 0.1em; color: var(--hot); white-space: nowrap; }
.hud-live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 8px var(--hot); animation: onair 1s steps(1) infinite; }
.hud-live span { color: var(--text-soft); letter-spacing: 0.06em; overflow: hidden; text-overflow: ellipsis; }
.hud-live .hud-ep { color: var(--lav); }
.hud-song { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; color: #fff; text-shadow: 0 1px 6px var(--night); }
.hud-song .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hud-song .diff-tag { font-size: 11px; padding: 3px 6px; }
.hud-mods { display: flex; gap: 4px; flex-wrap: wrap; }
.hud-mods .chip { height: 18px; font-size: 10px; padding: 0 7px; }

.hud-score { display: flex; flex-direction: column; align-items: flex-end; flex: none; padding-top: 2px; }
.hud-votes { font: 11px/1 var(--loud); letter-spacing: 0.16em; color: var(--lav); }

.odo {
  --odo-h: 30px;
  display: flex;
  height: var(--odo-h);
  overflow: hidden;
  font: 28px/var(--odo-h) var(--loud);
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 79, 163, 0.55), 0 2px 0 rgba(22, 11, 46, 0.6);
  font-variant-numeric: tabular-nums;
}

.odo-col { position: relative; width: 0.62em; height: var(--odo-h); overflow: hidden; text-align: center; }
.odo-col.lead { opacity: 0.28; }
.odo-strip { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-direction: column; transition: transform 0.11s var(--out); }
.odo-strip span { height: var(--odo-h); }
.odo-comma { width: 0.26em; text-align: center; }
.odo-comma.lead { opacity: 0.28; }

.hud-pb {
  min-height: 15px;
  margin-top: 2px;
  font: 13px/15px var(--loud);
  letter-spacing: 0.02em;
  color: var(--mint);
  opacity: 0;
  transition: opacity 0.3s;
  font-variant-numeric: tabular-nums;
}

.hud-pb.on { opacity: 1; animation: pop-in 0.3s var(--pop); }
.hud-pb.neg { color: #ff8fc6; }

.hud-progress {
  position: relative;
  order: -1;
  flex: 1 0 100%;
  margin-bottom: 2px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.14);
}

.hud-progress > i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 2px; background: linear-gradient(90deg, var(--hot), var(--lav)); box-shadow: 0 0 6px var(--hot); }
.hud-progress .mk { position: absolute; top: -2px; width: 2px; height: 7px; margin-left: -1px; border-radius: 1px; background: var(--butter); opacity: 0.85; }
.hud-progress .mk.ghost { top: -4px; height: 11px; width: 3px; background: #fff; opacity: 0.6; }

.hud-ocean {
  pointer-events: auto;
  position: absolute;
  right: calc(var(--sr) + 26px);
  top: calc(40% - 64px);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 76px;
  min-height: 52px;
  padding: 8px 12px;
  font: 16px/1 var(--loud);
  letter-spacing: 0.08em;
  color: var(--ink);
  background: linear-gradient(180deg, #fff3a8, var(--butter));
  border: 0;
  border-radius: 16px;
  box-shadow: 0 0 0 2.5px #fff, 0 0 24px rgba(255, 224, 102, 0.8);
  cursor: pointer;
  touch-action: manipulation;
  animation: ocean-ready 0.9s ease-in-out infinite;
}

.hud-ocean small { font: 11px/1 var(--cute); letter-spacing: 0; }
.hud-ocean.ready { display: flex; }
.hud-ocean.on { display: none; animation: none; background: linear-gradient(180deg, #fff, var(--butter)); box-shadow: 0 0 0 2.5px #fff, 0 0 40px rgba(255, 224, 102, 1); }

@keyframes ocean-ready { 50% { transform: translateY(-4px) scale(1.05); box-shadow: 0 0 0 2.5px #fff, 0 0 36px rgba(255, 224, 102, 1); } }

/* The bear talks from the stage: main.js anchors the bubble just right of the stage bear
   (--bub-l / --bub-t / --bub-w from renderer.geometry().bearRect), so it never covers the
   LED screen's messages or the highway. */
.hud-bubble {
  position: absolute;
  left: var(--bub-l, 58%);
  top: var(--bub-t, calc(var(--st) + 150px));
  max-width: var(--bub-w, 40vw);
  width: max-content;
  padding: 6px 11px 7px;
  font-size: 13px;
  line-height: 1.25;
  text-align: left;
  border-radius: 14px;
  box-shadow: 0 0 0 2.5px var(--hot), 0 0 18px rgba(255, 79, 163, 0.45);
  opacity: 0;
  transform-origin: 0 18px;
  transform: scale(0.6);
  transition: opacity 0.2s, transform 0.25s var(--pop);
}

.hud-bubble::before { left: -11px; top: 11px; bottom: auto; margin-left: 0; border-width: 7px 12px 7px 0; border-color: transparent #fff transparent transparent; filter: drop-shadow(-2.5px 0 0 var(--hot)); }
.hud-bubble.on { opacity: 1; transform: none; }

.hud-count {
  position: absolute;
  left: 0;
  right: 0;
  top: 33%;
  text-align: center;
  font: clamp(80px, 24vw, 150px)/1 var(--loud);
  color: #fff;
  text-shadow: 0 0 24px var(--hot), 0 0 4px #fff, 0 6px 0 rgba(22, 11, 46, 0.5);
  pointer-events: none;
}

.hud-count.pop { animation: count 0.5s var(--pop) both; }
/* GO! is a flash, not a sign: it must not sit on the first notes. */
.hud-count.go { color: var(--butter); text-shadow: 0 0 30px var(--butter), 0 6px 0 rgba(22, 11, 46, 0.5); }
.hud-count.pop.go { animation: count-go 0.55s ease-out both; }

@keyframes count-go { 0% { transform: scale(0.8); opacity: 0; } 22% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }

@keyframes count { 0% { transform: scale(2); opacity: 0; } 60% { transform: scale(0.95); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

.hud-third {
  position: absolute;
  left: 0;
  top: 33%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  max-width: 92vw;
  opacity: 0;
  transform: translateX(-104%);
  transition: transform 0.5s var(--out), opacity 0.3s;
}

.hud-third.on { opacity: 1; transform: none; }

.hud-third-main {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px 9px var(--sl);
  font: 16px/1.1 var(--cute);
  color: #fff;
  background: linear-gradient(90deg, var(--hot), #b06cff);
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
  box-shadow: 0 6px 20px rgba(255, 79, 163, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 92vw;
}

.hud-third-main b { font: 15px/1 var(--loud); letter-spacing: 0.06em; }
.hud-third-sub { padding: 5px 14px 6px var(--sl); font-size: 13px; color: var(--ink); background: var(--butter); clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%); white-space: nowrap; }

.hud-slate {
  position: absolute;
  right: var(--sr);
  top: calc(33% - 52px);
  padding: 6px 10px 7px;
  font: 13px/1 var(--loud);
  letter-spacing: 0.08em;
  color: #fff;
  background: repeating-linear-gradient(-45deg, #222 0 8px, #f6efff 8px 16px) top / 100% 7px no-repeat, rgba(22, 11, 46, 0.85);
  border-radius: 6px;
  padding-top: 13px;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.4);
  opacity: 0;
  transform: rotate(4deg) translateY(-8px);
  transition: opacity 0.3s, transform 0.4s var(--pop);
}

.hud-slate.on { opacity: 1; transform: rotate(4deg); }

/* ---------- Desktop ---------- */

@media (min-width: 900px) and (min-height: 600px) {
  :root {
    --st: max(20px, env(safe-area-inset-top));
    --sb: max(20px, env(safe-area-inset-bottom));
    --sl: max(32px, env(safe-area-inset-left));
    --sr: max(32px, env(safe-area-inset-right));
  }

  .seg b { font-size: 20px; }
  .seg span { font-size: 14px; }

  /* title */
  .logo { margin-top: 2vh; }
  .name { font-size: clamp(110px, 13vw, 176px); }
  .ribbon { font-size: clamp(44px, 5.2vw, 70px); }
  .tagline { font-size: 17px; max-width: none; }
  .title-bubble { margin-bottom: 26px; font-size: 17px; max-width: 420px; }
  .title-menu { width: 460px; margin-bottom: 24px; }
  .tiles { grid-template-columns: repeat(4, 1fr); width: 760px; align-self: center; }
  .tile { grid-template-columns: 1fr; justify-items: center; text-align: center; row-gap: 4px; min-height: 92px; }
  .tile svg { grid-row: auto; width: 30px; height: 30px; }
  .title-menu { width: 760px; }
  .title-menu .cta { width: 460px; align-self: center; }
  .fanchip { position: absolute; top: calc(var(--st) + 60px); right: var(--sr); width: 300px; }

  /* select */
  .carousel { --cover: min(320px, 38vh); gap: 34px; padding-top: 26px; padding-bottom: 34px; }
  .car-arrow { display: grid; }
  .album-name { font-size: 40px; }
  .track { font-size: 20px; }
  .album-style,
  .album-best { font-size: 15px; }
  .diffs { max-width: 600px; }
  .diff { min-height: 66px; }
  /* centred with auto margins, not justify-content: they collapse to 0 instead of cutting off the top when it scrolls */
  .select-body { gap: 10px; }
  .select-body > .carousel-wrap { margin-top: auto; }
  #scr-select .cta-dock { margin-top: 10px; margin-bottom: auto; background: none; }
  #scr-select .cta-dock::after { display: none; }

  /* results: hero | race, stats | xp + quip, then one centered action row */
  .res-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "hero race" "stats xp" "stats say" "foot foot";
    grid-template-rows: auto auto auto auto;
    align-content: center;
    gap: 16px 22px;
    width: min(100%, 1120px);
    margin: 0 auto;
    padding: 12px 0 0;
    overflow: visible;
  }

  .res-col { display: contents; }
  #res-hero { grid-area: hero; }
  #res-stats { grid-area: stats; align-self: start; }
  #res-race-card { grid-area: race; }
  #res-xp { grid-area: xp; align-self: start; }
  #res-saybox { grid-area: say; align-self: start; }
  .res-btns { grid-area: foot; position: static; justify-self: center; width: min(100%, 760px); margin-top: 4px; padding-top: 0; background: none; }
  .res-btn-grid { grid-template-columns: 1fr 1.7fr 1fr; gap: 12px; }
  .res-btn-grid .cta { grid-column: auto; order: 2; }
  #res-songs { order: 1; }
  #res-next { order: 3; }
  .res-btn-grid .btn:not(.cta) { min-height: 72px; font-size: 20px; }
  .res-hero { padding: 20px 22px; }
  .res-grade { width: 150px; height: 150px; border-radius: 30px; }
  .res-grade b { font-size: 96px; }
  .res-grade span { font-size: 15px; }
  .res-score-n { font-size: 64px; }
  .stamp { font-size: 22px; }
  .res-stats { padding: 18px 22px 14px; }
  .judges li { font-size: 18px; line-height: 1.3; }
  .judges li .j-kr { font-size: 13px; }
  .hist { height: 104px; }
  .hist-axis { font-size: 13px; }
  .hist-axis b { font-size: 15px; }
  .res-mini,
  .res-mini b { font-size: 14px; }
  .res-race .card-h { font-size: 17px; margin-bottom: 12px; }
  .race-place { font-size: 15px; }
  .xp-title { font-size: 18px; }
  .xp-gain { font-size: 22px; }
  .xp-parts { font-size: 13px; }
  .goal-chip,
  .offset-chip { font-size: 15px; min-height: 40px; }
  .res-race,
  .res-xp { padding: 18px 22px 14px; }
  .race li { grid-template-columns: 24px 120px 1fr 72px; height: 30px; font-size: 14px; }
  .race .r-name { font-size: 14px; }
  .res-say p { font-size: 17px; }
  .res-bear { width: 64px; height: 64px; }
  .res-btn-grid .cta { min-height: 76px; }
  /* The ceremony fills in a laid-out page: race + XP wait as faint skeletons instead of a blank right half. */
  #res-race-card.res-reveal:not(.on),
  #res-xp.res-reveal:not(.on) { opacity: 0.2; transform: none; }
  .race { min-height: 129px; } /* 4 rows × 30 px: no jump when the rivals line up */

  /* fail */
  .fail-btns { margin-top: 18px; }

  /* daily */
  .today-row { grid-template-columns: 1fr 1fr; }
  .daily-body { width: min(100%, 780px); padding-top: 16px; }
  .daily-body .diffs { max-width: none; }
  .cal { max-width: 620px; margin: 0 auto; }

  /* settings: two masonry columns */
  .settings { display: block; columns: 2; column-gap: 16px; width: min(100%, 1000px); padding-top: 16px; }
  .settings > * { break-inside: avoid; margin-bottom: 16px; }
  .settings .credits { column-span: all; }

  /* hud */
  .hud-top { padding-left: var(--sl); padding-right: var(--sr); }
  .hud-progress { flex-basis: 40%; margin: 0 30%; }
  .odo { --odo-h: 40px; font-size: 38px; }
  .hud-votes { font-size: 13px; }
  .hud-song { font-size: 16px; }
  .hud-ocean { top: auto; bottom: 22%; right: 26%; }
  .hud-third { top: 30%; }
}

/* Big monitors: the results and the text-heavy menus scale up instead of sitting small in the
   middle (pure DOM blocks only: no canvases that size from the viewport, no rect-driven motion). */
@media (min-width: 1500px) and (min-height: 950px) {
  .res-grid,
  .title-menu,
  .title-bubble,
  .daily-body,
  .settings { zoom: 1.2; }
}

@media (min-width: 1880px) and (min-height: 1040px) {
  .res-grid,
  .title-menu,
  .title-bubble,
  .daily-body,
  .settings { zoom: 1.38; }
}

/* Narrow phones: the LIVE tag folds into the segment subtitle so titles fit beside back + wallet. */
@media (max-width: 480px) {
  .seg b { font-size: 16px; }
  .wallet { padding: 0 10px 0 7px; font-size: 15px; }
  .bar:has(.back) .onair { display: none; }
  .bar:has(.back) .seg > span::before {
    content: "● LIVE  ";
    font: 11px/1 var(--loud);
    letter-spacing: 0.08em;
    color: var(--hot);
  }
}

/* The fanchant guide needs a tall screen (360×780 Androids, 375×812 iPhones hide it). */
@media (max-height: 820px) {
  .chant-guide { display: none; }
}

/* Short phones (iPhone SE and landscape-ish heights) */
@media (max-height: 740px) {
  .fail-nap { width: 120px; }
  .logo { margin-top: 0; }
  .name { font-size: clamp(56px, 16vw, 110px); }
  .ribbon { font-size: clamp(26px, 7vw, 48px); }
  .tagline { display: none; }
  .title-bubble { margin-bottom: 18px; font-size: 14px; padding: 9px 14px; }
  .title-menu .cta { min-height: 60px; font-size: 26px; }
  .tile { min-height: 54px; }
  .carousel { --cover: min(60vw, 260px, 30vh); padding-top: 12px; padding-bottom: 20px; }
  .album-name { font-size: 24px; }
  .track { font-size: 16px; margin-top: 2px; }
  .album-best { margin-top: 4px; }
  .diff { min-height: 52px; }
  .res-grade { width: 84px; height: 84px; }
  .res-grade b { font-size: 52px; }
  .res-score-n { font-size: 34px; }
  .hist { height: 48px; }
  .res-btn-grid .cta { min-height: 58px; font-size: 26px; }
  .res-btn-grid .btn:not(.cta) { min-height: 46px; }
  .xp-parts { display: none; }
  .fail-btns .cta { min-height: 64px; font-size: 28px; }
}

@media (max-height: 640px) {
  .res-say { display: none; }
  .race li { height: 20px; }
}

/* Phones: XP breakdown and extra stats only when there's room; the song line lives in the header. */
@media (max-width: 899px) {
  .res-song { display: none; }
  .res-hero { padding-top: 12px; }
  .res-btn-grid .cta { min-height: 60px; }
  .res-btn-grid .btn:not(.cta) { min-height: 48px; }
}

@media (max-width: 899px) and (max-height: 900px) {
  .xp-parts { display: none; }
  .res-mini span:nth-child(4) { display: none; }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .logo { flex-direction: row; gap: 18px; align-items: center; justify-content: center; }
  .name { font-size: 64px; }
  .title-bubble { display: none; }
  .title-menu { width: min(100%, 720px); margin-top: auto; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .res-grid { flex-direction: row; gap: 12px; overflow-y: auto; }
  .res-col { width: 50%; }

  /* standby: the studio scales with the height, so "tap to enter" stays on screen */
  .studio { width: min(96vw, 560px, 64vh); height: min(82vw, 380px, 44vh); margin-bottom: 6px; }
  .standby-line { min-height: 0; }

  /* select: covers on the left; album, difficulty and START on the right */
  .select-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 1fr auto auto auto auto 1fr;
    grid-template-areas: "car ." "car info" "car diffs" "car lock" "car dock" "car .";
    column-gap: 20px;
    row-gap: 8px;
  }
  .carousel-wrap { grid-area: car; align-self: center; width: calc(100% + var(--sl)); margin: 0 0 0 calc(-1 * var(--sl)); }
  .carousel { --cover: min(48vh, 190px); padding-top: 10px; padding-bottom: 14px; }
  .car-dots,
  .album-kind,
  .album-style,
  .chant-guide { display: none; }
  .album-info { grid-area: info; justify-self: center; }
  .diffs { grid-area: diffs; justify-self: center; }
  .diff { min-height: 46px; }
  .lockline { grid-area: lock; }
  #scr-select .cta-dock { grid-area: dock; width: auto; margin: 0; padding: 4px 0 0; background: none; }
  #scr-select .cta-dock::after { display: none; }
  #btn-start { min-height: 56px; }

  /* fail: no sleeping bear, the two buttons side by side */
  .fail-nap,
  .fail-kr,
  .fail-say { display: none; }
  .fail-h { margin-top: auto; }
  .fail-btns { flex-direction: row; justify-content: center; }
  .fail-btns > .btn { flex: 1; max-width: 280px; }
  .fail-btns .cta { min-height: 56px; font-size: 24px; }

  /* results: news toasts up in the corner, not over ENCORE */
  body[data-screen="results"] .toasts { top: calc(var(--st) + 6px); left: auto; right: var(--sr); width: min(44vw, 340px); transform: none; }

  /* soundcheck: the pad on the left, words, dots and APPLY on the right (it ran off the bottom) */
  .calib-card {
    width: min(100%, 640px);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "pad eye" "pad h" "pad say" "pad plot" "pad res" "pad btns";
    align-content: center;
    column-gap: 22px;
    row-gap: 6px;
    padding: 14px 20px;
  }
  .calib-card > .eyebrow { grid-area: eye; margin: 0; }
  .calib-h { grid-area: h; font-size: 30px; }
  .calib-say { grid-area: say; min-height: 0; }
  .calib-pad { grid-area: pad; width: min(42vh, 170px); margin: 0; align-self: center; }
  .dotplot { grid-area: plot; margin-top: 0; }
  .calib-result { grid-area: res; }
  .calib-btns { grid-area: btns; }

  /* daily: song + modifier side by side, and the difficulty row beside the button (one short dock) */
  #scr-daily .daily-body { width: min(100%, 760px); }
  .cal { max-width: 440px; margin: 0 auto; }
  .today-row { grid-template-columns: 1fr 1fr; }
  #scr-daily .cta-dock { flex-flow: row wrap; align-items: center; gap: 6px 10px; }
  #scr-daily .cta-dock .diffs { flex: 1 1 0; min-width: 0; }
  #scr-daily .cta-dock .daily-done { flex-basis: 100%; order: -1; }
  #scr-daily .diffs.compact .diff { min-height: 48px; }
  #btn-daily { flex: 1 1 0; width: auto; min-height: 52px; font-size: 22px; }
}

/* Frosted glass only with a mouse: re-blurring the live arena under every button and panel each
   frame cost ~40% of the GPU on the title. Touch screens get more opaque glass instead. */
@media (hover: hover) and (pointer: fine) {
  .btn { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  .panel { -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2); }
  .fanchip,
  .tile { -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
}

@media (hover: none), (pointer: coarse) {
  .btn,
  .tile { background-color: rgba(22, 11, 46, 0.8); }
  .fanchip { background-color: rgba(22, 11, 46, 0.82); }
  .btn.ghost { background-color: transparent; }
}

/* ---------- Comfort ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-delay: 0s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

html.reduce-flash .onair .dot,
html.reduce-flash .hud-live .dot,
html.reduce-flash .tally { animation: none; }
html.reduce-flash .trophy-rays { display: none; }

@media (pointer: coarse) {
  kbd { display: none; }
}

.hud-live .hud-diff-live { display: none; }

@media (max-width: 480px) {
  .hud-show { display: none; }
  /* The difficulty moves up into the LIVE row so the song title gets a row of its own (it was "honey on to…"). */
  .hud-live .hud-ep,
  .hud-song .diff-tag { display: none; }
  .hud-live .hud-diff-live { display: inline-block; padding: 2px 6px 3px; font-size: 11px; color: var(--ink); text-shadow: none; }
  .hud-song .t { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; font-size: 13px; line-height: 1.12; }
}

/* Portrait phones / tablets: the lower third spans the width, so it drops under the count-in numerals
   (both sat at 33% and the "3 2" covered the song title). */
@media (max-width: 899px) and (orientation: portrait) {
  .hud-third { top: calc(33% + clamp(80px, 24vw, 150px) + 12px); }
}

.noscript {
  position: fixed;
  inset: auto 0 20% 0;
  z-index: 5;
  text-align: center;
  font: 20px var(--cute);
}
