/* TIP TOE GOLD — a 1987 fantasy VHS that never existed. */

@font-face {
  font-family: "Cinzel";
  src: url("./assets/fonts/cinzel-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Pirata One";
  src: url("./assets/fonts/pirata-one.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("./assets/fonts/space-grotesk-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("./assets/fonts/space-grotesk-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("./assets/fonts/space-grotesk-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("./assets/fonts/barlow-condensed-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("./assets/fonts/barlow-condensed-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #0b0806;
  --ink-2: #15100b;
  --ink-3: #211910;
  --cream: #f4e7cf;
  --cream-dim: #c9b696;
  --muted: #907d62;
  --gold: #e8b568;
  --gold-hi: #ffe3a3;
  --gold-deep: #9a6a25;
  --blood: #a83b2a;
  --blood-hi: #ff7a52;
  --moss: #7f9f58;
  --panel: rgba(14, 10, 7, 0.78);
  --panel-line: rgba(232, 181, 104, 0.22);
  --font-display: "Cinzel", "Times New Roman", serif;
  --font-blackletter: "Pirata One", "Cinzel", serif;
  --font-body: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-condensed: "Barlow Condensed", "Arial Narrow", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body {
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 3px;
}

a {
  color: var(--gold-hi);
  text-underline-offset: 3px;
}

kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.05em 0.4em 0.12em;
  border: 1px solid rgba(244, 231, 207, 0.28);
  border-bottom-color: rgba(244, 231, 207, 0.45);
  border-radius: 3px;
  background: rgba(244, 231, 207, 0.08);
  color: var(--cream);
  font-family: var(--font-condensed);
  font-size: 0.86em;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-align: center;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 35%, #2a1c11 0%, #140d08 45%, #070504 100%);
}

#stage {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#stage:active {
  cursor: grabbing;
}

.is-hidden {
  display: none !important;
}

/* ── film treatment ───────────────────────────────────────────────────── */

.fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fx-vignette {
  z-index: 3;
  background:
    radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(0, 0, 0, 0.38) 78%, rgba(0, 0, 0, 0.72) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 16%, transparent 84%, rgba(0, 0, 0, 0.45));
}

.fx-scanlines {
  z-index: 4;
  opacity: 0.16;
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.55) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  mix-blend-mode: multiply;
}

.fx-grain {
  z-index: 5;
  opacity: 0.11;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='180' height='180' filter='url(%23n)' opacity='0.55'/></svg>");
  background-size: 220px 220px;
  mix-blend-mode: overlay;
  animation: grain-jitter 0.9s steps(3) infinite;
}

.fx-letterbox {
  z-index: 6;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.fx-letterbox span {
  display: block;
  height: 22px;
  background: #050403;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.8);
}

#flash {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 122, 82, 0.55), rgba(140, 20, 8, 0.15) 55%, transparent 75%);
  transition: opacity 180ms ease;
}

#flash.on {
  opacity: 1;
  transition: opacity 60ms ease;
}

@keyframes grain-jitter {
  0% { background-position: 0 0; }
  33% { background-position: -18px 12px; }
  66% { background-position: 14px -20px; }
  100% { background-position: 0 0; }
}

/* ── screens ──────────────────────────────────────────────────────────── */

.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  opacity: 1;
  transition: opacity 420ms ease;
}

.screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.menu {
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0;
  padding: calc(26px + var(--safe-top)) clamp(20px, 4.5vw, 72px) calc(26px + var(--safe-bottom));
  overflow-y: auto;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(5, 4, 3, 0.94) 0%, rgba(6, 4, 3, 0.86) 34%, rgba(8, 5, 3, 0.42) 62%, rgba(8, 5, 3, 0.08) 100%),
    radial-gradient(ellipse at 78% 42%, transparent 0%, rgba(5, 4, 3, 0.25) 72%);
}

