/* ============ Prize Pong — UI layer ============
   The game screen is a 375x476 frame. JS sets #game-stage's font-size so
   that 1em = 10px at exactly 375px wide; every UI dimension below is in em
   and scales proportionally if the frame shrinks on narrow viewports.
   All HUD/popup animation uses transform + opacity only, so every
   animation runs on the GPU compositor thread. */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Type system: Inter carries all reading text, Anton is the display
     accent (numbers, popups, title). Anton ships in weight 400 only. */
  --font-main: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-accent: "Anton", "Arial Narrow", "Segoe UI", sans-serif;

  /* Multi-hue 1px ring shared by the score panel and the summary cards. */
  --panel-ring: linear-gradient(90deg,
    hsla(250, 97%, 40%, 1),
    hsla(193, 82%, 54%, 1),
    hsla(206, 98%, 33%, 1),
    hsla(324, 62%, 85%, 1),
    hsla(284, 100%, 26%, 1));
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #050308;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-main);
  overscroll-behavior: none;
}

#game-root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-stage {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  /* JS sets width/height (max 375x476) and font-size (1em = 10px at 375) */
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

/* ---------- Popup layer (logical 750x952 space, scaled by JS) ---------- */

#popup-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 750px;
  height: 952px;
  transform-origin: 0 0;
  pointer-events: none;
  z-index: 40; /* above the header (#hud is 30), below the settings panel */
}

.popup {
  position: absolute;
  transform: translate(-50%, -100%);
  text-align: center;
  will-change: transform, opacity;
  animation: popup-rise 1.5s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 24px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

.popup .popup-value {
  display: block;
  font-family: var(--font-accent);
  font-size: 52px;
  font-weight: 400;
  color: #ffffff;
  letter-spacing: 1px;
  line-height: 1.05;
}

.popup .popup-label {
  display: block;
  font-family: var(--font-main);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #8dff2e;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 18px rgba(90, 220, 30, 0.55);
}

/* Icon rewards (fire/golden ball): icon + green value on one line, no label. */
.popup.icon-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}
.popup.icon-inline .popup-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.8));
}
.popup.icon-inline .popup-value {
  font-family: var(--font-main);
  font-weight: 800;
  letter-spacing: 0;
  color: #8dff2e;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 18px rgba(90, 220, 30, 0.55);
}

.popup.prize .popup-label  { color: #ffd94a; text-shadow: 0 2px 6px rgba(0,0,0,.9), 0 0 22px rgba(255,190,40,.8); }
.popup.nowin .popup-label  { font-size: 36px; color: #ff6a6a; text-shadow: 0 2px 6px rgba(0,0,0,.9), 0 0 16px rgba(255,60,60,.5); }
.popup.bonus .popup-label  { color: #c98bff; text-shadow: 0 2px 6px rgba(0,0,0,.9), 0 0 18px rgba(180,110,255,.6); }

/* Physical prize reveal: a framed card pops out of the cup — spinning
   light burst behind the item art, prize name underneath. Sized in the
   logical 750x952 space of #popup-layer. */
.prize-pop {
  position: absolute;
  width: 178px;
  height: 143px; /* frame art is 137x110 */
  margin-left: -89px;
  will-change: transform, opacity;
  animation: prize-pop-rise 2.6s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55));
}

.prize-pop-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.prize-pop-light {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 150px;
  height: 150px;
  mix-blend-mode: screen;
  animation: prize-light-spin 5s linear infinite;
}

.prize-pop-item {
  position: absolute;
  left: 50%;
  top: 44%;
  height: 92px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
}

.prize-pop-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 7px;
  text-align: center;
  font-family: var(--font-accent);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9), 0 0 12px rgba(80, 180, 255, 0.7);
}

@keyframes prize-pop-rise {
  0%   { transform: translateY(-20%) scale(0.15); opacity: 0; }
  14%  { transform: translateY(-112%) scale(1.1); opacity: 1; }
  22%  { transform: translateY(-106%) scale(1); opacity: 1; }
  82%  { transform: translateY(-118%) scale(1); opacity: 1; }
  100% { transform: translateY(-140%) scale(0.92); opacity: 0; }
}

@keyframes prize-light-spin {
  from { transform: translate(-50%, -50%) rotate(0turn); }
  to   { transform: translate(-50%, -50%) rotate(1turn); }
}

@keyframes popup-rise {
  0%   { transform: translate(-50%, -100%) translateY(10px) scale(0.4); opacity: 0; }
  12%  { transform: translate(-50%, -100%) translateY(-6px) scale(1.12); opacity: 1; }
  22%  { transform: translate(-50%, -100%) translateY(-12px) scale(1); opacity: 1; }
  70%  { transform: translate(-50%, -100%) translateY(-58px) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -100%) translateY(-96px) scale(0.96); opacity: 0; }
}

/* ---------- HUD header ---------- */

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8em;
  padding: 1.2em 1.2em 0;
  z-index: 30;
  pointer-events: none;
}

.hud-btn {
  pointer-events: auto;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.2em;
  height: 3.2em;
  border: none;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  padding: 0;
  font: inherit; /* buttons default to a UA font-size, breaking em sizing */
  filter: drop-shadow(0 0.2em 0.4em rgba(0, 0, 0, 0.8));
  transition: transform 0.12s ease;
}
.hud-btn:active { transform: scale(0.88); }
/* 2.4em = 24px at the 375px design size; the 3.2em button keeps the hit area */
.hud-btn svg { width: 2.4em; height: 2.4em; }

#score-panel {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4em;
  border-radius: 8px;
  background: rgba(23, 18, 60, 0.50);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px); /* Safari/iOS */
  padding: 0.6em 1.6em;
  min-width: 19em;
}

/* Gradient border ring: a masked overlay so the gradient paints only the
   1px edge and never tints the translucent panel fill. */
#score-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--panel-ring);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.score-cell {
  display: flex;
  align-items: center;
  gap: 0.7em;
}

.score-icon {
  width: 2.4em;
  height: 2.4em;
  object-fit: contain;
  filter: drop-shadow(0 0.15em 0.3em rgba(0, 0, 0, 0.5));
}

.score-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

.score-value {
  font-family: var(--font-accent);
  font-size: 1.7em;
  font-weight: 400; /* Anton is a single-weight display face */
  letter-spacing: 0.02em;
  color: #ffffff;
}
.score-value.bump { animation: value-bump 0.4s ease; }

@keyframes value-bump {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.45); }
  100% { transform: scale(1); }
}

.score-label {
  font-size: 0.9em;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #8dff2e;
}

.score-divider {
  width: 1px;
  height: 2.8em;
  background: rgba(150, 110, 255, 0.35);
}

/* ---------- Collectible tally row ---------- */

/* Per the design: no chrome behind the cells — the icon sits centred above
   a single "<count> <LABEL>" line, count in gold, label in white. */
#tally-row {
  position: absolute;
  /* Clears the score panel (its bottom edge sits at 5.26em) plus the
     icons' drop shadow. */
  top: 6.2em;
  left: 0.4em;
  right: 0.4em;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  z-index: 30;
  pointer-events: none;
}
#tally-row.hidden { display: none; }

