/* =========================================================================
   Ragdoll Survivor — war-zone UI
   Palette: gunmetal + olive + sand, hazard amber for action, signal red for danger.
   ========================================================================= */
:root {
  --ink-0: #0b0d0e;      /* page */
  --ink-1: #121618;      /* panels */
  --ink-2: #1a2023;      /* raised */
  --ink-3: #242c30;      /* hover */
  --line: #333c41;
  --line-2: #4a555b;
  --text: #efe9dc;       /* warm white */
  --muted: #a8a294;      /* field khaki */
  --amber: #f2a900;      /* primary action */
  --amber-hi: #ffc93c;
  --amber-lo: #8a6100;
  --fire: #ff6b1a;
  --red: #e0393e;
  --red-lo: #7d1d20;
  --olive: #6b7b3a;
  --olive-hi: #93a64e;
  --green: #4cc46a;
  --cyan: #4cc9f0;       /* the player */
  --outline: #0b0d0e;
  --display: 'Black Ops One', Impact, 'Arial Black', sans-serif;
  --body: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --cut: 12px;           /* chamfered corners */
  --hazard: repeating-linear-gradient(-45deg, var(--amber) 0 10px, #111 10px 20px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--ink-0);
  color: var(--text);
  font-family: var(--body);
  font-weight: 600;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}
button:focus-visible { outline: 3px solid var(--amber-hi); outline-offset: 2px; }
/* controller: the highlighted menu button */
button.pad-focus { outline: 3px solid var(--text); outline-offset: 3px; box-shadow: inset 0 0 0 3px var(--text), 0 0 0 7px rgba(255, 190, 40, .35); filter: brightness(1.12); transform: scale(1.04); position: relative; z-index: 1; }
/* controller button guide replaces the keyboard one while a pad is in use */
.how.pad-how { display: none; }
body[data-pad] .how.key-how { display: none; }
body[data-pad] .how.pad-how { display: flex; }
.pad-how .pb { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink-2); border: 1px solid var(--line); }
.pad-how .pb svg { width: 13px; height: 13px; fill: none; stroke: var(--text); stroke-width: 2.6; }
.pad-how .pr { display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 5px; border-radius: 6px; background: var(--ink-2); border: 1px solid var(--line); font-size: 12px; color: var(--text); }

svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
svg.fill { fill: currentColor; stroke: none; }

[hidden] { display: none !important; }

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  border: 1px solid var(--line-2);
  border-bottom-width: 3px;
  border-radius: 4px;
  background: var(--ink-2);
  color: var(--text);
  font: 700 13px var(--body);
  text-align: center;
}

/* ===== HUD ===== */
#hud {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  background: linear-gradient(#15191b, var(--ink-0));
  border-bottom: 1px solid #1d2326;
}

.brand {
  font-family: var(--display);
  line-height: .95;
  letter-spacing: 1px;
}
.brand .b1 { display: block; font-size: 15px; color: var(--text); }
.brand .b2 { display: block; font-size: 15px; color: var(--amber); }

.scorebox { text-align: center; }
.score-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--muted);
}
.score {
  font-family: var(--display);
  font-size: 28px;
  line-height: 1;
  color: var(--text);
  text-shadow: 2px 2px 0 #000;
  font-variant-numeric: tabular-nums;
}
.score.bump { animation: bump .18s ease-out; }
@keyframes bump { 50% { transform: scale(1.12); } }

.hud-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.best {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1px;
  margin-right: 4px;
}
.best b { font-family: var(--display); font-weight: 400; color: var(--amber); font-size: 16px; }

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: background .15s, border-color .15s, transform .1s;
}
.icon-btn:hover { background: var(--ink-3); border-color: var(--line-2); }
.icon-btn:active { transform: scale(.94); }
#btn-sound .slash { display: none; }
body.muted #btn-sound .slash { display: inline; }
body.muted #btn-sound .wave { display: none; }

.nuke-btn { color: var(--ink-0); background: var(--fire); border-color: #ffb07a; }
.nuke-btn:hover { background: #ff8a45; }
.nuke-btn em {
  position: absolute;
  bottom: 1px;
  right: 3px;
  font: 800 9px var(--body);
  font-style: normal;
  color: var(--ink-0);
}
.nuke-btn:disabled { filter: grayscale(1) brightness(.55); cursor: default; }
body:not([data-mode="survive"]) .nuke-btn, body:not([data-state="play"]) .nuke-btn { display: none; }

/* ===== Stage ===== */
#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px 8px;
}

#game {
  display: block;
  border: 1px solid #262e32;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6);
  touch-action: none;
}

.combo {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: 22px;
  color: var(--amber);
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s;
  white-space: nowrap;
}
.combo.on { opacity: 1; }
.combo.pop { animation: combo-pop .22s ease-out; }
@keyframes combo-pop {
  0% { transform: translateX(-50%) scale(1.4) rotate(-3deg); }
  100% { transform: translateX(-50%) scale(1) rotate(0); }
}

.toast {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translate(-50%, 20px);
  max-width: min(560px, calc(100% - 32px));
  padding: 10px 18px;
  background: rgba(11, 13, 14, .92);
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--amber);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .3px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 40;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* short phone screens: on the main menu the message sits at the top, clear of the mode buttons */
@media (max-height: 500px) { body[data-state="title"] .toast { top: 10px; bottom: auto; transform: translate(-50%, -20px); } body[data-state="title"] .toast.show { transform: translate(-50%, 0); } }

