:root {
  --ink: #2a1220;
  --paper: #f6e7c8;
  --gold: #f2c25a;
  --rust: #c9502c;
  --teal: #2f8f94;
  --shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
  --font: 'Rockwell', 'Roboto Slab', 'Georgia', serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #1a0c14; color: var(--paper); font-family: var(--font); overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#app { position: fixed; inset: 0; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: none; }
body.menu #stage { cursor: default; }
button { font-family: inherit; }
[hidden] { display: none !important; }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l)); z-index: 20; overflow-y: auto; }
.screen.show { display: flex; }
#loading { background: radial-gradient(circle at 50% 40%, #6a2a3a, #1a0c14); flex-direction: column; gap: 8px; }
#pause, #results, #select, #howto, #fail { background: rgba(26, 10, 18, 0.55); backdrop-filter: blur(3px); }

.logo { font-size: clamp(30px, 6vw, 44px); font-weight: 900; letter-spacing: 0.04em; color: var(--paper); text-shadow: 0 4px 0 var(--ink), 0 0 24px rgba(255, 160, 80, 0.45); line-height: 1; text-align: center; }
.logo b { color: var(--gold); display: block; }
.logo.big { font-size: clamp(44px, 11vw, 96px); }
.tagline { margin: 14px 0 22px; font-size: clamp(15px, 2.4vw, 20px); text-align: center; text-shadow: 0 2px 0 var(--ink); }
.title-card { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 18vh; }
.stars-total { margin: 4px 0 0; color: var(--gold); text-shadow: 0 2px 0 var(--ink); min-height: 1.2em; }

