:root {
  --bg: #0b0b0b; --page-bg: #0b0b0b; --panel: #141414; --panel-2: #1a1a1a; --line: #262626;
  --ink: #fff; --muted: #8a8a8a; --faint: #5a5a5a; --heat: #ffb020; --danger: #d7263d; --hp: #5ee6a0;
  --font: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--font); padding: 0 16px; }
[hidden] { display: none !important; }
a { color: inherit; }
.wrap { max-width: 760px; margin: 0 auto; }
.eyebrow { font: 500 11.5px/1 var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.hero { padding: 36px 0 20px; display: flex; flex-direction: column; gap: 10px; }
.hero h1 { margin: 0; font-size: clamp(40px, 8vw, 64px); letter-spacing: .08em; font-weight: 700; line-height: 1; }
.lede { margin: 0; color: var(--muted); font-size: 17px; max-width: 48ch; }
.btn { appearance: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: 700 14px var(--font); letter-spacing: .03em; text-decoration: none; cursor: pointer; }
.btn.go { background: var(--ink); color: #000; border-color: var(--ink); }

/* the floor: one big touch target */
.stage { position: relative; border: 1px solid var(--line); border-radius: 18px; background: radial-gradient(ellipse at 50% 80%, #171717 0%, #0f0f0f 60%); overflow: hidden; padding: 16px 20px 18px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.stage.holding { border-color: #444; }
.hud { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.score { font: 500 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.score b { font: 700 22px var(--font); color: var(--ink); letter-spacing: .02em; margin-right: 6px; }
.lives { display: inline-flex; gap: 6px; }
.lives i { width: 12px; height: 12px; border-radius: 50%; background: var(--heat); box-shadow: 0 0 8px rgba(255,176,32,.6); transition: background .3s, box-shadow .3s; }
.lives i.gone { background: #2a2a2a; box-shadow: none; }
.streak { font: 700 14px var(--mono); letter-spacing: .1em; color: var(--heat); min-height: 1em; }
.streak.bump { animation: bump .3s ease; }
@keyframes bump { 50% { transform: scale(1.25); } }
.foe { margin-top: 10px; display: grid; gap: 6px; }
.foe b { color: var(--ink); font-weight: 500; }
.hp { height: 10px; background: #1e1e1e; border-radius: 5px; overflow: hidden; }
.hp i { display: block; height: 100%; width: 100%; background: var(--hp); border-radius: 5px; transition: width .35s ease; }
.sprite.them.wrecked { animation: wreck .7s ease forwards; }
@keyframes wreck { 0% { transform: none; opacity: 1; } 30% { transform: translateY(-14px) rotate(-8deg); } 100% { transform: translateY(30px) rotate(18deg); opacity: 0; } }
.sprite.them.enter { animation: enter .5s ease both; }
@keyframes enter { from { transform: translateX(60px); opacity: 0; } to { transform: none; opacity: 1; } }
.stage.shake { animation: stage-shake .3s ease; }
@keyframes stage-shake { 25% { transform: translate(-4px, 2px); } 50% { transform: translate(3px, -2px); } 75% { transform: translate(-2px, 1px); } }
.bar .clean { position: absolute; top: 0; bottom: 0; background: rgba(94,230,160,.22); border-left: 1px solid rgba(94,230,160,.5); pointer-events: none; transition: opacity .4s; }
.bar .clean.gone { opacity: 0; }
.bar .critz { position: absolute; top: 0; bottom: 0; background: rgba(255,255,255,.55); box-shadow: 0 0 8px rgba(255,255,255,.6); pointer-events: none; transition: opacity .4s; }
.bar .critz.gone { opacity: 0; }

/* critical hit: a white flash, the banner slams in, a beat of hit-stop in app.js */
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 4; }
.flash.go { animation: whiteout .4s ease-out; }
@keyframes whiteout { 0% { opacity: .55; } 100% { opacity: 0; } }
.critbanner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(.6) skewX(-8deg); font: 700 clamp(30px, 7vw, 54px)/1 var(--font); letter-spacing: .06em; color: #fff; white-space: nowrap; pointer-events: none; opacity: 0; z-index: 5; text-shadow: 0 0 18px rgba(255,176,32,.9), 0 0 42px rgba(215,38,61,.7), 0 4px 0 #d7263d; }
.critbanner.go { animation: crit 1.1s cubic-bezier(.2,.9,.3,1.2) forwards; }
@keyframes crit { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.9) skewX(-8deg); } 14% { opacity: 1; transform: translate(-50%, -50%) scale(.95) skewX(-8deg); } 22% { transform: translate(-50%, -50%) scale(1.04) skewX(-8deg); } 75% { opacity: 1; transform: translate(-50%, -50%) scale(1) skewX(-8deg); } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1) skewX(-8deg); } }
.floor { position: relative; display: flex; justify-content: space-between; align-items: flex-end; height: 210px; margin-top: 8px; }
.arena3d { position: absolute; inset: 0; pointer-events: none; }
.arena3d canvas { width: 100%; height: 100%; display: block; }
.floor.three .sprite { display: none; }
.sprite { width: min(230px, 42%); transition: transform .14s ease; }
.sprite .bot-svg { width: 100%; height: auto; display: block; }
.bot-svg.flip { transform: scaleX(-1); }
.sprite.you.lunge { transform: translateX(26px); }
.sprite.them.hit { animation: shake .35s ease; }
.sprite.you.stall { animation: flicker .5s steps(2) 2; }
.sprite.you .reactor-core { filter: drop-shadow(0 0 calc(var(--glow, 0) * 10px) #ffb020); }
.pop { position: absolute; left: 50%; top: 0; transform: translateX(-50%); font: 700 26px var(--font); pointer-events: none; opacity: 0; white-space: nowrap; z-index: 3; text-shadow: 0 2px 12px rgba(0,0,0,.8); }
.pop.show { animation: rise .9s ease forwards; }
.pop.dmg { color: var(--ink); } .pop.big { color: var(--hp); font-size: 34px; } .pop.stall { color: var(--danger); } .pop.tap { color: var(--muted); font-size: 18px; } .pop.wreck { color: var(--heat); font-size: 38px; } .pop.crit { color: #fff; font-size: 40px; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-8px) rotate(-2deg); } 50% { transform: translateX(6px) rotate(1deg); } 80% { transform: translateX(-3px); } }
@keyframes flicker { 0% { opacity: 1; } 50% { opacity: .25; } 100% { opacity: 1; } }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, 10px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -34px); } }

/* the heat bar: fill, the cap line, the red past it */
.heat { margin-top: 10px; }
.bar { position: relative; height: 18px; background: #1e1e1e; border-radius: 9px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--heat); border-radius: 9px; }
.bar.over i { background: var(--danger); }
.bar .cap { position: absolute; top: -2px; bottom: -2px; width: 3px; background: var(--ink); left: 70%; transition: opacity .25s; }
.bar .cap.gone { opacity: 0; transition: opacity .6s; }
.bar .red { position: absolute; top: 0; bottom: 0; right: 0; left: 70%; background: repeating-linear-gradient(135deg, rgba(215,38,61,.18) 0 6px, transparent 6px 12px); pointer-events: none; }
.legend { display: flex; justify-content: space-between; gap: 14px; margin-top: 6px; font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.start { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(11,11,11,.6); z-index: 6; padding: 16px; }
.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 200px)); gap: 12px; }
.mode { appearance: none; display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 16px 18px; border-radius: 14px; border: 1px solid #444; background: rgba(20,20,20,.92); color: var(--ink); font: inherit; cursor: pointer; transition: border-color .2s, transform .2s; }
.mode b { font-size: 18px; letter-spacing: .02em; }
.mode span { color: var(--muted); font: 500 11px var(--mono); letter-spacing: .06em; }
.mode:hover { border-color: var(--heat); transform: translateY(-2px); }
.mode:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.below { display: flex; justify-content: flex-end; padding: 8px 2px 0; }
.how { padding: 40px 0 10px; }
.how h2 { margin: 0; }
.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 12px; }
.cols h3 { margin: 0 0 6px; font-size: 16px; }
.cols p { margin: 0; color: var(--muted); font-size: 14.5px; }
.link { appearance: none; background: none; border: 0; color: var(--muted); font: 500 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; cursor: pointer; padding: 4px 0; }
.link:hover { color: var(--ink); }
/* defend: the bar is their wind-up, so it reads as a threat */
.stage.defend .bar i { background: #ff7a59; }
.sprite.you.hit { animation: shake .35s ease; }
.sprite.them.lunge { transform: translateX(-26px); }
.sprite.you.brace .bot-svg { filter: drop-shadow(0 0 10px rgba(159,216,255,.7)); }

.result { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.72); display: grid; place-items: center; padding: 16px; }
.rcard { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px; max-width: 420px; width: 100%; display: flex; flex-direction: column; gap: 10px; }
.rcard h2 { margin: 0; font-size: 64px; letter-spacing: .04em; line-height: 1; }
.rcard p { margin: 0 0 8px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 0 36px; color: var(--faint); font: 500 12px/1.7 var(--mono); letter-spacing: .06em; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
@media (max-width: 820px) { .cols { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .floor { height: 170px; } .rcard h2 { font-size: 52px; } }
@media (prefers-reduced-motion: reduce) { .sprite, .bar .cap, .hp i { transition: none; } .sprite.them.hit, .sprite.you.stall, .pop.show, .stage.shake, .streak.bump, .sprite.them.enter, .critbanner.go { animation: none; } .critbanner.go { opacity: 1; transform: translate(-50%, -50%) skewX(-8deg); } .flash.go { animation: none; } .pop.show { opacity: 1; } .sprite.them.wrecked { animation: none; opacity: 0; } }

.legend span:first-child { white-space: nowrap; }
.legend #hint { text-align: right; }