.tally-cell {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.15em;
}
.tally-cell.visible { display: flex; }

.tally-icon {
  width: 2.1em;
  height: 2.1em;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 0.15em 0.35em rgba(0, 0, 0, 0.7));
}

.tally-text {
  display: flex;
  align-items: baseline;
  gap: 0.3em;
  font-family: var(--font-accent);
  font-weight: 400;
  font-size: 1.05em;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-shadow: 0 0.12em 0.3em rgba(0, 0, 0, 0.9);
}

.tally-value { color: #ffd94a; }
.tally-value.bump { animation: value-bump 0.4s ease; }

.tally-label { color: #ffffff; }

/* ---------- Fire Ball bonus round HUD ---------- */

/* Sits in the collectible tally row's slot (that row hides while a round
   runs) — orange counts, white labels, full-width tally rail, per the
   design (assets/v2/design/Fire Ball-06.png). */
#fireball-hud {
  position: absolute;
  top: 6.4em;
  left: 1.5em;
  right: 1.5em;
  z-index: 30;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 0.9em;
}
#fireball-hud.hidden { display: none; }

.fireball-hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-accent);
  font-size: 1.1em;
  letter-spacing: 0.04em;
  color: #ffffff;
  text-shadow: 0 0.12em 0.3em rgba(0, 0, 0, 0.9);
}

.fireball-hud-games,
.fireball-hud-balls {
  display: flex;
  align-items: center;
  gap: 0.4em;
}
.fireball-hud-icon {
  width: 1.7em;
  height: 1.7em;
  object-fit: contain;
  filter: drop-shadow(0 0.1em 0.3em rgba(0, 0, 0, 0.7));
}

.fireball-hud-num { color: #ff7a1c; }

/* Shared Fire Ball prize-tally bar: one segment per cup, 4 of which carry
   an escalating gift-tier icon. Used both live (#fireball-tally) and as a
   static preview in the tutorial modal (#fireball-intro-tally). */
.prize-tally {
  display: flex;
  gap: 0.3em;
}

.prize-tally-segment {
  position: relative;
  flex: 1;
  height: 0.6em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: visible;
}
.prize-tally-segment.filled {
  background: linear-gradient(90deg, #ff9d3c, #ffd94a);
  box-shadow: 0 0 0.5em rgba(255, 157, 60, 0.6);
}

.prize-tally-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.2em;
  height: 2.2em;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0.1em 0.3em rgba(0, 0, 0, 0.6));
}

/* ---------- Instructions ---------- */

#instructions {
  position: absolute;
  bottom: 2.5%;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 25;
  pointer-events: none;
}

/* Persistent hint text, dim #C5D5F2 per the design spec.
   Font-size is 1em = 10px at the 375px design size, scaling with the stage. */
.instr-line {
  color: rgba(197, 213, 242, 0.42);
  text-align: center;
  font-family: var(--font-main);
  font-size: 1em;
  font-style: normal;
  font-weight: 500;
  line-height: normal;
  text-transform: uppercase;
  margin-top: 0.4em;
}

/* "TAP or SWIPE to throw" line: hand icons + bright keywords over the
   dim base colour, per the design */
.instr-throw {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  /* 1em = 10px at the 375px design size — all footer text is 10px */
  font-size: 1em;
}

.instr-strong {
  color: rgba(197, 213, 242, 0.90);
}

.instr-icon {
  width: 1.6em;
  height: 1.6em;
  color: rgba(197, 213, 242, 0.90);
}

/* ---------- Settings panel ---------- */

#settings-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  background: linear-gradient(180deg, rgba(30, 18, 54, 0.97), rgba(12, 8, 26, 0.97));
  border: 1px solid rgba(150, 110, 255, 0.4);
  border-radius: 1.2em;
  padding: 1.8em 2.2em 2em;
  min-width: 27em;
  box-shadow: 0 1em 3em rgba(0, 0, 0, 0.7);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
#settings-panel.hidden {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
  pointer-events: none;
}

#settings-panel h3 {
  color: #fff;
  font-size: 1.3em;
  letter-spacing: 0.25em;
  text-align: center;
  margin-bottom: 1.3em;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  font-size: 1.2em;
  font-weight: 700;
  padding: 0.55em 0;
  cursor: pointer;
}
.settings-row + .settings-row { border-top: 1px solid rgba(255, 255, 255, 0.07); }

/* Same pill switch as the intro modals' "don't show again" row (see
   .golden-intro-skip-row input) — restyled native checkbox, so keyboard/
   label semantics come free. */