/* ===== HUD overlays on the canvas ===== */
.objective {
  position: absolute;
  top: 12px;
  left: 12px;
  min-width: 190px;
  padding: 8px 14px 9px;
  background: rgba(11, 13, 14, .82);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  pointer-events: none;
}
.obj-level { font-size: 12px; letter-spacing: 2px; color: var(--muted); font-weight: 700; }
.obj-goal { font-family: var(--display); font-size: 21px; line-height: 1.1; color: var(--text); }
.obj-goal.done { color: var(--green); }
.obj-text { font-size: 14px; color: var(--muted); }
.obj-text:empty { display: none; }

.timer {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: 26px;
  padding: 4px 14px;
  background: rgba(11, 13, 14, .82);
  border: 1px solid var(--line);
  pointer-events: none;
}
.timer.low { color: var(--red); border-color: var(--red); animation: tick 1s steps(2) infinite; }
@keyframes tick { 50% { opacity: .55; } }

.hearts {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  background: rgba(11, 13, 14, .82);
  border: 1px solid var(--line);
  pointer-events: none;
}
/* the player's life bar (same family as the enemies' bars) */
.lifebar { position: relative; width: 210px; height: 20px; background: #2a1b1b; border: 2px solid #000; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); overflow: hidden; }
.lifebar i { position: absolute; left: 0; top: 0; bottom: 0; }
.lifebar .lb-trail { background: #fff3d6; transition: width .5s ease-in .25s; }
.lifebar .lb-fill { background: linear-gradient(#57e39f, #2fb877); transition: width .12s ease-out; }
.lifebar.low .lb-fill { background: linear-gradient(#ff6b6b, #d7263d); animation: lb-low .8s ease-in-out infinite; }
.lifebar.hit { animation: lb-hit .3s ease-out; }
.lifebar b { position: absolute; inset: 0; display: grid; place-items: center; font: 800 13px var(--body); letter-spacing: .5px; color: #fff; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; }
@keyframes lb-low { 50% { filter: brightness(1.35); } }
@keyframes lb-hit { 0% { transform: translateX(-4px); border-color: var(--red); } 40% { transform: translateX(4px); } 100% { transform: none; } }
.lb-extra { display: inline-flex; align-items: center; }
.lifecol { display: flex; flex-direction: column; gap: 3px; }
/* SUPER meter under the life bar: fills gold as you land hits, glows when ready */
.superbar { position: relative; width: 210px; height: 9px; background: #1d1a12; border: 2px solid #000; overflow: hidden; }
.superbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(#ffe27a, #e0a21b); transition: width .15s ease-out; }
.superbar b { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); font: 800 7px var(--body); letter-spacing: 1px; color: rgba(255, 255, 255, .7); }
.superbar.full { animation: super-glow .6s ease-in-out infinite; border-color: #ffd23f; }
.superbar.full b { color: #000; }
@keyframes super-glow { 50% { box-shadow: 0 0 10px 2px rgba(255, 210, 63, .8); } }
.superbar.rage { border-color: #ff3b2f; animation: rage-glow .3s ease-in-out infinite; }
.superbar.rage i { background: linear-gradient(#ffd9d0, #ff3b2f 45%, #9e140b); transition: width .2s linear; }
.superbar.rage b { color: #fff; }
@keyframes rage-glow { 50% { box-shadow: 0 0 12px 3px rgba(255, 40, 25, .85); } }
.shop-card.fighter .card-btn { margin-top: auto; }
.shop-card.fighter small.perk { font-size: 12px; line-height: 1.25; color: var(--muted); min-height: 30px; }
.shop-card.fighter img { width: 80px; height: 80px; }
.hearts .arm { position: relative; display: inline-flex; margin-left: 6px; width: 24px; height: 24px; }
.hearts .arm svg { width: 24px; height: 24px; fill: var(--amber); stroke: #000; stroke-width: 1.5; }
.hearts .arm i { position: absolute; right: -5px; bottom: -5px; font: 800 12px var(--body); font-style: normal; color: #fff; text-shadow: 1px 1px 0 #000; }
.hearts .arm.gone { opacity: .3; }
.hearts em { margin-left: 8px; padding: 2px 7px; font: 800 12px var(--body); font-style: normal; background: var(--ink-3); color: var(--muted); }
.hearts em.ready { background: var(--cyan); color: var(--ink-0); }
.hearts em.live { background: #fff; color: var(--ink-0); }
.hearts em.buff { color: var(--ink-0); }

.banner {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.6);
  font-family: var(--display);
  font-size: clamp(30px, 6vw, 60px);
  color: var(--text);
  text-shadow: 3px 3px 0 #000;
  letter-spacing: 2px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}
.banner.hot { color: var(--amber); }
.banner.show { animation: banner-pop 1.3s cubic-bezier(.2, 1.6, .4, 1) forwards; }
@keyframes banner-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(.95); }
}

.bossbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, 50%);
  text-align: center;
  pointer-events: none;
}
.bossbar b { font-family: var(--display); font-size: 17px; letter-spacing: 2px; color: var(--red); text-shadow: 2px 2px 0 #000; }
.bb-track { height: 12px; margin-top: 4px; background: rgba(0, 0, 0, .7); border: 1px solid var(--line-2); }
.bb-track i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--red), var(--fire)); transition: width .2s; }
body.has-boss .combo { top: 60px; }

/* ===== Touch controls ===== */
.touch {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  pointer-events: none;
}
.touch > * { pointer-events: auto; }
.joy {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: rgba(11, 13, 14, .35);
  border: 2px solid rgba(239, 233, 220, .3);
  touch-action: none;
}
.joy i { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px; border-radius: 50%; background: rgba(239, 233, 220, .35); border: 2px solid rgba(239, 233, 220, .6); }
.dpad { display: flex; gap: 10px; align-items: flex-end; }
/* action cluster: a 300x300 box anchored bottom-right; ATTACK sits in the corner and the other
   buttons ring it (inner ring: JUMP, HEAVY, BLOCK; outer ring: DASH, GRAB, BUBBLE) */
.tbuttons { position: relative; width: 300px; height: 300px; transform-origin: 100% 100%; pointer-events: none; }
.tbuttons .tc { position: absolute; pointer-events: auto; transform: translate(-50%, -50%); }
.tbuttons .tc:active, .tbuttons .tc.down { transform: translate(-50%, -50%) scale(.92); }
.tbuttons .tc.denied { animation: tc-deny-c .3s ease-out; }
@keyframes tc-deny-c {
  0%, 100% { transform: translate(-50%, -50%); }
  20% { transform: translate(calc(-50% - 5px), -50%); border-color: var(--red); }
  45% { transform: translate(calc(-50% + 5px), -50%); border-color: var(--red); }
}
.tbuttons .tc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0; }
.tbuttons .tc svg { width: 42%; height: 42%; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tbuttons .tc span { font: 800 11px var(--body); letter-spacing: .8px; line-height: 1; }
.tbuttons .t-attack { left: 238px; top: 238px; width: 96px; height: 96px; background: var(--red); border-color: #ff8a8d; color: #fff; }
.tbuttons .t-attack span { font-size: 14px; }
.tbuttons .t-jump { left: 138px; top: 238px; width: 74px; height: 74px; background: var(--amber); border-color: var(--amber-hi); color: var(--ink-0); }
.tbuttons .t-jump span { font-size: 12px; }
.tbuttons .t-heavy { left: 167px; top: 167px; width: 66px; height: 66px; background: #7a2318; border-color: #c4512a; color: #fff; }
.tbuttons .t-block { left: 238px; top: 138px; width: 66px; height: 66px; background: rgba(40, 52, 58, .78); border-color: #9fb7c1; color: #e3eef2; }
.tbuttons .t-block.down { background: #cfe3ea; color: var(--ink-0); }
.tbuttons .t-dash { left: 74px; top: 178px; width: 58px; height: 58px; }
.tbuttons .t-grab { left: 150px; top: 86px; width: 58px; height: 58px; }
.tbuttons .t-bubble { left: 253px; top: 64px; width: 58px; height: 58px; border-color: #7fd6f2; color: #bfe9ff; }
.tbuttons .tc.cool { opacity: .4; }
/* SUPER: shows up only when the meter is full, pulsing gold */
.tbuttons .t-super { left: 70px; top: 92px; width: 70px; height: 70px; background: var(--amber); border-color: #fff3d6; color: var(--ink-0); animation: super-pulse .7s ease-in-out infinite; }
.tbuttons .t-super span { font-size: 12px; }
@keyframes super-pulse { 50% { box-shadow: 0 0 0 6px rgba(255, 210, 63, .35); filter: brightness(1.15); } }
.tc {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(11, 13, 14, .6);
  border: 2px solid rgba(239, 233, 220, .35);
  font: 800 13px var(--body);
  letter-spacing: 1px;
  color: var(--text);
  touch-action: none;
}
.tc:active, .tc.down { transform: scale(.93); }
.tc.cool { opacity: .4; }
.tc.denied { animation: tc-deny .3s ease-out; }
@keyframes tc-deny {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); border-color: var(--red); }
  45% { transform: translateX(5px); border-color: var(--red); }
  70% { transform: translateX(-3px); }
}

.tc.arrow { width: 72px; height: 72px; border-radius: 14px; }
.tc.arrow svg { width: 32px; height: 32px; stroke-width: 3; }
.tc.arrow[data-hold="down"] { width: 60px; height: 60px; }
.tc.arrow.down { background: var(--cyan); color: var(--ink-0); }
body[data-ctl="btn"] .joy { display: none; }
body[data-ctl="joy"] .dpad { display: none; }
@media (hover: hover) and (pointer: fine) { .touch, .touch-only { display: none !important; } }

/* ===== Overlays & panels ===== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(6, 8, 9, .78);         /* no backdrop blur: it cost menus ~70% of their frame rate on slow devices */
  animation: fade .2s ease-out;
  overflow-y: auto;
}
@keyframes fade { from { opacity: 0; } }

.panel {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 26px 26px 22px;
  background: var(--ink-1);
  border: 1px solid var(--line);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--hazard);
}
.panel h2 {
  margin: 4px 0 14px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 34px;
  letter-spacing: 2px;
  color: var(--text);
}
.panel h2.lose { color: var(--red); }
.moves-note { margin: -6px 0 10px; color: var(--muted); font-size: 15px; }
.moves-list { list-style: none; margin: 0 0 14px; padding: 0; max-height: 52vh; overflow-y: auto; text-align: left; }
.moves-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 16px; }
.moves-list b { color: var(--amber); font-weight: 600; white-space: nowrap; }
.moves-list span { color: var(--text); text-align: right; }
@media (max-height: 500px) { .moves-list { max-height: 50vh; } .moves-list li { padding: 3px 4px; font-size: 14px; } }

.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

.big-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 220px;
  min-height: 58px;
  padding: 10px 30px;
  background: var(--amber);
  color: var(--ink-0);
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: 2px;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  box-shadow: inset 0 -5px 0 var(--amber-lo);
  transition: background .15s, transform .1s;
}
.big-btn:hover { background: var(--amber-hi); }
.big-btn:active { transform: translateY(2px); }
.big-btn.campaign-btn { flex-direction: column; gap: 0; line-height: 1.05; }
.big-btn.campaign-btn small { font: 700 14px var(--body); letter-spacing: .5px; }
.big-btn.small { min-width: 140px; min-height: 48px; font-size: 21px; padding: 8px 22px; }
.big-btn.revive { flex-direction: column; gap: 0; background: var(--green); box-shadow: inset 0 -5px 0 #24733a; }
.big-btn.revive:hover { background: #63d97f; }
.big-btn.revive em { font: 800 12px var(--body); font-style: normal; padding: 1px 6px; background: var(--ink-0); color: var(--green); margin-left: 6px; vertical-align: middle; }
.big-btn.revive small { font: 700 14px var(--body); letter-spacing: .5px; }

.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 8px 18px;
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: background .15s, border-color .15s, transform .1s;
}
.menu-btn:hover { background: var(--ink-3); border-color: var(--amber); }
.menu-btn:active { transform: translateY(1px); }
.menu-btn small { display: block; font-size: 12px; color: var(--muted); text-transform: none; letter-spacing: 0; }
.menu-btn:disabled { opacity: .4; cursor: default; }

.ad-btn { margin-top: 12px; border-color: var(--amber); color: var(--amber); }
.ad-btn em { font: 800 11px var(--body); font-style: normal; padding: 1px 6px; background: var(--amber); color: var(--ink-0); }

.field-label { margin: 14px 0 8px; font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); text-align: left; }

.coin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe28a, var(--amber) 55%, #b77d00);
  border: 1px solid #6d4b00;
  vertical-align: -2px;
}
.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  font-family: var(--display);
  color: var(--amber);
  font-size: 16px;
}
.coin-pill b { font-weight: 400; }
.coin-pill.big { font-size: 20px; padding: 7px 14px; }
.coin-pill.big .coin { width: 18px; height: 18px; }

/* ===== Title screen ===== */
#screen-title {
  place-items: stretch;
  padding: 0;
  background: linear-gradient(90deg, rgba(6, 8, 9, .92) 0%, rgba(6, 8, 9, .72) 38%, rgba(6, 8, 9, .15) 75%, rgba(6, 8, 9, 0) 100%);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.title-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  min-height: 100%;
  padding: 32px max(32px, 6vw);
}
.title-block { max-width: 520px; }
.kicker { display: flex; align-items: center; gap: 10px; font-size: 15px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.kicker .tag { padding: 2px 8px; background: var(--red); color: #fff; letter-spacing: 2px; }
.logo { margin: 10px 0 6px; font-family: var(--display); font-weight: 400; line-height: .9; }
.logo .l1 { display: block; font-size: clamp(46px, 8vw, 88px); color: var(--text); text-shadow: 4px 4px 0 #000; }
.logo .l2 {
  display: inline-block;
  font-size: clamp(46px, 8vw, 88px);
  color: var(--amber);
  text-shadow: 4px 4px 0 #000;
  padding-bottom: 10px;
  background: var(--hazard) bottom / 100% 8px no-repeat;
}
.tagline { margin: 6px 0 22px; font-size: 21px; color: var(--text); opacity: .85; letter-spacing: .5px; }
.diff { margin: 0 0 16px; }
.diff-label { display: block; margin-bottom: 6px; font-size: 13px; letter-spacing: 3px; color: var(--muted); }
.diff-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line-2); background: rgba(18, 22, 24, .9); }
.diff-seg button {
  min-height: 44px;
  padding: 6px 4px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  border-right: 1px solid var(--line);
  transition: background .15s, color .15s;
}
.diff-seg button:last-child { border-right: 0; }
.diff-seg button:hover { color: var(--text); background: var(--ink-3); }
.diff-seg button.active { background: var(--amber); color: var(--ink-0); }
.diff-seg button[data-d="veteran"].active { background: var(--red); color: #fff; }
.diff-desc { margin: 6px 0 0; min-height: 20px; font-size: 15px; color: var(--muted); }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 62px;
  padding: 10px 14px;
  background: rgba(18, 22, 24, .9);
  border: 1px solid var(--line);
  border-left: 4px solid var(--olive-hi);
  text-align: left;
  transition: background .15s, border-color .15s;
}
.mode-btn:hover { background: var(--ink-3); border-left-color: var(--amber); }
.mode-btn b { font-size: 20px; letter-spacing: 1px; text-transform: uppercase; }
.mode-btn small { font-size: 14px; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; margin-left: 4px; border-radius: 50%; background: var(--red); vertical-align: 2px; animation: tick 1s steps(2) infinite; }
.how { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; list-style: none; font-size: 16px; color: var(--muted); }
.how li { display: flex; align-items: center; gap: 4px; }

/* ===== Level select ===== */
.levels-panel { width: min(760px, 100%); }
.chapter-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chapter-nav .arrow { min-width: 48px; padding: 0; }
.chapter-nav .arrow svg { width: 26px; height: 26px; stroke-width: 3; }
.chapter-nav .arrow:disabled { opacity: .25; }
.chapter-title { display: flex; flex-direction: column; }
.chapter-title span { font-size: 14px; letter-spacing: 3px; color: var(--muted); }
.chapter-title b { font-family: var(--display); font-weight: 400; font-size: 30px; letter-spacing: 1px; color: var(--amber); }
.ch-brief { margin: 8px auto 0; max-width: 520px; font-size: 16px; color: var(--muted); }
.ch-brief:empty { display: none; }
.stars-total { margin-top: 6px; font-size: 15px; color: var(--muted); }
.ch-lock { margin-top: 10px; color: var(--red); font-weight: 700; }
.ch-lock:empty { display: none; }
.level-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.lvl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 92px;
  padding: 10px 6px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-top: 3px solid var(--olive);
  transition: background .15s, border-color .15s, transform .1s;
}
.lvl:hover { background: var(--ink-3); border-top-color: var(--amber); }
.lvl:active { transform: translateY(1px); }
.lvl .num { font-family: var(--display); font-size: 26px; line-height: 1; color: var(--text); }
.lvl .lvl-name { font-size: 13px; color: var(--muted); line-height: 1.1; }
.lvl .lvl-stars { color: var(--amber); font-size: 14px; letter-spacing: 1px; }
.lvl .lvl-stars i { font-style: normal; color: #3a4044; }
.lvl svg { width: 22px; height: 22px; }
.lvl.boss { border-top-color: var(--red); background: linear-gradient(#231618, var(--ink-2)); }
.lvl.boss .num { color: var(--red); }
.lvl.boss .lvl-name { color: #ff9a9d; }
.lvl.locked { opacity: .45; cursor: default; }
.lvl.locked:hover { background: var(--ink-2); border-top-color: var(--olive); }

/* ===== Results ===== */
.win-stars { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 6px 0 4px; }
.star { width: 46px; height: 46px; fill: #2b3135; stroke: #000; stroke-width: 1; }
.star.big { width: 62px; height: 62px; }
.star.on { fill: var(--amber); animation: star-pop .35s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes star-pop { from { transform: scale(.3) rotate(-30deg); } }
.result-score { font-family: var(--display); font-size: 40px; color: var(--text); }
.result-sub { margin: 4px 0; font-size: 17px; color: var(--muted); }
.result-sub:empty { display: none; }
.result-sub b { color: var(--text); }
.win-coins { margin-top: 8px; font-family: var(--display); font-size: 22px; color: var(--amber); }
.win-coins:empty { display: none; }
/* reward chest after each of the first 10 missions */
.win-reward { margin-top: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.win-reward[hidden] { display: none; }
.wr-box { position: relative; display: flex; flex-direction: column; align-items: center; padding: 8px 22px 7px; background: rgba(242, 169, 0, .12); border: 2px solid var(--amber); animation: wr-pop .5s cubic-bezier(.2, 1.6, .4, 1) .35s both; }
.wr-tag { position: absolute; top: -9px; padding: 0 6px; background: var(--amber); color: var(--ink-0); font: 800 11px var(--body); letter-spacing: 1.5px; }
.wr-box b { font-family: var(--display); font-size: 21px; color: var(--text); letter-spacing: 1px; }
.wr-box small { font-size: 13px; color: var(--muted); }
.wr-next { font-size: 14px; color: var(--muted); }
.wr-next b { color: var(--amber); }
@keyframes wr-pop { from { transform: scale(.4); opacity: 0; } }
/* RANK: XP bar on the win / lose screens, rank badge on the title screen */
.xp-row { width: min(360px, 100%); margin: 8px auto 0; text-align: left; }
.xp-row[hidden] { display: none; }
.xp-top { display: flex; justify-content: space-between; font: 800 12px var(--body); letter-spacing: 1px; color: var(--muted); }
.xp-top b { color: #7fd6f2; }
.xp-bar { position: relative; height: 10px; margin-top: 3px; background: #10181c; border: 2px solid #000; overflow: hidden; }
.xp-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#9be7ff, #3fa7d6); transition: width 1s ease-out; }
.xp-next { margin-top: 2px; font-size: 12px; color: var(--muted); }
.xp-up { margin-top: 3px; font-family: var(--display); font-size: 18px; color: var(--amber); text-align: center; animation: wr-pop .5s cubic-bezier(.2, 1.6, .4, 1) .9s both; }
.rank-chip { position: relative; display: inline-block; margin: 2px 0 8px; padding: 3px 10px 5px; background: rgba(11, 13, 14, .7); border: 1px solid var(--line-2); font-size: 13px; color: var(--text); letter-spacing: .5px; overflow: hidden; }
.rank-chip:empty { display: none; }
.rank-chip b { color: #7fd6f2; margin-right: 4px; }
.rank-chip i { position: absolute; left: 0; bottom: 0; height: 3px; background: #3fa7d6; }
/* "one more try" lose screen */
.lose-near { margin: 6px 0 0; font-size: 17px; color: var(--text); }
.lose-near:empty { display: none; }
.lose-near b { color: var(--amber); }
.lose-cb { display: block; margin-top: 4px; font-size: 14px; color: var(--amber); }
.retry-big { display: block; width: min(320px, 100%); margin: 10px auto 0; animation: retry-nudge 1.4s ease-in-out 1.2s infinite; }
@keyframes retry-nudge { 0%, 70%, 100% { transform: none; } 80% { transform: scale(1.05); } 90% { transform: scale(.98); } }
.day .day7 { font-size: 12px; line-height: 1.1; color: var(--amber); }
/* lose screen tip + "tomorrow" gift on the win / lose screens (2026-10-15) */
.lose-tip { margin: 4px auto 0; max-width: 420px; font-size: 15px; color: #7fd6f2; }
.lose-tip:empty { display: none; }
.tmrw { margin: 8px auto 0; display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 2px 10px; padding: 4px 12px; border: 2px dashed #7fd6f2; background: rgba(76, 201, 240, .08); }
.tmrw[hidden] { display: none; }
.tm-tag { padding: 0 6px; background: #7fd6f2; color: var(--ink-0); font: 800 11px var(--body); letter-spacing: 1.5px; align-self: center; }
.tmrw > b { font-family: var(--display); font-size: 17px; color: var(--text); letter-spacing: 1px; }
.tmrw small { font-size: 13px; color: var(--muted); }
.tm-got b { color: var(--green); }
/* computer keys during the first missions: a quiet strip along the bottom of the arena */
.keys-help { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px;
  max-width: calc(100% - 24px); padding: 6px 14px; background: rgba(11, 13, 14, .72); border: 1px solid var(--line); font-size: 14px; color: var(--muted); pointer-events: none; }
.keys-help[hidden] { display: none; }
.keys-help span { white-space: nowrap; }
.keys-help kbd { display: inline-block; min-width: 18px; margin-right: 3px; padding: 0 4px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--ink-2); color: var(--text); font: 700 12px var(--body); text-align: center; }
body:not([data-state="play"]) .keys-help { display: none; }
/* Armory buttons: "NEW!" when an upgrade can be bought */
.has-new { position: relative; }
.has-new::after { content: 'NEW!'; position: absolute; top: -8px; right: -6px; padding: 2px 6px; background: var(--red); color: #fff; font: 800 11px var(--body); letter-spacing: 1px; animation: new-bob 1s ease-in-out infinite; pointer-events: none; }
@keyframes new-bob { 50% { transform: translateY(-2px) scale(1.06); } }

/* ===== Shop ===== */
.shop-panel { width: min(640px, 100%); }
.shop-head { display: flex; align-items: center; justify-content: space-between; }
.shop-head h2 { margin: 4px 0; }
.tabs { display: flex; gap: 6px; margin: 12px 0; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1;
  min-height: 44px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 3px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--amber); }
.shop-list { max-height: 50vh; overflow-y: auto; text-align: left; padding-right: 4px; }
.shop-list.rows { display: flex; flex-direction: column; gap: 8px; }
.shop-item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--ink-2); border: 1px solid var(--line); }
.shop-item.locked { opacity: .45; }
.si-icon { flex: 0 0 auto; display: grid; place-items: center; width: 48px; height: 48px; background: var(--ink-0); border: 1px solid var(--line); color: var(--amber); }
.si-icon svg { width: 28px; height: 28px; }
.si-body { flex: 1; min-width: 0; }
.si-body b { display: block; font-size: 19px; letter-spacing: .5px; text-transform: uppercase; }
.si-body small { display: block; font-size: 15px; color: var(--muted); line-height: 1.25; }
.ups { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.up-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 12px;
  background: var(--ink-0);
  border: 1px solid var(--line-2);
  font-weight: 700;
  font-size: 15px;
}
.up-btn:not(:disabled):hover { border-color: var(--amber); }
.up-btn:disabled { opacity: .45; cursor: default; }
.up-btn .pips { font-style: normal; color: var(--amber); letter-spacing: 1px; }
.up-btn em { font-style: normal; color: var(--amber); font-family: var(--display); font-size: 14px; }
.shop-list.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.shop-sub { grid-column: 1 / -1; margin-top: 6px; font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); }
.shop-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px; background: var(--ink-2); border: 1px solid var(--line); text-align: center; }
.shop-card img { width: 72px; height: 72px; }
.shop-card b { font-size: 15px; letter-spacing: .5px; }
.shop-card.equipped { border-color: var(--amber); }
.card-btn { width: 100%; min-height: 36px; background: var(--ink-0); border: 1px solid var(--line-2); font-weight: 700; font-size: 14px; }
.card-btn:not(:disabled):hover { border-color: var(--amber); }
.card-btn:disabled { opacity: .55; cursor: default; }
.shop-card.equipped .card-btn:disabled { opacity: 1; color: var(--amber); border-color: var(--amber); }

/* ===== Unlock / threat intro ===== */
.unlock-panel { width: min(420px, 100%); }
.unlock-tag { display: inline-block; padding: 2px 10px; background: var(--red); color: #fff; font-size: 14px; letter-spacing: 3px; }
.unlock-icon { display: grid; place-items: center; width: 96px; height: 96px; margin: 14px auto 0; background: var(--ink-0); border: 1px solid var(--line); color: var(--amber); }
.unlock-icon svg { width: 56px; height: 56px; }
.unlock-panel h2 { margin-top: 10px; }
.unlock-panel .big-btn { margin-top: 16px; }

/* ===== Daily ===== */
.daily-track { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; background: var(--ink-2); border: 1px solid var(--line); }
.day small { font-size: 12px; color: var(--muted); }
.day b { font-family: var(--display); font-weight: 400; font-size: 15px; color: var(--amber); }
.day b .coin { width: 11px; height: 11px; margin-right: 2px; }
.day.done { opacity: .45; }
.day.today { border-color: var(--amber); background: #221d10; }
.daily-ch { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; background: var(--ink-2); border: 1px solid var(--line); border-left: 4px solid var(--red); text-align: left; }
.daily-ch b { font-size: 20px; letter-spacing: .5px; text-transform: uppercase; }
.daily-ch small { font-size: 15px; color: var(--muted); }
.daily-ch em { font-style: normal; font-size: 15px; color: var(--amber); }

/* ===== Challenges ===== */
.ch-panel { width: min(620px, 100%); }
.challenge-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow-y: auto; text-align: left; }
.ch-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--ink-2); border: 1px solid var(--line); }
.ch-medal { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--ink-0); border: 2px solid var(--line-2); color: var(--line-2); font-size: 18px; }
.ch-medal.gold { color: #ffd34d; border-color: #ffd34d; }
.ch-medal.silver { color: #cfd6da; border-color: #cfd6da; }
.ch-medal.bronze { color: #d08a4c; border-color: #d08a4c; }
.ch-item small.best { color: var(--text); }
.ch-medal svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.prompt {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%);
  padding: 12px 22px;
  background: rgba(11, 13, 14, .88);
  border: 1px solid var(--line-2);
  border-left: 5px solid var(--amber);
  font-family: var(--display);
  font-size: clamp(18px, 2.6vw, 28px);
  letter-spacing: 1.5px;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}
.prompt.on { opacity: 1; animation: prompt-in .3s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes prompt-in { from { transform: translate(-50%, -50%) scale(.85); } }
body.banner-on .prompt.on { opacity: 0; animation: none; }
body:not([data-state="play"]) .prompt { display: none; }   /* hints never sit on top of the win / lose / pause screens */   /* a big banner (KNOCKOUT!, AIR STRIKE!) has the stage */
.ch-item .big-btn.small { min-width: 96px; font-size: 18px; min-height: 44px; }

/* ===== Ad ===== */
.ad-panel { width: min(320px, 100%); }
.ad-panel p { margin: 14px 0 0; color: var(--muted); font-size: 17px; }
.spinner { width: 44px; height: 44px; margin: 6px auto 0; border: 4px solid var(--line); border-top-color: var(--amber); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

body:not([data-mode="survive"]) .survive-only,
body:not([data-state="play"]):not([data-state="paused"]) .touch,
body:not([data-mode="survive"]) .objective,
body:not([data-mode="survive"]) .hearts { display: none !important; }

/* legacy, not shown */
#toolbar, #screen-custom { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 820px) {
  .best { display: none; }
  .level-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .lvl { min-height: 78px; padding: 8px 2px; }
  .lvl .lvl-name { display: none; }
}
@media (max-width: 560px) {
  #hud { padding: 0 10px; gap: 8px; }
  .brand .b1, .brand .b2 { font-size: 12px; }
  .score { font-size: 22px; }
  .icon-btn { width: 40px; height: 40px; }
  .hud-coins { padding: 4px 8px; font-size: 14px; }
  .mode-grid { grid-template-columns: 1fr 1fr; }
  .level-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .panel { padding: 22px 16px 18px; }
  .panel h2 { font-size: 28px; }
  .big-btn { min-width: 180px; font-size: 24px; }
  .daily-track { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-height: 560px) {
  #hud { height: 46px; }
  .title-wrap { padding: 16px max(24px, 4vw); gap: 14px; }
  .logo .l1, .logo .l2 { font-size: clamp(36px, 9vh, 64px); }
  .tagline { margin-bottom: 12px; font-size: 17px; }
  .mode-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mode-btn { min-height: 52px; padding: 6px 10px; }
  .mode-btn b { font-size: 16px; }
  .mode-btn small { font-size: 12px; }
  .how, body[data-pad] .how.pad-how { display: none; }
  .diff { margin-bottom: 10px; }
  .diff-seg button { min-height: 38px; font-size: 15px; }
  .diff-desc { display: none; }
  .objective { top: 8px; left: 8px; min-width: 150px; padding: 5px 10px; }
  .obj-goal { font-size: 17px; }
  .hearts { top: 8px; right: 8px; padding: 5px 9px; }
  .lifebar { width: 140px; height: 16px; }
  .superbar { width: 140px; height: 8px; }
  .lifebar b { font-size: 11px; }
  .joy { width: 104px; height: 104px; }
  .joy i { width: 46px; height: 46px; margin: -23px; }
  .tbuttons { transform: scale(.74); margin: -78px 0 0 -78px; }
  .tc { width: 48px; height: 48px; font-size: 11px; background: rgba(11, 13, 14, .45); }
  .tc.arrow { width: 60px; height: 60px; }
  .tc.arrow[data-hold="down"] { width: 50px; height: 50px; }
  .dpad { gap: 8px; }
  .panel { max-height: calc(100dvh - 16px); padding: 18px 16px 14px; }
  .overlay { padding: 8px; }
  .lvl { min-height: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ===== Phones: no browser zoom, turn-sideways hint ===== */
html { touch-action: none; -webkit-text-size-adjust: 100%; }
.rotate-hint {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: var(--ink-0);
  color: var(--text);
}
.rotate-hint[hidden] { display: none; }
.rotate-hint svg { width: 120px; height: 120px; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.rotate-hint .ph { stroke: var(--amber); transform-origin: 32px 26px; animation: tilt 2.2s ease-in-out infinite; }
.rotate-hint .arc { stroke: var(--muted); }
.rotate-hint b { font: 400 26px var(--display); letter-spacing: 1px; color: var(--amber); }
.rotate-hint span { font-size: 17px; color: var(--muted); }
@keyframes tilt { 0%, 25% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }

/* ===== Phones & tablets (touch): full-screen arena, see-through top bar ===== */
@media (hover: none) and (pointer: coarse) {
  #stage { padding: 0; }
  #game { border: 0; box-shadow: none; }
  #hud {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 5;
    height: auto;
    padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
    background: none;
    border: 0;
    pointer-events: none;
  }
  #hud > * { pointer-events: auto; }
  #hud .hud-coins, #hud .best, #hud .score-label { display: none; }
  #hud .brand { visibility: hidden; }          /* keeps its slot so the score stays centred */
  body:not([data-state="play"]) #hud { display: none; }
  #hud .score { font-size: 20px; }
  .icon-btn { width: 38px; height: 38px; background: rgba(11, 13, 14, .55); }
  .hud-right { gap: 6px; }
  .objective { top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); }
  .hearts { top: 52px; right: max(8px, env(safe-area-inset-right)); }
  .timer { top: 34px; }
}

/* ===== Short screens (phones held sideways): every card fits without scrolling ===== */
@media (max-height: 500px) {
  .overlay { padding: 6px; }
  .panel { width: min(720px, 100%); max-height: calc(100dvh - 12px); padding: 14px 18px 12px; }
  .panel h2 { font-size: 24px; margin: 2px 0 6px; letter-spacing: 1px; }
  .row { margin-top: 8px; gap: 8px; }
  .menu-btn { min-height: 38px; padding: 4px 14px; font-size: 15px; }
  .big-btn { min-width: 160px; min-height: 44px; font-size: 22px; padding: 6px 20px; }
  .big-btn.small { min-width: 110px; min-height: 38px; font-size: 18px; padding: 4px 16px; }
  .ad-btn { margin-top: 6px; }
  .field-label { margin: 6px 0 4px; font-size: 11px; }
  /* win / lose */
  .win-stars { margin: 0; gap: 6px; }
  .star { width: 30px; height: 30px; }
  .star.big { width: 40px; height: 40px; }
  .result-score { font-size: 24px; line-height: 1.1; }
  .result-sub { margin: 2px 0; font-size: 14px; }
  .win-coins { margin-top: 2px; font-size: 17px; }
  .xp-row { margin-top: 3px; } .xp-up { font-size: 15px; } .lose-near { font-size: 14px; margin-top: 2px; } .retry-big { margin-top: 6px; }
  .wr-box small { display: none; }   /* "reward chest" caption: room for the TOMORROW line */
  .tmrw { margin-top: 3px; padding: 1px 10px; } .tmrw > b { font-size: 14px; } .tmrw small { font-size: 12px; } .lose-tip { font-size: 13px; margin-top: 2px; }
  .win-reward { margin-top: 2px; } .wr-box { padding: 5px 16px 4px; } .wr-box b { font-size: 17px; } .wr-box small, .wr-next { font-size: 12px; }
  #screen-win .ad-btn { min-height: 34px; }
  .big-btn.revive { min-height: 52px; padding: 4px 22px; }
  .big-btn.revive small { font-size: 12px; }
  /* lists keep the buttons under them on screen: the list shrinks and scrolls instead */
  .shop-panel, .ch-panel, .levels-panel { display: flex; flex-direction: column; }
  .shop-list, .challenge-list { flex: 1 1 auto; min-height: 0; max-height: none; }
  .shop-head h2 { margin: 0; }
  .coin-pill.big { padding: 4px 10px; font-size: 16px; }
  .tabs { margin: 4px 0 8px; }
  .tab { min-height: 34px; padding: 4px 10px; }
  .shop-item { padding: 6px 10px; gap: 10px; }
  .si-icon { width: 38px; height: 38px; }
  .si-body b { font-size: 16px; }
  .si-body small { font-size: 13px; }
  .ups { margin-top: 4px; }
  .up-btn { min-height: 34px; }
  .shop-card { padding: 6px; gap: 4px; }
  .shop-card img, .shop-card.fighter img { width: 52px; height: 52px; }
  .ch-item { padding: 6px 10px; }
  .ch-panel > .result-sub { display: none; }
  /* daily */
  .daily-track { gap: 4px; }
  .day { padding: 3px 2px; }
  .daily-ch { padding: 6px 10px; }
  .daily-ch b { font-size: 16px; }
  .daily-ch small, .daily-ch em { font-size: 13px; }
  /* threat card */
  .unlock-icon { width: 64px; height: 64px; margin-top: 6px; }
  .unlock-icon svg { width: 38px; height: 38px; }
  .unlock-panel .big-btn { margin-top: 8px; }
  /* title */
  .title-wrap { gap: 10px; padding: 10px max(20px, 4vw); }
  .kicker { font-size: 12px; }
  .logo { margin: 4px 0 2px; }
  .logo .l1, .logo .l2 { font-size: clamp(28px, 10vh, 48px); }
  .tagline { margin: 2px 0 6px; font-size: 15px; }
  .diff { margin: 8px 0 6px; }
  .diff-label { margin-bottom: 3px; font-size: 11px; }
  .diff-seg button { min-height: 34px; font-size: 14px; }
  .mode-grid { margin-top: 8px; gap: 6px; }
  .mode-btn { min-height: 44px; padding: 4px 10px; }
  .mode-btn b { font-size: 15px; }
  .mode-btn small { font-size: 11px; }
}
@media (max-height: 380px) {
  .kicker, .tagline { display: none; }
  .logo .l1, .logo .l2 { font-size: clamp(24px, 9vh, 36px); }
  .result-sub { font-size: 13px; }
}

/* until game.js has started (it waits for the CrazyGames SDK), menu buttons can't be pressed */
body[data-state="loading"] #screen-title button { pointer-events: none; opacity: .55; }
