/* Fonts are vendored (vendor/fonts) rather than loaded from a CDN, so the
   game keeps its typography offline and on any host. */
@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./vendor/fonts/chakra-petch-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./vendor/fonts/chakra-petch-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('./vendor/fonts/chakra-petch-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./vendor/fonts/barlow-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./vendor/fonts/barlow-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./vendor/fonts/barlow-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('./vendor/fonts/barlow-latin-700-normal.woff2') format('woff2');
}

/* ============================================================
   CLICK AND GET STRONGER — "power stage" look.
   Committed single-theme dark design (an arcade screen, not a document),
   so every colour is painted explicitly rather than inherited.
   --accent is rewritten by JS at every rank-up, so the whole HUD shifts
   colour in lockstep with the 3D stage.
   ============================================================ */
:root {
  --accent: #ff5a2e;
  --void: #05060a;
  --slab: rgba(13, 14, 21, 0.84);
  --slab-solid: #0d0e15;
  --edge: rgba(255, 255, 255, 0.09);
  --bone: #f4f1ea;
  --ash: #8c8898;
  --good: #6ef2a0;

  --display: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --body: 'Barlow', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --cut: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 13px 100%, 0 calc(100% - 13px));
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--bone);
  font-family: var(--body);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Faint scanline texture over the whole stage — CRT, not gradient soup. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 3px);
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
}

button {
  font-family: var(--display);
  cursor: pointer;
}

button:focus-visible,
.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud-top {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
  pointer-events: none;
  z-index: 20;
}

.hud-card,
.level-card {
  position: relative;
  background: var(--slab);
  backdrop-filter: blur(12px);
  clip-path: var(--cut);
  padding: 11px 20px 13px;
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.55));
}

/* Accent rail down the left edge, tinted by the current rank. */
.hud-card::before,
.level-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 13px;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.sp-label,
.pump-label,
.level-rank {
  font-family: var(--display);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ash);
}

.sp-value {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  color: var(--bone);
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 65%, transparent);
}

.hud-sub {
  margin-top: 4px;
  display: flex;
  gap: 14px;
  font-size: 0.76rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ash);
}

.hud-sub span:first-child { color: var(--good); }
.hud-sub span:last-child { color: var(--accent); }

.level-card { min-width: 190px; }

.level-title {
  font-family: var(--display);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--bone);
  margin: 2px 0 7px;
  white-space: nowrap;
}

.level-bar,
.pump-bar {
  height: 5px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.level-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #fff);
  box-shadow: 0 0 12px var(--accent);
  transition: width 0.3s ease;
}

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

.pump-bar { flex: 1; height: 4px; }

.pump-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #fff, var(--accent));
  box-shadow: 0 0 10px var(--accent);
}

/* ---------- Hint + golden rep ---------- */
#hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--ash);
  pointer-events: none;
  z-index: 15;
  text-align: center;
  max-width: calc(100vw - 32px);
  animation: hint-pulse 3.4s ease-in-out infinite;
}

/* Always on screen — breathes gently, but never fades out of legibility. */
@keyframes hint-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

#golden-orb-hint {
  position: fixed;
  top: 96px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ffe08a, #ff9d2e);
  color: #241300;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: none;
  clip-path: var(--cut);
  padding: 9px 22px;
  box-shadow: 0 0 30px rgba(255, 190, 60, 0.65);
  z-index: 25;
  animation: golden-bounce 0.55s ease-in-out infinite alternate;
}

@keyframes golden-bounce {
  from { transform: translateX(-50%) translateY(0); }
  to { transform: translateX(-50%) translateY(-7px); }
}

/* ---------- Ending cutscene ---------- */
#cutscene {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
}
#cutscene:not(.hidden) ~ * { pointer-events: none; }

