:root {
  --bg: #000;
  --ink: #fff;
  --dim: #8a8a92;
  --hot: #ff2d2d;
  --gold: #ffcf3d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Helvetica Neue", Arial, system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: none;
}

/* Anything hidden must stay hidden — .screen is display:flex, and a bare
   [hidden] loses to any explicit display rule. Same trap as whistle's sheets. */
[hidden] { display: none !important; }

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: max(10px, env(safe-area-inset-top)) 14px 0;
  pointer-events: none;
  z-index: 5;
}

.hud-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.stat { display: flex; flex-direction: column; min-width: 74px; }
.stat.right { align-items: flex-end; }

.label {
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--dim);
  font-weight: 700;
}

.value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.timer {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.timer.low { color: var(--hot); animation: pulse .6s ease-in-out infinite; }

@keyframes pulse {
  50% { opacity: .45; }
}

.timerbar {
  margin-top: 8px;
  height: 4px;
  border-radius: 2px;
  background: #1c1c20;
  overflow: hidden;
}

.timerbar i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--ink);
  transform-origin: left center;
}

/* Survival: the same bar drains over the idle grace, then goes red for the fuse. */
.timerbar.hot i { background: var(--hot); }

.danger {
  margin-top: 8px;
  text-align: center;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: .12em;
  color: var(--hot);
  font-variant-numeric: tabular-nums;
  animation: pulse .5s ease-in-out infinite;
}

/* Lives are drawn in the SCORE slot in survival; spent ones stay as dim ghosts
   so the row never reflows as you lose them. */
.value .lost { color: #3a3a40; }

.combo {
  margin-top: 10px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--gold);
  min-height: 18px;
  opacity: 0;
  transition: opacity .15s;
}

.combo.on { opacity: 1; }

.armed {
  margin-top: 4px;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .1em;
  color: #ffd76a;
  min-height: 16px;
  opacity: 0;
  transition: opacity .15s;
}

.armed.on { opacity: 1; animation: pulse 1s ease-in-out infinite; }
.armed.ice { color: #8fe3ff; }

.best-line.coins b { color: var(--gold); }
.coins-earned { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: .04em; color: var(--gold); }

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

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px;
  text-align: center;
  background: rgba(0, 0, 0, .88);
  backdrop-filter: blur(3px);
}

.title {
  margin: 0;
  font-size: clamp(38px, 14vw, 66px);
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: .95;
}

.title .t-bash { color: var(--hot); display: block; }

/* The word BEN is the unlock gesture's tap target, so it is its own inline
   element — inline, not block, so the hit area is the word and not the whole
   centred line. It looks and lays out exactly as the bare text node it replaced. */
.title .t-ben {
  display: inline-block;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}

