@font-face {
  font-family: "Noto Color Emoji";
  src: url("assets/fonts/NotoLittleGuys.woff2") format("woff2");
  font-display: block;
  font-style: normal;
  font-weight: 400;
}

:root {
  color-scheme: dark;
  --bg: #070c12;
  --panel: #101a24;
  --panel-2: #162431;
  --panel-3: #1b2c3a;
  --line: #2a4050;
  --line-soft: #203340;
  --text: #f5f1df;
  --muted: #9bb0b8;
  --blue: #38caff;
  --red: #ff5c64;
  --gold: #ffd166;
  --green: #68e0ad;
  --light: #63d9ff;
  --medium: #6be1a5;
  --heavy: #ffad5c;
  --mythic: #c998ff;
  --shadow: 0 18px 50px #02060999;
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
body { user-select: none; background: radial-gradient(circle at 50% -10%, #213848 0, #0a1219 42%, #060a0f 100%); }
button { font: inherit; color: inherit; }
button:focus-visible, canvas:focus-visible { outline: 3px solid #f6d365; outline-offset: 2px; }

#app { height: 100%; display: grid; grid-template-rows: 60px minmax(0, 1fr); }
.topbar { position: relative; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-bottom: 1px solid #2b4150; background: #0a1219eb; box-shadow: 0 8px 30px #0008; backdrop-filter: blur(18px); }
.brand { width: 262px; flex: 0 0 262px; padding: 0 8px; display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid #72d8f480; border-radius: 13px; background: linear-gradient(145deg, #254b60, #122837); color: #b9efff; font-weight: 950; font-size: 13px; letter-spacing: .08em; box-shadow: inset 0 1px #ffffff20, 0 8px 22px #02060980; }
.brand strong { display: block; white-space: nowrap; font-size: 16px; letter-spacing: .015em; }
.brand small { display: block; margin-top: 2px; color: #78cfe7; font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.economy-strip, .match-strip { min-width: 0; display: flex; align-items: center; gap: 5px; }
.economy-strip { flex: 1; }
.match-strip { margin-left: auto; }
.metric { min-width: 94px; height: 46px; padding: 7px 11px; border: 1px solid #243b4a; border-radius: 11px; background: #13202bbd; display: flex; flex-direction: column; justify-content: center; box-shadow: inset 0 1px #ffffff08; }
.metric span { display: flex; justify-content: space-between; gap: 8px; color: #8da5af; font-size: 9px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.metric span em { color: #6f8e9c; font-style: normal; letter-spacing: 0; }
.metric strong { margin-top: 2px; white-space: nowrap; font-size: 14px; font-variant-numeric: tabular-nums; }
.metric.money strong { color: var(--gold); }
.metric.pressure strong { color: #ff957f; }
.upgrade-button, .icon-button { height: 46px; border: 1px solid #2d4657; border-radius: 11px; background: #172835; padding: 7px 13px; cursor: pointer; box-shadow: inset 0 1px #ffffff0c; transition: transform .14s ease, border-color .14s ease, background .14s ease; }
.upgrade-button { min-width: 128px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.upgrade-button span { color: #adc0c7; font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.upgrade-button strong { margin-top: 2px; color: var(--gold); }
.upgrade-button:hover:not(:disabled), .icon-button:hover { border-color: #5b879c; background: #203746; transform: translateY(-1px); }
.upgrade-button:disabled { opacity: .45; cursor: not-allowed; }
.icon-button { font-size: 12px; font-weight: 750; }
.icon-button.danger { color: #ff9ca8; }
.icon-button.network { color: #92e9ff; }

.game-shell { min-height: 0; display: grid; grid-template-columns: 270px minmax(320px, 1fr) 230px; gap: 8px; padding: 8px; }
.build-panel, .command-panel { min-height: 0; border: 1px solid var(--line-soft); border-radius: 15px; background: linear-gradient(160deg, #14222ddd, #0d171fef); z-index: 10; box-shadow: var(--shadow), inset 0 1px #ffffff0a; }
.build-panel { display: flex; flex-direction: column; padding: 15px 13px 12px; }
.command-panel { padding: 10px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #385466 transparent; }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 0 3px; }
.eyebrow { display: block; color: #70d9f7; font-size: 9px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
.panel-heading h1 { margin: 3px 0 0; font-size: 19px; letter-spacing: -.02em; }
.panel-note { margin: 10px 3px 12px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.small-button { padding: 6px 9px; border: 1px solid #365165; border-radius: 9px; background: #172733; font-size: 10px; font-weight: 750; cursor: pointer; }
.small-button:disabled { opacity: .35; cursor: default; }
.tier-legend { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 0 0 12px; padding: 4px; border: 1px solid #253d4b; border-radius: 12px; background: #0b151c; }
.tier-filter { min-width: 0; padding: 7px 2px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; transition: background .14s ease, color .14s ease, transform .14s ease; }
.tier-filter:hover { background: #1c2c37; color: var(--text); }
.tier-filter:disabled { opacity: .32; cursor: not-allowed; transform: none; background: transparent; box-shadow: none; }
.tier-filter.active { background: color-mix(in srgb, currentColor 16%, #15232d); box-shadow: inset 0 0 0 1px currentColor; transform: translateY(-1px); }
.tier-filter.light { color: var(--light); }
.tier-filter.medium { color: var(--medium); }
.tier-filter.heavy { color: var(--heavy); }
.tier-filter.mythic { color: var(--mythic); }
.build-list { min-height: 0; flex: 1; overflow-y: auto; padding: 0 1px 4px; scrollbar-width: thin; scrollbar-color: #3a596a transparent; }
.tier-section { display: none; }
.tier-section.visible { display: grid; grid-template-columns: 1fr; gap: 8px; align-content: start; animation: tier-in .16s ease-out; }
@keyframes tier-in { from { opacity: 0; transform: translateY(4px); } }
.tier-title { grid-column: 1 / -1; margin: 0; padding: 2px 2px 4px; display: flex; justify-content: space-between; color: #91a7b1; font-size: 9px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.build-card { --tier-color: var(--light); width: 100%; min-width: 0; position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 4px 9px; align-items: center; min-height: 70px; padding: 9px 10px; border: 1px solid #2a414f; border-radius: 13px; background: linear-gradient(145deg, color-mix(in srgb, var(--tier-color) 9%, #172630), #101a22 72%); text-align: left; cursor: pointer; box-shadow: inset 0 1px #ffffff0a, 0 7px 18px #03070a55; transition: transform .14s ease, border-color .14s ease, background .14s ease; }
.build-card.medium { --tier-color: var(--medium); }
.build-card.heavy { --tier-color: var(--heavy); }
.build-card.mythic { --tier-color: var(--mythic); }
.build-card:hover:not(:disabled), .build-card.active { border-color: var(--tier-color); background: linear-gradient(145deg, color-mix(in srgb, var(--tier-color) 16%, #1a2a34), #12202a 72%); transform: translateY(-2px); }
.build-card.active { box-shadow: inset 0 0 0 1px var(--tier-color), 0 10px 25px color-mix(in srgb, var(--tier-color) 16%, transparent); }
.build-card:disabled { opacity: .42; cursor: not-allowed; filter: saturate(.55); }
.unit-glyph { width: 42px; height: 42px; grid-column: 1; grid-row: 1 / 3; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--tier-color) 60%, #fff); border-radius: 12px; background: #08131a; font-family: "Noto Color Emoji"; font-size: 25px; font-weight: 400; box-shadow: inset 0 1px #ffffff10; }
.build-name { min-width: 0; grid-column: 2; grid-row: 1; }
.build-name strong { display: block; overflow: hidden; color: #f4f4ec; font-size: 11px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.build-name span { display: block; margin-top: 3px; overflow: hidden; color: #89a1ab; font-size: 9px; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.build-price { grid-column: 3; grid-row: 1; align-self: center; display: flex; align-items: baseline; gap: 3px; color: var(--gold); font-variant-numeric: tabular-nums; }
.build-price b { font-size: 12px; font-weight: 900; }
.build-price small { color: #9f9270; font-size: 8px; font-weight: 700; text-transform: uppercase; }
.build-card .batch-badge { grid-column: 2 / 4; grid-row: 2; align-self: start; justify-self: start; color: #8ca0aa; font-size: 9px; font-weight: 700; }

.battlefield { position: relative; min-width: 0; min-height: 0; overflow: hidden; contain: paint; border: 1px solid #294353; border-radius: 16px; background: #071016; box-shadow: var(--shadow), inset 0 0 70px #0009; }
.battlefield::after { content: ""; position: absolute; z-index: 3; inset: 0; border-radius: inherit; box-shadow: inset 0 1px #ffffff12, inset 0 0 80px #02060980; pointer-events: none; }
#webgpuCanvas, #gameCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#webgpuCanvas { z-index: 0; pointer-events: none; }
#gameCanvas { z-index: 1; }
#gameCanvas { z-index: 1; cursor: crosshair; touch-action: none; }
.team-key { position: absolute; z-index: 4; left: 12px; top: 12px; display: flex; gap: 5px; padding: 5px; border: 1px solid #3b5668a8; border-radius: 10px; background: #071118df; box-shadow: 0 7px 22px #0008; pointer-events: none; }
.team-key span { display: flex; align-items: center; gap: 5px; padding: 3px 6px; border-radius: 6px; color: #dbe8ec; font-size: 8px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.team-key b { font: inherit; }
.team-key i { display: block; border: 1px solid #ecf9ffcc; box-shadow: 0 0 0 2px #02070b; }
.team-key .friendly i { width: 13px; height: 7px; border-radius: 999px; background: var(--blue); }
.team-key .enemy i { width: 8px; height: 12px; border-radius: 2px; background: var(--red); transform: rotate(45deg) scale(.78); }
.canvas-hint { position: absolute; z-index: 4; right: 12px; bottom: 11px; padding: 7px 10px; border: 1px solid #42627499; border-radius: 10px; background: #09141be8; color: #a4bbc4; font-size: 9px; font-weight: 650; pointer-events: none; box-shadow: 0 8px 24px #0007; }
.touch-hint { display: none; }
.placement-banner { position: absolute; z-index: 4; top: 12px; left: 50%; transform: translateX(-50%); max-width: 70%; padding: 8px 13px; border: 1px solid #45c584; border-radius: 999px; background: #0d2b22ee; color: #9bf0c6; font-size: 11px; font-weight: 800; text-align: center; pointer-events: none; box-shadow: 0 8px 25px #0008; }
.placement-banner.invalid { border-color: #ff6678; background: #2b0e15e8; color: #ff9ba6; }
.toast-stack { position: absolute; z-index: 4; left: 50%; top: 52px; transform: translateX(-50%); display: grid; gap: 5px; pointer-events: none; }
.toast { padding: 8px 12px; border: 1px solid #415f70; border-radius: 11px; background: #111f29ee; color: #edf3ef; font-size: 10px; font-weight: 700; box-shadow: 0 10px 28px #0009; animation: toast-in .18s ease-out; }
.toast.good { border-color: #4fd395; color: #a8f1ce; }
.toast.bad { border-color: #ff6778; color: #ffadb6; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-5px); } }
.tooltip { position: absolute; z-index: 40; width: 258px; padding: 11px 12px; border: 1px solid #486477; border-radius: 12px; background: #0d1820f5; box-shadow: 0 16px 40px #000c; color: #edf2e9; font-size: 10px; line-height: 1.45; pointer-events: none; }
.tooltip h3 { margin: 0 0 5px; font-size: 12px; }
.tooltip-emoji { font-family: "Noto Color Emoji"; font-size: 16px; font-weight: 400; }
.tooltip .tip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; margin: 6px 0; color: #9eb0c4; }
.tooltip .counter { color: #ffe091; }
.hidden { display: none !important; }

.selection-card, .intel-card, .controls-card { margin-bottom: 8px; padding: 12px; border: 1px solid #294150; border-radius: 13px; background: linear-gradient(150deg, #172733, #0f1b24); box-shadow: inset 0 1px #ffffff0b; }
.selection-card h2 { margin: 5px 0 6px; font-size: 15px; line-height: 1.15; letter-spacing: -.015em; }
.selection-card > p { color: #9fb2b9; font-size: 10px; line-height: 1.45; }
.selection-list { max-height: 178px; margin: 8px 0; overflow-y: auto; }
.touch-multiselect { display: none; width: 100%; margin: 0 0 8px; padding: 9px 10px; border: 1px solid #3c6175; border-radius: 10px; background: #142b39; text-align: left; }
.touch-multiselect span, .touch-multiselect small { display: block; }
.touch-multiselect span { font-size: 11px; font-weight: 850; }
.touch-multiselect small { margin-top: 3px; color: #9db2bb; font-size: 9px; }
.touch-multiselect.active { border-color: #6ce5ff; background: #17445a; box-shadow: inset 0 0 0 1px #6ce5ff55; }
.touch-multiselect.active span { color: #a8efff; }
.selection-item { margin: 0 0 5px; padding: 7px 8px; border: 1px solid #2c4555; border-radius: 9px; background: #0c171f; }
.selection-item .row { display: flex; justify-content: space-between; gap: 6px; font-size: 9px; }
.selection-item .row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selection-item .row span { color: var(--muted); }
.progress { height: 4px; margin-top: 5px; overflow: hidden; border-radius: 4px; background: #1b2635; }
.progress i { display: block; height: 100%; width: 0; background: var(--blue); }
.selection-item.waiting .progress i { background: var(--gold); animation: pulse 1s infinite; }
.selection-item.syncing { border-color: #a66ad2; }
@keyframes pulse { 50% { opacity: .45; } }
.building-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; }
.building-actions button { min-width: 0; padding: 8px 6px; border: 1px solid #3c6175; border-radius: 9px; background: #173142; cursor: pointer; }
.building-actions button.sell { border-color: #774451; background: #3a2028; }
.building-actions span, .building-actions small { display: block; }
.building-actions span { font-size: 11px; font-weight: 850; }
.building-actions small { margin-top: 2px; overflow: hidden; color: #9db2bb; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.building-actions button:hover:not(:disabled) { border-color: #70d8ff; background: #21485e; }
.building-actions button.sell:hover:not(:disabled) { border-color: #ff8291; background: #512a34; }
.building-actions button:disabled { opacity: .35; cursor: not-allowed; }
.sync-button { width: 100%; padding: 10px; border: 1px solid #76529a; border-radius: 11px; background: linear-gradient(180deg, #4a2d66, #312044); cursor: pointer; box-shadow: inset 0 1px #ffffff16; }
.sync-button span, .sync-button small { display: block; }
.sync-button span { font-size: 12px; font-weight: 800; }
.sync-button small { margin-top: 2px; color: #c8aedc; font-size: 9px; }
.sync-button:hover:not(:disabled) { border-color: #d08cff; background: #45236c; }
.sync-button:disabled { opacity: .38; cursor: not-allowed; }
.rule-note { margin: 9px 0 0 !important; padding-top: 8px; border-top: 1px solid #273d4a; color: #8fa6ae !important; font-size: 9px !important; line-height: 1.45; }
.army-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #233844; color: #afc1c6; font-size: 10px; }
.army-row strong { color: #edf4fb; }
.base-health-row { display: grid; grid-template-columns: 56px 1fr 34px; gap: 6px; align-items: center; margin-top: 9px; font-size: 9px; }
.base-health-row strong { text-align: right; font-variant-numeric: tabular-nums; }
.mini-bar { height: 7px; overflow: hidden; border-radius: 8px; background: #263640; box-shadow: inset 0 1px 2px #0008; }
.mini-bar i { display: block; width: 100%; height: 100%; background: var(--blue); }
.base-health-row.enemy .mini-bar i { background: var(--red); }
.controls-card { padding: 0; overflow: hidden; }
.controls-card summary { padding: 10px 11px; color: #b9cbd0; font-size: 10px; font-weight: 800; cursor: pointer; }
.controls-card dl { margin: 0; padding: 0 11px 10px; }
.controls-card dl div { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 9px; }
.controls-card dt { color: #d7e3ef; }
.controls-card dd { margin: 0; color: var(--muted); text-align: right; }

.soft-overlay { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; border-radius: inherit; background: #020509a8; pointer-events: none; }
.soft-overlay div { padding: 16px 27px; border: 1px solid #68869a; border-radius: 14px; background: #0b1720ee; text-align: center; box-shadow: 0 18px 55px #000b; }
.soft-overlay strong { display: block; letter-spacing: .18em; }
.soft-overlay span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.result-overlay { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; background: radial-gradient(circle, #0c1932d9, #020407f2); backdrop-filter: blur(5px); }
.result-card { width: min(420px, calc(100vw - 30px)); padding: 31px; border: 1px solid #52778c; border-radius: 20px; background: linear-gradient(145deg, #193142, #0b161f); box-shadow: 0 30px 90px #000; text-align: center; }
.result-card h2 { margin: 6px 0 8px; font-size: 39px; }
.result-card p { color: #a9b8c7; font-size: 13px; }
.result-stats { display: flex; justify-content: center; gap: 20px; margin: 20px 0; color: var(--muted); font-size: 11px; }
.result-stats strong { display: block; color: #eef5fb; font-size: 17px; }
.result-card button { padding: 10px 25px; border: 1px solid #69c8ff; border-radius: 8px; background: #173b5a; cursor: pointer; }

.start-menu-overlay { position: fixed; z-index: 140; inset: 0; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 32%, #18384be8, #03070bf5 64%); backdrop-filter: blur(7px); }
.start-menu-card { width: min(560px, 100%); padding: 38px; border: 1px solid #5992aa; border-radius: 24px; background: linear-gradient(145deg, #1a3445f5, #09141df8 72%); box-shadow: 0 35px 120px #000, inset 0 1px #ffffff14; text-align: center; }
.start-menu-mark { width: 72px; height: 72px; margin: 0 auto 18px; display: grid; place-items: center; border: 1px solid #72d8f4a8; border-radius: 21px; background: linear-gradient(145deg, #2c6078, #122b3a); color: #c9f4ff; font-size: 21px; font-weight: 950; letter-spacing: .1em; box-shadow: inset 0 1px #ffffff25, 0 14px 40px #020609a0; }
.start-menu-card h1 { margin: 7px 0 10px; font-size: clamp(38px, 8vw, 62px); line-height: .95; letter-spacing: -.055em; }
.start-menu-card > p { max-width: 430px; margin: 0 auto; color: #a9bdc6; font-size: 13px; line-height: 1.55; }
.start-menu-actions { margin-top: 27px; display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.start-menu-actions button { min-height: 92px; padding: 17px; border: 1px solid #456c80; border-radius: 15px; background: linear-gradient(160deg, #183447, #10222e); color: #eaf5f8; cursor: pointer; text-align: left; box-shadow: inset 0 1px #ffffff10; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.start-menu-actions button.primary { border-color: #62c4eb; background: linear-gradient(160deg, #205779, #143247); }
.start-menu-actions button:hover { transform: translateY(-2px); border-color: #8be8ff; background: linear-gradient(160deg, #26556d, #173246); }
.start-menu-actions strong, .start-menu-actions span { display: block; }
.start-menu-actions strong { font-size: 17px; }
.start-menu-actions span { margin-top: 7px; color: #9db5bf; font-size: 10px; line-height: 1.35; }
.start-menu-card .start-menu-note { margin-top: 17px; color: #6f8e9c; font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }

.multiplayer-overlay { position: fixed; z-index: 120; inset: 0; display: grid; place-items: center; padding: 18px; background: #02060bd9; }
.multiplayer-card { position: relative; width: min(520px, 100%); padding: 27px; border: 1px solid #4f7a91; border-radius: 20px; background: linear-gradient(150deg, #193142, #0b161f 72%); box-shadow: 0 30px 100px #000; }
.multiplayer-card h2 { margin: 5px 0 8px; font-size: 26px; }
.multiplayer-card > p { color: #a9bbc4; font-size: 12px; line-height: 1.5; }
.multiplayer-close { position: absolute; right: 13px; top: 12px; width: 30px; height: 30px; border: 1px solid #426276; border-radius: 9px; background: #101f29; cursor: pointer; }
.multiplayer-actions { display: grid; grid-template-columns: 1fr auto 1.15fr 1fr; gap: 8px; align-items: end; margin-top: 18px; }
.multiplayer-actions > span { align-self: center; color: #77909c; font-size: 10px; text-align: center; text-transform: uppercase; }
.multiplayer-actions label span { display: block; margin-bottom: 4px; color: #8ea7b2; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.multiplayer-actions input { width: 100%; height: 39px; border: 1px solid #395568; border-radius: 9px; background: #08141c; padding: 8px 10px; color: #eaf7ff; font: 900 16px/1 monospace; letter-spacing: .16em; text-transform: uppercase; outline: none; }
.multiplayer-actions input:focus { border-color: #58cfff; box-shadow: 0 0 0 2px #58cfff22; }
.multiplayer-actions button, .room-code-panel button { min-height: 39px; border: 1px solid #4c819b; border-radius: 9px; background: #17384a; padding: 8px 12px; cursor: pointer; font-size: 11px; font-weight: 800; }
.room-code-panel { margin-top: 18px; display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 13px; border: 1px solid #416174; border-radius: 12px; background: #08131b; }
.room-code-panel span { color: #8da5af; font-size: 10px; text-transform: uppercase; }
.room-code-panel strong { color: #8be8ff; font: 950 24px/1 monospace; letter-spacing: .16em; }
.leave-room { margin-top: 12px; min-height: 36px; border: 1px solid #9b4c59; border-radius: 9px; background: #3a1720; padding: 8px 14px; color: #ffbdc5; cursor: pointer; font-size: 11px; font-weight: 800; }
.network-note { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid #2b4352; }
body[data-local-side="enemy"] .team-key .friendly i { width: 8px; height: 12px; border-radius: 2px; background: var(--red); transform: rotate(45deg) scale(.78); }
body[data-local-side="enemy"] .team-key .enemy i { width: 13px; height: 7px; border-radius: 999px; background: var(--blue); transform: none; }
body[data-local-side="enemy"] .base-health-row:not(.enemy) .mini-bar i { background: var(--red); }
body[data-local-side="enemy"] .base-health-row.enemy .mini-bar i { background: var(--blue); }

@media (max-width: 1180px) {
  .game-shell { grid-template-columns: 250px minmax(320px, 1fr) 215px; }
  .brand { width: 250px; flex-basis: 250px; }
  .soft-overlay { inset: 0; }
  .metric { min-width: 82px; padding-inline: 9px; }
  .topbar .metric:nth-child(3) { display: none; }
  .build-card { padding-inline: 8px; }
}
@media (max-width: 900px) {
  #app { grid-template-rows: 52px minmax(0, 1fr); }
  .topbar { height: 52px; min-width: 0; padding: 4px 5px; gap: 4px; }
  .brand { width: 174px; flex: 0 0 174px; padding: 4px 7px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand small { display: none; }
  .game-shell {
    min-width: 0;
    grid-template-columns: clamp(170px, 30vw, 230px) minmax(0, 1fr);
    grid-template-rows: minmax(160px, 1fr) clamp(126px, 32vh, 230px);
    gap: 6px;
    padding: 6px;
  }
  .build-panel { grid-column: 1; grid-row: 1 / 3; }
  .battlefield { grid-column: 2; grid-row: 1; }
  .command-panel {
    display: block;
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    padding: 6px;
    overflow-y: auto;
  }
  .selection-card, .intel-card, .controls-card { margin-bottom: 6px; padding: 8px; }
  .selection-card h2 { font-size: 13px; }
  .selection-list { max-height: 108px; }
  .rule-note { display: none; }
  .build-panel { padding: 10px 8px; }
  .build-card { min-height: 66px; grid-template-columns: 34px minmax(0, 1fr) auto; padding: 7px; }
  .unit-glyph { width: 34px; height: 34px; border-radius: 10px; font-size: 20px; }
  .match-strip .metric { display: none; }
  .metric { min-width: 72px; padding-inline: 7px; }
  .upgrade-button { min-width: 108px; padding-inline: 9px; }
  .icon-button { padding-inline: 10px; }
  .soft-overlay { inset: 0; }
}

@media (max-width: 600px) {
  html, body { height: auto; min-height: 100%; overflow-x: hidden; overflow-y: auto; }
  body { min-height: 100dvh; }
  #app { height: auto; min-height: 100dvh; grid-template-rows: auto auto; }
  .topbar { position: sticky; top: 0; height: auto; min-height: 52px; flex-wrap: wrap; padding: max(4px, env(safe-area-inset-top)) 5px 4px; }
  .brand { width: 52px; flex-basis: 52px; padding: 6px 8px; }
  .brand > :not(.brand-mark) { display: none; }
  .metric { min-width: 67px; padding-inline: 5px; }
  .metric strong { font-size: 12px; }
  .upgrade-button { min-width: 92px; padding: 6px; }
  .upgrade-button span { font-size: 8px; }
  .upgrade-button strong { font-size: 11px; }
  .icon-button { padding-inline: 7px; font-size: 10px; }
  .economy-strip { flex: 1 1 calc(100% - 56px); }
  .match-strip { width: 100%; margin: 0; justify-content: stretch; }
  .match-strip .icon-button { flex: 1; min-height: 42px; }
  .game-shell { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(300px, 48dvh) auto auto; gap: 7px; padding: 7px; }
  .battlefield { grid-column: 1; grid-row: 1; min-height: 300px; }
  .build-panel { grid-column: 1; grid-row: 2; max-height: none; padding: 12px 10px; }
  .command-panel { grid-column: 1; grid-row: 3; max-height: none; padding: 8px; overflow: visible; }
  .build-list { overflow: visible; }
  .tier-section.visible { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tier-title { grid-column: 1 / -1; }
  .build-card { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 4px; min-height: 60px; padding: 6px; }
  .unit-glyph { width: 30px; height: 30px; font-size: 18px; }
  .build-name span { display: none; }
  .panel-note { display: none; }
  .tier-legend { margin-top: 7px; }
  .tier-filter { font-size: 7px; padding-inline: 1px; }
  .command-panel { font-size: 9px; }
  .icon-button.network { width: 42px; overflow: hidden; font-size: 0; }
  .icon-button.network::after { content: "PvP"; font-size: 10px; }
  .multiplayer-card { padding: 22px 17px; }
  .multiplayer-actions { grid-template-columns: 1fr 1fr; }
  .multiplayer-actions > span { display: none; }
  .multiplayer-actions label { grid-column: 1; }
  .start-menu-card { padding: 28px 19px; }
  .start-menu-actions { grid-template-columns: 1fr; }
  .start-menu-actions button { min-height: 76px; }
  .canvas-hint { right: 7px; bottom: 7px; left: 7px; text-align: center; }
  .desktop-hint { display: none; }
  .touch-hint { display: inline; }
  .team-key { left: 7px; top: 7px; }
  .placement-banner { top: 48px; max-width: calc(100% - 16px); }
  .start-menu-overlay, .multiplayer-overlay, .result-overlay { overflow-y: auto; padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .start-menu-card { margin: auto; }
  .multiplayer-actions input { font-size: 16px; }
}

@media (max-width: 390px) {
  .economy-strip .metric:nth-child(2) { display: none; }
  .upgrade-button { min-width: 84px; }
  .tier-section.visible { grid-template-columns: 1fr; }
  .start-menu-mark { width: 56px; height: 56px; margin-bottom: 12px; }
  .start-menu-card h1 { font-size: 38px; }
}

@media (pointer: coarse) {
  button, summary { min-height: 44px; }
  .small-button, .tier-filter { min-height: 40px; }
  .build-card { min-height: 68px; }
  .desktop-hint { display: none; }
  .touch-hint { display: inline; }
  .tooltip { display: none !important; }
  .touch-multiselect { display: block; }
}

body:has(.start-menu-overlay:not(.hidden)),
body:has(.multiplayer-overlay:not(.hidden)),
body:has(.result-overlay:not(.hidden)) { overflow: hidden; }

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