:root {
  --bg: #0b1220;
  --panel: #111a2b;
  --panel2: #16223a;
  --line: #24324d;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --blue: #3b82f6;
  --blue-l: #7fb2ff;
  --red: #ef4444;
  --red-l: #ff8a8a;
  --accent: #fbbf24;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .4; cursor: default; }
.portrait { image-rendering: crisp-edges; image-rendering: pixelated; display: block; object-fit: cover; }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }

.primary { background: var(--accent); color: #111; font-weight: 700; border-radius: 10px; padding: 10px 16px; min-height: 44px; }
.ghost { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; }

.side-blue { --team: var(--blue); --team-l: var(--blue-l); }
.side-red { --team: var(--red); --team-l: var(--red-l); }

/* Draft */
.draft-scroll { flex: 1; overflow-y: auto; padding: 16px max(16px, env(safe-area-inset-left)) 24px; max-width: 1100px; width: 100%; margin: 0 auto; }
.draft-head h1 { margin: 0; font-size: 28px; letter-spacing: .12em; }
.draft-head h1 span { color: var(--team); }
.draft-head .sub { margin: 2px 0 14px; color: var(--muted); }
.draft-top { display: flex; gap: 12px; align-items: stretch; }
.cmdr-card { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 2px solid var(--team); border-radius: 14px; padding: 8px 12px 8px 8px; }
.cmdr-card img { width: 72px; height: 72px; border-radius: 10px; }
.cmdr-card small, .budget small, .side-pick small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.cmdr-card b { font-size: 18px; }
.budget { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.budget-row { display: flex; justify-content: space-between; align-items: baseline; }
.budget-row b { font-size: 20px; font-variant-numeric: tabular-nums; }
.meter { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
#budget-bar { height: 100%; background: var(--team); transition: width .2s; }
.side-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.side-pick button { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--panel); border: 2px solid var(--line); text-align: left; opacity: .65; }
.side-pick button img { width: 44px; height: 44px; border-radius: 8px; }
.side-pick button[data-side="blue"].on { border-color: var(--blue); opacity: 1; box-shadow: 0 0 0 3px rgba(59,130,246,.25); }
.side-pick button[data-side="red"].on { border-color: var(--red); opacity: 1; box-shadow: 0 0 0 3px rgba(239,68,68,.25); }
.vs { color: var(--muted); font-size: 13px; margin: 8px 2px 12px; }
#roster { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.card.picked { border-color: var(--team); }
.card h3 { margin: 0; font-size: 15px; }
.card p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.card-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.cost { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cost::after { content: " pts"; font-size: 11px; font-weight: 400; color: var(--muted); }
.icon { width: 48px; height: 48px; background: var(--bg); border: 2px solid var(--team); border-radius: 50%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.icon img { width: auto; height: auto; max-width: 40px; max-height: 40px; }
.px { image-rendering: pixelated; image-rendering: crisp-edges; }
.map-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 4px; }
.map-pick button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 9px 10px; border-radius: 12px; background: var(--panel); border: 2px solid var(--line); min-width: 0; }
.map-pick button b { font-size: 14px; }
.map-pick button small { color: var(--muted); font-size: 11px; }
.map-pick button.on { border-color: var(--accent); background: var(--panel2); }
#draft.online #draft-maps button:not(.on) { display: none; }
#draft.online #draft-maps { grid-template-columns: 1fr; }
#loader { align-items: center; justify-content: center; }
.loader-meter { margin: 18px 0 8px; }
#loader-bar { width: 0; transition: width .15s; }
.stats { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.stats span { background: var(--bg); border-radius: 6px; padding: 1px 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.stats i { font-style: normal; color: var(--muted); margin-right: 4px; font-size: 10.5px; }
.stepper { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stepper button { width: 44px; height: 38px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); font-size: 22px; line-height: 1; }
.stepper output { font-weight: 700; font-size: 17px; }
.draft-actions { display: grid; grid-template-columns: repeat(3, auto) 1fr; gap: 8px; padding: 10px max(12px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); }
@media (max-width: 480px) {
  .draft-actions { grid-template-columns: 1fr 1fr 1fr; }
  .draft-actions .primary { grid-column: 1 / -1; }
  .cmdr-card img { width: 60px; height: 60px; }
  .cmdr-card b { font-size: 16px; }
  #roster { grid-template-columns: 1fr; }
}

/* Battle */
#battle { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "top" "map" "info"; }
#hud-top { grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px max(10px, env(safe-area-inset-left)); padding-top: max(8px, env(safe-area-inset-top)); background: var(--panel); border-bottom: 1px solid var(--line); }
.cmdr { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 12px; border: 2px solid transparent; opacity: .55; filter: grayscale(.6); transition: all .25s; min-width: 0; }
.cmdr[data-side="red"] { flex-direction: row-reverse; text-align: right; padding: 4px 4px 4px 10px; }
.cmdr img { width: 52px; height: 52px; border-radius: 9px; border: 2px solid var(--team); }
.cmdr b { display: block; font-size: 14px; white-space: nowrap; }
.cmdr small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.cmdr.active { opacity: 1; filter: none; border-color: var(--team); background: var(--panel2); box-shadow: 0 0 14px -2px var(--team); }
.turn-box { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#turn-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
#end-turn.pulse { animation: glow 1.1s ease-in-out infinite; }
#map-wrap { grid-area: map; position: relative; min-height: 0; overflow: hidden; background: radial-gradient(circle at 50% 40%, #142036, var(--bg)); }
#map-stage { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
#terrain { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; pointer-events: none; }
#btn-fit { position: absolute; right: 10px; bottom: 10px; width: 44px; height: 44px; padding: 0; font-size: 22px; border-radius: 12px; background: rgba(11,18,32,.82); }
#btn-fit.on { color: var(--accent); border-color: var(--accent); }
#hud-info { grid-area: info; display: flex; align-items: center; gap: 10px; min-height: 88px; padding: 8px max(12px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); }
#hud-info .icon { flex: none; width: 52px; height: 52px; }
.info-main { flex: 1; min-width: 0; }
.info-title { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tag { font-size: 11px; color: var(--team-l); border: 1px solid var(--team); border-radius: 6px; padding: 0 5px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
#hold { flex: none; }
@media (max-width: 420px) {
  .cmdr img { width: 44px; height: 44px; }
  .cmdr b { font-size: 12.5px; }
  .cmdr small { font-size: 10.5px; }
  .cmdr { padding-right: 4px; gap: 6px; }
  .cmdr[data-side="red"] { padding-left: 4px; }
  #end-turn { padding: 8px 10px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  #battle { grid-template-columns: minmax(0, 1fr) 260px; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "map top" "map info"; }
  #hud-top { flex-wrap: wrap; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); padding-top: 8px; }
  .turn-box { order: 3; width: 100%; flex-direction: row; justify-content: space-between; }
  #hud-info { flex-direction: column; align-items: stretch; border-left: 1px solid var(--line); border-top: 0; overflow-y: auto; }
  .cmdr img { width: 40px; height: 40px; }
}

#banner { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(.9); padding: 10px 22px; border-radius: 12px; background: rgba(11,18,32,.88); border: 2px solid var(--team, #fff); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: 0; pointer-events: none; transition: all .25s; white-space: nowrap; }
#banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#banner small { display: block; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--accent); margin-top: 2px; }
.cmdr .pts { color: var(--accent); font-variant-numeric: tabular-nums; display: inline-block; margin-left: .4em; }
#btn-mute { position: absolute; right: 10px; top: 10px; width: 44px; height: 44px; padding: 0; font-size: 19px; border-radius: 12px; background: rgba(11,18,32,.82); }
.menu-note { color: var(--accent); font-size: 13px; margin: 8px 0 0; min-height: 0; }
.menu-note:empty { display: none; }
.menu-mute { margin-top: 10px; width: 44px; padding: 0; }
#btn-reinforce { position: absolute; left: 10px; bottom: 10px; min-height: 44px; padding: 8px 12px; border-radius: 12px; background: rgba(11,18,32,.86); font-weight: 700; color: var(--accent); border-color: rgba(251,191,36,.5); }
#buy-panel { position: absolute; left: 8px; right: 8px; bottom: 8px; max-height: calc(100% - 16px); overflow-y: auto; background: rgba(17,26,43,.97); border: 1px solid var(--line); border-radius: 14px; padding: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); max-width: 460px; margin: 0 auto; }
#buy-panel header { display: flex; align-items: center; gap: 10px; }
#buy-panel header b { font-size: 16px; }
#buy-meta { flex: 1; color: var(--accent); font-size: 13px; font-variant-numeric: tabular-nums; }
#buy-close { min-height: 36px; padding: 4px 12px; }
#buy-note { color: var(--muted); font-size: 12px; margin: 6px 0 8px; }
#buy-list { display: grid; gap: 6px; }
.buy-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; text-align: left; padding: 6px 10px 6px 6px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); min-height: 52px; }
.buy-row .icon { width: 40px; height: 40px; }
.buy-row .icon img { max-width: 34px; max-height: 34px; }
.buy-row b { display: block; font-size: 13.5px; }
.buy-row small { color: var(--muted); font-size: 11px; }
.buy-row:not(:disabled):active { border-color: var(--accent); }
.diff-pick { display: flex; align-items: center; gap: 6px; margin: 8px 0 2px; flex-wrap: wrap; }
.diff-pick .label { margin-right: 4px; }
.diff-pick button { flex: 1; min-width: 70px; padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 2px solid var(--line); font-weight: 700; font-size: 13px; }
.diff-pick button.on { border-color: var(--accent); background: var(--panel2); color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .unit.flier .bob, .unit.selected .base { animation: none; }
  .rotor .spin { animation-duration: .6s; }
}

/* Map */
#map * { pointer-events: none; }
.city-label { font: 700 7.5px system-ui, sans-serif; fill: #f8fafc; stroke: #0b1220; stroke-width: 2.4; paint-order: stroke; text-anchor: middle; letter-spacing: .02em; }
.hq-ring { fill: none; stroke: var(--team); stroke-width: 3; stroke-dasharray: 6 4; }
.hq-star { fill: var(--team); opacity: .9; }
.hq-label { font: 700 8px system-ui, sans-serif; fill: var(--team-l); text-anchor: middle; letter-spacing: .1em; }

.reach { fill: rgba(147,197,253,.22); stroke: rgba(191,219,254,.75); stroke-width: 1.5; }
.sel { fill: none; stroke: var(--accent); stroke-width: 3; }
.inspect { fill: none; stroke: #cbd5e1; stroke-width: 2; stroke-dasharray: 4 3; }
.target { fill: rgba(248,113,113,.12); stroke: #f87171; stroke-width: 3; animation: pulse 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.cross { stroke: #f87171; stroke-width: 2.5; stroke-linecap: round; }

.unit { transition: opacity .45s; }
.unit .face { transition: transform .14s ease-out; }
.unit .shadow { fill: #000; opacity: .28; }
.unit.flier .bob { animation: bob 1.4s ease-in-out infinite; }
.unit .flash { fill: #fff; opacity: 0; }
.rotor .disc { fill: rgba(20,24,28,.16); stroke: rgba(226,232,240,.28); stroke-width: 1; }
.rotor .spin { animation: spin .15s steps(3) infinite; }
.rotor .spin rect { fill: rgba(15,18,22,.5); }
.unit.selected .base { animation: selpulse 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.unit .base { fill: var(--team); fill-opacity: .55; stroke: var(--team-l); stroke-width: 2; }
.unit image { image-rendering: pixelated; image-rendering: crisp-edges; }
.unit.spent { opacity: .5; }
.unit.selected .base { stroke: var(--accent); stroke-width: 3.5; }
.unit.dead { opacity: 0; }
.unit .body.hit { animation: shake .35s; }
.hp-bg { fill: #0b1220; }
.hp-badge { fill: #0b1220; stroke: var(--team); stroke-width: 1.2; }
.hp-num { font: 700 10px system-ui, sans-serif; fill: #fff; text-anchor: middle; }

.tracer { stroke: #fde68a; stroke-width: 2.4; stroke-linecap: square; fill: none; }
.tracer.heavy { stroke: #fbbf24; stroke-width: 3.4; }
.tracer.shellround { stroke: #fff7ed; stroke-width: 4.5; }
.artyround { fill: #fdba74; stroke: #7c2d12; stroke-width: 1; }
.trail, .trail circle { fill: #cbd5e1; }
.dust rect { fill: #b8a98c; }
.mflash rect { fill: #fde68a; shape-rendering: crispEdges; }
.mflash .core { fill: #fff; }
.boom rect { fill: #f97316; shape-rendering: crispEdges; }
.boom .hot { fill: #fde047; }
.boom .white { fill: #fff; }
.spawn { fill: rgba(74,222,128,.2); stroke: #4ade80; stroke-width: 2; stroke-dasharray: 5 4; }
.flag .pole { fill: #e5e7eb; }
.flag .pole-cap { fill: var(--accent); }
.flag .cloth { fill: var(--team); stroke: #0b1220; stroke-width: .8; }
.flag.neutral .cloth { fill: #cbd5e1; }
.flag .cloth-mark { fill: rgba(255,255,255,.75); }
.flag.neutral .cloth-mark { fill: #64748b; }
.flag rect, .flag path { shape-rendering: crispEdges; }
.shell { stroke: #fdba74; stroke-width: 2.5; fill: none; stroke-dasharray: 4 5; animation: fade .6s forwards; }
.burst rect { fill: #fb923c; shape-rendering: crispEdges; }
.burst .core { fill: #fef3c7; }
.burst { animation: fade .45s steps(4) forwards; }
#fx, #stage-fx { shape-rendering: crispEdges; }
.dmg { font: 800 16px system-ui, sans-serif; fill: #fff; stroke: #7f1d1d; stroke-width: 3; paint-order: stroke; text-anchor: middle; animation: rise .9s forwards; }

/* End */
#end { background: rgba(5,9,18,.82); align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(3px); }
.end-card { background: var(--panel); border: 2px solid var(--team); border-radius: 18px; padding: 20px; width: min(420px, 100%); text-align: center; max-height: 100%; overflow-y: auto; }
#end-title { margin: 0 0 12px; font-size: 34px; letter-spacing: .14em; text-transform: uppercase; }
#end.win #end-title { color: var(--accent); }
#end.lose #end-title { color: var(--red-l); }
.end-portraits { display: flex; justify-content: center; align-items: flex-end; gap: 14px; }
.end-portraits figure { margin: 0; }
.end-portraits figcaption { font-size: 13px; color: var(--muted); margin-top: 4px; }
.winner img { width: 160px; height: 160px; border-radius: 14px; border: 3px solid var(--accent); }
.loser img { width: 72px; height: 72px; border-radius: 10px; filter: grayscale(1) brightness(.6); border: 2px solid var(--line); }
#end-reason { margin: 14px 0 8px; }
#end-stats { display: flex; justify-content: center; gap: 14px; color: var(--muted); font-size: 13px; margin-bottom: 16px; flex-wrap: wrap; }
#end-stats b { color: var(--text); }
@media (max-height: 520px) { .winner img { width: 110px; height: 110px; } }

@keyframes pulse { 50% { transform: scale(.88); opacity: .7; } }
@keyframes bob { 50% { transform: translateY(-1.5px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes selpulse { 50% { transform: scale(1.1); stroke-opacity: .55; } }
@keyframes glow { 50% { box-shadow: 0 0 0 5px rgba(251,191,36,.35); } }
@keyframes shake { 20% { transform: translate(-3px, 1px); } 40% { transform: translate(3px, -1px); } 60% { transform: translate(-2px, 0); } 80% { transform: translate(2px, 1px); } }
@keyframes fade { from { opacity: 1; } to { opacity: 0; } }
@keyframes rise { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-26px); opacity: 0; } }

/* Settings toggle */
.scenes-toggle { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); margin: 0 2px 12px; cursor: pointer; min-height: 36px; }
.scenes-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 42px; height: 24px; border-radius: 12px; background: var(--line); position: relative; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #cbd5e1; transition: transform .2s; }
.scenes-toggle input:checked + .switch { background: var(--accent); }
.scenes-toggle input:checked + .switch::after { transform: translateX(18px); background: #111; }

/* Battle scene */
#scene { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(3,6,12,.92); }
#scene-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.scene-card { width: min(760px, 100%); height: 100%; max-height: 100%; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
@media (min-width: 700px) and (min-height: 640px) {
  .scene-card { height: auto; border: 1px solid var(--line); border-radius: 16px; }
  .stage-wrap { flex: none; aspect-ratio: 4 / 3; max-height: 60vh; }
}
.scene-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; padding: 10px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--panel); }
.vs-mark { font-weight: 900; color: var(--accent); letter-spacing: .1em; font-size: 15px; }
.fighter { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; }
.fighter.def { flex-direction: row-reverse; text-align: right; }
.fighter img { width: 48px; height: 48px; border-radius: 9px; border: 2px solid var(--team); flex: none; }
.ft-text { min-width: 0; flex: 1; }
.ft-text small { display: block; font-size: 10.5px; color: var(--team-l); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ft-text b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hpbar { height: 7px; background: #020617; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.hpbar i { display: block; height: 100%; width: 100%; transition: width .45s ease-out, background .45s; }
.fighter.def .hpbar i { margin-left: auto; }
.hpnum { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pick-badge { position: absolute; bottom: -22px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; background: var(--team); color: #fff; border-radius: 6px; padding: 1px 7px; z-index: 2; }
.pick-badge:empty { display: none; }
.fighter.att .pick-badge { left: 56px; }
.fighter.def .pick-badge { right: 56px; }
.stage-wrap { position: relative; flex: 1 1 auto; min-height: 180px; overflow: hidden; background: #0f1b2e; }
#stage { width: 100%; height: 100%; display: block; }
#scene-headline { position: absolute; top: 28px; left: 0; right: 0; text-align: center; font-weight: 900; font-size: 20px; letter-spacing: .06em; text-transform: uppercase; color: #fff; text-shadow: 0 2px 6px #000; pointer-events: none; }
#scene-skip { position: absolute; right: 10px; bottom: 10px; background: rgba(11,18,32,.75); }
#tactics { padding: 12px; background: var(--panel); flex: none; }
#tactics h3 { margin: 0 0 8px; font-size: 15px; }
.tactic-note { margin: -4px 0 8px; font-size: 12.5px; color: var(--muted); }
.tactic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.tactic { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; min-height: 64px; padding: 10px 12px; border-radius: 12px; background: var(--panel2); border: 2px solid var(--line); }
.tactic:active { border-color: var(--accent); }
.tactic b { font-size: 16px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.tactic small { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.locked { margin: 4px 0; text-align: center; font-size: 15px; }
.scene-foot { padding: 4px 12px max(6px, env(safe-area-inset-bottom)); background: var(--panel); flex: none; }
.scene-foot .scenes-toggle { margin: 0; }
@media (orientation: landscape) and (max-height: 560px) {
  .scene-card { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: auto 1fr auto; }
  .scene-top { grid-column: 1 / -1; padding: 6px 10px; }
  .stage-wrap { grid-row: 2 / 4; max-height: none; aspect-ratio: auto; }
  #tactics { overflow-y: auto; }
  .tactic-grid { grid-template-columns: 1fr; }
  .tactic { min-height: 52px; padding: 6px 10px; }
}

#scene.compact { align-items: flex-end; background: rgba(3,6,12,.45); }
#scene.compact .scene-card { height: auto; border-radius: 16px 16px 0 0; border: 1px solid var(--line); }
#scene.compact .stage-wrap { display: none; }
#scene.compact .scene-card { display: flex; }
#scene.compact .pick-badge { position: static; margin: 0 4px; }

.rig.hover { animation: hover 1.6s ease-in-out infinite; }
.st-tracer { stroke: #fde68a; stroke-width: 2.2; stroke-linecap: round; }
.st-tracer.heavy { stroke: #fbbf24; stroke-width: 3.2; }
.st-blur { fill: rgba(203,213,225,.22); }
.st-blade { fill: rgba(17,24,39,.75); animation: blade .09s linear infinite alternate; transform-box: fill-box; transform-origin: center; }
.st-tail { animation: spin .12s steps(3) infinite; }
.st-tail rect { fill: rgba(17,24,39,.7); }
.st-track { stroke: rgba(15,15,15,.55); stroke-width: 2; stroke-dasharray: 3 3; }
.berm rect { fill: #a08455; stroke: #4a3820; stroke-width: 1; shape-rendering: crispEdges; }
@keyframes blade { to { transform: scaleX(.12); } }
.st-shell { stroke: #fff7ed; stroke-width: 4; stroke-linecap: round; }
.st-trail { fill: none; stroke: #cbd5e1; stroke-width: 3; stroke-linecap: round; opacity: .9; }
.st-arc { fill: none; stroke: #fdba74; stroke-width: 1.6; stroke-dasharray: 3 4; opacity: .9; }
.st-sparks line { stroke: #fde68a; stroke-width: 2.2; stroke-linecap: round; }
.st-dmg { font: 900 26px system-ui, sans-serif; fill: #fff; stroke: #7f1d1d; stroke-width: 4; paint-order: stroke; text-anchor: middle; }
.st-dmg.evaded { fill: #a5f3fc; stroke: #164e63; font-size: 18px; }
@keyframes hover { 50% { transform: translateY(-5px); } }

/* Menu & lobby */
#menu, #lobby { align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.menu-card { width: min(440px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: center; margin: auto; }
.menu-card h2 { margin: 0; font-size: 24px; letter-spacing: .08em; }
.logo { margin: 0; font-size: 40px; letter-spacing: .14em; }
.logo span { color: var(--red); }
.menu-card .sub { color: var(--muted); margin: 0; }
.menu-portraits { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 8px 0; }
.menu-portraits figure { margin: 0; }
.menu-portraits img { width: 120px; height: 120px; border-radius: 14px; border: 3px solid var(--team); }
.menu-portraits figcaption { margin-top: 4px; font-weight: 700; color: var(--team-l); }
.wide { width: 100%; min-height: 52px; font-size: 17px; }
.back { align-self: flex-start; min-height: 36px; padding: 6px 12px; font-size: 14px; }
.draft-head .back { margin-bottom: 8px; }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; min-width: 0; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 0 12px; font: inherit; letter-spacing: .08em; }
#join-code { text-transform: uppercase; }
.room-code { font: 800 44px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .25em; color: var(--accent); }
.label { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.lobby-portrait { width: 96px; height: 96px; border-radius: 12px; margin: 0 auto; border: 3px solid var(--line); }
#lobby-wait { display: flex; flex-direction: column; gap: 10px; }
.waiting-dots::after { content: ""; animation: dots 1.4s steps(4) infinite; }
.error { color: var(--red-l); min-height: 1.2em; margin: 0; }
#lobby .side-pick { margin: 4px 0 6px; }
#draft.online .side-pick { display: none; }
#toast { position: fixed; left: 50%; bottom: max(96px, calc(env(safe-area-inset-bottom) + 96px)); transform: translateX(-50%) translateY(20px); background: #1e293b; border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.tactic-timer { float: right; font-variant-numeric: tabular-nums; color: var(--accent); }
.tactic-timer.urgent { color: var(--red-l); }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* Music controls and battle round banner */
[hidden] { display: none !important; }
.music-row { display: flex; align-items: center; gap: 8px; }
.music-toggle { width: 44px; padding: 0; font-size: 19px; flex: none; position: relative; }
.music-toggle.off { opacity: .6; }
.music-toggle.off::after { content: ""; position: absolute; left: 9px; right: 9px; top: 50%; height: 3px; background: var(--red-l); transform: rotate(-35deg); border-radius: 2px; }
.music-volume { accent-color: var(--accent); width: 130px; min-width: 80px; flex: 1 1 130px; height: 32px; touch-action: manipulation; }
.menu-audio { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; }
.menu-audio .menu-mute { margin-top: 0; }
.menu-audio .music-volume { flex: 0 1 150px; }
#btn-music { position: absolute; right: 62px; top: 10px; height: 44px; border-radius: 12px; background: rgba(11,18,32,.82); }
#draft .music-row { margin: 0 2px 12px; }
.scene-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.scene-foot .music-toggle { height: 36px; min-height: 36px; width: 38px; font-size: 16px; }
.scene-foot .music-volume { flex: 0 1 110px; width: 110px; min-width: 70px; }
.vs-mark small { display: block; font-size: 10px; letter-spacing: .12em; color: var(--muted); font-weight: 800; text-align: center; }
#scene-round { position: absolute; left: 0; right: 0; top: 40%; text-align: center; pointer-events: none; opacity: 0; font: 900 38px/1 system-ui, sans-serif; letter-spacing: .24em; text-transform: uppercase; color: #fde68a; text-shadow: 0 0 0 #000, 3px 3px 0 #7c2d12, -2px 2px 0 #7c2d12, 0 6px 14px rgba(0,0,0,.7); }
#scene-round small { display: block; margin-top: 8px; font-size: 14px; letter-spacing: .3em; color: #fff; text-shadow: 0 2px 5px #000; }
.st-flame { shape-rendering: crispEdges; }
.st-ring { fill: none; stroke: #fed7aa; stroke-width: 3; }
.st-casing { fill: #d4a017; }
@media (max-width: 480px) {
  #scene-round { font-size: 30px; }
  .scene-foot .music-volume { flex-basis: 80px; width: 80px; }
}