/* The gym clears out for the ending: no HUD, no buttons, just the shot. */
body.cutscene-on #hud-top,
body.cutscene-on #hint,
body.cutscene-on #golden-orb-hint,
body.cutscene-on #levelup-banner,
body.cutscene-on #toast-layer,
body.cutscene-on #fx-layer,
body.cutscene-on #p2w-toggle,
body.cutscene-on #shop-toggle,
body.cutscene-on #bottom-bar,
body.cutscene-on #panel {
  opacity: 0;
  pointer-events: none;
  /* The hint pulses on a keyframe animation; cancel it or it keeps
     fading itself back in over the top of the shot. */
  animation: none;
  transition: opacity 0.55s ease;
}

.cine-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 11vh;
  background: #000;
  animation: cine-in 0.9s ease forwards;
}
.cine-bar.top { top: 0; transform: translateY(-100%); }
.cine-bar.bottom { bottom: 0; transform: translateY(100%); }

@keyframes cine-in { to { transform: translateY(0); } }

#cutscene-caption {
  position: absolute;
  left: 50%;
  bottom: 15vh;
  transform: translateX(-50%);
  max-width: min(90vw, 34ch);
  text-align: center;
  font-family: var(--display);
  font-size: clamp(1.1rem, 4.4vw, 1.6rem);
  font-weight: 600;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.95);
  opacity: 0;
  transition: opacity 0.5s ease;
}
#cutscene-caption.on { opacity: 1; }

#cutscene-fade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  transition: opacity 1.6s ease;
}
#cutscene-fade.on { opacity: 1; }

#end-card {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  text-align: center;
  padding: 24px;
  pointer-events: auto;
  animation: end-in 1.2s ease forwards;
}

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

.end-kicker {
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.46em;
  text-transform: uppercase;
  color: var(--accent);
}

.end-title {
  font-family: var(--display);
  font-size: clamp(1.7rem, 7.5vw, 3rem);
  font-weight: 700;
  color: #fff;
  text-wrap: balance;
}

.end-note {
  color: var(--ash);
  font-size: 0.86rem;
  max-width: 34ch;
  line-height: 1.55;
  margin: 6px 0 4px;
}

#end-continue {
  margin-top: 14px;
  background: var(--accent);
  color: #12060a;
  border: none;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 13px 26px;
  clip-path: var(--cut);
  pointer-events: auto;
}

/* ---------- Level-up banner ---------- */
#levelup-banner {
  position: fixed;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  z-index: 45;
  animation: levelup-in 2.4s ease forwards;
}

.levelup-kicker {
  font-family: var(--display);
  font-size: 0.72rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.levelup-title {
  font-family: var(--display);
  font-size: clamp(1.8rem, 8vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 0 34px var(--accent), 0 0 90px var(--accent);
}

@keyframes levelup-in {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.35); filter: blur(8px); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: blur(0); }
  75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(0.98); }
}

/* ---------- Floating numbers + toasts ---------- */
#fx-layer, #toast-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

.float-num {
  position: absolute;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 0 14px var(--accent), 0 2px 6px rgba(0, 0, 0, 0.8);
  animation: float-up 0.95s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  white-space: nowrap;
}

.float-num.crit {
  font-size: 1.85rem;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 0 22px var(--accent), 0 0 50px var(--accent);
  animation: float-crit 1.05s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

@keyframes float-up {
  0% { transform: translate(-50%, 0) scale(0.7); opacity: 0; }
  14% { opacity: 1; transform: translate(-50%, -12px) scale(1.12); }
  100% { transform: translate(-50%, -90px) scale(1); opacity: 0; }
}

@keyframes float-crit {
  0% { transform: translate(-50%, 0) scale(0.5) rotate(-8deg); opacity: 0; }
  16% { opacity: 1; transform: translate(-50%, -16px) scale(1.35) rotate(3deg); }
  100% { transform: translate(-50%, -120px) scale(1.05) rotate(0deg); opacity: 0; }
}

.toast {
  position: absolute;
  top: 104px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--slab);
  border-left: 3px solid var(--accent);
  backdrop-filter: blur(12px);
  padding: 10px 20px;
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
  animation: toast-in 0.3s ease, toast-out 0.4s ease 2.6s forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translate(-50%, -14px); }
}

