:root {
  --ink: #f5e7cc;
  --muted: #b7a282;
  --coal: #100c09;
  --panel: #211913;
  --line: #503b2a;
  --red: #e05435;
  --red-dark: #812c1c;
  --ochre: #e19a38;
  --blue: #63a2b9;
  --blue-dark: #285a6d;
  font-family: Inter, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--coal);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% -10%, #5d2a18 0, transparent 35%), linear-gradient(#18110d, #0f0c09); }
button, select, input { font: inherit; }
button { border: 1px solid var(--line); background: #39291e; color: var(--ink); border-radius: 8px; padding: 8px 11px; cursor: pointer; font-size: .875rem; }
button:hover:not(:disabled) { border-color: var(--ochre); background: #493324; }
button:focus-visible, select:focus-visible, [data-entity]:focus-visible { outline: 2px solid var(--ochre); outline-offset: 2px; }
button:disabled { opacity: .36; cursor: not-allowed; }
h1 { margin: .2rem 0; font-size: clamp(2.5rem, 6vw, 5rem); line-height: .8; letter-spacing: -.065em; }
h2 { margin: .2rem 0 1rem; }
p { color: var(--muted); margin: .4rem 0; }
.site-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 28px 4vw; border-bottom: 1px solid var(--line); }
.header-controls { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.view-control { color: var(--muted); font-size: .875rem; }
.view-control select { width: auto; min-width: 150px; display: block; margin: 4px 0 0; }
.eyebrow { color: var(--ochre); font: 700 .78rem/1.3 ui-monospace, monospace; letter-spacing: .14em; }
.phase-badge { border: 1px solid var(--ochre); color: var(--ochre); padding: 10px 14px; border-radius: 999px; font: 700 .875rem ui-monospace, monospace; }
main { width: min(1560px, 95vw); margin: 24px auto 60px; }
.panel { background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 35px #0005; }
.mission { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; }
.mission h2 { margin-bottom: .25rem; }
.primary { background: var(--red); border-color: #f67859; font-weight: 800; padding: 13px 18px; white-space: nowrap; }
.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 12px 0; }
.stat { padding: 14px 16px; }
.stat span { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.stat strong { font-size: 1.2rem; }
.arena-panel { padding: 18px; overflow: hidden; }
.arena-heading, .section-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.arena-heading h2 { margin-bottom: .2rem; }
.arena-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.selection-readout { min-width: 210px; padding: 9px 12px; border-radius: 8px; background: #130f0c; color: var(--muted); font: 700 .78rem/1.2 ui-monospace, monospace; text-align: right; }
.arena-scroll { min-height: 620px; margin-top: 12px; border: 1px solid #3e2c20; border-radius: 12px; overflow: hidden; background: radial-gradient(circle at center, #382619, #17100c 68%); }
.arena { display: block; width: 100%; height: 70vh; min-height: 620px; max-height: 880px; user-select: none; touch-action: manipulation; }
.hex-cell { fill: #2a1d15; stroke: #65442c; stroke-width: 1.15; vector-effect: non-scaling-stroke; cursor: default; transition: fill .12s ease, stroke .12s ease; }
.hex-cell.edge-red { fill: #351b15; }
.hex-cell.edge-blue { fill: #172a31; }
.hex-cell.center { fill: #46301a; stroke: var(--ochre); stroke-width: 1.7; }
.hex-cell.occupied { fill: #302117; }
.hex-cell.legal { fill: #38502d; stroke: #b9e891; stroke-width: 2.4; cursor: pointer; }
.hex-cell.legal:hover { fill: #587b45; }
.hex-cell.deployment-legal { fill: #5e4a25; stroke: #f4c765; stroke-width: 2.4; cursor: pointer; }
.hex-cell.outside-phase { fill: #120e0b; stroke: #2a211b; opacity: .45; }
.hex-cell.placement-start { fill: #8d632d; stroke: #ffd072; stroke-width: 3; }
.unit-token { cursor: pointer; }
.unit-token circle { stroke: #f7e8ca; stroke-width: 1.5; filter: drop-shadow(0 2px 3px #0009); }
.unit-token.red circle { fill: var(--red-dark); }
.unit-token.blue circle { fill: var(--blue-dark); }
.unit-token.selected circle { stroke: #ffcc64; stroke-width: 3.5; }
.unit-token.active circle { filter: drop-shadow(0 0 7px #ffd76a); }
.unit-token.targetable circle { stroke: #ff5c49; stroke-width: 3.5; animation: target-pulse 1.15s ease-in-out infinite alternate; }
.unit-token.disabled-unit { opacity: .58; }
.unit-token text { fill: #fff8e8; font: 800 10px/1 ui-monospace, monospace; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.objective-mark { fill: none; stroke: #f1b75a; stroke-width: 4; stroke-dasharray: 5 4; pointer-events: none; }
.site-marker circle { fill: #20170fdd; stroke: #c9964f; stroke-width: 2; }
.site-marker text { fill: #fff1d2; font: 800 7px/1 ui-monospace, monospace; text-anchor: middle; dominant-baseline: central; }
.site-marker .site-detail { fill: #ffe081; font-size: 9px; }
.site-marker.resource-site circle { fill: #70511fdd; stroke: #f0bd52; }
.site-marker.intel-site circle { fill: #2d5362dd; stroke: #83c4dd; }
.site-marker.control-site circle { fill: #77501ddd; stroke: #ffc45d; stroke-width: 3; }
.site-marker.cache-site circle { fill: #4d3d22dd; }
.site-marker.sabotage-site circle { fill: #5f241ddd; stroke: #e86b53; }
.site-marker.rally-site circle { fill: #35512bdd; stroke: #94c577; }
.site-marker.sentinel-site circle { fill: #452f5ddd; stroke: #c9a2ef; }
.site-marker.fob-site circle { fill: #16373bdd; stroke: #7ed2c7; }
.site-marker.red-site circle { filter: drop-shadow(0 0 4px #e0543577); }
.site-marker.blue-site circle { filter: drop-shadow(0 0 4px #63a2b977); }
.barricade-line { stroke: #f5c56d; stroke-width: 7; stroke-linecap: round; pointer-events: none; filter: drop-shadow(0 0 3px #000); }
.arena-legend { display: flex; flex-wrap: wrap; gap: 10px 22px; padding-top: 13px; color: var(--muted); font-size: .8rem; }
.arena-legend span { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 12px; height: 12px; display: inline-block; border-radius: 50%; border: 1px solid #fff6; }
.red-swatch { background: var(--red-dark); }
.blue-swatch { background: var(--blue-dark); }
.move-swatch { background: #587b45; }
.objective-swatch { background: #8c5d24; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, .8fr); gap: 24px; margin-top: 28px; }
.section-note { color: var(--muted); font-size: .875rem; }
.entity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stack { display: grid; gap: 10px; }
.card, .controls { padding: 14px; }
.card.red { border-left: 4px solid var(--red); }
.card.blue { border-left: 4px solid var(--blue); }
.card.selected { box-shadow: 0 0 0 2px var(--ochre), 0 14px 35px #0005; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.money { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 10px; }
.money span { background: #16110d; padding: 7px; border-radius: 7px; font-size: .75rem; }
.private-mask { padding: 10px; border: 1px dashed var(--line); border-radius: 8px; background: #15100d; }
.tag { padding: 4px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: 700 .75rem ui-monospace, monospace; }
.controls { display: grid; gap: 14px; margin-top: 10px; }
.control-group { border-top: 1px solid var(--line); padding-top: 12px; }
.control-group:first-child { border: 0; padding-top: 0; }
.control-group label { display: block; margin-bottom: 7px; color: var(--muted); font-size: .875rem; }
.control-group summary { color: var(--muted); font-size: .875rem; cursor: pointer; }
.control-group small { color: var(--muted); }
.chosen { background: var(--ochre); border-color: #ffd07b; color: #24170c; font-weight: 800; }
.confirm { background: #426736; border-color: #9ecb7d; }
.los-prompt { padding: 12px; border: 1px solid var(--ochre); border-radius: 9px; background: #332317; }
select, input { width: 100%; margin-bottom: 7px; padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: #17120e; color: var(--ink); }
.objective-progress { height: 8px; margin: 8px 0 10px; overflow: hidden; border-radius: 999px; background: #110d0a; }
.objective-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--ochre), #f3c163); }
.winner { padding: 12px; border: 1px solid var(--ochre); border-radius: 9px; background: #4b3117; }
.ghost { background: transparent; }
.log-panel { margin-top: 28px; padding: 18px; }
.log-panel ol { max-height: 260px; overflow: auto; padding-left: 30px; color: #cbbb9f; font: 12px/1.5 ui-monospace, monospace; }
#notice { min-height: 24px; color: var(--ochre); font-weight: 700; }
@keyframes target-pulse { to { filter: drop-shadow(0 0 8px #ff5c49); } }
@media (max-width: 1000px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .arena { height: 68vh; }
}
@media (max-width: 700px) {
  .site-header, .mission, .arena-heading { align-items: flex-start; flex-direction: column; }
  .header-controls { width: 100%; justify-content: space-between; }
  .status-grid, .entity-grid { grid-template-columns: repeat(2, 1fr); }
  .arena-toolbar { width: 100%; justify-content: space-between; }
  .selection-readout { text-align: left; min-width: 0; }
  .arena-scroll, .arena { min-height: 520px; }
}
@media (max-width: 430px) {
  .status-grid, .entity-grid { grid-template-columns: 1fr; }
  .arena-scroll { margin-left: -10px; margin-right: -10px; border-radius: 0; }
}