.poster {
  position: relative;
  width: min(620px, 100%);
  margin: auto 0;
  padding: clamp(10px, 2vw, 22px) 0 8px;
  animation: poster-in 900ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes poster-in {
  from { transform: translateY(18px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.poster-stamp {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(18px, 3vh, 34px);
  color: var(--muted);
  font-family: var(--font-condensed);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.poster-stamp span {
  padding: 4px 7px 3px;
  border: 1px solid rgba(232, 181, 104, 0.32);
  transform: rotate(-1.2deg);
}

.poster-stamp span + span {
  transform: rotate(0.8deg);
  border-color: rgba(244, 231, 207, 0.14);
  color: rgba(244, 231, 207, 0.38);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-family: var(--font-condensed);
  font-size: clamp(0.7rem, 1.1vw, 0.86rem);
  font-weight: 700;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.3rem, 9.4vw, 8.6rem);
  font-weight: 700;
  line-height: 0.82;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.6));
}

.title span {
  display: block;
}

.title span:first-child {
  color: #efe2c9;
  text-shadow:
    0 1px 0 #b89a6c,
    0 2px 0 #8a6b42,
    0 3px 0 #5d4427,
    0 5px 0 #3a2a18,
    0 10px 18px rgba(0, 0, 0, 0.7);
}

.title .title-gold {
  margin-top: 0.06em;
  background: linear-gradient(180deg, #fff3c7 0%, #f4cf83 28%, #d69a45 55%, #8c5a1d 82%, #c58a3c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 4px 0 #3b2712) drop-shadow(0 12px 24px rgba(0, 0, 0, 0.7));
  font-size: 1.16em;
  letter-spacing: 0.04em;
}

.tagline {
  max-width: 34ch;
  margin: clamp(18px, 2.6vh, 28px) 0 0;
  color: var(--cream-dim);
  font-size: clamp(0.98rem, 1.35vw, 1.14rem);
  line-height: 1.55;
  text-wrap: pretty;
}

.tagline em {
  color: var(--gold-hi);
  font-style: normal;
  border-bottom: 1px solid rgba(232, 181, 104, 0.45);
}

.menu-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 26px;
  margin-top: clamp(22px, 3.4vh, 36px);
}

.big-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 58px;
  padding: 0 30px;
  border: 1px solid rgba(255, 227, 163, 0.55);
  background:
    linear-gradient(180deg, #f8db9d 0%, #e8b568 38%, #c98f40 100%);
  color: #231507;
  font-family: var(--font-condensed);
  font-size: 1.16rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  box-shadow:
    0 2px 0 #8a5c20,
    0 8px 26px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.big-button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.07);
  box-shadow:
    0 4px 0 #8a5c20,
    0 14px 34px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.big-button:active:not(:disabled) {
  transform: translateY(1px);
  filter: brightness(0.96);
}

.big-button:disabled {
  cursor: wait;
  filter: grayscale(0.65) brightness(0.72);
}

.big-button .play-icon {
  font-size: 0.82em;
  transform: translateY(-1px);
}

.best-line {
  color: var(--muted);
  font-family: var(--font-condensed);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.best-line b {
  display: inline-block;
  margin-left: 6px;
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 0.94rem;
  letter-spacing: 0.03em;
}

.how {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: clamp(26px, 4.2vh, 44px);
  border-top: 1px solid rgba(232, 181, 104, 0.22);
  border-bottom: 1px solid rgba(232, 181, 104, 0.12);
}

.how article {
  position: relative;
  padding: 16px 16px 18px;
  border-left: 1px solid rgba(232, 181, 104, 0.12);
}

.how article:first-child {
  border-left: 0;
  padding-left: 0;
}

.how-num {
  display: block;
  margin-bottom: 6px;
  color: rgba(232, 181, 104, 0.55);
  font-family: var(--font-condensed);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.how h3 {
  margin: 0 0 5px;
  color: var(--gold-hi);
  font-family: var(--font-condensed);
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.how p {
  margin: 0;
  color: var(--cream-dim);
  font-size: 0.79rem;
  line-height: 1.5;
}

.meme-note {
  max-width: 58ch;
  margin: 18px 0 0;
  color: rgba(201, 182, 150, 0.62);
  font-size: 0.72rem;
  line-height: 1.55;
}

.meme-note b {
  color: rgba(244, 231, 207, 0.85);
  font-weight: 500;
}

.menu-foot {
  position: absolute;
  right: clamp(20px, 4.5vw, 72px);
  bottom: calc(34px + var(--safe-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(201, 182, 150, 0.55);
  font-family: var(--font-condensed);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.menu-foot .foot-dot {
  display: none;
}

/* ── shared HUD bits ──────────────────────────────────────────────────── */

.hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  padding: calc(30px + var(--safe-top)) clamp(16px, 3vw, 40px) calc(22px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-body);
  animation: hud-in 500ms ease both;
}

@keyframes hud-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.hud-top {
  display: flex;
  align-items: flex-start;
  gap: clamp(14px, 2.4vw, 34px);
  width: 100%;
}

.hud-kicker {
  display: block;
  color: var(--muted);
  font-family: var(--font-condensed);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.hud-block {
  min-width: 120px;
}

.hud-value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 2px;
}

.hud-value b {
  color: var(--cream);
  font-family: var(--font-condensed);
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hud-value span {
  color: var(--muted);
  font-family: var(--font-condensed);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.track {
  position: relative;
  height: 4px;
  margin-top: 7px;
  overflow: hidden;
  background: rgba(244, 231, 207, 0.13);
}

.track i {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--gold-hi));
  box-shadow: 0 0 12px rgba(232, 181, 104, 0.6);
  transition: width 220ms ease;
}

.hud-sack {
  width: clamp(116px, 12vw, 156px);
}

.hud-bank {
  width: clamp(128px, 14vw, 176px);
}

.hud-clock {
  flex: 0 0 auto;
  min-width: 110px;
  text-align: center;
  padding: 6px 18px 8px;
  border-left: 1px solid rgba(232, 181, 104, 0.18);
  border-right: 1px solid rgba(232, 181, 104, 0.18);
}

.hud-clock #clock {
  margin-top: 1px;
  color: var(--cream);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.5vw, 2.05rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.hud-clock.low #clock {
  color: var(--blood-hi);
  animation: clock-pulse 1s ease-in-out infinite;
}

@keyframes clock-pulse {
  50% { opacity: 0.55; }
}

.dawn-track {
  margin-top: 5px;
  background: linear-gradient(90deg, rgba(168, 59, 42, 0.35), rgba(232, 181, 104, 0.18));
}

.dawn-track i {
  background: linear-gradient(90deg, #6b2a1d, #b7503a, #e8b568);
  box-shadow: 0 0 10px rgba(183, 80, 58, 0.55);
}

.hud-lives {
  display: flex;
  gap: 7px;
  margin-left: auto;
  padding-top: 4px;
}

.life {
  width: 15px;
  height: 19px;
  border: 1px solid rgba(232, 181, 104, 0.55);
  border-radius: 45% 45% 40% 40%;
  background: linear-gradient(180deg, rgba(232, 181, 104, 0.95), rgba(154, 106, 37, 0.85));
  box-shadow: inset 0 -3px 0 rgba(80, 48, 12, 0.35);
  transition: opacity 220ms ease, filter 220ms ease, transform 220ms ease;
}

.life.lost {
  opacity: 0.22;
  filter: grayscale(1);
  transform: scale(0.88);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(232, 181, 104, 0.25);
  background: rgba(12, 9, 6, 0.55);
  color: var(--cream-dim);
  font-family: var(--font-condensed);
  font-size: 0.8rem;
  font-weight: 700;
  pointer-events: auto;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.icon-button:hover {
  border-color: var(--gold);
  color: var(--gold-hi);
  background: rgba(40, 26, 12, 0.75);
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button svg path:first-child {
  fill: currentColor;
  stroke: none;
}

.icon-button.muted .wave {
  display: none;
}

#mute {
  margin-left: 8px;
  margin-top: 4px;
}

/* ── giant panel ──────────────────────────────────────────────────────── */

.giant-panel {
  position: absolute;
  left: clamp(16px, 3vw, 40px);
  top: 50%;
  width: clamp(190px, 20vw, 250px);
  transform: translateY(-46%);
  padding: 12px 13px 11px;
  border: 1px solid var(--panel-line);
  border-left: 2px solid rgba(232, 181, 104, 0.5);
  background:
    linear-gradient(90deg, rgba(14, 10, 7, 0.86), rgba(14, 10, 7, 0.5));
  backdrop-filter: blur(3px);
}

.giant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.phase {
  color: var(--moss);
  font-family: var(--font-condensed);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  transition: color 200ms ease;
}

.giant-panel[data-state="stir"] .phase {
  color: var(--gold);
}
.giant-panel[data-state="scan"] .phase {
  color: var(--blood-hi);
}

.wake-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.eye {
  position: relative;
  flex: 0 0 46px;
  height: 26px;
  overflow: hidden;
  border: 1px solid rgba(232, 181, 104, 0.5);
  border-radius: 50% / 62%;
  background:
    radial-gradient(ellipse at 50% 50%, #2b1a0c 0%, #120c07 70%);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.8);
}

.eye .pupil {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #fff2c4, #e8b568 45%, #7a4c16 100%);
  box-shadow: 0 0 10px rgba(232, 181, 104, 0.7);
  transform: translate(-50%, -50%) scale(0.55);
  transition: transform 260ms ease;
}

.eye .lid {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, #24170c, #140d08);
  transform: translateY(0%);
  transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

.giant-panel[data-state="stir"] .eye .lid {
  transform: translateY(-46%);
}
.giant-panel[data-state="stir"] .eye .pupil {
  transform: translate(-50%, -50%) scale(0.8);
}
.giant-panel[data-state="scan"] .eye {
  border-color: var(--blood-hi);
  box-shadow: 0 0 16px rgba(255, 122, 82, 0.45), inset 0 0 12px rgba(0, 0, 0, 0.7);
}
.giant-panel[data-state="scan"] .eye .lid {
  transform: translateY(-100%);
}
.giant-panel[data-state="scan"] .eye .pupil {
  background: radial-gradient(circle at 38% 35%, #fff, #ffb18a 40%, #a83b2a 100%);
  box-shadow: 0 0 12px rgba(255, 122, 82, 0.9);
  transform: translate(-50%, -50%) scale(1);
}

.wake-track {
  position: relative;
  flex: 1;
  height: 9px;
  background: rgba(244, 231, 207, 0.1);
  overflow: hidden;
}

.wake-track i {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #5f7b41, #c7a548 55%, #b7503a);
  transition: width 140ms linear;
}

.wake-ticks {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 9px, rgba(10, 7, 5, 0.5) 9px 10px);
}

.noise-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  color: var(--muted);
  font-family: var(--font-condensed);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.noise-track {
  flex: 1;
  height: 3px;
  background: rgba(244, 231, 207, 0.1);
}

.noise-track i {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--blood-hi);
  transition: width 100ms linear;
}

.giant-tip {
  margin: 9px 0 0;
  color: rgba(201, 182, 150, 0.62);
  font-size: 0.68rem;
  line-height: 1.4;
}

/* ── bottom HUD ───────────────────────────────────────────────────────── */

.hud-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.prompt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 7px 16px 8px;
  border: 1px solid rgba(232, 181, 104, 0.28);
  background: rgba(10, 7, 5, 0.74);
  backdrop-filter: blur(3px);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease, border-color 160ms ease;
  overflow: hidden;
}

.prompt.visible {
  opacity: 1;
  transform: translateY(0);
}

.prompt.hot {
  border-color: rgba(255, 227, 163, 0.7);
  box-shadow: 0 0 22px rgba(232, 181, 104, 0.15);
}

.prompt-key {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid rgba(255, 227, 163, 0.5);
  color: var(--gold-hi);
  font-family: var(--font-condensed);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.prompt-text {
  color: var(--cream);
  font-family: var(--font-condensed);
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.prompt-sub {
  color: var(--muted);
  font-size: 0.78rem;
}

.prompt-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0%;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-hi));
  box-shadow: 0 0 10px rgba(232, 181, 104, 0.7);
}

.hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  color: rgba(201, 182, 150, 0.55);
  font-size: 0.67rem;
  letter-spacing: 0.03em;
}

.hints kbd {
  margin-right: 4px;
}

.tiptoe-tag {
  position: absolute;
  left: clamp(16px, 3vw, 40px);
  bottom: calc(26px + var(--safe-bottom));
  padding: 5px 9px 4px;
  border: 1px solid rgba(127, 159, 88, 0.5);
  background: rgba(20, 30, 13, 0.5);
  color: #b6d18b;
  font-family: var(--font-condensed);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  opacity: 0;
  transition: opacity 160ms ease;
}

.tiptoe-tag.on {
  opacity: 1;
}

/* ── toasts and alerts ────────────────────────────────────────────────── */

.toast-stack {
  position: absolute;
  left: 50%;
  top: 24%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 3px 12px 4px;
  color: var(--gold-hi);
  font-family: var(--font-condensed);
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
  animation: toast-rise 1.45s ease forwards;
}

.toast.bad {
  color: var(--blood-hi);
}

.toast.good {
  color: var(--gold-hi);
}

.toast.soft {
  color: var(--cream-dim);
  font-size: 0.9rem;
}

@keyframes toast-rise {
  0% { opacity: 0; transform: translateY(10px) scale(0.96); }
  14% { opacity: 1; transform: translateY(0) scale(1); }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-16px); }
}

.scan-alert {
  position: absolute;
  left: 50%;
  top: 17%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.scan-alert.on {
  opacity: 1;
  animation: scan-pulse 0.86s ease-in-out infinite;
}

.scan-title {
  color: #ffe0cf;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-shadow: 0 0 18px rgba(255, 80, 40, 0.75), 0 3px 0 rgba(80, 10, 0, 0.8);
}

.scan-sub {
  color: rgba(255, 190, 160, 0.75);
  font-family: var(--font-condensed);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

@keyframes scan-pulse {
  50% { transform: translateX(-50%) scale(1.035); }
}

body.is-scan .fx-vignette {
  background:
    radial-gradient(ellipse at 50% 48%, transparent 30%, rgba(120, 16, 4, 0.32) 70%, rgba(60, 5, 0, 0.8) 100%);
  transition: background 300ms ease;
}

body.is-scan #stage {
  filter: saturate(0.86) contrast(1.06);
}

/* ── end / pause screens ──────────────────────────────────────────────── */

.end,
.pause {
  align-items: center;
  justify-content: center;
  padding: 22px;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(28, 18, 10, 0.35), rgba(4, 3, 2, 0.9) 78%);
  backdrop-filter: blur(5px);
  overflow-y: auto;
}

.end-card,
.pause-card {
  width: min(600px, 100%);
  margin: auto;
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid rgba(232, 181, 104, 0.24);
  background:
    linear-gradient(160deg, rgba(24, 17, 11, 0.94), rgba(10, 7, 5, 0.97));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: card-in 500ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes card-in {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.end-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 5.4vw, 3.9rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--cream);
}

.end-card.win .end-title {
  background: linear-gradient(180deg, #fff3c7, #e8b568 55%, #a06a29);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.end-card.lose .end-title {
  color: var(--blood-hi);
  text-shadow: 0 0 30px rgba(168, 59, 42, 0.35);
}

.end-sub {
  margin: 10px 0 0;
  color: var(--cream-dim);
  font-size: 0.94rem;
  line-height: 1.5;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0 18px;
  padding: 15px 0;
  border-top: 1px solid rgba(232, 181, 104, 0.18);
  border-bottom: 1px solid rgba(232, 181, 104, 0.18);
}

.rank-badge {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 1px solid rgba(232, 181, 104, 0.55);
  background: radial-gradient(circle at 35% 30%, rgba(255, 227, 163, 0.22), rgba(20, 14, 8, 0.9));
  color: var(--gold-hi);
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  clip-path: polygon(50% 0, 100% 18%, 100% 82%, 50% 100%, 0 82%, 0 18%);
}

.rank-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rank-copy b {
  color: var(--cream);
  font-family: var(--font-condensed);
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.score-copy {
  margin-left: auto;
  text-align: right;
}

.score-copy b {
  color: var(--gold-hi);
  font-family: var(--font-condensed);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.end-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(232, 181, 104, 0.1);
  border-left: 1px solid rgba(232, 181, 104, 0.1);
}

.end-stats div {
  padding: 10px 12px;
  border-right: 1px solid rgba(232, 181, 104, 0.1);
  border-bottom: 1px solid rgba(232, 181, 104, 0.1);
}

.end-stats span {
  display: block;
  color: var(--muted);
  font-family: var(--font-condensed);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.end-stats b {
  color: var(--cream);
  font-family: var(--font-condensed);
  font-size: 1.24rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.end-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.ghost-button {
  min-height: 58px;
  padding: 0 20px;
  border: 1px solid rgba(232, 181, 104, 0.3);
  color: var(--cream-dim);
  font-family: var(--font-condensed);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.ghost-button:hover {
  border-color: var(--gold);
  color: var(--gold-hi);
  background: rgba(232, 181, 104, 0.06);
}

.end-best {
  margin-top: 14px;
  text-align: center;
}

.pause-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pause-card p:not(.eyebrow) {
  margin: 0 0 20px;
  color: var(--cream-dim);
  font-size: 0.9rem;
}

.pause-card .big-button {
  width: 100%;
  margin-bottom: 10px;
}

.pause-card .ghost-button {
  width: 100%;
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--ink);
  color: var(--cream);
  text-align: center;
}

/* ── touch controls ───────────────────────────────────────────────────── */

.touch {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
}

.stick {
  position: absolute;
  left: calc(18px + env(safe-area-inset-left, 0px));
  bottom: calc(24px + var(--safe-bottom));
  width: 124px;
  height: 124px;
  border: 1px solid rgba(232, 181, 104, 0.28);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(20, 14, 9, 0.5), rgba(10, 7, 5, 0.24));
  pointer-events: auto;
  touch-action: none;
}

.stick::before,
.stick::after {
  content: "";
  position: absolute;
  background: rgba(232, 181, 104, 0.12);
}

.stick::before {
  left: 50%;
  top: 18%;
  bottom: 18%;
  width: 1px;
}

.stick::after {
  top: 50%;
  left: 18%;
  right: 18%;
  height: 1px;
}

.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 227, 163, 0.45);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(255, 227, 163, 0.3), rgba(60, 40, 18, 0.6));
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.touch-buttons {
  position: absolute;
  right: calc(18px + env(safe-area-inset-right, 0px));
  bottom: calc(26px + var(--safe-bottom));
  display: flex;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

.touch-button {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border: 1px solid rgba(232, 181, 104, 0.4);
  border-radius: 50%;
  background: rgba(14, 10, 7, 0.62);
  color: var(--cream);
  font-family: var(--font-condensed);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  pointer-events: auto;
  touch-action: none;
  backdrop-filter: blur(3px);
}

.touch-button.use {
  width: 92px;
  height: 92px;
  border-color: rgba(255, 227, 163, 0.6);
  background: radial-gradient(circle at 40% 30%, rgba(232, 181, 104, 0.32), rgba(32, 21, 10, 0.7));
  color: var(--gold-hi);
}

.touch-button.active {
  background: rgba(232, 181, 104, 0.28);
  border-color: var(--gold-hi);
}

.pause-button {
  position: absolute;
  z-index: 13;
  right: calc(16px + env(safe-area-inset-right, 0px));
  top: calc(84px + var(--safe-top));
  width: 34px;
  height: 34px;
  font-family: var(--font-body);
  letter-spacing: -0.1em;
  pointer-events: auto;
}

/* ── responsive ───────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .menu {
    background:
      linear-gradient(90deg, rgba(5, 4, 3, 0.95), rgba(6, 4, 3, 0.72) 60%, rgba(8, 5, 3, 0.42)),
      radial-gradient(ellipse at 80% 38%, transparent, rgba(5, 4, 3, 0.55) 80%);
  }
  .poster {
    margin: auto 0;
  }
  .menu-foot {
    display: none;
  }
  .how {
    grid-template-columns: 1fr;
    border-bottom: 0;
  }
  .how article {
    display: grid;
    grid-template-columns: 34px 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    padding: 11px 0;
    border-left: 0;
    border-top: 1px solid rgba(232, 181, 104, 0.12);
  }
  .how article:first-child {
    border-top: 0;
  }
  .how-num {
    grid-row: 1 / span 2;
    margin: 2px 0 0;
  }
  .how h3 {
    margin: 0;
  }
  .how p {
    grid-column: 2;
  }
  .hud-top {
    gap: 12px;
  }
  .hud-clock {
    padding: 5px 10px 7px;
    min-width: 86px;
  }
  .hud-sack {
    width: 96px;
  }
  .hud-bank {
    width: 108px;
  }
  .giant-panel {
    top: auto;
    bottom: calc(140px + var(--safe-bottom));
    left: 14px;
    width: 180px;
    transform: none;
  }
  .hints {
    display: none;
  }
  .hud-bottom {
    padding-bottom: 2px;
  }
  .toast-stack {
    top: 21%;
  }
}

@media (max-width: 640px) {
  .fx-letterbox span {
    height: 10px;
  }
  .menu {
    padding-top: calc(14px + var(--safe-top));
    padding-left: 18px;
    padding-right: 18px;
  }
  .poster-stamp {
    margin-bottom: 14px;
    font-size: 0.62rem;
    letter-spacing: 0.2em;
  }
  .poster-stamp span + span {
    display: none;
  }
  .title {
    font-size: clamp(3rem, 17vw, 5.6rem);
  }
  .tagline {
    font-size: 0.94rem;
    max-width: 32ch;
  }
  .menu-actions {
    margin-top: 20px;
    gap: 12px;
  }
  .big-button {
    width: 100%;
    min-height: 54px;
    font-size: 1.04rem;
  }
  .best-line {
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
  }
  .how {
    margin-top: 22px;
  }
  .how p {
    font-size: 0.76rem;
  }
  .meme-note {
    font-size: 0.66rem;
    padding-bottom: 8px;
  }
  .hud {
    padding: calc(20px + var(--safe-top)) 12px calc(12px + var(--safe-bottom));
  }
  .hud-top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas:
      "sack clock bank"
      "lives lives mute";
    gap: 6px 8px;
  }
  .hud-sack { grid-area: sack; width: auto; }
  .hud-clock { grid-area: clock; border: 0; padding: 0; }
  .hud-bank { grid-area: bank; width: auto; text-align: right; }
  .hud-bank .track { transform-origin: right; }
  .hud-bank .hud-value { justify-content: flex-end; }
  .hud-lives { grid-area: lives; margin: 2px 0 0; }
  #mute { grid-area: mute; margin: 0; justify-self: end; width: 32px; height: 32px; }
  .hud-value b { font-size: 1.34rem; }
  .hud-value span { font-size: 0.7rem; }
  .hud-clock #clock { font-size: 1.42rem; }
  .hud-kicker { font-size: 0.56rem; letter-spacing: 0.16em; }
  .giant-panel {
    top: auto;
    bottom: calc(150px + var(--safe-bottom));
    left: 12px;
    width: 156px;
    padding: 8px 9px;
  }
  .giant-tip { display: none; }
  .noise-row { display: none; }
  .wake-row { margin-top: 7px; gap: 7px; }
  .eye { flex-basis: 36px; height: 21px; }
  .hud-bottom { gap: 0; padding-bottom: 238px; }
  .prompt {
    min-height: 34px;
    padding: 4px 10px 5px;
    gap: 6px;
    max-width: calc(100vw - 24px);
  }
  .prompt-text { font-size: 0.78rem; letter-spacing: 0.06em; }
  .prompt-sub { font-size: 0.68rem; }
  .prompt-key { height: 20px; min-width: 20px; font-size: 0.66rem; }
  .tiptoe-tag { display: none; }
  .toast-stack { top: 26%; }
  .scan-alert { top: 13%; }
  .scan-title { font-size: 1.4rem; letter-spacing: 0.12em; }
  .end-card, .pause-card { padding: 20px 16px; }
  .end-title { font-size: clamp(2.1rem, 12vw, 3rem); }
  .rank-badge { width: 52px; height: 52px; font-size: 1.6rem; }
  .score-copy b { font-size: 1.6rem; }
  .end-stats { grid-template-columns: repeat(3, 1fr); }
  .end-stats div { padding: 8px 9px; }
  .end-stats b { font-size: 1.06rem; }
  .end-actions { flex-direction: column; }
  .end-actions .big-button, .end-actions .ghost-button { width: 100%; }
  .stick { width: 108px; height: 108px; }
  .stick-knob { width: 42px; height: 42px; }
  .touch-button { width: 68px; height: 68px; font-size: 0.68rem; }
  .touch-button.use { width: 82px; height: 82px; }
}

@media (max-height: 820px) and (min-width: 641px) {
  .poster {
    margin: 0;
  }
  .poster-stamp {
    margin-bottom: 14px;
  }
  .title {
    font-size: clamp(2.9rem, 7.4vw, 6.2rem);
  }
  .tagline {
    margin-top: 14px;
    font-size: 0.92rem;
  }
  .menu-actions {
    margin-top: 16px;
  }
  .how {
    margin-top: 20px;
  }
  .how article {
    padding-top: 10px;
    padding-bottom: 12px;
  }
  .how p {
    font-size: 0.75rem;
  }
  .meme-note {
    display: none;
  }
}

@media (max-height: 620px) and (min-width: 641px) {
  .poster-stamp { display: none; }
  .title { font-size: clamp(2.5rem, 6.4vw, 5rem); }
  .tagline { margin-top: 10px; }
  .how { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-grain { animation: none; }
  .poster { animation: none; }
  .toast { animation-duration: 1.8s; }
  .scan-alert.on { animation: none; }
  .hud-clock.low #clock { animation: none; }
}