/* ---------- Shop button + bottom bar ---------- */
.fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent);
  color: #12060a;
  border: none;
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 14px 26px;
  clip-path: var(--cut);
  box-shadow: 0 0 34px color-mix(in srgb, var(--accent) 55%, transparent);
  z-index: 40;
  transition: transform 0.14s ease, filter 0.14s ease;
}
.fab:hover { filter: brightness(1.12); }
.fab:active { transform: scale(0.94); }

/* ---------- Pay to Win ---------- */
/* Gold rather than the rank accent, so the store reads as a place apart. */
.fab-gold {
  bottom: 78px;
  background: linear-gradient(135deg, #ffe07a, #f0a020);
  color: #2a1a00;
  box-shadow: 0 0 30px rgba(255, 190, 60, 0.4);
  letter-spacing: 0.14em;
  padding: 12px 20px;
  font-size: 0.78rem;
}

/* Two classes, so this beats .modal-box's accent-coloured top border. */
.modal-box.p2w-box {
  max-width: 560px;
  width: 100%;
  text-align: center;
  border-top-color: #f5c451;
  position: relative;
}

.p2w-box h2 { color: #f5c451; margin: 2px 0 8px; }

/* Two classes so this beats `.modal-box button`, which paints buttons with
   near-black label text — that rule was rendering this ✕ invisible against
   the dark panel. Also sits clear of the clipped top-right corner. */
.modal-box .p2w-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.07) !important;
  border: 1px solid var(--edge);
  border-radius: 50%;
  clip-path: none;
  color: var(--bone) !important;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
  margin: 0 !important;
  letter-spacing: 0;
}
.modal-box .p2w-close:hover {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #fff !important;
}

/* Pinned to the foot of the panel so there's always an exit in view, even
   when the packs overflow a short screen. Opaque, with a fade above it, so
   scrolling content doesn't show through the label. */
.modal-box .p2w-close-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  position: sticky;
  bottom: -26px;
  z-index: 2;
  background: #171922 !important;
  border: 1px solid var(--edge);
  color: var(--bone) !important;
  padding: 14px 20px;
  box-shadow: 0 -18px 22px -6px var(--slab-solid);
}
.modal-box .p2w-close-btn:hover { background: rgba(255, 255, 255, 0.16) !important; }

.p2w-kicker {
  font-family: var(--display);
  font-size: 0.62rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: #b08b3c;
}

.p2w-note {
  font-size: 0.8rem !important;
  margin: 0 auto 16px;
  max-width: 42ch;
}
.p2w-note strong { color: #f5c451; }

.p2w-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  text-align: left;
}

.p2w-pack {
  position: relative;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--edge);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.p2w-pack.best {
  border-color: rgba(245, 196, 81, 0.6);
  background: rgba(245, 196, 81, 0.09);
  grid-column: 1 / -1;
  box-shadow: 0 0 26px rgba(245, 196, 81, 0.14) inset;
}

.p2w-ribbon {
  position: absolute;
  top: -1px;
  right: -1px;
  background: linear-gradient(135deg, #ffe07a, #f0a020);
  color: #2a1a00;
  font-family: var(--display);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 9px;
}

.p2w-amount {
  font-family: var(--display);
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.p2w-label {
  font-family: var(--display);
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ash);
}

.p2w-price {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  color: #f5c451;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.p2w-btn {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-family: var(--display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 9px 10px;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ash);
}

.p2w-btn.soon { cursor: default; }

a.p2w-btn {
  background: linear-gradient(135deg, #ffe07a, #f0a020);
  border-color: transparent;
  color: #2a1a00;
}
a.p2w-btn:hover { filter: brightness(1.1); }

.p2w-small {
  font-size: 0.7rem !important;
  margin-top: 14px;
  margin-bottom: 0;
  opacity: 0.75;
}

#bottom-bar {
  position: fixed;
  bottom: 20px;
  left: 16px;
  display: flex;
  gap: 8px;
  z-index: 40;
}

#bottom-bar button {
  background: var(--slab);
  border: 1px solid var(--edge);
  backdrop-filter: blur(12px);
  color: var(--ash);
  padding: 11px 16px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  clip-path: var(--cut);
  transition: color 0.15s ease, border-color 0.15s ease;
}
#bottom-bar button:hover { color: var(--bone); border-color: var(--accent); }
#bottom-bar button.off { opacity: 0.5; }

