:root {
  --bg: #070710;
  --panel: rgba(12, 12, 24, 0.82);
  --text: #f7f7ff;
  --muted: #b3b4ca;
  --accent: #ff8c22;
  --accent-2: #8b45ff;
  --good: #44f7b6;
  --warning: #ffd05a;
  --danger: #ff3d64;
  --musicLevel: 0;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-display: "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-family: var(--font-display);
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

body {
  touch-action: manipulation;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}

.reactive-vignette {
  position: fixed;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 22% 22%, rgba(255, 132, 30, calc(0.14 + var(--musicLevel) * 0.26)), transparent 30%),
    radial-gradient(circle at 78% 12%, rgba(137, 69, 255, calc(0.14 + var(--musicLevel) * 0.28)), transparent 32%),
    radial-gradient(circle at 50% 92%, rgba(255, 44, 145, calc(0.08 + var(--musicLevel) * 0.18)), transparent 28%);
  filter: blur(calc(24px + var(--musicLevel) * 20px));
  transform: scale(calc(1 + var(--musicLevel) * 0.04));
  transition: transform 70ms linear, filter 70ms linear;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  place-items: center;
  padding: 20px;
  background-position: center;
  background-size: cover;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, 0.34);
}

.screen.active {
  display: grid;
}

.screen-main {
  background-image: url("assets/backgrounds/bg_main_menu.png");
}

.screen-upload {
  background-image: url("assets/backgrounds/bg_audio_analysis.png");
}

.screen-gameplay {
  background-image: url("assets/backgrounds/bg_gameplay.png");
}

.card {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: clamp(22px, 4vw, 44px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(8, 8, 17, 0.74), rgba(8, 8, 17, 0.86)),
    url("assets/ui/ui_panel_large.png") center / cover no-repeat;
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.52),
    0 0 32px rgba(124, 70, 255, 0.22),
    inset 0 0 40px rgba(255, 134, 25, 0.05);
  backdrop-filter: blur(18px);
}

.hero-card { text-align: center; }
.compact-card { width: min(420px, calc(100vw - 34px)); text-align: center; }

.text-logo {
  display: inline-grid;
  place-items: center;
  min-height: 122px;
  width: min(480px, 100%);
  margin-bottom: 20px;
  padding: 18px 22px;
  color: #fff;
  font-weight: 1000;
  font-size: clamp(2.35rem, 9vw, 5.2rem);
  line-height: 0.92;
  letter-spacing: -0.075em;
  text-transform: uppercase;
  transform: skewX(-8deg);
  text-shadow:
    0 0 10px #fff,
    0 0 22px #34fff6,
    0 0 34px #8aff00,
    0 10px 0 rgba(255, 145, 24, 0.74),
    0 16px 22px rgba(0, 0, 0, 0.75);
}

h1,
h2,
p { margin-top: 0; }

h1 {
  font-size: clamp(2.05rem, 6vw, 3.4rem);
  line-height: 1;
  margin-bottom: 12px;
}

.subtitle,
.muted {
  color: var(--muted);
  line-height: 1.55;
}

.status-line,
.track-info {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--muted);
}

.track-info {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-wrap: anywhere;
}

.label { color: #fff; opacity: 0.8; }

.upload-box {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 172px;
  margin: 20px 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 134, 25, 0.16), transparent 36%),
    rgba(255, 255, 255, 0.045);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.upload-box:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 140, 34, 0.86);
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 134, 25, 0.24), transparent 36%),
    rgba(255, 255, 255, 0.06);
}

.upload-box input { display: none; }
.upload-art { width: 82px; height: 82px; object-fit: contain; filter: drop-shadow(0 0 18px rgba(255, 134, 25, 0.5)); }

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.button-row.vertical { flex-direction: column; }

.primary-btn,
.secondary-btn,
.ghost-btn,
.small-btn,
.difficulty-card {
  position: relative;
  border: 0;
  border-radius: 999px;
  min-height: 50px;
  padding: 13px 22px;
  color: white;
  font-weight: 900;
  letter-spacing: 0.01em;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
  filter: drop-shadow(0 0 12px rgba(255, 134, 25, 0.25));
}

.primary-btn { background-image: url("assets/ui/ui_button_primary.png"); }
.secondary-btn { background-image: url("assets/ui/ui_button_secondary.png"); }
.ghost-btn { background-image: url("assets/ui/ui_button_ghost.png"); }