.settings-row input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 3.4em;
  height: 1.8em;
  margin: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 0.1em 0.3em rgba(0, 0, 0, 0.5) inset;
  cursor: pointer;
  transition: background 0.18s ease;
}
.settings-row input::after {
  content: '';
  position: absolute;
  top: 0.2em;
  left: 0.2em;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0.1em 0.25em rgba(0, 0, 0, 0.45);
  transition: transform 0.18s ease;
}
.settings-row input:checked { background: #e8a01a; }
.settings-row input:checked::after { transform: translateX(1.6em); }

/* Dropdown rows (starting tickets): native select restyled to sit on the
   dark panel; option list colours stay browser-native. */
.settings-row select {
  flex: 0 0 auto;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.5em;
  padding: 0.25em 0.6em;
  cursor: pointer;
}
.settings-row select option { color: #000; }
.settings-row select:focus-visible {
  outline: 2px solid #8dff2e;
  outline-offset: 2px;
}

.settings-section {
  color: rgba(197, 213, 242, 0.6);
  font-size: 0.95em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin: 1.5em 0 0.6em;
}
#settings-panel h3 + .settings-section { margin-top: 0; }

#mode-selector {
  display: flex;
  gap: 0.5em;
  margin-bottom: 1.2em;
}

/* Momentary preview buttons (not a persistent toggle like the old ball
   selector) — picking Fire Ball/Golden Ball/Bonus Wheel jumps straight
   into that round via the same entry path organic triggers use. */
.mode-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5em;
  padding: 0.8em 0.3em;
  border: 1px solid rgba(150, 110, 255, 0.3);
  border-radius: 0.8em;
  background: rgba(255, 255, 255, 0.04);
  color: #bbb;
  font-family: inherit;
  font-size: 0.85em;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.mode-option:active {
  transform: scale(0.94);
  border-color: #8dff2e;
}

.mode-option img {
  width: 2.2em;
  height: 2.2em;
  object-fit: contain;
}

.settings-btn {
  display: block;
  width: 100%;
  padding: 0.8em;
  margin-top: 0.8em;
  border: 1px solid rgba(150, 110, 255, 0.4);
  border-radius: 0.8em;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-family: inherit;
  font-size: 1.1em;
  font-weight: 900;
  letter-spacing: 0.1em;
  cursor: pointer;
}
.settings-btn:active { transform: scale(0.96); }
.settings-btn.danger { border-color: rgba(255, 80, 80, 0.5); color: #ff8080; }

/* ---------- Primary CTA button ---------- */

/* The shared gold button used by every overlay's main action. The design
   spec's noise layer carried a `lightgray` backdrop colour (a Figma export
   artifact) — that would flatten the gold underneath, so the texture is
   blended with `overlay` instead and the backdrop dropped. The 3px/4px
   non-inset shadows form the 3D bottom edge, so the button reserves 4px of
   space below itself. */
.btn-primary {
  border: none;
  border-radius: 8px;
  margin-bottom: 4px;
  /* Spec'd at 20px; expressed as 2em because 1em = 10px at the 375px design
     width, so the label scales with the stage on narrow viewports. The
     spec's `leading-trim`/`text-edge` are Figma properties with no browser
     equivalent here, so they're omitted. */
  color: #242121;
  text-align: center;
  font-family: var(--font-accent);
  font-style: normal;
  font-weight: 400;
  font-size: 2em;
  text-transform: uppercase;
  /* Match the screen titles' tracking — .settings-btn sets 0.1em, which on
     Anton at this size reads far too loose. */
  letter-spacing: normal;
  /* Careful: font-size above resets this element's em, so the lengths below
     resolve against 20px, not the 10px stage base. 2.4em = 48px tall,
     1.5em = the spec'd 30px line box. min-height (not height) so the
     two-line "OPEN PRIZES / AUTO-OPEN IN" variant can never clip. */
  min-height: 2.4em;
  line-height: 1.5em;
  padding: 0 0.8em;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-image:
    radial-gradient(100% 50% at 50% 0%, #FFF481 0%, rgba(255, 244, 129, 0) 100%),
    url("../assets/v2/noise.png"),
    linear-gradient(0deg, #E89C03 0%, #FDC62E 100%);
  background-size: auto, 50px 50px, auto;
  background-repeat: no-repeat, repeat, no-repeat;
  background-blend-mode: normal, overlay, normal;
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.50) inset,
    0 -1px 1px 0 #FFE121 inset,
    0 3px 0 0 #813A02,
    0 4px 0 0 #CD620D;
}

/* Press: sink into the 3D edge rather than scaling. */
.btn-primary:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.50) inset,
    0 -1px 1px 0 #FFE121 inset,
    0 1px 0 0 #813A02,
    0 2px 0 0 #CD620D;
}

.btn-primary:disabled {
  opacity: 0.55;
  pointer-events: none;
}

/* ---------- Fire Ball tutorial modal ---------- */

#fireball-intro {
  position: absolute;
  inset: 0;
  z-index: 60; /* above the settings panel (50) */
  background: transparent; /* backdrop video + dressing live in #screen-bg */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1em;
  padding: 1.6em 2em 2em;
  text-align: center;
  transition: opacity 0.25s ease;
  box-shadow: 0 0 32px 0 #FC7A08 inset;
}
#fireball-intro.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Fire Ball round vignette: same orange inner glow over the gameplay
   screen while the round runs. Toggled by HUD.showFireballHud. */
#fire-vignette {
  position: absolute;
  inset: 0;
  z-index: 20; /* above the canvas, below the HUD (30) */
  pointer-events: none;
  box-shadow: 0 0 32px 0 #FC7A08 inset;
}
#fire-vignette.hidden { display: none; }

/* Golden Ball round: gold inner glow + hint line (design spec). */
#gold-vignette {
  position: absolute;
  inset: 0;
  z-index: 20; /* above the canvas, below the HUD (30) */
  pointer-events: none;
  box-shadow: 0 0 32px 0 #FCC708 inset;
}
#gold-vignette.hidden { display: none; }

#golden-hint {
  position: absolute;
  /* 4.7em at this 1.4em font = 6.6em in stage units — under the score panel. */
  top: 4.7em;
  left: 0.7em;
  right: 0.7em;
  z-index: 30;
  pointer-events: none;
  text-align: center;
  font-size: 1.4em;
  font-weight: 600;
  color: #FFA928;
  text-shadow: 0 0.1em 0.3em rgba(0, 0, 0, 0.85);
}
#golden-hint.hidden { display: none; }

/* Live FireballGL flame blitted into a canvas (96px). */
.fireball-intro-ball {
  width: 9.6em;
  height: 9.6em;
  filter: drop-shadow(0 0 2em rgba(255, 140, 30, 0.8));
}

/* Title flanked by plain stars (no rule lines, unlike the golden intro). */
.fireball-intro-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  width: 100%;
}
/* 0.93em of the h2's UA 1.5em font ≈ 14px at the 375px stage width. */
.fireball-intro-title .title-star { width: 0.93em; }

.fireball-intro-title-text {
  font-family: var(--font-accent);
  font-weight: 400;
  font-size: 1.7em;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fff3cf 0%, #ffd94a 45%, #e8a01a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0.08em 0.16em rgba(0, 0, 0, 0.6));
  white-space: nowrap;
}

.fireball-intro-rules {
  color: #fff;
  font-size: 1.4em;
  line-height: 1.4;
  text-align: left;
  padding-left: 1.3em;
  max-width: 21em;
}
.fireball-intro-rules li + li { margin-top: 0.6em; }
.fireball-intro-rules li { padding-left: 0.2em; }

.fireball-intro-tally-label {
  margin-top: 0.4em;
  font-family: var(--font-accent);
  font-weight: 400;
  font-size: 1.4em;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fff3cf 0%, #ffd94a 45%, #e8a01a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Full content width — exactly as wide as the PLAY button below. */
#fireball-intro .prize-tally {
  width: 100%;
}

/* Pinned toward the bottom with the CTA, per the design. */
.fireball-intro-skip-row { margin-top: auto; }

.fireball-intro-play { width: 100%; max-width: 30em; }

/* ---------- Golden Ball tutorial modal ---------- */

/* Same top-aligned layout as the Fire Ball intro: content stacks from the
   top, the toggle + full-width PLAY pin to the bottom. */
#golden-intro {
  position: absolute;
  inset: 0;
  z-index: 60; /* above the settings panel (50) */
  background: transparent; /* backdrop video + dressing live in #screen-bg */
  box-shadow: 0 0 32px 0 #FCC708 inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1em;
  padding: 2.4em 2em 2em;
  text-align: center;
  transition: opacity 0.25s ease;
}
#golden-intro.hidden {
  opacity: 0;
  pointer-events: none;
}

.golden-intro-ball {
  width: 6.4em;
  height: 6.4em;
  margin-top: 4.4em;
  object-fit: contain;
  filter: drop-shadow(0 0 1.6em rgba(255, 210, 80, 0.75));
}

/* Title flanked by plain stars — same lockup as the Fire Ball intro. */
.golden-intro-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  width: 100%;
}
/* 0.93em of the h2's UA 1.5em font ≈ 14px at the 375px stage width. */
.golden-intro-title .title-star { width: 0.93em; }

.title-star {
  width: 7em;
  height: auto;
  flex: 0 0 auto;
  opacity: 0.9;
}

.golden-intro-title-text {
  font-family: var(--font-accent);
  font-weight: 400;
  font-size: 1.7em;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fff3cf 0%, #ffd94a 45%, #e8a01a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0.08em 0.16em rgba(0, 0, 0, 0.6));
  white-space: nowrap;
}