/* ---------- Side panel ---------- */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 392px;
  max-width: 100vw;
  background: linear-gradient(180deg, rgba(10, 11, 17, 0.96), rgba(6, 7, 11, 0.97));
  border-left: 1px solid var(--edge);
  backdrop-filter: blur(18px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.3s cubic-bezier(0.3, 0.8, 0.3, 1);
  box-shadow: -30px 0 60px rgba(0, 0, 0, 0.5);
}

.panel.hidden { display: flex !important; transform: translateX(105%); }

.panel-header {
  display: flex;
  align-items: flex-start;
  border-bottom: 1px solid var(--edge);
  padding: 12px 8px 10px 12px;
  gap: 6px;
}

.panel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}

.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ash);
  padding: 6px 11px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.15s ease, background 0.15s ease;
}
.tab:hover { color: var(--bone); }

.tab.active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
}

#panel-close {
  background: transparent;
  border: none;
  color: var(--ash);
  font-size: 1rem;
  padding: 6px 10px;
}
#panel-close:hover { color: var(--bone); }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---------- Upgrade cards ---------- */
.upgrade-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--edge);
  border-left: 3px solid rgba(255, 255, 255, 0.14);
  padding: 11px 13px;
  margin-bottom: 9px;
  overflow: hidden;
  transition: border-color 0.18s ease, background 0.18s ease;
}

/* Bar creeping across the card = how close you are to affording it. */
.upgrade-card::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: var(--afford, 0%);
  background: var(--accent);
  opacity: 0.5;
  transition: width 0.25s ease;
}

.upgrade-card.affordable {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border-left-color: var(--accent);
}

.upgrade-icon {
  font-size: 1.55rem;
  width: 34px;
  text-align: center;
  filter: saturate(1.1);
}

.upgrade-info { flex: 1; min-width: 0; }

.upgrade-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}

.upgrade-desc { font-size: 0.74rem; color: var(--ash); }

.upgrade-owned {
  font-family: var(--display);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--good);
  margin-top: 3px;
}

.buy-btn {
  background: transparent;
  color: var(--ash);
  border: 1px solid var(--edge);
  font-weight: 700;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  padding: 9px 12px;
  min-width: 80px;
  text-align: center;
  letter-spacing: 0.04em;
  transition: all 0.15s ease;
}

.buy-btn:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #12060a;
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent);
}
.buy-btn:not(:disabled):hover { filter: brightness(1.12); }
.buy-btn:not(:disabled):active { transform: scale(0.95); }
.buy-btn:disabled { cursor: not-allowed; }

/* ---------- Prestige tab ---------- */
.prestige-box { text-align: center; padding: 12px 4px; }

.prestige-box h3 {
  font-family: var(--display);
  color: var(--bone);
  margin: 4px 0;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
}
#prestige-legend-count { color: var(--accent); }

.prestige-box p { color: var(--ash); font-size: 0.8rem; }

.prestige-mult { font-size: 0.86rem !important; color: var(--bone) !important; }
.prestige-mult strong { color: var(--accent); font-family: var(--display); }

.prestige-explainer {
  text-align: left;
  line-height: 1.55;
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  padding: 11px 13px;
  margin: 12px 0;
}
.prestige-explainer strong { color: var(--accent); }

.prestige-progress { margin: 16px 0 6px; text-align: left; }

.prestige-progress-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--display);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ash);
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}

.prestige-status { font-size: 0.8rem !important; }
.prestige-status strong { color: var(--accent); font-family: var(--display); }

.prestige-btn {
  margin-top: 14px;
  background: linear-gradient(135deg, #b98cff, #6a3df0);
  color: #fff;
  border: none;
  padding: 13px 26px;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  clip-path: var(--cut);
  box-shadow: 0 0 28px rgba(133, 84, 255, 0.45);
  transition: filter 0.15s ease, transform 0.15s ease;
}
.prestige-btn:not(:disabled):hover { filter: brightness(1.15); }
.prestige-btn:not(:disabled):active { transform: scale(0.96); }

.prestige-btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ash);
  box-shadow: none;
  cursor: not-allowed;
}