.small-btn {
  min-height: 44px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.20);
}

button:disabled {
  opacity: 0.44;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.icon-label,
.icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.icon-label img,
.icon-only img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.difficulty-card {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  min-height: 210px;
  padding: 20px;
  text-align: center;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.12)),
    rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.difficulty-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 140, 34, 0.8);
  box-shadow: 0 0 28px rgba(255, 140, 34, 0.18);
}

.difficulty-card img {
  width: 74px;
  height: 74px;
  object-fit: contain;
}

.difficulty-card strong { font-size: 1.45rem; }
.difficulty-card span,
.difficulty-card small { color: var(--muted); }

.gameplay-screen {
  padding: 0;
  grid-template-rows: auto auto 1fr auto;
  place-items: stretch;
}

.hud {
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: rgba(4, 4, 10, 0.82);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
}

.hud > div,
.results-grid > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.hud-label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.hud strong,
.results-grid strong {
  font-size: clamp(1rem, 3vw, 1.55rem);
}

.game-area {
  position: relative;
  width: min(760px, 100vw);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  touch-action: none;
  -ms-touch-action: none;
  border-inline: 1px solid rgba(255, 255, 255, 0.10);
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent 45%),
    rgba(0, 0, 0, 0.24);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.48);
}

.lane-layer,
.note-layer {
  position: absolute;
  inset: 0;
}

.lane-layer {
  display: grid;
  z-index: 1;
}

.lane {
  position: relative;
  display: grid;
  place-items: end center;
  padding-bottom: 28px;
  touch-action: none;
  -ms-touch-action: none;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.08)),
    rgba(255, 255, 255, 0.035);
  border-inline: 1px solid rgba(255, 255, 255, 0.09);
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

.lane::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(to bottom,
      rgba(255, 255, 255, 0.06),
      rgba(255, 255, 255, 0.06) 1px,
      transparent 1px,
      transparent 68px);
  opacity: 0.25;
}

.lane.pressed::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/fx/fx_lane_flash.png") center bottom / 80% 100% no-repeat;
  opacity: 0.84;
  mix-blend-mode: screen;
  animation: laneFlash 140ms ease-out forwards;
}

@keyframes laneFlash {
  from { opacity: 0.95; transform: translateY(20px) scaleY(0.9); }
  to { opacity: 0; transform: translateY(-18px) scaleY(1.08); }
}

.lane-label { display: none; }

.note-layer {
  z-index: 2;
  pointer-events: none;
}

.note {
  position: absolute;
  width: 62px;
  height: 62px;
  transform: translate3d(-100px, -100px, 0);
  will-change: transform, opacity;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 0 18px rgba(255, 140, 34, 0.58));
}

.note.note-easy { background-image: url("assets/notes/note_easy.png"); }
.note.note-medium { background-image: url("assets/notes/note_medium.png"); }
.note.note-hard { background-image: url("assets/notes/note_hard.png"); }

.note.hit,
.note.missed { opacity: 0; }

.note.miss-fx { animation: noteMiss 260ms ease-out forwards; }

@keyframes noteMiss {
  0% { opacity: 1; filter: drop-shadow(0 0 18px rgba(255, 140, 34, 0.58)) saturate(1); }
  100% { opacity: 0; filter: drop-shadow(0 0 10px rgba(255, 61, 100, 0.85)) saturate(0.3); }
}

.hit-zone {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 90px;
  z-index: 3;
  height: 68px;
  background: url("assets/fx/hit_zone.png") center / 100% auto no-repeat;
  pointer-events: none;
  filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.45));
}

.hit-zone.pulse {
  animation: hitPulse 180ms ease-out;
}

@keyframes hitPulse {
  0% { transform: scaleY(1); filter: brightness(1) drop-shadow(0 0 16px rgba(255, 255, 255, 0.45)); }
  50% { transform: scaleY(1.22); filter: brightness(1.55) drop-shadow(0 0 30px rgba(255, 140, 34, 0.65)); }
  100% { transform: scaleY(1); filter: brightness(1) drop-shadow(0 0 16px rgba(255, 255, 255, 0.45)); }
}

.judgment-text {
  position: absolute;
  left: 50%;
  top: 18%;
  z-index: 5;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: min(460px, 78vw);
  min-height: 112px;
  pointer-events: none;
  text-align: center;
}