.golden-intro-subtitle {
  color: #fff;
  font-size: 1.4em;
  line-height: 1.35;
  max-width: 19em;
}

.golden-intro-legend {
  display: flex;
  justify-content: center;
  gap: 2em;
  margin: 0.6em 0;
}

/* Cup art beside its meaning, per the design — not stacked, text centred
   on the cup. Font size lives on the span so the img's em sizing stays in
   stage units (1em = 10px). */
.golden-intro-legend-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35em;
  color: #fff;
  font-family: var(--font-accent);
  font-weight: 400;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
/* The v2 cup art carries transparent padding around the visible cup
   (win-flash canvas headroom above, drop-shadow space to the right), so
   flex layout alone leaves the label high and far away — drop it to the
   visible cup's centre and pull it against the cup's visible right edge. */
.golden-intro-legend-item span {
  font-size: 1.4em;
  margin-left: -1.1em;
  transform: translateY(1.1em);
}
.golden-intro-legend-item img {
  height: 9.6em;
  width: auto;
  object-fit: contain;
}

/* Toggle first, then the label — matching the design's reading order.
   Shared by the golden and fireball intro modals. */
.golden-intro-skip-row,
.fireball-intro-skip-row,
.levelup-intro-skip-row {
  display: flex;
  align-items: center;
  gap: 0.8em;
  color: #fff;
  font-size: 1.4em;
  cursor: pointer;
}
/* Pill switch, per the design — a restyled native checkbox so it keeps
   full keyboard/label semantics without extra markup. */
.golden-intro-skip-row input,
.fireball-intro-skip-row input,
.levelup-intro-skip-row input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 3.4em;
  height: 1.8em;
  margin: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 0.1em 0.3em rgba(0, 0, 0, 0.5) inset;
  cursor: pointer;
  transition: background 0.18s ease;
}
.golden-intro-skip-row input::after,
.fireball-intro-skip-row input::after,
.levelup-intro-skip-row input::after {
  content: '';
  position: absolute;
  top: 0.2em;
  left: 0.2em;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0.1em 0.25em rgba(0, 0, 0, 0.45);
  transition: transform 0.18s ease;
}
.golden-intro-skip-row input:checked,
.fireball-intro-skip-row input:checked,
.levelup-intro-skip-row input:checked {
  background: #e8a01a;
}
.golden-intro-skip-row input:checked::after,
.fireball-intro-skip-row input:checked::after,
.levelup-intro-skip-row input:checked::after {
  transform: translateX(1.6em);
}

/* Pinned toward the bottom with the CTA, per the design. 0.43em of this
   row's 14px font (6px) + the container's 1em gap (10px) = 16px clearance
   above the PLAY button. */
.golden-intro-skip-row,
.levelup-intro-skip-row {
  margin-top: auto;
  margin-bottom: 0.43em;
}

.golden-intro-play { width: 100%; }
.levelup-intro-play { width: 100%; }

/* ---------- Jackpot win banner ---------- */

.jackpot-banner {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  z-index: 45;
  font-family: var(--font-accent);
  font-weight: 400;
  font-size: 3em;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, #fff3cf, #ffd94a 55%, #ff9d3c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0.3em 0.6em rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  animation: jackpot-banner-pop 1.8s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

@keyframes jackpot-banner-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  25%  { transform: translate(-50%, -50%) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* ---------- Level Up tutorial modal ---------- */

/* Same composition as the Golden Ball intro, dressed in the Level Up
   blues: confetti backdrop + the round's blue inner shadow. */
#levelup-intro {
  position: absolute;
  inset: 0;
  z-index: 60; /* above the settings panel (50) */
  background: transparent; /* backdrop video + dressing live in #screen-bg */
  box-shadow: 0 0 32px 0 #2e7bff inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1em;
  padding: 2.4em 2em 2em;
  text-align: center;
  transition: opacity 0.25s ease;
}
#levelup-intro.hidden {
  opacity: 0;
  pointer-events: none;
}

.levelup-intro-ball {
  width: 6.4em;
  height: 6.4em;
  margin-top: 4.4em;
  object-fit: contain;
  filter: drop-shadow(0 0 1.6em rgba(60, 130, 255, 0.75));
}

.levelup-intro-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  width: 100%;
}
.levelup-intro-title .title-star { width: 0.93em; }

.levelup-intro-title-text {
  font-family: var(--font-accent);
  font-weight: 400;
  font-size: 1.7em;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fff3cf 0%, #ffd94a 45%, #e8a01a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0.08em 0.16em rgba(0, 0, 0, 0.6));
  white-space: nowrap;
}

.levelup-intro-subtitle {
  color: #fff;
  font-size: 1.4em;
  line-height: 1.35;
  max-width: 19em;
}

.levelup-intro-legend {
  display: flex;
  justify-content: center;
  gap: 2em;
  margin: 0.6em 0;
}

/* Same cup-beside-label lockup (and the same v2 cup-art padding
   compensation) as the Golden Ball intro legend. */
.levelup-intro-legend-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35em;
  color: #fff;
  font-family: var(--font-accent);
  font-weight: 400;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.levelup-intro-legend-item span {
  font-size: 1.4em;
  margin-left: -1.1em;
  transform: translateY(1.1em);
}
.levelup-intro-legend-item img {
  height: 9.6em;
  width: auto;
  object-fit: contain;
}

/* ---------- Jackpot reveal screen ---------- */

#jackpot-reveal {
  position: absolute;
  inset: 0;
  z-index: 65; /* above the golden intro (60) */
  background: transparent; /* backdrop video + dressing live in #screen-bg */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.8em;
  padding: 2em 1.6em 2em; /* design: button 24px off the bottom */
  text-align: center;
  transition: opacity 0.25s ease;
}
#jackpot-reveal.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Same yellow inner glow the Golden Ball round wears (#gold-vignette). */
#jackpot-reveal::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  box-shadow: 0 0 32px 0 #fcc708 inset;
}

.jackpot-reveal-kicker {
  margin-top: 1em; /* content sits in the upper half, per the design */
  color: #fff;
  font-family: var(--font-accent);
  font-weight: 400;
  font-size: 2.2em; /* design: Anton 22px */
  letter-spacing: 0.04em;
  text-shadow:
    0 0.32em 0.14em rgba(0, 0, 0, 0.03),
    0 0.18em 0.09em rgba(0, 0, 0, 0.1),
    0 0.09em 0.09em rgba(0, 0, 0, 0.17),
    0 0 0.05em rgba(0, 0, 0, 0.2);
}

.jackpot-reveal-title {
  font-family: var(--font-accent);
  font-weight: 400;
  font-size: 4.8em; /* design: Anton 48px */
  letter-spacing: 0.02em;
  background: url("../assets/v2/noise.png"), linear-gradient(0deg, #e89c03 0%, #fdc62e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.jackpot-reveal-chevron {
  width: 3em; /* design: 30x26 arrow art */
  height: auto;
  margin-top: 2.6em; /* design: generous air between title and reel */
  animation: jackpot-chevron-bob 1.2s ease-in-out infinite;
}
@keyframes jackpot-chevron-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(0.3em); }
}