/* Retriggered per tap once the gesture is past its silent threshold. */
@keyframes benhit {
  0%   { transform: translate(0, 0) rotate(0deg); }
  25%  { transform: translate(-3px, 1px) rotate(-2.5deg); }
  55%  { transform: translate(3px, -1px) rotate(2deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

.title .t-ben.hit { animation: benhit .16s ease-out; }

.tally { font-size: 12px; color: #4a4a52; }
.tally b { color: var(--dim); }

/* Only ever visible once Round 2 has been unlocked. */
.btn.round2 {
  background: var(--hot);
  color: #fff;
}

.tag { margin: 0; color: var(--dim); font-size: 14px; }

.btn {
  margin-top: 6px;
  padding: 16px 44px;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: .1em;
  color: #000;
  background: var(--ink);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.btn:active { transform: scale(.96); }

.btn.ghost {
  color: var(--ink);
  background: transparent;
  border: 2px solid #33333a;
  padding: 13px 38px;
  font-size: 16px;
}

.best-line { margin: 0; color: var(--dim); font-size: 13px; }
.best-line b { color: var(--ink); }

.ver {
  position: absolute;
  bottom: max(12px, env(safe-area-inset-bottom));
  margin: 0;
  font-size: 11px;
  color: #3a3a40;
}

.over-label {
  margin: 0;
  font-size: 13px;
  letter-spacing: .3em;
  color: var(--dim);
}

.final {
  font-size: clamp(56px, 22vw, 110px);
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.final.record { color: var(--gold); }

.breakdown {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  font-size: 13px;
  color: var(--dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.breakdown b { color: var(--ink); }

.rotate { font-size: 17px; color: var(--dim); }

@media (orientation: landscape) and (max-height: 500px) {
  .hud, #menu, #over { visibility: hidden; }
}

/* A text-weight action so the menu doesn't grow a third fat pill button. */
.btn.link {
  margin-top: 2px;
  padding: 8px 16px;
  background: transparent;
  border: 0;
  color: var(--dim);
  font-size: 12px;
  letter-spacing: .22em;
}

.btn.link:active { color: var(--ink); transform: none; }

/* ---------- credits ---------- */

/* Lighter scrim than the other screens: Ben is bouncing behind these two and
   an .88 backdrop buries him entirely. Text gets a shadow instead — same
   trade as whistle's banner scrim, contrast first but not at the cost of the
   thing it's sitting on. */
#menu, #credits {
  background: rgba(0, 0, 0, .45);
  backdrop-filter: none;          /* the blur smears the attract face into a blob */
  text-shadow: 0 2px 14px #000, 0 0 10px #000, 0 0 4px #000;
}

#credits { gap: 10px; justify-content: center; }

.names {
  list-style: none;
  margin: 2px 0 6px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: clamp(20px, 7vw, 28px);
  font-weight: 900;
  letter-spacing: -.01em;
}

.dedication {
  max-width: 30em;
  border-top: 1px solid #26262c;
  padding-top: 14px;
  color: var(--dim);
  font-size: 13px;
  line-height: 1.5;
}

.dedication p { margin: 0 0 8px; }

.dedi-head {
  color: var(--hot);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .12em;
}

.dedi-sign { color: #55555e; font-size: 11px; font-style: italic; margin-bottom: 0 !important; }

@media (orientation: landscape) and (max-height: 500px) {
  #credits { visibility: hidden; }
}

/* The two text-weight actions sit on one line so the menu doesn't get taller. */
.linkrow {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn.link.off { color: #3a3a40; }


/* The menu clears out as the title word falls, so BEN is alone on screen for
   the reveal instead of tumbling behind BASHER and the start button. */
@keyframes dropfade {
  from { opacity: 1; }
  to   { opacity: 0; }
}

#menu.dropping {
  animation: dropfade .45s ease-in forwards;
  pointer-events: none;
}

/* Brighter than the credits' sign-off: on the Round 2 end card this line is the
   point of the whole mode, not a footnote. */
#overNote { color: #8a8a95; font-size: 12px; }

/* ---------- Shop: face wheel ---------- */

.btn.link.shop { color: var(--gold); }

/* Taller than a phone screen, so it scrolls; justify-content:center would clip
   the top of a column that overflows, hence flex-start plus auto margins. */
#shop {
  justify-content: flex-start;
  overflow-y: auto;
  gap: 12px;
  padding-top: max(28px, env(safe-area-inset-top));
  background: rgba(0, 0, 0, .94);
}
#shop > :first-child { margin-top: auto; }
#shop > :last-child { margin-bottom: auto; flex-shrink: 0; }
#shop > * { flex-shrink: 0; }

.wheel-wrap { position: relative; width: 240px; height: 240px; margin-top: 10px; }

.wheel {
  position: relative;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  border: 4px solid #f0f0f4;
  box-sizing: border-box;
  box-shadow: 0 0 0 3px #000, 0 0 30px rgba(255, 207, 61, .25);
  transition: transform 4.2s cubic-bezier(.12, .8, .18, 1);   /* = SPIN_MS */
}

.wheel-face, .wheel-star {
  position: absolute;
  left: 50%;
  top: 50%;
}
.wheel-face { width: 46px; height: 46px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.wheel-star { font-size: 16px; color: #000; line-height: 1; }

.wheel-pointer {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: -12px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 24px solid var(--hot);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.7));
}

#spinBtn:disabled { opacity: .35; transform: none; }

.spin-result { margin: 0; min-height: 20px; font-size: 15px; font-weight: 800; color: var(--ink); }
.spin-result.show { animation: pop .35s ease-out; }
.spin-result b { color: var(--rc, var(--gold)); }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.odds { list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--dim); text-align: left; display: flex; flex-direction: column; gap: 3px; }
.odds i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.odds b { color: var(--ink); }

.faces { display: grid; grid-template-columns: repeat(3, 96px); gap: 10px; }
.face-tile {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; border-radius: 12px; cursor: pointer;
  background: #141418; border: 2px solid #26262c; color: var(--ink);
  font: inherit;
}
.face-tile img { width: 58px; height: 58px; }
.face-tile .fn { font-size: 11px; font-weight: 800; }
.face-tile .fr { font-size: 9px; font-weight: 900; letter-spacing: .1em; color: var(--rc); }
.face-tile.on { border-color: var(--gold); box-shadow: 0 0 12px rgba(255, 207, 61, .35); }
.face-tile.on .fr { color: var(--gold); }
.face-tile.locked { cursor: default; }
.face-tile.locked img { filter: brightness(0) opacity(.5); }
.face-tile.locked .fn { color: #4a4a52; }

.coins-earned .cap { font-size: 11px; font-weight: 700; color: var(--dim); letter-spacing: 0; }

/* ---------- TEMPORARY test menu ---------- */

/* Invisible tap target in the menu's top-right corner. */
.dev-hotspot {
  position: absolute;
  top: 0;
  right: 0;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}

#dev { background: rgba(0, 0, 0, .95); }
.dev-lock, .dev-panel { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#devCode {
  width: 160px;
  padding: 12px;
  font: 800 24px "Helvetica Neue", Arial, sans-serif;
  letter-spacing: .4em;
  text-align: center;
  color: var(--ink);
  background: #141418;
  border: 2px solid #33333a;
  border-radius: 12px;
}
#devErr { color: var(--hot); min-height: 16px; }
.dev-grid { display: grid; grid-template-columns: repeat(2, 140px); gap: 10px; }
.btn.dev-btn { margin: 0; padding: 14px 0; font-size: 17px; width: 100%; background: var(--gold); }
.btn.dev-btn.minus { background: #33333a; color: var(--ink); }
.btn.dev-btn.wide { width: 290px; background: #3d8bff; color: #fff; font-size: 15px; }