.judgment-text span {
  font-size: clamp(2.2rem, 8vw, 4.2rem);
  font-weight: 1000;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.5), 0 10px 30px rgba(0,0,0,.8);
}

.judgment-text img {
  max-width: 100%;
  max-height: 130px;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.7));
}

.judgment-text.pop {
  animation: judgmentPop 260ms ease-out;
}

@keyframes judgmentPop {
  0% { transform: translateX(-50%) scale(0.78); opacity: 0; }
  55% { transform: translateX(-50%) scale(1.08); opacity: 1; }
  100% { transform: translateX(-50%) scale(1); opacity: 0.95; }
}

.burst,
.combo-burst {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  mix-blend-mode: screen;
}

.burst {
  width: 96px;
  height: 96px;
  background-image: url("assets/fx/fx_note_hit_burst.png");
  animation: burstOut 340ms ease-out forwards;
}

.combo-burst {
  left: 50%;
  top: 23%;
  width: min(380px, 88vw);
  height: min(380px, 88vw);
  background-image: url("assets/fx/fx_combo_milestone.png");
  animation: comboBurst 560ms ease-out forwards;
}

@keyframes burstOut {
  from { transform: translate(-50%, -50%) scale(0.25); opacity: 0.95; }
  to { transform: translate(-50%, -50%) scale(1.45); opacity: 0; }
}

@keyframes comboBurst {
  from { transform: translate(-50%, -50%) scale(0.35); opacity: 0.9; }
  to { transform: translate(-50%, -50%) scale(1.25); opacity: 0; }
}

.control-hint {
  z-index: 4;
  min-height: 54px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  text-align: center;
  color: var(--muted);
  background: rgba(4, 4, 10, 0.82);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
}

.pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(10px);
}

.hidden { display: none !important; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 22px 0;
}

.results-grid > div {
  padding: 16px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.judgment-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
}

.judgment-breakdown span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

@media (max-width: 720px) {
  .screen { padding: 14px; }

  .difficulty-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .difficulty-card {
    min-height: 150px;
    grid-template-columns: auto 1fr;
    justify-items: start;
    text-align: left;
  }

  .difficulty-card img {
    grid-row: span 3;
  }

  .hud {
    grid-template-columns: repeat(3, 1fr);
  }

  .hud .small-btn {
    grid-column: 1 / -1;
  }

  .note {
    width: 54px;
    height: 54px;
  }

  .card {
    border-radius: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reactive-vignette,
  .hit-zone.pulse,
  .judgment-text.pop,
  .burst,
  .combo-burst,
  .note.miss-fx,
  .lane.pressed::after {
    animation: none;
    transition: none;
  }
}

/* -------------------------------------------------------------------------- */
/* Ship build additions: typography accents, track list, settings, progress   */
/* -------------------------------------------------------------------------- */

/* Monospace numerics for a clinical, data-readout feel */
.hud strong,
.results-grid strong,
.track-row-time,
#calibrationValue {
  font-family: var(--font-mono);
}

/* Track list */
.track-list {
  display: grid;
  gap: 8px;
  margin: 18px 0 4px;
  max-height: min(46vh, 360px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 140, 34, 0.6) transparent;
}

.track-list::-webkit-scrollbar { width: 8px; }
.track-list::-webkit-scrollbar-thumb {
  background: rgba(255, 140, 34, 0.5);
  border-radius: 999px;
}

.track-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.12));
  color: var(--text);
  text-align: left;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.track-row:hover {
  transform: translateX(2px);
  border-color: rgba(255, 140, 34, 0.7);
  background: linear-gradient(90deg, rgba(255, 140, 34, 0.14), rgba(0, 0, 0, 0.12));
}

.track-row.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 22px rgba(255, 140, 34, 0.28);
  background: linear-gradient(90deg, rgba(255, 140, 34, 0.22), rgba(139, 69, 255, 0.12));
}

.track-row-title { overflow-wrap: anywhere; }
.track-row-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.86rem;
}