/* Full-bleed reel viewport: escapes the screen's side padding so cards
   clip at both screen edges, CS:GO case-opening style. */
.jackpot-reveal-viewport {
  position: relative;
  flex: none; /* never squashed by the column flex — the reel must not clip */
  width: calc(100% + 3.2em); /* cancel #jackpot-reveal's 1.6em side padding */
  margin: -0.2em -1.6em 0; /* design: arrow sits 8px above the reel */
  height: 12.4em;
  overflow: hidden;
}

.jackpot-reveal-strip {
  position: absolute;
  top: 50%;
  left: 0;
  display: flex;
  gap: 1.1em; /* design: 11px between 145px-wide cards */
  transform: translateY(-50%);
  will-change: transform;
}
/* The roll itself is driven by the Web Animations API (JackpotReveal.js);
   .rolling here only flags the screen state for the marker/button. */

.jackpot-reveal-card {
  position: relative;
  flex: 0 0 auto;
  width: 14.5em;  /* design: 145x116 thumbnails */
  height: 11.6em;
  border-radius: 0.6em;
  /* The design's card art — blue panel with sparkles and edge glow. */
  background: #14225e url("../assets/prize-frame.png") center / 100% 100% no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Starburst light behind the prize art — the design's ray asset. */
.jackpot-reveal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../assets/v2/prize-light.svg") center / contain no-repeat;
}

.jackpot-reveal-card-art {
  position: relative;
  max-width: 58%;
  max-height: 62%;
  object-fit: contain;
  filter: drop-shadow(0 0.3em 0.5em rgba(0, 0, 0, 0.55));
}

/* The landed winner: gold ring flash, pop, and spinning rays. */
.jackpot-reveal-card.winner {
  animation: jackpot-winner-pop 0.55s cubic-bezier(0.2, 1.6, 0.4, 1) forwards;
  box-shadow: 0 0 1.6em rgba(255, 217, 74, 0.65);
}
.jackpot-reveal-card.winner::before {
  animation: jackpot-winner-rays 9s linear infinite;
}
.jackpot-reveal-card.winner::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid rgba(255, 217, 74, 0.9);
}
@keyframes jackpot-winner-pop {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); } /* fits the viewport without clipping */
}
@keyframes jackpot-winner-rays {
  to { transform: rotate(360deg); }
}

/* Losing neighbours dim once the winner lands. */
.jackpot-reveal-strip.landed .jackpot-reveal-card:not(.winner) {
  filter: brightness(0.45) saturate(0.6);
  transition: filter 0.5s ease;
}

/* Gold ticker hairline over the strip centre — visible only mid-roll. */
.jackpot-reveal-marker {
  position: absolute;
  top: 2%;
  bottom: 2%;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(180deg, transparent, #ffd94a 20%, #ffd94a 80%, transparent);
  box-shadow: 0 0 0.6em rgba(255, 217, 74, 0.8);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
#jackpot-reveal.rolling .jackpot-reveal-marker { opacity: 1; }

.jackpot-reveal-caption {
  color: #fff;
  font-family: var(--font-main);
  font-weight: 500;
  font-size: 2em; /* design: Inter 500 20px */
  min-height: 1.2em;
}
/* Won: the prize name lands in the shared dark pill with the multi-hue
   ring — the same badge the score panel and prize screens use. */
.jackpot-reveal-caption.won {
  position: relative;
  font-family: var(--font-accent);
  font-weight: 400;
  letter-spacing: 0.03em;
  color: #fff;
  text-shadow: 0 0.1em 0.25em rgba(0, 0, 0, 0.8);
  background: rgba(14, 10, 34, 0.66);
  border-radius: 0.6em;
  padding: 0.4em 1.2em 0.32em;
  animation: jackpot-caption-pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.jackpot-reveal-caption.won::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--panel-ring);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}
@keyframes jackpot-caption-pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.jackpot-reveal-btn {
  max-width: 20em;
  margin-top: auto; /* pinned to the bottom edge (24px via container padding) */
  transition: opacity 0.3s ease, transform 0.3s ease;
}
/* Mid-roll and after landing the button gives the stage to the reel —
   the screen closes itself once the celebration has played. */
#jackpot-reveal.rolling .jackpot-reveal-btn,
#jackpot-reveal.rolled .jackpot-reveal-btn {
  opacity: 0;
  transform: translateY(0.6em);
  pointer-events: none;
}

.jackpot-reveal-confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

/* ---------- Bonus Wheel (Spin the Bottle) ---------- */

#bonus-wheel {
  position: absolute;
  inset: 0;
  z-index: 62; /* above the golden intro (60); the two never overlap in practice */
  background: transparent; /* backdrop video + dressing live in #screen-bg */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between; /* title top, wheel centre, hint bottom — as in the mock */
  padding: 1.8em 0 1.4em;
  text-align: center;
  overflow: hidden; /* the zoomed wheel scales past the stage edges */
  transition: opacity 0.25s ease;
}
#bonus-wheel.hidden {
  opacity: 0;
  pointer-events: none;
}

.bonus-wheel-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  width: 100%;
  position: relative;
  z-index: 2; /* above the wheel until the zoom fades it out */
  transition: opacity 0.4s ease;
}
/* BonusWheel.js fades the title away while the wheel is zoomed in. */
.bonus-wheel-title.faded { opacity: 0; }
/* 0.93em of the h2's UA 1.5em font ≈ 14px at the 375px stage width. */
.bonus-wheel-title .title-star { width: 0.93em; }

.bonus-wheel-title-text {
  font-family: var(--font-accent);
  font-weight: 400;
  font-size: 2.8em;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fff3cf 0%, #ffd94a 45%, #e8a01a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0.08em 0.16em rgba(0, 0, 0, 0.6));
  white-space: nowrap;
}

/* Mock proportions (bonus-wheel-1.png @ 4x stage scale): the wheel spans
   ~92% of the 37.5em stage width. */
#bonus-wheel-wrap {
  position: relative;
  width: 34.5em;
  height: 34.5em;
  flex: 0 0 auto;
  transition: transform 1.1s cubic-bezier(0.3, 0, 0.3, 1);
}
/* Zoom-in as the bottle winds down — BonusWheel.js aims transform-origin
   at where the bottle tip will stop before flipping this class on. */
#bonus-wheel-wrap.zoomed {
  transform: scale(1.9);
}

/* The wheel art (wooden rim, felt, spokes) fills the wrap; the cards layer
   sits on top of it, the bottle on top of both. */
.bonus-wheel-disc-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0.6em 1.6em rgba(0, 0, 0, 0.7));
}
#bonus-wheel-disc {
  position: absolute;
  inset: 0;
}

/* One prize card per wedge, pushed out from the hub and rotated with its
   wedge (top toward the rim) like the design mock: a blue card with a
   starburst of light rays behind the prize art and a pale blue-violet
   border. Mock card ≈ 6.5 x 7.8em, centred at ~69% of the wheel radius. */
