:root {
  --bg: #0b0f2a; --bg2: #141a45; --win: #17206b; --win2: #0e1550; --line: #e8ecff; --text: #f3f5ff;
  --muted: #a9b2e6; --blue: #5b8cff; --red: #ff5c7a; --green: #5be39b; --gold: #ffd24a;
  --fire: #ff7a45; --leaf: #5bd46a; --water: #4aa8ff; --volt: #ffe14a; --void: #b07aff;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: radial-gradient(ellipse at top, var(--bg2), var(--bg) 70%) fixed; background-color: var(--bg); color: var(--text); }
body { font-family: 'VT323', ui-monospace, monospace; font-size: 21px; line-height: 1.2; min-height: 100vh; -webkit-text-size-adjust: 100%; }
body.flash { animation: flash .3s; }
@keyframes flash { 0% { background-color: #fff; } 100% { background-color: var(--bg); } }
.app { max-width: 520px; margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
h1, h2, button, .bar b { font-family: 'Press Start 2P', ui-monospace, monospace; letter-spacing: .5px; }
h1 { font-size: 22px; margin: 8px 0; color: var(--gold); text-shadow: 3px 3px 0 #7a2b00; }
h2 { font-size: 12px; margin: 0 0 10px; line-height: 1.5; color: var(--gold); }
a { color: var(--gold); }
.top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 24px; font-size: 17px; }
.chain { color: var(--muted); }
.chain.live { color: var(--green); }
.chain.sim { color: var(--gold); }
.ticker { color: var(--blue); opacity: 0; white-space: nowrap; }
.ticker.pulse { animation: pulse 2.4s ease-out; }
@keyframes pulse { 0% { opacity: 1; transform: translateY(-4px); } 70% { opacity: 1; } 100% { opacity: 0; } }

.win { background: linear-gradient(180deg, var(--win), var(--win2)); border: 3px solid var(--line); border-radius: 8px;
  box-shadow: 0 0 0 3px #050826, inset 0 0 0 2px #3b47a8; padding: 12px 14px; margin: 12px 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

button { cursor: pointer; border: 3px solid var(--line); border-radius: 8px; color: var(--text); font-size: 11px; line-height: 1.4;
  padding: 14px 10px; background: var(--win2); box-shadow: 0 4px 0 #050826; transition: transform .06s; touch-action: manipulation; }
button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #050826; }
button:disabled { opacity: .4; cursor: not-allowed; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.primary { background: linear-gradient(180deg, #ff9a3c, #e0531f); border-color: #ffe0b0; font-size: 13px; }
.secondary { background: linear-gradient(180deg, #3b5bff, #2235b8); }
.ghost { background: transparent; box-shadow: none; border-color: #3b47a8; color: var(--muted); }
.small { padding: 8px 10px; font-size: 9px; }

.logo-wrap { text-align: center; margin-top: 8px; }
.tagline { color: var(--muted); margin: 0; }
.how { margin: 0; padding-left: 22px; }
.how li { margin-bottom: 8px; }
.chart { margin: 6px 0 0; color: var(--gold); text-align: center; }

.sprite { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.sprite.big { width: 132px; height: 132px; }
#logo-a { margin: 0 auto; width: 96px; height: 96px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }

.bar { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.bar b { font-size: 12px; color: var(--gold); }
.blockcard { font-size: 18px; padding: 8px 12px; }
.mono { color: var(--blue); word-break: break-all; }
.tag { display: inline-block; margin: 4px 6px 0 0; padding: 1px 6px; border-radius: 4px; font-size: 17px; }
.tag.gold { background: #4d3b00; color: var(--gold); }
.tag.red { background: #4d0f1d; color: var(--red); }
.tag.green { background: #0f3d26; color: var(--green); }

.arena { position: relative; }
.side { position: relative; display: flex; align-items: center; gap: 10px; }
.side .info { flex: 1; min-width: 0; margin: 6px 0; padding: 8px 10px; }
.side.enemy .sprite { animation: bob 1.8s ease-in-out infinite; }
.sprite.dead { animation: die .7s forwards !important; }
@keyframes die { to { opacity: 0; transform: scale(.2) rotate(20deg); } }
.shake { animation: shake .3s !important; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.nm { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.nm b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.el { font-size: 16px; padding: 0 6px; border-radius: 4px; color: #111; white-space: nowrap; }
.el-fire { background: var(--fire); } .el-leaf { background: var(--leaf); } .el-water { background: var(--water); }
.el-volt { background: var(--volt); } .el-void { background: var(--void); }
.hp { height: 10px; background: #050826; border: 2px solid var(--line); border-radius: 3px; margin: 4px 0; overflow: hidden; }
.hp i { display: block; height: 100%; background: var(--green); transition: width .35s; }
.hp i.low { background: var(--red); }
#e-hpbar { background: var(--red); }
.sub { display: flex; justify-content: space-between; color: var(--muted); font-size: 18px; }
.pips { display: flex; align-items: center; gap: 4px; font-size: 16px; color: var(--muted); }
.pips span { margin-right: 4px; }
.pip { width: 12px; height: 12px; border: 2px solid var(--muted); border-radius: 2px; display: inline-block; }
.pip.blue.on { background: var(--blue); border-color: #cfe0ff; box-shadow: 0 0 6px var(--blue); }
.pip.red.on { background: var(--red); border-color: #ffd0d9; box-shadow: 0 0 6px var(--red); }

.float { position: absolute; right: 40px; top: 10px; font-family: 'Press Start 2P', monospace; font-size: 14px; color: var(--gold);
  text-shadow: 2px 2px 0 #000; pointer-events: none; animation: rise 1s ease-out forwards; }
.hero .float { left: 30px; right: auto; }
.float.red { color: var(--red); } .float.green { color: var(--green); } .float.blue { color: var(--blue); }
@keyframes rise { to { transform: translateY(-36px); opacity: 0; } }

.cmds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.cmd { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; min-height: 58px; }
.cmd b { font-weight: normal; font-size: 9.5px; }
.cmd small { font-family: 'VT323', monospace; font-size: 16px; color: var(--muted); }
.cmd-51:not(:disabled) { background: linear-gradient(180deg, #ff3c7a, #8a1250); border-color: #ffc0d8; }
.cmd-strike:not(:disabled) { background: linear-gradient(180deg, #3b5bff, #2235b8); }
.log { min-height: 112px; font-size: 19px; padding: 8px 12px; }
.log div { opacity: .55; } .log div:first-child { opacity: 1; }
.log .sys { color: var(--blue); } .log .warn { color: var(--red); } .log .big { color: var(--gold); }

.perk { font-size: 11px; background: linear-gradient(180deg, #2a8a5a, #135c38); }
.big-text { font-size: 28px; color: var(--gold); margin: 8px 0; }
.pick { font-size: 48px; animation: bob 0.6s ease-in-out infinite; }
.loader { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.loader i { width: 12px; height: 12px; background: var(--blue); animation: blink 1s infinite; }
.loader i:nth-child(2) { animation-delay: .2s; } .loader i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }
[hidden] { display: none !important; }

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