:root {
  color-scheme: dark;
  --ink: #f2f7fb;
  --muted: #aebdca;
  --panel: rgba(10, 18, 25, 0.72);
  --panel-strong: rgba(12, 23, 31, 0.94);
  --edge: rgba(126, 216, 255, 0.25);
  --steel: #32404a;
  --amber: #ffb45c;
  --cyan: #7ed8ff;
  --raider: #ffb45c;
  --warden: #7ed8ff;
  --signal: #66ffd2;
  --danger: #ff6b5e;
}
* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; overflow: hidden; background: #0b1117; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; }
button, a { font: inherit; }
button { min-height: 44px; border: 1px solid rgba(255,255,255,.14); border-radius: 14px; color: var(--ink); background: rgba(255,255,255,.08); cursor: pointer; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
button:hover, button:focus-visible, a:focus-visible { border-color: rgba(102,255,210,.65); outline: none; transform: translateY(-1px); }
a { color: var(--ink); text-decoration: none; }
.game-shell { position: fixed; inset: 0; overflow: hidden; background: radial-gradient(circle at 50% 10%, #1e3442, #0b1117 62%); }
#gameCanvas { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; display: block; }
.topbar { position: fixed; z-index: 30; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: linear-gradient(180deg, rgba(6,10,14,.82), rgba(6,10,14,0)); pointer-events: auto; }
.topbar > * { pointer-events: auto; }
.back-link { min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: rgba(0,0,0,.2); }
.brand { display: grid; text-align: center; letter-spacing: .08em; text-transform: uppercase; }
.brand span { font-size: 13px; color: var(--signal); font-weight: 800; }
.brand b { font-size: 11px; color: var(--muted); white-space: nowrap; }
.top-actions { display: flex; gap: 8px; }
.top-actions button { min-width: 74px; padding-inline: 12px; background: rgba(0,0,0,.28); }
.hud { position: fixed; z-index: 9; left: 16px; right: 16px; bottom: 14px; display: grid; grid-template-columns: repeat(4, minmax(92px, 150px)) minmax(220px, 1fr) auto; gap: 10px; align-items: end; pointer-events: none; }
.status-card, .objective-hud, .score-hud { border: 1px solid var(--edge); border-radius: 18px; background: var(--panel); box-shadow: 0 18px 48px rgba(0,0,0,.28); backdrop-filter: blur(10px); }
.status-card { position: relative; overflow: hidden; min-height: 62px; padding: 10px 12px; }
.status-card span { display:block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.status-card strong { font-size: 24px; line-height: 1.05; }
.status-card small { display:block; color: var(--muted); }
.status-card i { position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; background: linear-gradient(90deg, var(--signal), #58ffca); transform-origin: left center; }
.status-card:nth-child(2) i { background: linear-gradient(90deg, #5bc8ff, #d6f5ff); }
.weapon strong { font-size: 19px; }
.objective-hud, .score-hud { min-height: 52px; padding: 14px 16px; display:flex; align-items:center; }
.score-hud { justify-content:center; min-width: 156px; color: var(--signal); font-weight: 800; }
.radar { position: fixed; z-index: 10; top: 74px; left: 16px; width: 164px; padding: 9px; border: 1px solid rgba(126,216,255,.34); border-radius: 18px; background: rgba(6,12,18,.62); box-shadow: 0 18px 48px rgba(0,0,0,.28), inset 0 0 24px rgba(126,216,255,.06); backdrop-filter: blur(10px); opacity: 0; pointer-events: none; }
body[data-game-state="playing"] .radar, body[data-game-state="paused"] .radar { opacity: 1; }
.radar-title { display:flex; justify-content:space-between; align-items:center; margin: 0 2px 7px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.radar-title b { color: var(--signal); font-size: 11px; }
.radar-map { position: relative; width: 144px; height: 144px; overflow: hidden; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; background: radial-gradient(circle at 50% 50%, rgba(126,216,255,.08), rgba(14,24,31,.58) 45%, rgba(4,8,12,.82)); }
.radar-grid, .radar-sweep { position:absolute; inset:0; border-radius:50%; pointer-events:none; }
.radar-grid { background: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 24px 24px; opacity:.72; }
.radar-sweep { background: conic-gradient(from 0deg, rgba(102,255,210,.24), transparent 58deg, transparent 360deg); mix-blend-mode: screen; }
.radar-site, .radar-pip { position: absolute; transform: translate(-50%, -50%); display:grid; place-items:center; }
.radar-site { width: 22px; height: 22px; border: 1px solid currentColor; border-radius: 50%; color: var(--amber); background: rgba(255,180,92,.14); font-size: 11px; font-weight: 950; box-shadow: 0 0 14px currentColor; }
.radar-site[data-site="B"] { color: var(--cyan); background: rgba(126,216,255,.14); }
.radar-pip { width: 8px; height: 8px; border-radius: 50%; background: #fff; border: 1px solid rgba(0,0,0,.45); box-shadow: 0 0 8px currentColor; }
.radar-pip.player { width: 13px; height: 13px; color: var(--signal); background: var(--signal); clip-path: polygon(50% 0, 100% 100%, 50% 72%, 0 100%); border-radius: 0; }
.radar-pip.ally { color: var(--cyan); background: var(--cyan); }
.radar-pip.enemy { color: var(--amber); background: var(--amber); }
.world-callouts { position: fixed; z-index: 11; inset: 0; pointer-events: none; opacity: 0; }
body[data-game-state="playing"] .world-callouts, body[data-game-state="paused"] .world-callouts { opacity: 1; }
.world-callout { position:absolute; min-width: 102px; transform: translate(-50%, -100%); padding: 7px 10px; border: 1px solid rgba(255,255,255,.24); border-radius: 12px; background: rgba(6,12,18,.62); box-shadow: 0 0 24px rgba(0,0,0,.28), inset 0 0 18px rgba(255,255,255,.04); backdrop-filter: blur(8px); text-align:center; }
.world-callout::after { content:""; position:absolute; left:50%; bottom:-14px; width:1px; height:14px; background: currentColor; box-shadow: 0 0 12px currentColor; }
.world-callout[data-site="A"] { color: var(--amber); }
.world-callout[data-site="B"] { color: var(--cyan); }
.world-callout b { display:block; font-size: 13px; line-height:1; text-transform: uppercase; letter-spacing:.08em; }
.world-callout span { display:block; margin-top:3px; color: var(--ink); font-size: 10px; opacity:.82; }
.plant-alert { position: fixed; z-index: 13; top: 76px; left: 50%; transform: translate(-50%, -20px); display:flex; align-items:center; gap:12px; padding: 9px 16px; border: 1px solid rgba(255,107,94,.55); border-radius: 999px; background: rgba(45,10,12,.72); box-shadow: 0 0 34px rgba(255,107,94,.28); opacity: 0; pointer-events:none; text-transform: uppercase; letter-spacing:.09em; font-size:12px; font-weight:950; }
.plant-alert.active { opacity: 1; transform: translate(-50%, 0); animation: plantPulse .75s ease-in-out infinite alternate; }
.plant-alert span { color: #ffe3a6; font-variant-numeric: tabular-nums; }
@keyframes plantPulse { from { box-shadow: 0 0 20px rgba(255,107,94,.22); } to { box-shadow: 0 0 42px rgba(255,107,94,.62); } }
.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 78px 18px 18px; background: radial-gradient(circle at 52% 25%, rgba(24,51,63,.66), rgba(5,8,12,.86) 62%); }
.hidden { display: none !important; }
.menu-card { width: min(920px, 100%); max-height: min(760px, calc(100vh - 96px)); overflow: auto; padding: clamp(18px, 3vw, 34px); border: 1px solid rgba(126,216,255,.28); border-radius: 30px; background: linear-gradient(135deg, rgba(11,20,28,.96), rgba(32,39,42,.9)); box-shadow: 0 28px 80px rgba(0,0,0,.48), inset 0 1px 0 rgba(255,255,255,.07); }
.menu-card.small { width: min(440px, 100%); text-align: center; }
.eyebrow { margin: 0 0 8px; color: var(--signal); text-transform: uppercase; letter-spacing: .13em; font-size: 12px; font-weight: 900; }
h1, h2 { margin: 0; letter-spacing: -.05em; line-height: .96; }
h1 { font-size: clamp(36px, 7.2vw, 78px); }
h1 em { color: var(--raider); font-style: normal; white-space: nowrap; }
h2 { font-size: clamp(28px, 5vw, 46px); }
.lede { max-width: 760px; color: #d8e4ea; font-size: clamp(15px, 2.2vw, 19px); line-height: 1.45; }
.team-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin: 18px 0 12px; }
.team-card { text-align: left; padding: 16px; min-height: 96px; }
.team-card b { display:block; font-size: 20px; color: var(--warden); }
.team-card[data-team="raiders"] b { color: var(--raider); }
.team-card span, .briefing { color: var(--muted); line-height: 1.35; }
.team-card.selected, .buy-strip button.selected { border-color: var(--signal); background: rgba(102,255,210,.12); }
.briefing { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; font-size: 14px; }
.briefing p { margin: 0; padding: 12px; border-radius: 16px; background: rgba(255,255,255,.055); }
.buy-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.buy-strip button { padding: 0 13px; }
.menu-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.primary { min-width: 210px; padding: 0 22px; color: #081817; font-weight: 950; background: linear-gradient(135deg, var(--signal), #7ed8ff); border-color: transparent; box-shadow: 0 10px 36px rgba(102,255,210,.24); }
.crosshair { position: fixed; z-index: 8; left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%); pointer-events: none; opacity: 0; }
body[data-game-state="playing"] .crosshair { opacity: .95; }
.crosshair i { position:absolute; background: rgba(236,255,250,.9); box-shadow: 0 0 10px rgba(102,255,210,.55); }
.crosshair i:nth-child(1), .crosshair i:nth-child(2) { width: 10px; height: 2px; top: 16px; }
.crosshair i:nth-child(1) { left: 0; } .crosshair i:nth-child(2) { right:0; }
.crosshair i:nth-child(3), .crosshair i:nth-child(4) { width: 2px; height: 10px; left: 16px; }
.crosshair i:nth-child(3) { top: 0; } .crosshair i:nth-child(4) { bottom:0; }
.touch-ui { position: fixed; z-index: 12; inset: auto 0 0 0; min-height: 220px; padding: 0 14px max(14px, env(safe-area-inset-bottom)); display: none; pointer-events: none; }
.stick { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); width: 118px; height: 118px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); background: rgba(7,13,18,.44); pointer-events: auto; display:grid; place-items:center; color: rgba(242,247,251,.82); font-size: 12px; font-weight: 900; letter-spacing:.08em; box-shadow: inset 0 0 28px rgba(126,216,255,.08), 0 10px 30px rgba(0,0,0,.22); }
.stick b { position:absolute; width: 48px; height: 48px; border-radius:50%; background: rgba(102,255,210,.42); border:1px solid rgba(255,255,255,.24); }
#movePad { left: 18px; }
#aimPad { right: 18px; }
.touch-buttons { position: absolute; left: 50%; bottom: max(154px, calc(env(safe-area-inset-bottom) + 154px)); transform: translateX(-50%); display: grid; grid-template-columns: repeat(5, 52px); gap: 6px; pointer-events: auto; }
.touch-buttons button { min-width: 52px; min-height: 46px; padding: 0 5px; border-radius: 14px; background: rgba(10,18,25,.72); font-size: 11px; font-weight: 850; box-shadow: 0 10px 24px rgba(0,0,0,.22); }
#fireTouch { background: linear-gradient(135deg, rgba(255,180,92,.82), rgba(255,107,94,.72)); color:#160b07; border-color: transparent; }
@media (hover: none), (pointer: coarse) {
  body[data-game-state="playing"] .touch-ui { display: block; }
  .top-actions button { min-width: 64px; }
}
@media (max-width: 720px) {
  .topbar { padding: max(7px, env(safe-area-inset-top)) 8px 5px; min-height: 42px; }
  .back-link { display:none; }
  .brand { text-align:left; }
  .brand span { font-size: 11px; }
  .brand b { font-size: 9px; }
  .top-actions { gap: 4px; }
  .top-actions button { min-width: 44px; min-height: 36px; padding-inline: 6px; border-radius: 11px; font-size: 11px; }
  .radar, .world-callouts { display: none; }
  .plant-alert { top: 132px; width: min(330px, calc(100vw - 28px)); justify-content:center; font-size: 10px; padding: 7px 10px; }
  .hud { left: 8px; right: 8px; top: 48px; bottom: auto; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 5px; align-items: stretch; }
  .status-card { min-height: 38px; padding: 5px 6px; border-radius: 12px; }
  .status-card span { font-size: 8px; letter-spacing: .05em; }
  .status-card strong { font-size: 15px; }
  .weapon strong { font-size: 12px; }
  .status-card small { display:none; }
  .status-card i { height: 3px; }
  .objective-hud, .score-hud { min-height: 30px; padding: 6px 8px; border-radius: 12px; font-size: 10px; line-height: 1.15; }
  .objective-hud { grid-column: span 3; }
  .score-hud { grid-column: span 1; min-width: 0; }
  .overlay { align-items: start; padding: 48px 10px 10px; }
  .menu-card { border-radius: 22px; max-height: calc(100vh - 58px); padding: 16px; }
  h1 { font-size: 34px; }
  .lede { margin: 8px 0; font-size: 14px; }
  .team-grid, .briefing { grid-template-columns: 1fr; gap: 8px; }
  .team-card { min-height: 72px; padding: 11px; }
  .team-card span, .briefing { font-size: 12px; }
  .briefing p:nth-child(2) { display: none; }
  .buy-strip { display: none; }
  .menu-actions { align-items: stretch; flex-direction: column; margin-top: 8px; }
  .primary, #playBtn { width: 100%; min-height: 52px; }
}
@media (max-width: 430px) and (max-height: 870px) {
  .overlay { padding-top: 44px; }
  .menu-card { max-height: 790px; padding: 13px; }
  .eyebrow { font-size: 10px; margin-bottom: 4px; }
  h1 { font-size: 29px; }
  .lede { font-size: 12.5px; line-height: 1.24; }
  .team-card { min-height: 61px; }
  .team-card b { font-size: 17px; }
  .briefing p { padding: 8px; }
  #playBtn { min-height: 50px; }
  .stick { width: 116px; height: 116px; bottom: max(18px, env(safe-area-inset-bottom)); }
  #movePad { left: 16px; }
  #aimPad { right: 16px; }
  .touch-buttons { grid-template-columns: repeat(5, 52px); bottom: max(154px, calc(env(safe-area-inset-bottom) + 154px)); }
}