.bonus-wheel-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6.5em;
  height: 7.8em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  border-radius: 0.9em;
  background:
    radial-gradient(circle at 50% 44%, rgba(150, 210, 255, 0.55), rgba(20, 60, 160, 0) 58%),
    repeating-conic-gradient(from -8deg at 50% 44%,
      rgba(150, 205, 255, 0.18) 0deg 8deg,
      rgba(0, 0, 0, 0) 8deg 16deg),
    linear-gradient(160deg, #2e6fd8 0%, #143a9e 55%, #0c2470 100%);
  border: 0.16em solid rgba(196, 205, 255, 0.85);
  box-shadow:
    inset 0 0 1.3em rgba(10, 25, 90, 0.8),
    0 0.3em 0.9em rgba(0, 0, 0, 0.55);
}
.bonus-wheel-card img {
  width: 3.4em;
  height: 3.4em;
  object-fit: contain;
  filter: drop-shadow(0 0.15em 0.25em rgba(0, 0, 0, 0.5));
}
.bonus-wheel-card span {
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-shadow: 0 0.15em 0.3em rgba(0, 0, 0, 0.85);
}
/* Physical-prize names ("LEGO MCLAREN P1") are far longer than the money
   labels — smaller type, wrapped over up to two lines. */
.bonus-wheel-card span.item-label {
  font-size: 0.58em;
  line-height: 1.2;
  padding: 0 0.4em;
}

/* Bottle art spinner: pivots about its own centre, on the wheel hub.
   Rests pointing at 12 o'clock; BonusWheel.js rotates it to spin.
   Mock bottle spans ~47% of the wheel diameter. */
#bonus-wheel-bottle {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 16.4em;
  width: auto;
  transform-origin: 50% 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  pointer-events: none;
  filter: drop-shadow(0 0.3em 0.9em rgba(0, 0, 0, 0.75));
}

/* Landing banner: names the prize across the wheel once the bottle stops.
   A sibling of the wrap (overlay coordinates), so the wheel's zoom
   transform never moves it. */
#bonus-wheel-banner {
  position: absolute;
  left: 50%;
  bottom: 1.2em; /* prize name sits at the bottom of the screen */
  z-index: 2;
  transform: translateX(-50%) scale(0.8);
  min-width: 88%;
  padding: 0.4em 0.8em;
  border-radius: 0.5em;
  background: rgba(9, 22, 24, 0.88);
  border: 0.12em solid rgba(130, 190, 230, 0.5);
  box-shadow: 0 0.4em 1.2em rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
#bonus-wheel-banner.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
#bonus-wheel-banner-text {
  font-family: var(--font-accent);
  font-weight: 400;
  font-size: 2.2em;
  letter-spacing: 0.04em;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 0.1em 0.3em rgba(0, 0, 0, 0.8);
}

.bonus-wheel-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  transition: opacity 0.3s ease;
  /* Neutral gray palette (the game footer's blue tint doesn't match this
     screen's mock): dim gray connectors, near-white TAP/SWIPE + icons. */
  color: rgba(184, 184, 189, 0.55);
}
.bonus-wheel-hint .instr-strong,
.bonus-wheel-hint .instr-icon {
  color: rgba(244, 244, 246, 0.95);
}
.bonus-wheel-hint.faded { opacity: 0; }

/* Golden confetti celebration when the bottle stops — drawn by
   BonusWheel.js on this full-screen layer above the wheel and banner. */
#bonus-wheel-confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

/* ---------- Session Summary ---------- */

#session-summary {
  position: absolute;
  inset: 0;
  z-index: 63;
  background: transparent; /* backdrop video + dressing live in #screen-bg */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Base gap is the card-to-card rhythm; the larger gaps in the design are
     added as margins on the 1em-based children below. */
  gap: 0.95em;
  padding: 1.6em 1.6em 0.4em;
  text-align: center;
  transition: opacity 0.25s ease;
}
#session-summary.hidden {
  opacity: 0;
  pointer-events: none;
}

.session-summary-logo {
  height: 5.4em;
  width: auto;
  margin-bottom: 0.5em;
  filter: drop-shadow(0 0.3em 0.7em rgba(0, 0, 0, 0.65));
}

.session-summary-title {
  font-family: var(--font-accent);
  font-weight: 400;
  font-size: 3.1em;
  line-height: 1;
  background: linear-gradient(180deg, #ffe89a 0%, #ffd23f 55%, #e79a06 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0.05em 0.1em rgba(0, 0, 0, 0.7));
}

/* Icon left, label-over-value right, inside a 1px multi-hue ring — the
   same masked-gradient technique as the score panel, so the border paints
   only the edge and never tints the translucent card fill. */
.summary-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.9em;
  padding: 1em 1.2em;
  border-radius: 1.2em;
  background: rgba(14, 10, 34, 0.66);
  width: 100%;
  min-height: 7.6em;
}
.summary-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--panel-ring);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}
.summary-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9em;
  width: 100%;
  margin-top: 1.15em; /* carried over from the retired wide Prizes card */
  margin-bottom: 1.4em;
}

.summary-card-icon {
  width: 4.2em;
  height: 4.2em;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 0.2em 0.4em rgba(0, 0, 0, 0.6));
}

.summary-card-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1em;
}