.prestige-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  text-align: left;
  font-size: 0.76rem;
}

.prestige-table th {
  font-family: var(--display);
  color: var(--ash);
  font-weight: 600;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: left;
  padding: 5px 6px;
  border-bottom: 1px solid var(--edge);
}

.prestige-table td {
  padding: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-variant-numeric: tabular-nums;
}

.prestige-row-done td { color: var(--good); }
.prestige-row-ready td { color: var(--accent); font-weight: 700; }
.prestige-row-locked td { color: var(--ash); }

/* ---------- Stats ---------- */
.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--edge);
  font-size: 0.82rem;
  color: var(--ash);
}

.stat-row span:last-child {
  font-family: var(--display);
  color: var(--bone);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* The 1T tease that sits at the foot of every panel tab. */
.panel-teaser {
  margin: 18px 0 4px;
  padding: 11px 13px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ash);
  text-align: center;
}

.panel-teaser strong {
  font-family: var(--display);
  color: var(--accent);
  letter-spacing: 0.02em;
}

/* ---------- Achievements ---------- */
.ach-card {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 9px 11px;
  margin-bottom: 7px;
  border: 1px solid var(--edge);
  border-left: 3px solid rgba(255, 255, 255, 0.1);
  opacity: 0.45;
}

.ach-card.unlocked {
  opacity: 1;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-left-color: var(--accent);
}

.ach-icon { font-size: 1.35rem; }

.ach-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.83rem;
}

.ach-desc { font-size: 0.72rem; color: var(--ash); }

/* ---------- Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 3, 6, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}
.modal.hidden { display: none; }

.modal-box {
  background: var(--slab-solid);
  border: 1px solid var(--edge);
  border-top: 2px solid var(--accent);
  clip-path: var(--cut);
  padding: 26px 28px;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  /* On a short screen the content can outgrow the viewport; without this it
     overflows off-screen and takes the close controls with it. */
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-box h2 {
  font-family: var(--display);
  margin-top: 0;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  color: var(--bone);
}

.modal-box p { color: var(--ash); font-size: 0.85rem; line-height: 1.5; }

.modal-box button {
  margin-top: 14px;
  background: var(--accent);
  border: none;
  color: #12060a;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 11px 22px;
  clip-path: var(--cut);
}

.reset-box { max-width: 430px; text-align: left; }
.reset-box h2 { text-align: center; }
.reset-box em { color: var(--bone); font-style: normal; font-weight: 600; }

.reset-list {
  margin: 0 0 12px;
  padding-left: 18px;
  color: var(--bone);
  font-size: 0.82rem;
  line-height: 1.65;
}

.reset-hint {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-left: 2px solid var(--accent);
  padding: 9px 12px;
  font-size: 0.78rem !important;
}
.reset-hint strong { color: var(--accent); }

.modal-btn-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.modal-btn-secondary {
  background: rgba(255, 255, 255, 0.07) !important;
  color: var(--bone) !important;
}

.modal-btn-danger {
  background: linear-gradient(135deg, #ff5a2e, #c62828) !important;
  color: #fff !important;
}

/* ---------- Small screens ---------- */
@media (max-width: 620px) {
  #hud-top { gap: 8px; }
  .hud-card, .level-card { padding: 9px 16px 11px; }
  .level-card { min-width: 0; flex: 1; }
  .level-title { font-size: 0.85rem; }
  .panel { width: 100%; }
  #hint { font-size: 0.68rem; }
  .fab { padding: 13px 20px; font-size: 0.78rem; }
}

/* Below roughly 800px the bottom bar on the left and the Shop / Pay to Win
   stack on the right meet in the middle, so the hint moves above them
   instead of sitting underneath the buttons. */
@media (max-width: 800px) {
  #hint { bottom: 136px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