/* Loading status shimmer */
.status-line.loading {
  color: var(--text);
  border-color: rgba(255, 140, 34, 0.4);
  animation: statusPulse 1.1s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Settings (volume + calibration) */
.settings-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.setting {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.setting > label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.setting-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-toggle {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.1rem;
  line-height: 1;
}

.icon-toggle[aria-pressed="true"] {
  border-color: var(--danger);
  background: rgba(255, 61, 100, 0.18);
}

input[type="range"] {
  flex: 1 1 auto;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 0 12px rgba(255, 140, 34, 0.6);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 0 12px rgba(255, 140, 34, 0.6);
  cursor: pointer;
}

.setting small { font-size: 0.72rem; line-height: 1.3; }

/* Gameplay progress bar */
.progress-track {
  position: relative;
  z-index: 4;
  height: 4px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 10px rgba(255, 140, 34, 0.6);
  will-change: transform;
}

/* Results rank badge */
.rank-badge {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: 6px auto 18px;
  border-radius: 24px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3.4rem;
  line-height: 1;
  color: #fff;
  background: linear-gradient(160deg, rgba(255, 140, 34, 0.3), rgba(139, 69, 255, 0.3));
  border: 1px solid rgba(255, 255, 255, 0.22);
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 32px rgba(255, 140, 34, 0.3), inset 0 0 24px rgba(0, 0, 0, 0.4);
}

@media (max-width: 720px) {
  .settings-row { grid-template-columns: 1fr; }
  .progress-track { height: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .status-line.loading { animation: none; }
}

/* -------------------------------------------------------------------------- */
/* Sprite integration: receptors, approach rings, bursts, countdown, ranks     */
/* -------------------------------------------------------------------------- */

/* Lane receptors — static target at the hit line, with a lit flash on input */
.receptor {
  position: absolute;
  left: 50%;
  bottom: 124px; /* hit-zone vertical center: bottom 90px + height/2 (34px) */
  width: min(78%, 116px);
  aspect-ratio: 1 / 1;
  transform: translate(-50%, 50%);
  background: url("assets/fx/receptor_idle.png") center / contain no-repeat;
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

.receptor::after {
  content: "";
  position: absolute;
  inset: -10%;
  background: url("assets/fx/receptor_lit.png") center / contain no-repeat;
  opacity: 0;
  mix-blend-mode: screen;
}

.receptor.lit::after { animation: receptorLit 220ms ease-out; }

@keyframes receptorLit {
  0% { opacity: 0; transform: scale(0.86); }
  35% { opacity: 1; transform: scale(1.12); }
  100% { opacity: 0; transform: scale(1); }
}

/* Approach ring — collapses from large onto the note (scale set per-frame in JS) */
.approach-ring {
  position: absolute;
  inset: -6%;
  background: url("assets/fx/approach_ring.png") center / contain no-repeat;
  transform: scale(2.6);
  transform-origin: center;
  opacity: 0.4;
  pointer-events: none;
  will-change: transform, opacity;
}

/* Per-judgment hit bursts (override the base .burst sprite + size) */
.burst.perfect { width: 152px; height: 152px; background-image: url("assets/fx/burst_perfect.png"); }
.burst.great   { width: 124px; height: 124px; background-image: url("assets/fx/burst_great.png"); }
.burst.good    { width: 108px; height: 108px; background-image: url("assets/fx/burst_good.png"); }

/* Countdown 3 / 2 / 1 / GO */
.countdown-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.countdown-overlay.hidden { display: none; }

.countdown-img {
  width: min(46%, 260px);
  filter: drop-shadow(0 10px 34px rgba(0, 0, 0, 0.65));
}

.countdown-img.pop { animation: countPop 600ms ease-out; }

@keyframes countPop {
  0% { opacity: 0; transform: scale(0.45); }
  22% { opacity: 1; transform: scale(1.06); }
  75% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.22); }
}

/* Results rank badge + full-combo badge */
.rank-wrap { display: grid; place-items: center; gap: 10px; margin: 6px auto 18px; }

.rank-img {
  width: 124px;
  height: 124px;
  object-fit: contain;
  filter: drop-shadow(0 0 28px rgba(255, 140, 34, 0.42));
}

.rank-img.pop { animation: rankIn 520ms ease-out; }

.fc-badge {
  width: min(230px, 72%);
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(139, 69, 255, 0.5));
  animation: rankIn 620ms ease-out 0.12s both;
}

.fc-badge.hidden { display: none; }

@keyframes rankIn {
  0% { opacity: 0; transform: scale(0.5) rotate(-7deg); }
  60% { opacity: 1; transform: scale(1.1) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
  .receptor.lit::after,
  .countdown-img.pop,
  .rank-img.pop,
  .fc-badge { animation: none; }
  .approach-ring { display: none; } /* skip the shrinking-ring motion */
}