/* Labels stay in the reading face; only the values are display-condensed. */
.summary-card-label {
  font-family: var(--font-main);
  font-size: 1.05em;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: #c98bff; /* Prizes card's default */
}
.summary-card--credit .summary-card-label { color: #3ddc55; }
.summary-card--golden .summary-card-label { color: #f0a81e; }
.summary-card--fire .summary-card-label { color: #f5901e; }
.summary-card--levelup .summary-card-label { color: #3fa1ff; }
.summary-card--bonus .summary-card-label { color: #ff4fd8; }

.summary-card-value {
  font-family: var(--font-accent);
  font-size: 2.1em;
  font-weight: 400;
  line-height: 1.1;
  color: #ffffff;
}

/* Sits under the 30px main label; together they stay inside the 48px box. */
.session-summary-cta-sub {
  font-size: 0.7em;
  line-height: 1.15em;
  letter-spacing: 0.04em;
}

/* ---------- Prize Reveal ---------- */

/* Two states, driven by a `revealed` class on the root (set in
   PrizeReveal.js): closed = logo / gold "PRIZE X OF Y" / closed gift box /
   "REVEALING..." panel; revealed = the counter yields to a large art card,
   the lid tips off to the right and the box settles lower, and the panel
   shows the item name. Layout matches assets/v2/design/Summary-03/04. */
#prize-reveal {
  position: absolute;
  inset: 0;
  z-index: 64;
  background: transparent; /* backdrop video + dressing live in #screen-bg */
  text-align: center;
  transition: opacity 0.25s ease;
}
#prize-reveal.hidden {
  opacity: 0;
  pointer-events: none;
}
/* One-frame guard while the screen (re)opens: the box, panel and card
   snap to their closed-state positions instead of animating there. */
#prize-reveal.no-anim .prize-reveal-box-top,
#prize-reveal.no-anim .prize-reveal-box-bottom,
#prize-reveal.no-anim .prize-reveal-panel,
#prize-reveal.no-anim .prize-reveal-card {
  transition: none !important;
  animation: none !important;
}

.prize-reveal-logo {
  position: absolute;
  top: 1.2em;
  left: 50%;
  transform: translateX(-50%);
  width: 7em;
  filter: drop-shadow(0 0.3em 0.6em rgba(0, 0, 0, 0.6));
}

.prize-reveal-counter {
  position: absolute;
  /* 4em at this 2.2em font = 8.8em in stage units — just under the logo. */
  top: 4em;
  left: 0;
  right: 0;
  font-family: var(--font-accent);
  font-weight: 400;
  font-size: 2.2em;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #ffe89a, #ffd94a 55%, #e8a01a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0.08em 0.16em rgba(0, 0, 0, 0.6));
  transition: opacity 0.25s ease;
}
#prize-reveal.revealed .prize-reveal-counter { opacity: 0; }

/* Revealed-state art card: blue burst frame, spinning light, item art.
   Springs up out of the box (staged just after the lid pops). */
.prize-reveal-card {
  position: absolute;
  top: 7.8em; /* clears the logo (its bottom edge sits at ~7.4em) */
  left: 50%;
  width: 18.5em;
  height: 14.8em; /* frame art is 137x110 */
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 2.2em rgba(255, 190, 60, 0.5));
}
#prize-reveal.revealed .prize-reveal-card {
  animation: prize-card-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 0.12s forwards;
}
@keyframes prize-card-pop {
  from { opacity: 0; transform: translateX(-50%) translateY(5em) scale(0.55); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.prize-reveal-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.prize-reveal-light {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13.5em;
  transform: translate(-50%, -50%);
  mix-blend-mode: screen;
  animation: prize-light-spin 12s linear infinite;
}
.prize-reveal-art {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 9.5em;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0.3em 0.5em rgba(0, 0, 0, 0.6));
}

/* Gift box: centred while closed, settles low (lid tipped off to the
   right, per the design) once revealed. */
#prize-reveal-stage {
  position: absolute;
  top: 16em;
  bottom: 8.2em;
  left: 0;
  right: 0;
  pointer-events: none;
}

.prize-reveal-box-bottom,
.prize-reveal-box-top {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), bottom 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 0.4em 0.8em rgba(0, 0, 0, 0.5));
}
.prize-reveal-box-bottom {
  width: 13.2em; /* art is 600x400 */
  bottom: 5.6em;
}
.prize-reveal-box-top {
  width: 13.7em; /* art is 624x332 */
  bottom: 13.5em;
}
#prize-reveal.revealed .prize-reveal-box-bottom { bottom: 0.2em; }
#prize-reveal.revealed .prize-reveal-box-top {
  bottom: 6.4em;
  transform: translateX(32%) rotate(22deg);
}

/* Bottom panel: ring-bordered card carrying "REVEALING..." / item name. */
.prize-reveal-panel {
  position: absolute;
  left: 5.4em;
  right: 5.4em;
  bottom: 1.6em;
  transition: bottom 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 5.8em;
  border-radius: 1.6em;
  background: rgba(16, 12, 44, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.8em 1.2em;
}
.prize-reveal-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--panel-ring);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.prize-reveal-label,
.prize-reveal-caption {
  font-family: var(--font-accent);
  font-weight: 400;
  font-size: 2em;
  letter-spacing: 0.03em;
  color: #ffffff;
  text-shadow: 0 0.1em 0.25em rgba(0, 0, 0, 0.8);
}
.prize-reveal-label { display: none; }
#prize-reveal.revealed .prize-reveal-label {
  display: block;
  animation: prize-label-pop 0.35s ease 0.3s backwards;
}
#prize-reveal.revealed .prize-reveal-caption { display: none; }
@keyframes prize-label-pop {
  from { opacity: 0; transform: translateY(0.4em); }
}

/* Reveal-moment FX: a gold flash bloom centred on the box, and the
   confetti canvas layered over the whole overlay. */
.prize-reveal-flash {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 34em;
  height: 34em;
  margin: -17em 0 0 -17em;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle,
    rgba(255, 225, 130, 0.9) 0%,
    rgba(255, 175, 55, 0.4) 40%,
    rgba(255, 150, 40, 0) 70%);
  opacity: 0;
}
.prize-reveal-flash.burst {
  animation: prize-flash 0.8s ease-out forwards;
}
@keyframes prize-flash {
  0%   { opacity: 0; transform: scale(0.25); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1.7); }
}

.prize-reveal-confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1; /* over the box/card, under the arrows (2) */
}

/* Carousel arrows: floating circles at the screen edges, mid-height.
   Only shown when there's more than one prize to browse. */
.prize-reveal-arrow {
  position: absolute;
  top: 50%;
  width: 1.8em;
  height: 1.8em;
  transform: translateY(-50%);
  border-radius: 50%;
  border: none;
  background: rgba(38, 38, 44, 0.8);
  color: #fff;
  font-size: 2.2em;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.prize-reveal-arrow.hidden { display: none; }
.prize-reveal-arrow-prev { left: 0.75em; }
.prize-reveal-arrow-next { right: 0.75em; }
.prize-reveal-arrow:active {
  transform: translateY(-50%) scale(0.92);
}
@media (hover: hover) {
  .prize-reveal-arrow:hover { background: rgba(62, 62, 70, 0.9); }
}

/* The box/panel cluster sits shifted up and the CONTINUE CTA takes the
   bottom of the screen for the whole carousel (the .all-open class is
   applied from show() on), so players can leave for the table at any
   point rather than only after every box is opened. */
.prize-reveal-continue {
  display: none;
  position: absolute;
  /* Exactly 16px off the bottom edge: 0.8em at the button's 2em font,
     with .btn-primary's 4px shadow margin zeroed out. */
  left: 1em;
  right: 1em;
  bottom: 0.8em;
  margin-bottom: 0;
  width: auto;
  z-index: 2;
}
#prize-reveal.all-open .prize-reveal-continue {
  display: flex;
  animation: prize-label-pop 0.35s ease 0.45s backwards;
}
#prize-reveal.all-open .prize-reveal-panel { bottom: 8.6em; }
#prize-reveal.all-open.revealed .prize-reveal-box-bottom { bottom: 6.2em; }
#prize-reveal.all-open.revealed .prize-reveal-box-top { bottom: 12.4em; }

/* ---------- Screen backdrop (video + Figma game-background dressing) ----------
   One shared layer behind every full-screen overlay: the looping backdrop
   video (re-parented from the splash by main.js), a centred dark blur that
   seats screen content, and the 103px bottom gradient. Faded in via
   :has() whenever one of the overlay screens is open, so the screens
   themselves stay transparent. */

#screen-bg {
  position: absolute;
  inset: 0;
  z-index: 55; /* above the settings panel (50), below every screen (60+) */
  background: #0a0612; /* covers the canvas until the video has frames */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease; /* matches the screens' fade */
}

