:root {
  color-scheme: dark;
  --night: #111a24;
  --panel: #18232d;
  --panel-light: #1d2b35;
  --line: rgba(209, 221, 218, .12);
  --text: #e7ece7;
  --muted: #9aa8a6;
  --gold: #d3a75d;
  --green: #88b99a;
  --red: #d38274;
  --blue: #7d9dc3;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--text); background: radial-gradient(ellipse at 86% 4%, rgba(112, 145, 137, .13), transparent 35rem), var(--night); }
button, input, select { font: inherit; }
button, select { color: inherit; }
[hidden] { display: none !important; }
.shell { width: min(1240px, calc(100% - 56px)); min-height: 100vh; margin: 0 auto; display: flex; flex-direction: column; }
.masthead { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--text); font-size: 13px; font-weight: 800; letter-spacing: .16em; text-decoration: none; }
.brand-mark { color: var(--gold); font-size: 21px; }
.site-note, .eyebrow, .status-chip, .weather, .room-share, .map-legend, .footer { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; letter-spacing: .13em; }
.site-note { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 13px rgba(136, 185, 154, .7); }
.lobby { min-height: 670px; padding: 78px 7% 66px; display: grid; grid-template-columns: 1fr minmax(320px, .75fr); gap: 9%; align-items: center; }
.eyebrow { margin: 0 0 13px; color: var(--gold); text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
.hero h1, .game-heading h1 { margin: 0; font-size: clamp(42px, 5.2vw, 68px); font-weight: 550; line-height: 1.05; letter-spacing: -.06em; }
.hero h1 span { color: #97a5a2; }
.intro { max-width: 465px; margin: 23px 0 34px; color: #aab6b2; font-size: 14px; line-height: 1.8; }
.principles { max-width: 460px; border-top: 1px solid var(--line); }
.principles > div { min-height: 56px; display: flex; gap: 18px; align-items: center; border-bottom: 1px solid var(--line); }
.principles span { color: var(--gold); font-family: ui-monospace, monospace; font-size: 9px; }
.principles p { margin: 0; color: #bdc5c0; font-size: 11px; }
.lobby-card, .command-card, .intel-card, .players-card, .map-panel { border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(145deg, rgba(29, 43, 53, .96), rgba(22, 32, 42, .96)); box-shadow: 0 22px 65px rgba(0, 0, 0, .13); }
.lobby-card { padding: 30px; }
.lobby-card h2 { margin: 0 0 22px; font-size: 23px; font-weight: 560; letter-spacing: -.04em; }
.mode-label, .join-form label, .command-card label { display: block; margin: 0 0 7px; color: var(--muted); font-size: 10px; }
select, input { width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: 5px; background: #121d26; color: var(--text); font-size: 11px; }
select:focus, input:focus { outline: 2px solid rgba(211, 167, 93, .6); outline-offset: 1px; }
.remember-choice { margin: 13px 0 4px; display: flex; align-items: start; gap: 8px; color: var(--muted); font-size: 9px; line-height: 1.5; cursor: pointer; }
.remember-choice input { width: 14px; min-height: 14px; height: 14px; margin: 0; accent-color: var(--gold); }
.lobby-actions { display: grid; gap: 8px; margin-top: 16px; }
.button { min-height: 43px; padding: 0 13px; border: 1px solid transparent; border-radius: 5px; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; font-size: 11px; font-weight: 650; transition: transform .15s, background .15s, opacity .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .42; cursor: not-allowed; }
.button-primary { background: var(--gold); color: #1d211e; }
.button-primary:hover:not(:disabled) { background: #e2bb79; }
.button-secondary { border-color: var(--line); background: rgba(255,255,255,.025); color: var(--text); }
.button-secondary:hover:not(:disabled) { background: rgba(255,255,255,.075); }
.divider { margin: 21px 0 16px; border-top: 1px solid var(--line); text-align: center; }
.divider span { position: relative; top: -7px; padding: 0 10px; background: #1a2630; color: var(--muted); font-size: 9px; }
.join-form { display: grid; gap: 8px; }
.join-form input { text-align: center; font-family: ui-monospace, monospace; letter-spacing: .2em; text-transform: uppercase; }
.notice { min-height: 16px; margin: 9px 0 0; color: #e5a099; font-size: 10px; line-height: 1.5; }
.notice.success { color: var(--green); }
.game { padding: 40px 0 48px; }
.game-heading { margin: 0 0 22px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.game-heading h1 { font-size: clamp(30px, 3.8vw, 44px); }
.leave-button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 10px; }
.leave-button:hover { color: var(--text); }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 16px; align-items: start; }
.map-panel { min-width: 0; padding: 17px; }
.map-heading { min-height: 29px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.map-heading > div { display: flex; align-items: center; gap: 10px; color: #c1cbc5; font-size: 10px; }
.status-chip { padding: 5px 7px; border: 1px solid rgba(136,185,154,.25); border-radius: 3px; color: var(--green); font-size: 8px; }
.status-chip.waiting { border-color: rgba(211,167,93,.25); color: var(--gold); }
.weather { color: var(--muted); font-size: 8px; }
.map-wrap { overflow: hidden; border: 1px solid rgba(211,221,218,.08); border-radius: 6px; background: radial-gradient(ellipse at 50% 45%, rgba(69, 98, 93, .12), transparent 65%), #121d26; }
#map { width: 100%; min-height: 280px; display: block; }
.edge { stroke: rgba(161, 185, 174, .27); stroke-width: 2; }
.edge-route { stroke: rgba(211, 167, 93, .72); stroke-width: 3; stroke-dasharray: 6 6; }
.territory { cursor: pointer; }
.territory circle { stroke: rgba(230,239,231,.45); stroke-width: 2; transition: r .15s, filter .15s; }
.territory:hover circle, .territory.selected circle { filter: drop-shadow(0 0 7px rgba(228,208,156,.7)); stroke: #f0cf88; stroke-width: 3; }
.territory .node-core { fill: rgba(13, 23, 30, .65); stroke: none; pointer-events: none; }
.territory .node-name { fill: #dbe3dc; font: 10px ui-monospace, monospace; text-anchor: middle; pointer-events: none; }
.territory .node-units { fill: #f4ede0; font: 10px ui-monospace, monospace; font-weight: 700; text-anchor: middle; pointer-events: none; }
.territory.owner-0 circle { fill: #ad675d; }
.territory.owner-1 circle { fill: #6484a9; }
.territory.owner-neutral circle { fill: #777e74; }
.territory.owner-hidden circle { fill: #26333a; stroke: #4a5759; stroke-dasharray: 3 3; }
.territory.owner-hidden .node-name { fill: #899692; }
.map-legend { padding: 12px 3px 3px; display: flex; flex-wrap: wrap; gap: 13px; color: var(--muted); font-size: 8px; letter-spacing: .02em; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 9px; height: 9px; border-radius: 50%; }
.legend-own { background: #ad675d; }.legend-enemy { background: #6484a9; }.legend-neutral { background: #777e74; }.legend-hidden { border: 1px dashed #82908d; background: #26333a; }
.event-label { margin: 10px 3px 0; color: #a9b5b0; font-size: 10px; }
.sidebar { display: grid; gap: 12px; }
.command-card, .intel-card, .players-card { padding: 17px; }
.command-card h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.command-copy { min-height: 33px; margin: 0 0 14px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.command-card select, .command-card input { margin-bottom: 11px; }
.command-card input { min-height: 36px; }
.selection-readout { margin: 0 0 12px; padding: 10px; display: grid; grid-template-columns: 1fr 1.3fr; gap: 7px; border: 1px solid var(--line); border-radius: 5px; background: rgba(8,15,20,.18); }
.selection-readout span { color: var(--muted); font-size: 9px; }
.selection-readout strong { overflow: hidden; font-size: 9px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.command-card .button { width: 100%; }
.resource-row { padding: 8px 0; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.resource-row strong { color: var(--text); font-family: ui-monospace, monospace; font-size: 10px; font-weight: 500; }
.intel-copy { margin: 11px 0 0; color: #c4c9bd; font-size: 10px; line-height: 1.55; }
.commander-row { min-height: 40px; display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); color: #cad3ce; font-size: 10px; }
.commander-row small { color: var(--muted); font-size: 8px; }
.room-share { margin-top: 12px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 8px; letter-spacing: .04em; }
.room-share strong { margin-left: auto; color: var(--text); letter-spacing: .15em; }
.room-share button { border: 0; background: none; color: var(--gold); cursor: pointer; font-size: 9px; }
.footer { min-height: 58px; margin-top: auto; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); color: #7e8d8a; font-size: 8px; }
.footer a { color: inherit; text-decoration: none; }
.footer a:hover { color: var(--text); }
@media (max-width: 880px) {
  .shell { width: min(100% - 36px, 720px); }
  .lobby { padding: 58px 2% 48px; grid-template-columns: 1fr; gap: 38px; }
  .lobby-card { width: min(100%, 480px); margin: auto; }
  .game-layout { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .command-card { grid-row: span 2; }
}
@media (max-width: 560px) {
  .shell { width: calc(100% - 28px); }
  .masthead { height: 64px; }
  .site-note { font-size: 7px; }
  .hero h1 { font-size: 46px; }
  .lobby { padding: 48px 0 36px; }
  .lobby-card { padding: 22px; }
  .game { padding-top: 29px; }
  .game-heading { align-items: start; }
  .game-heading h1 { font-size: 29px; }
  .map-panel { padding: 10px; }
  #map { min-height: 190px; }
  .territory .node-name { font-size: 13px; }
  .sidebar { grid-template-columns: 1fr; }
  .command-card { grid-row: auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