.btn { appearance: none; border: 3px solid var(--ink); background: var(--paper); color: var(--ink); font-size: 18px; font-weight: 800; padding: 12px 26px; border-radius: 14px; box-shadow: var(--shadow); cursor: pointer; min-width: 220px; letter-spacing: 0.03em; transition: transform 0.08s; touch-action: manipulation; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.btn.primary { background: linear-gradient(#ffd66b, #f2a83a); }
.btn:focus-visible, .card:focus-visible, .icon-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.panel { background: var(--paper); color: var(--ink); border: 4px solid var(--ink); border-radius: 20px; box-shadow: 0 10px 0 rgba(0, 0, 0, 0.4); padding: 20px 22px; width: min(420px, 100%); display: flex; flex-direction: column; align-items: center; gap: 10px; max-height: 100%; overflow-y: auto; }
.panel.wide { width: min(880px, 100%); align-items: stretch; }
.panel h2 { margin: 4px 0 6px; font-size: 26px; text-align: center; }
.panel h3 { margin: 6px 0; font-size: 18px; }
.row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.row .btn { min-width: 150px; }

.cards { display: grid; gap: 10px; }
.cards.heroes { grid-template-columns: repeat(4, 1fr); }
.cards.stages { grid-template-columns: repeat(3, 1fr); }
.cards.guns { grid-template-columns: repeat(3, 1fr); }
.card.gun { min-height: 0; }
.card.gun canvas { width: 100%; aspect-ratio: 2 / 1; border-radius: 10px; background: radial-gradient(#fff8e8, #e8d4b0); }
.card .stats { font-size: 12px; font-weight: 700; color: #7a4a26; }
.card .tag { align-self: flex-start; margin-top: 4px; font-size: 11px; font-weight: 900; padding: 3px 8px; border-radius: 8px; background: #2f8f94; color: #fff; }
.card .tag.buy { background: #c9502c; }
.card .goal { font-size: 12px; font-weight: 800; color: #2f6f94; }
.wallet { font-size: 15px; color: #c98a1a; margin-left: 8px; white-space: nowrap; }
.goal.ok { color: #2f8f4a; font-weight: 900; margin: 0; }
.goal.bad { color: #c9502c; font-weight: 900; margin: 0; }
.objective { position: absolute; bottom: calc(14px + var(--safe-b)); left: calc(12px + var(--safe-l)); max-width: min(340px, calc(50vw - 60px)); background: rgba(42, 18, 32, 0.72); border: 2px solid rgba(242, 194, 90, 0.7); border-radius: 10px; padding: 5px 9px; font-size: 13px; font-weight: 700; line-height: 1.25; text-shadow: 0 1px 0 #000; }
.objective b { color: var(--gold); margin-right: 4px; }
.objective span { color: var(--gold); font-weight: 900; margin-left: 4px; font-variant-numeric: tabular-nums; }
.objective.done { border-color: #7ad84a; }
.objective.done b, .objective.done span { color: #9cff6a; }
.objective.bump { animation: bump 0.3s; }
.cylinder.prompt { animation: pulse 0.35s infinite alternate; border-color: #ff5a3a; box-shadow: 0 0 0 4px rgba(255, 90, 58, 0.45), 0 4px 0 rgba(0,0,0,0.4); }
.cylinder.prompt #reload-hint { opacity: 1; }
.card { appearance: none; text-align: left; font: inherit; color: var(--ink); background: #fff8e8; border: 3px solid #c9b38a; border-radius: 14px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; position: relative; min-height: 120px; touch-action: manipulation; }
.card canvas { width: 100%; aspect-ratio: 1 / 1; border-radius: 10px; background: linear-gradient(#ffd8a0, #e8875a); }
.card.stage .swatch { height: 46px; border-radius: 10px; }
.card .name { font-weight: 900; font-size: 16px; }
.card .sub { font-size: 12.5px; opacity: 0.85; line-height: 1.3; }
.card .stars { color: #d98a1a; font-size: 15px; letter-spacing: 2px; }
.card.on { border-color: var(--rust); box-shadow: 0 0 0 3px var(--gold); background: #fff2d0; }
.card.locked { cursor: not-allowed; filter: grayscale(0.9); opacity: 0.6; }
.card .lock { position: absolute; top: 8px; right: 8px; background: var(--ink); color: var(--paper); font-size: 11px; padding: 3px 7px; border-radius: 8px; }

.howto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.controls { margin: 0; padding-left: 18px; line-height: 1.45; font-size: 14.5px; }
.critters { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.critters li { display: flex; align-items: center; gap: 8px; }
.critters .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); flex: none; }
.critters .pts { margin-left: auto; font-weight: 800; }

.res-stars { display: flex; gap: 10px; font-size: 44px; }
.res-stars i { font-style: normal; color: #cbb68e; transform: scale(0.6); transition: transform 0.3s cubic-bezier(.3,1.8,.5,1), color 0.2s; }
.res-stars i::before { content: '\2605'; }
.res-stars i.on { color: #f2a83a; transform: scale(1); text-shadow: 0 3px 0 var(--ink); }
.res-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.res-table td { padding: 5px 4px; border-bottom: 1px dashed #c9b38a; }
.res-table td:last-child { text-align: right; font-weight: 800; }
.res-table tr.total td { font-size: 20px; color: var(--rust); }
.unlock { background: var(--ink); color: var(--gold); padding: 8px 12px; border-radius: 10px; font-weight: 800; text-align: center; margin: 4px 0; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.hud-top { position: absolute; top: calc(10px + var(--safe-t)); left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); display: flex; justify-content: space-between; align-items: flex-start; }
.hud-score .label { font-size: 12px; letter-spacing: 0.15em; opacity: 0.9; text-shadow: 0 2px 0 var(--ink); }
.hud-score .value { font-size: clamp(26px, 5vw, 38px); font-weight: 900; color: var(--paper); text-shadow: 0 3px 0 var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
.combo { margin-top: 4px; display: flex; align-items: center; gap: 6px; }
#combo-mult { background: var(--gold); color: var(--ink); font-weight: 900; padding: 1px 8px; border-radius: 8px; border: 2px solid var(--ink); font-size: 18px; }
#combo-mult.bump { animation: bump 0.25s; }
.pips { display: flex; gap: 3px; }
.pips i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.3); border: 1.5px solid var(--ink); }
.pips i.on { background: var(--gold); }
@keyframes bump { 50% { transform: scale(1.35); } }

.hud-timer { position: absolute; left: 50%; transform: translateX(-50%); width: 64px; height: 64px; display: grid; place-items: center; }
.hud-timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.hud-timer .track { fill: rgba(42, 18, 32, 0.6); stroke: rgba(255,255,255,0.15); stroke-width: 4; }
.hud-timer .ring { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 119.4; transition: stroke 0.3s; }
#timer { position: relative; font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 var(--ink); }
.hud-timer.danger .ring { stroke: #ff5a3a; }
.hud-timer.danger #timer { color: #ffb0a0; animation: pulse 0.5s infinite alternate; }
.hud-timer.bonus { animation: bump 0.4s; }
@keyframes pulse { to { transform: scale(1.15); } }
.hud-buttons { display: flex; gap: 8px; pointer-events: auto; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 3px solid var(--ink); background: rgba(246, 231, 200, 0.92); color: var(--ink); font-size: 17px; font-weight: 900; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,0.35); touch-action: manipulation; }

.boss { position: absolute; top: calc(84px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(360px, 70vw); text-align: center; }
.boss-name { font-weight: 900; font-size: 14px; color: var(--gold); text-shadow: 0 2px 0 var(--ink); letter-spacing: 0.08em; }
.boss-bar { height: 12px; border: 3px solid var(--ink); border-radius: 8px; background: rgba(0,0,0,0.4); overflow: hidden; margin-top: 3px; }
.boss-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(#ff7a5a, #c92a2a); transition: width 0.2s; }

.banner { position: absolute; top: 30%; left: 0; right: 0; text-align: center; font-size: clamp(30px, 7vw, 64px); font-weight: 900; color: var(--gold); text-shadow: 0 4px 0 var(--ink), 0 0 30px rgba(255, 140, 40, 0.6); opacity: 0; transform: scale(0.6); transition: opacity 0.2s, transform 0.25s cubic-bezier(.3,1.6,.5,1); }
.banner.show { opacity: 1; transform: scale(1); }
.banner.red { color: #ff7a5a; }
.banner.blue { color: #9fe0ff; }

#popups { position: absolute; inset: 0; overflow: hidden; }
.pop { position: absolute; transform: translate(-50%, -50%); font-weight: 900; font-size: 20px; color: #fff; text-shadow: 0 2px 0 var(--ink), 0 0 6px rgba(0,0,0,0.5); white-space: nowrap; animation: rise 0.95s ease-out forwards; }
.pop.bonus { color: var(--gold); font-size: 17px; }
.pop.big { font-size: 30px; color: var(--gold); }
.pop.bad { color: #ff7a5a; }
.pop.time { color: #9fe0ff; }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }

.cylinder { position: absolute; bottom: calc(14px + var(--safe-b)); left: 50%; transform: translateX(-50%); width: 92px; height: 92px; border-radius: 50%; border: 3px solid var(--ink); background: radial-gradient(#6a6e78, #34363e); box-shadow: 0 4px 0 rgba(0,0,0,0.4); pointer-events: auto; cursor: pointer; padding: 0; touch-action: manipulation; }
.cylinder svg { width: 100%; height: 100%; transition: transform 0.12s; }
.cylinder .chamber { fill: #1a1a1f; stroke: #111; stroke-width: 2; }
.cylinder .chamber.full { fill: #e8b13a; stroke: #7a5a1a; }
.cylinder .axle { fill: #22242a; }
.cylinder.reloading svg { animation: spin 0.25s linear infinite; }
.cylinder.empty { animation: pulse 0.4s infinite alternate; border-color: #ff5a3a; }
#reload-hint { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 900; color: #ff9a7a; text-shadow: 0 2px 0 var(--ink); opacity: 0; transition: opacity 0.2s; }
.cylinder.empty #reload-hint { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

#crosshair { position: fixed; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 15; display: none; }
#crosshair.show { display: block; }
#crosshair i { position: absolute; display: block; }
#crosshair .ring { width: 40px; height: 40px; left: -20px; top: -20px; border: 2.5px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(0,0,0,0.5), inset 0 0 0 1.5px rgba(0,0,0,0.4); transition: transform 0.1s, border-color 0.1s; }
#crosshair .dot { width: 6px; height: 6px; left: -3px; top: -3px; border-radius: 50%; background: #ff4a3a; box-shadow: 0 0 0 1.5px #fff; }
#crosshair .tick { background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.45); }
#crosshair .tick.t, #crosshair .tick.b { width: 2.5px; height: 9px; left: -1.25px; }
#crosshair .tick.t { top: -31px; } #crosshair .tick.b { top: 22px; }
#crosshair .tick.l, #crosshair .tick.r { height: 2.5px; width: 9px; top: -1.25px; }
#crosshair .tick.l { left: -31px; } #crosshair .tick.r { left: 22px; }
#crosshair.on .ring { border-color: #ff5a3a; transform: scale(0.8); }
#crosshair.friendly .ring { border-color: #6ab0ff; transform: scale(0.9); }
#crosshair .hitmark { width: 30px; height: 30px; left: -15px; top: -15px; opacity: 0; background:
  linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%),
  linear-gradient(-45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%); }
#crosshair.hit .hitmark { animation: hitmark 0.22s; }
#crosshair.touch { transition: opacity 0.4s; }
@keyframes hitmark { 0% { opacity: 1; transform: scale(1.4); } 100% { opacity: 0; transform: scale(0.8); } }

#countdown { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 12; font-size: clamp(60px, 16vw, 140px); font-weight: 900; color: var(--gold); text-shadow: 0 6px 0 var(--ink); }
#countdown span { animation: count 0.7s ease-out forwards; }
@keyframes count { 0% { transform: scale(1.8); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 100% { opacity: 0; transform: scale(0.9); } }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .cards.heroes { grid-template-columns: repeat(2, 1fr); }
  .cards.stages { grid-template-columns: 1fr; }
  .cards.guns { grid-template-columns: repeat(2, 1fr); }
  .hearts { top: calc(56px + var(--safe-t)); font-size: 18px; }
  .objective { font-size: 11.5px; max-width: calc(50vw - 50px); padding: 4px 7px; }
  .card.stage { flex-direction: row; align-items: center; min-height: 0; }
  .card.stage .swatch { width: 56px; flex: none; }
  .howto-grid { grid-template-columns: 1fr; }
  .hud-timer { width: 54px; height: 54px; }
  #timer { font-size: 20px; }
  .boss { top: calc(72px + var(--safe-t)); }
  .cylinder { width: 76px; height: 76px; }
  .btn { min-width: 200px; }
}
@media (max-height: 480px) and (orientation: landscape) {
  .title-card { margin-top: 4vh; }
  .cylinder { width: 66px; height: 66px; left: auto; right: calc(14px + var(--safe-r)); transform: none; }
  .cards.heroes { grid-template-columns: repeat(4, 1fr); }
  .cards.stages { grid-template-columns: repeat(3, 1fr); }
  .cards.guns { grid-template-columns: repeat(3, 1fr); }
  .card canvas { aspect-ratio: 4 / 3; }
}
@media (prefers-reduced-motion: reduce) {
  .banner, .pop, #countdown span, .res-stars i { animation: none !important; transition: none !important; }
}

/* ---------- tabbed select + frontier map ---------- */
.panel.select { gap: 8px; }
.tabs { display: flex; gap: 6px; align-items: center; border-bottom: 3px solid #c9b38a; padding-bottom: 6px; }
.tab { appearance: none; font: inherit; font-weight: 900; font-size: 16px; color: var(--ink); background: #efe0bf; border: 3px solid #c9b38a; border-radius: 12px 12px 4px 4px; padding: 7px 14px; cursor: pointer; touch-action: manipulation; }
.tab.on { background: var(--gold); border-color: var(--ink); }
.tabs .wallet { margin-left: auto; font-weight: 900; }
.tab-body { min-height: 0; overflow-y: auto; }
.cards.heroes { grid-template-columns: repeat(4, 1fr); }
.map-wrap { background: radial-gradient(ellipse at 50% 45%, #f4e2b8, #d8b47a 75%, #b8894a); border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; }
#stage-map { display: block; width: 100%; height: auto; max-height: 52vh; }
#stage-map .road { fill: none; stroke: #7a4a26; stroke-width: 0.9; stroke-dasharray: 2 1.4; stroke-linecap: round; }
#stage-map .node { cursor: pointer; }
#stage-map .node circle.pin { stroke: var(--ink); stroke-width: 0.7; }
#stage-map .node.locked { cursor: not-allowed; opacity: 0.55; }
#stage-map .node.on circle.pin { stroke: #c9502c; stroke-width: 1.4; }
#stage-map .node text { font-family: var(--font); font-weight: 900; text-anchor: middle; fill: var(--ink); paint-order: stroke; stroke: #f6e7c8; stroke-width: 0.9px; }
#stage-map .node .nm { font-size: 3px; }
#stage-map .node .st { font-size: 2.6px; fill: #b8660a; }
#stage-map .deco { opacity: 0.35; }
.stage-info { display: grid; grid-template-columns: 60px 1fr; gap: 10px; align-items: center; background: #fff8e8; border: 3px solid #c9b38a; border-radius: 14px; padding: 8px 10px; }
.stage-info .swatch { height: 60px; border-radius: 10px; }
.stage-info .name { font-weight: 900; font-size: 18px; }
.stage-info .sub { font-size: 13px; }
.stage-info .goal { font-size: 13px; font-weight: 800; color: #2f6f94; }
.foot { align-items: center; justify-content: flex-end; }
.loadout { margin-right: auto; font-size: 13px; font-weight: 800; }
@media (max-width: 760px) {
  .tab { font-size: 14px; padding: 6px 9px; }
  .cards.heroes { grid-template-columns: repeat(2, 1fr); }
  .foot .btn { min-width: 110px; padding: 10px 14px; }
  .loadout { flex-basis: 100%; text-align: center; }
}
@media (max-height: 480px) and (orientation: landscape) {
  #stage-map { max-height: 40vh; }
  .cards.heroes { grid-template-columns: repeat(6, 1fr); }
}

/* ---------- hearts, danger and hurt ---------- */
.hearts { position: absolute; top: calc(62px + var(--safe-t)); right: calc(12px + var(--safe-r)); display: flex; gap: 3px; font-size: 22px; line-height: 1; text-shadow: 0 2px 0 var(--ink); }
.hearts i { font-style: normal; color: #ff5a6a; transition: transform 0.15s, color 0.2s; }
.hearts i.lost { color: rgba(255, 255, 255, 0.28); transform: scale(0.8); }
.hearts i.pop { animation: bump 0.4s; }
#danger-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.danger { position: absolute; top: 30%; transform: translateX(-50%); text-align: center; font-weight: 900; color: #ff5a3a; text-shadow: 0 2px 0 var(--ink); animation: danger 1.5s ease-out forwards; }
.danger b { display: block; font-size: 38px; line-height: 1; }
.danger span { font-size: 12px; letter-spacing: 0.1em; }
@keyframes danger { 0% { opacity: 0; transform: translateX(-50%) scale(0.5); } 12% { opacity: 1; transform: translateX(-50%) scale(1.25); } 30%, 70% { opacity: 1; transform: translateX(-50%) scale(1); } 100% { opacity: 0; } }
#threat { position: fixed; inset: 0; pointer-events: none; z-index: 11; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(220, 30, 20, 0.55) 100%); transition: opacity 0.12s; }
#hurt { position: fixed; inset: 0; pointer-events: none; z-index: 14; opacity: 0; background: radial-gradient(ellipse at center, rgba(255, 40, 30, 0.35), rgba(200, 0, 0, 0.75)); }
#hurt.on { animation: hurtflash 0.55s ease-out; }
@keyframes hurtflash { 0% { opacity: 1; } 100% { opacity: 0; } }
/* ---------- difficulty modes ---------- */
.stage-info .modes { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mode { appearance: none; font: inherit; color: var(--ink); background: #efe0bf; border: 3px solid #c9b38a; border-radius: 10px; padding: 5px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; touch-action: manipulation; }
.mode b { font-size: 14px; }
.mode span { font-size: 12px; color: #b8660a; font-weight: 800; }
.mode.on { background: var(--gold); border-color: var(--ink); }
.mode.locked { opacity: 0.5; cursor: not-allowed; }
.mode[data-mode="hard"].on { background: #e8854a; }
.mode[data-mode="deadeye"].on { background: #c9502c; color: #fff4e0; }
.mode[data-mode="deadeye"].on span { color: #ffe08a; }
#stage-map .node .mb { font-size: 3px; }

/* ---------- the deep ---------- */
.air { position: absolute; top: calc(92px + var(--safe-t)); right: calc(12px + var(--safe-r)); width: 120px; display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 900; text-shadow: 0 1px 0 #000; color: #bfeaff; }
.air b { flex: 1; height: 10px; border: 2px solid var(--ink); border-radius: 6px; background: rgba(0, 0, 0, 0.45); overflow: hidden; }
.air i { display: block; height: 100%; width: 100%; background: linear-gradient(#8ae8ff, #3aa8e8); transition: width 0.2s; }
.air.low i { background: linear-gradient(#ff8a6a, #e83a2a); }
.air.low { animation: pulse 0.5s infinite alternate; color: #ffb0a0; }
.regions { display: flex; gap: 6px; margin-bottom: 6px; }
.map-wrap.deep { background: radial-gradient(ellipse at 50% 20%, #5ac0d8, #1e78a8 60%, #0e4468); }
.map-wrap.deep #stage-map .road { stroke: #d8f4ff; }
.map-wrap.deep #stage-map .node text { fill: var(--ink); stroke: #e8fbff; }
.gun-head { margin: 8px 0 6px; font-size: 16px; }
.gun-head small { font-weight: 600; font-size: 12px; opacity: 0.75; }
@media (max-width: 760px) { .air { top: calc(80px + var(--safe-t)); width: 100px; } }

/* ---------- arsenal: alt fire, gadget, ammo chip, shop details ---------- */
.alt-btn, .gadget-btn { position: absolute; bottom: calc(24px + var(--safe-b)); pointer-events: auto; border: 3px solid var(--ink); border-radius: 14px; background: rgba(246, 231, 200, 0.94); color: var(--ink); font: inherit; font-weight: 900; box-shadow: 0 3px 0 rgba(0,0,0,0.4); touch-action: manipulation; cursor: pointer; }
.alt-btn { left: calc(50% + 62px); height: 52px; padding: 0 12px; font-size: 13px; }
.alt-btn.spent { opacity: 0.45; }
.gadget-btn { left: calc(50% - 124px); width: 62px; height: 62px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; }
.gadget-btn span { font-size: 28px; position: relative; z-index: 1; }
.gadget-btn b { position: absolute; bottom: 2px; right: 6px; font-size: 12px; z-index: 2; }
.gadget-btn i { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(30, 30, 40, 0.55); z-index: 0; }
.gadget-btn.cooling span { opacity: 0.45; }
.ammo-type { position: absolute; bottom: calc(112px + var(--safe-b)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--gold); border-radius: 8px; padding: 1px 8px; font-size: 11px; font-weight: 900; letter-spacing: 0.1em; }
.card .mastery { font-size: 11px; font-weight: 800; color: #2f6f94; }
.card .modes-line { font-size: 10.5px; font-weight: 900; color: #b8660a; letter-spacing: 0.03em; }
.card.item { min-height: 0; }
@media (max-width: 760px) { .alt-btn { left: auto; right: calc(10px + var(--safe-r)); bottom: calc(130px + var(--safe-b)); } .gadget-btn { left: calc(10px + var(--safe-l)); bottom: calc(80px + var(--safe-b)); } .ammo-type { bottom: calc(96px + var(--safe-b)); } }
@media (max-height: 480px) and (orientation: landscape) { .alt-btn { left: auto; right: calc(94px + var(--safe-r)); bottom: calc(20px + var(--safe-b)); } .gadget-btn { left: auto; right: calc(94px + var(--safe-r)); bottom: calc(80px + var(--safe-b)); } }

/* ---------- loops: title row, daily, duels, book, draft, mutators ---------- */
.loop-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 560px; }
.loop-row .btn { min-width: 120px; padding: 9px 14px; font-size: 15px; position: relative; }
.badge { position: absolute; top: -8px; right: -8px; background: #c9502c; color: #fff; border-radius: 50%; min-width: 22px; height: 22px; display: grid; place-items: center; font-size: 12px; border: 2px solid var(--ink); }
.select-title { margin: 0 0 4px; font-size: 20px; }
.daily-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.daily-grid > div { background: #fff8e8; border: 3px solid #c9b38a; border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.daily-grid .mut { border-color: #c9502c; }
.daily-grid .k { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; color: #7a4a26; text-transform: uppercase; }
.daily-grid b { font-size: 17px; }
.daily-grid .sub, .date { font-size: 13px; margin: 0; }
.medals, .streak { font-size: 14px; text-align: center; margin: 6px 0; }
.duel-list { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 3px; font-size: 14px; }
.duel-list li { display: flex; justify-content: space-between; background: #fff8e8; border: 2px solid #e0d0a8; border-radius: 8px; padding: 3px 10px; }
.book-body { overflow-y: auto; max-height: 62vh; }
.cards.book { grid-template-columns: repeat(4, 1fr); }
.book-card { min-height: 0; gap: 2px; align-items: flex-start; }
.book-card.unseen { opacity: 0.55; }
.book-card .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink); }
.book-card .bar { width: 100%; height: 7px; border: 2px solid var(--ink); border-radius: 5px; background: rgba(0,0,0,0.12); overflow: hidden; }
.book-card .bar i { display: block; height: 100%; background: linear-gradient(#ffd66b, #f2a83a); }
.book-card .gold { color: #d98a1a; font-size: 12px; }
.btn.small { min-width: 0; padding: 4px 12px; font-size: 13px; margin-left: 8px; }
.wave-label { position: absolute; top: calc(66px + var(--safe-t)); left: 50%; transform: translateX(-50%); font-weight: 900; font-size: 13px; letter-spacing: 0.12em; color: var(--gold); text-shadow: 0 2px 0 var(--ink); }
.mutators { position: absolute; bottom: calc(52px + var(--safe-b)); left: calc(12px + var(--safe-l)); display: flex; flex-direction: column; gap: 3px; max-width: calc(50vw - 60px); }
.mutators i { font-style: normal; font-size: 11px; font-weight: 900; background: rgba(201, 80, 44, 0.9); color: #fff4e0; border: 2px solid var(--ink); border-radius: 8px; padding: 1px 7px; width: fit-content; }
#draft { z-index: 22; }
@media (max-width: 760px) { .cards.book { grid-template-columns: repeat(2, 1fr); } .daily-grid { grid-template-columns: 1fr; } .loop-row .btn { min-width: 100px; } .mutators { bottom: calc(88px + var(--safe-b)); } }

/* ---------- stage picker: chapters of tidy cards ---------- */
.map-wrap { background: #f2e2bd; }
.map-wrap.deep { background: linear-gradient(#bfe6f0, #8fc6d8); }
#stage-map.stage-list { display: block; max-height: 46vh; overflow-y: auto; padding: 8px 10px 10px; }
.chapter { margin-bottom: 10px; }
.chapter h3 { display: flex; align-items: center; gap: 8px; margin: 4px 0 2px; font-size: 16px; }
.ch-no { width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #f6e7c8; display: grid; place-items: center; font-size: 13px; }
.ch-stars { margin-left: auto; font-size: 13px; color: #b8660a; }
.ch-blurb { margin: 0 0 6px 32px; font-size: 12px; opacity: 0.75; }
.stage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stage-card { display: flex; align-items: center; gap: 8px; text-align: left; padding: 6px 8px; min-height: 52px; background: #fff8e8; border: 3px solid #c9b38a; border-radius: 12px; font-family: var(--font); color: var(--ink); cursor: pointer; }
.stage-card:hover { border-color: #8a6a3a; }
.stage-card.on { border-color: #c9502c; box-shadow: 0 0 0 2px #c9502c33; background: #fff1d0; }
.stage-card.locked { opacity: 0.5; cursor: not-allowed; }
.stage-card.clear .sc-badge { box-shadow: 0 0 0 2px #f2b83a; }
.sc-badge { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; font-weight: 900; font-size: 14px; }
.sc-text { display: flex; flex-direction: column; min-width: 0; }
.sc-name { font-weight: 900; font-size: 13px; line-height: 1.15; }
.sc-sub { font-size: 12px; color: #b8660a; font-weight: 800; }
@media (max-width: 760px) { .stage-grid { grid-template-columns: repeat(2, 1fr); } #stage-map.stage-list { max-height: 40vh; } }
@media (max-width: 420px) { .stage-grid { grid-template-columns: 1fr; } }

/* ---------- cosmetics, Style tab, Marketplace bar ---------- */
.market-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; background: #fff8e8; border: 3px solid #c9b38a; border-radius: 12px; padding: 6px 10px; margin-bottom: 6px; }
.market-bar b { color: #2f6f94; }
.market-msg { color: #b8400a; font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { font-family: var(--font); font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 999px; border: 2px solid #c9b38a; background: #fff8e8; color: var(--ink); cursor: pointer; }
.chip.on { background: #f2b83a; border-color: var(--ink); }
.cards.cosmetics { grid-template-columns: repeat(4, 1fr); }
.card.cos { min-height: 0; gap: 4px; align-items: flex-start; }
.card.cos .name { font-size: 13px; }
.card.cos .sw { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--ink); background: #ddd; display: grid; place-items: center; font-size: 18px; font-style: normal; }
.card.sol-only { opacity: 0.85; }
.card.sol-only .tag { color: #2f6f94; }
.title-badge { margin: 2px 0 6px; font-size: 14px; font-weight: 900; color: var(--gold); text-shadow: 0 2px 0 var(--ink); }
#crosshair .glyph { display: none; left: -16px; top: -20px; width: 32px; font-size: 30px; line-height: 32px; text-align: center; font-style: normal; color: #fff; text-shadow: 0 0 3px #000, 0 0 6px #000; }
#crosshair.glyphed .glyph { display: block; }
#crosshair.glyphed .ring, #crosshair.glyphed .tick { display: none; }
@media (max-width: 760px) { .cards.cosmetics { grid-template-columns: repeat(2, 1fr); } }

/* ---------- results: Next stage ---------- */
.btn.next { font-size: 20px; padding: 14px 22px; }
.btn.next.locked { opacity: 0.55; cursor: not-allowed; filter: grayscale(0.4); }

/* ---------- in-game purchase dialog ---------- */
.buy-modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(20, 10, 30, 0.55); padding: 16px; }
.buy-modal[hidden] { display: none; }
.buy-panel { max-width: 420px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.buy-panel img { width: 100%; height: auto; border-radius: 12px; border: 3px solid var(--ink); }
.buy-panel h3 { margin: 4px 0 0; font-size: 22px; }
.buy-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.buy-actions .btn { width: 100%; }
.buy-msg { min-height: 1.2em; font-size: 14px; font-weight: 800; margin: 2px 0; }
.buy-msg.ok { color: #2f8a3a; } .buy-msg.bad { color: #b8400a; }