#game-stage:has(#fireball-intro:not(.hidden)) #screen-bg,
#game-stage:has(#golden-intro:not(.hidden)) #screen-bg,
#game-stage:has(#levelup-intro:not(.hidden)) #screen-bg,
#game-stage:has(#jackpot-reveal:not(.hidden)) #screen-bg,
#game-stage:has(#bonus-wheel:not(.hidden)) #screen-bg,
#game-stage:has(#session-summary:not(.hidden)) #screen-bg,
#game-stage:has(#prize-reveal:not(.hidden)) #screen-bg {
  opacity: 1;
}

/* Design overlay: 103px fade to #190A06 pinned to the bottom edge. Used
   twice — inside #screen-bg for the overlay screens, and stage-level
   (#game-bottom-overlay) over the gameplay canvas. */
.bottom-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 10.34em; /* design: 103px */
  background: linear-gradient(180deg, rgba(25, 10, 6, 0) 0%, #190a06 74.63%);
  pointer-events: none;
}

#game-bottom-overlay {
  z-index: 10; /* above the canvas, below the vignettes (20) and HUD (30) */
}

/* Figma "dark-blur": a blurred #100804 rounded rect centred behind screen
   content (265x344 @ 375x476, radius 38, blur 44.2, centre +11px down).
   Shown for the onboarding intros, jackpot, spin-the-bottle and summary
   screens; the prize reveal runs on the plain video + gradient. */
#screen-bg .screen-dark-blur {
  position: absolute;
  left: 50%;
  top: calc(50% + 1.11em);
  width: 26.51em;
  height: 34.41em;
  transform: translate(-50%, -50%);
  border-radius: 3.8em;
  background: #100804;
  filter: blur(4.42em);
  opacity: 0;
  transition: opacity 0.25s ease;
}

#game-stage:has(#fireball-intro:not(.hidden)) #screen-bg .screen-dark-blur,
#game-stage:has(#golden-intro:not(.hidden)) #screen-bg .screen-dark-blur,
#game-stage:has(#levelup-intro:not(.hidden)) #screen-bg .screen-dark-blur,
#game-stage:has(#jackpot-reveal:not(.hidden)) #screen-bg .screen-dark-blur,
#game-stage:has(#bonus-wheel:not(.hidden)) #screen-bg .screen-dark-blur,
#game-stage:has(#session-summary:not(.hidden)) #screen-bg .screen-dark-blur {
  opacity: 1;
}

/* ---------- Loading ---------- */

#loading {
  position: absolute;
  inset: 0;
  z-index: 100;
  /* Flat colour covers until the backdrop video paints its first frame */
  background: #0a0612;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.2em;
  transition: opacity 0.5s ease;
}
#loading.done { opacity: 0; pointer-events: none; }

/* Same backdrop video as the game; the static background beneath covers
   until it has frames (or if autoplay is blocked). scale(1.032) replicates
   the canvas renderer's +24 logical px overscan (774/750) so the video
   doesn't shift when the game takes over drawing it. */
.loading-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.032);
}

/* After the splash: re-parented into #screen-bg, still playing — it feeds
   the canvas background and backs every overlay screen. The .loading-video
   cover styles (absolute, cover, 1.032 overscan) still apply; #screen-bg
   controls visibility. */
.bg-video-feeder {
  pointer-events: none;
}

.loading-logo {
  position: relative;
  width: 52%;
  max-width: 21em;
  /* Sit the logo just above centre, as in the splash design */
  margin-top: -12%;
  filter: drop-shadow(0 1em 2.4em rgba(0, 0, 0, 0.65));
  /* Entrance: pop up from 40px below (1em = 10px stage units) — a fast
     ~300ms rise, then a springy double-bounce settle with a hint of
     squash-and-stretch. `backwards` keeps it hidden until the animation
     starts. */
  animation: loading-logo-in 0.55s ease-out backwards;
}

@keyframes loading-logo-in {
  0%   { opacity: 0; transform: translateY(4em) scale(0.96, 1.05); }
  45%  { opacity: 1; transform: translateY(-0.6em) scale(1.01, 1); }
  65%  { transform: translateY(0.18em) scale(1.04, 0.96); } /* squash on touchdown */
  82%  { transform: translateY(-0.14em) scale(0.99, 1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Shown by main.js if boot fails */
.loading-title {
  font-family: var(--font-accent);
  font-weight: 400;
  color: #fff;
  font-size: 2.2em;
  letter-spacing: 0.28em;
  text-shadow: 0 0 0.9em rgba(120, 255, 60, 0.5);
}

/* Replaces the loading bar once assets are in: the tap that dismisses the
   splash is also the browser's audio unlock (see main.js). */
.tap-to-start {
  font-size: 1.6em;
  cursor: pointer;
  animation: tap-to-start-pulse 1.5s ease-in-out infinite;
}

@keyframes tap-to-start-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.loading-bar {
  position: relative; /* paints above the backdrop video */
  width: 14em;
  height: 0.3em;
  border-radius: 0.15em;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  /* Follows the logo in once its overshoot has landed */
  animation: loading-bar-in 0.45s ease-out 0.25s backwards;
}

@keyframes loading-bar-in {
  from { opacity: 0; transform: translateY(0.9em); }
  to   { opacity: 1; transform: none; }
}

#loading-fill {
  position: relative;
  overflow: hidden;
  width: 0%;
  height: 100%;
  border-radius: 0.15em;
  background: linear-gradient(90deg, #4dbf1e, #8dff2e);
  box-shadow: 0 0 0.6em rgba(141, 255, 46, 0.55);
  /* Timed 0→100% fill, landing just before the minimum splash (1.5s)
     lifts — not real asset progress, which finishes near-instantly from
     local/cache and made the bar jump straight to full. */
  animation: loading-fill-grow 1s ease-out 0.45s forwards;
}

@keyframes loading-fill-grow {
  from { width: 0%; }
  to   { width: 100%; }
}

/* Shine sweep across the filled portion only (the fill clips it) */
#loading-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: translateX(-100%);
  animation: loading-shine 1.1s ease-in-out 0.9s infinite;
}

@keyframes loading-shine {
  to { transform: translateX(100%); }
}

/* ---------- Accessibility ---------- */

/* Hover states — pointer devices only, so touch taps don't leave a stuck
   hover. Active/press styles stay as defined per button. */
@media (hover: hover) {
  .hud-btn:hover { transform: scale(1.1); }
  .settings-btn:not(.btn-primary):hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(150, 110, 255, 0.7);
  }
  .settings-btn.danger:hover {
    background: rgba(255, 80, 80, 0.12);
    border-color: rgba(255, 80, 80, 0.8);
  }
  .mode-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(150, 110, 255, 0.6);
    color: #fff;
  }
  .btn-primary:hover { filter: brightness(1.07); }
}

.hud-btn:focus-visible,
.settings-btn:focus-visible,
.mode-option:focus-visible,
.settings-row input:focus-visible,
.golden-intro-skip-row input:focus-visible,
.fireball-intro-skip-row input:focus-visible,
.levelup-intro-skip-row input:focus-visible {
  outline: 2px solid #8dff2e;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .popup { animation-duration: 0.9s; }
  .prize-pop { animation-duration: 1.4s; }
  .prize-pop-light { animation: none; }
}
