* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #07090c; color: #e8e2d4; font-family: Georgia, serif; overflow: hidden; }
#rts-wrap { position: fixed; inset: 0; }
#rts-canvas { width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
#rts-top { position: absolute; top: 0; left: 0; right: 240px; display: flex; gap: 8px; align-items: center; padding: 9px 12px; background: linear-gradient(180deg, rgba(5,8,10,.9), rgba(5,8,10,0)); z-index: 5; }
.chip { background: rgba(16,22,26,.92); border: 1px solid #3d4a4a; border-radius: 8px; padding: 6px 12px; font-size: 16.5px; }
.chip.dim { color: #9fb3ab; }
/* Pacing retest (Nov 22, 2026): the HUD message chip had no flex room, so
   long messages — including the opening build-order brief — overflowed
   the top bar and clipped mid-word. The message now takes the bar's
   leftover width and wraps inside its chip. */
#hud-msg { flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.chip.low { border-color: #b03030; color: #ff9a9a; }
.spacer { flex: 1; }
.top-btn { background: #1a2422; color: #e8e2d4; border: 1px solid #4a5a54; border-radius: 8px; padding: 7px 13px; font-size: 15.5px; cursor: pointer; font-family: inherit; }
.top-btn:disabled { opacity: .45; }
#rts-side { position: absolute; top: 0; right: 0; bottom: 0; width: 240px; background: rgba(9,13,15,.95); border-left: 1px solid #37474a; padding: 12px; overflow-y: auto; z-index: 5; }
.side-sec h3 { font-size: 14.5px; letter-spacing: 1.5px; color: #ffd98a; margin: 10px 0 6px; }
.b-btn { display: block; width: 100%; text-align: left; background: #182220; border: 1px solid #41534c; color: #e8e2d4; border-radius: 8px; padding: 7px 9px; margin: 5px 0; cursor: pointer; font-family: inherit; font-size: 14px; }
.b-btn:hover { background: #22302b; }
.b-btn:disabled { opacity: .42; cursor: default; }
.b-btn b { color: #ffd98a; }
.b-btn .q { float: right; color: #57e6d9; }
#sel-info { font-size: 14px; color: #b9c6bd; line-height: 1.5; }
#sel-info b { color: #ffd98a; }
#rts-intro, #rts-end { position: absolute; inset: 0; background: rgba(4,6,8,.92); z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
#rts-intro h1 { font-size: 52px; letter-spacing: 5px; margin: 0 0 8px; color: #ffd98a; text-shadow: 0 0 34px rgba(255,180,60,.3); }
#rts-end h2 { font-size: 40px; color: #ffd98a; margin: 0 0 10px; }
#rts-end p { font-size: 18.5px; color: #b9c6bd; max-width: 620px; line-height: 1.5; }
.tag { color: #b9c6bd; font-size: 18px; line-height: 1.5; }
.fac-row { display: flex; gap: 12px; margin: 18px 0 22px; flex-wrap: wrap; justify-content: center; }
.fac { width: 300px; text-align: left; background: #10181a; border: 2px solid #37474a; border-radius: 12px; padding: 14px; }
.fac h4 { margin: 0 0 6px; font-size: 18px; }
.fac p { margin: 0; font-size: 14.5px; color: #a9bab0; line-height: 1.45; }
.fac.aegis h4 { color: #ffd98a; } .fac.syndicate h4 { color: #c4a8ff; } .fac.keepers h4 { color: #8fe0c8; }
.big-btn { background: #5d3b16; border: 1px solid #c98f2e; color: #ffe9bb; border-radius: 10px; padding: 13px 30px; font-size: 19px; cursor: pointer; font-family: inherit; }
.big-btn:hover { background: #75501d; }
.fine { color: #77877e; font-size: 13.5px; margin-top: 16px; max-width: 640px; }
#rts-intro .fac { cursor: pointer; }
#rts-intro .fac.sel { border-color: #c98f2e; background: #1b1710; }
.setup-row { display: flex; gap: 14px; align-items: center; margin: 5px 0; font-size: 16px; color: #b9c6bd; }
.setup-row > span:first-child { width: 130px; text-align: right; letter-spacing: 1px; }
.set-btn { background: #182220; border: 1px solid #41534c; color: #e8e2d4; border-radius: 8px; padding: 7px 14px; margin: 0 3px; cursor: pointer; font-family: inherit; font-size: 15px; }
.set-btn.sel { border-color: #c98f2e; background: #2a2113; color: #ffe9bb; }
.menu-row { display: flex; gap: 12px; margin-top: 20px; }
.big-btn.alt { background: #14201e; border-color: #2e7f86; color: #bfeef2; }
#rts-campaign { position: absolute; inset: 0; background: rgba(4,6,8,.94); z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; text-align: center; padding: 30px 24px; overflow-y: auto; }
#rts-campaign h1 { font-size: 42px; letter-spacing: 5px; color: #ffd98a; margin: 0 0 6px; }
#camp-factions .fac { cursor: pointer; }
#camp-factions .fac.sel { border-color: #c98f2e; background: #1b1710; }
#camp-missions { display: flex; flex-direction: column; gap: 8px; width: min(760px, 92vw); margin: 8px 0 20px; }
.mission { text-align: left; background: #10181a; border: 1px solid #37474a; border-radius: 10px; padding: 11px 14px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.mission h4 { margin: 0 0 3px; font-size: 16.5px; color: #ffd98a; }
.mission p { margin: 0; font-size: 13.5px; color: #a9bab0; line-height: 1.4; }
.mission.locked { opacity: .55; }
.mission:not(.locked) { cursor: pointer; }
.mission.sel { border-color: #c98f2e; background: rgba(201,143,46,.10); }
.mission .play-btn { background: #5d3b16; border: 1px solid #c98f2e; color: #ffe9bb; border-radius: 8px; padding: 8px 16px; cursor: pointer; font-family: inherit; font-size: 15px; white-space: nowrap; }
.mission .soon { color: #77877e; font-size: 13.5px; white-space: nowrap; }

/* #868 — MENU IDENTITY: orbiting battlefield through a vignette, heraldry banners, the war table */
#rts-intro { background: radial-gradient(120% 90% at 50% 40%, rgba(4,6,8,.14) 0%, rgba(4,6,8,.5) 52%, rgba(3,4,6,.93) 100%), linear-gradient(180deg, rgba(3,4,6,.68) 0%, rgba(3,4,6,0) 20%, rgba(3,4,6,0) 72%, rgba(3,4,6,.9) 100%); }
#rts-campaign { background: radial-gradient(120% 90% at 50% 30%, rgba(4,6,8,.34) 0%, rgba(4,6,8,.72) 55%, rgba(3,4,6,.95) 100%); }
#rts-intro h1 { display: inline-block; padding: 10px 36px 13px; border: 2px solid #c98f2e; outline: 1px solid rgba(201,143,46,.4); outline-offset: 5px; background: linear-gradient(180deg, rgba(28,20,10,.88), rgba(10,8,5,.93)); box-shadow: 0 12px 34px rgba(0,0,0,.65), inset 0 0 26px rgba(201,143,46,.13); }
#rts-intro .fac { text-align: center; border-radius: 4px 4px 12px 12px; box-shadow: 0 12px 24px rgba(0,0,0,.55); }
.crest { width: 48px; height: 58px; margin: 0 auto 10px; display: flex; align-items: flex-start; justify-content: center; padding-top: 9px; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); box-shadow: inset 0 -8px 12px rgba(0,0,0,.35); }
.crest svg { width: 27px; height: 27px; }
.fac.aegis { background: linear-gradient(180deg, rgba(216,168,58,.16), #151006 58%, #100c06); }
.fac.aegis .crest { background: linear-gradient(180deg, #96742a, #5d3b16); color: #ffe9bb; }
.fac.syndicate { background: linear-gradient(180deg, rgba(138,95,232,.17), #110b1a 58%, #0c0812); }
.fac.syndicate .crest { background: linear-gradient(180deg, #4b2f86, #241543); color: #dcc9ff; }
.fac.keepers { background: linear-gradient(180deg, rgba(63,174,138,.15), #0b1511 58%, #081009); }
.fac.keepers .crest { background: linear-gradient(180deg, #256b52, #123528); color: #c9f2e2; }
#rts-intro .fac.aegis.sel { border-color: #d8a83a; box-shadow: 0 0 24px rgba(216,168,58,.4), 0 12px 24px rgba(0,0,0,.55); }
#rts-intro .fac.syndicate.sel { border-color: #8a5fe8; box-shadow: 0 0 24px rgba(138,95,232,.45), 0 12px 24px rgba(0,0,0,.55); }
#rts-intro .fac.keepers.sel { border-color: #3fae8a; box-shadow: 0 0 24px rgba(63,174,138,.4), 0 12px 24px rgba(0,0,0,.55); }
#camp-factions .fac { box-shadow: 0 10px 22px rgba(0,0,0,.5); }
#camp-factions .fac.syndicate.sel { border-color: #8a5fe8; }
#camp-factions .fac.keepers.sel { border-color: #3fae8a; }
#rts-intro .setup-row { width: min(700px, 94vw); justify-content: flex-start; background: linear-gradient(180deg, rgba(26,20,12,.93), rgba(12,10,7,.95)); border: 1px solid #4a3a1c; border-radius: 10px; padding: 8px 16px; margin: 6px 0; box-shadow: 0 8px 20px rgba(0,0,0,.5); }
.big-btn { background: linear-gradient(180deg, #73491f, #53320e); border: 1px solid #d8a83a; box-shadow: 0 8px 20px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,220,150,.35); letter-spacing: 1px; }
.big-btn:hover { background: linear-gradient(180deg, #855723, #64400f); }

/* #869 — PAINTED FACTION ART */
.fac-art { width: calc(100% + 28px); height: 118px; object-fit: cover; object-position: 50% 16%; display: block; margin: -14px -14px 0; border-bottom: 2px solid #37474a; border-radius: 4px 4px 0 0; }
.fac.aegis .fac-art { border-color: #d8a83a; }
.fac.syndicate .fac-art { border-color: #8a5fe8; }
.fac.keepers .fac-art { border-color: #3fae8a; }
.crest { margin-top: -30px; position: relative; z-index: 2; }

/* #869b — flex-overflow title clip fix */
#rts-intro, #rts-campaign { justify-content: flex-start; }
.screen-inner { margin: auto 0; }

/* #870 — LEADERBOARD */
#rts-lb h4 { margin: 16px 0 4px; font-size: 17px; }
.lb-list { list-style: none; margin: 6px auto 4px; width: min(360px, 86vw); text-align: left; padding: 0; }
.lb-list li { display: flex; justify-content: space-between; padding: 5px 10px; border-bottom: 1px solid rgba(216,168,58,.18); color: #d8d2c2; }
.lb-list li b { color: #ffd98a; }
.lb-none, .lb-loading { color: #9d968a; font-style: italic; }

/* #870 — LEADERBOARD */
#rts-lb { position: absolute; inset: 0; background: rgba(4,6,8,.95); z-index: 11; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; overflow-y: auto; padding: 28px 24px; text-align: center; }
#rts-lb h4 { margin: 16px 0 4px; font-size: 17px; }
.lb-list { list-style: none; margin: 6px auto 4px; width: min(360px, 86vw); text-align: left; padding: 0; }
.lb-list li { display: flex; justify-content: space-between; padding: 5px 10px; border-bottom: 1px solid rgba(216,168,58,.18); color: #d8d2c2; }
.lb-list li b { color: #ffd98a; }
.lb-none, .lb-loading { color: #9d968a; font-style: italic; }

/* #872 — FMV BRIEFING */
/* Batch 2e: the briefing is a comms card docked over the live map,
 * not a full-screen takeover — the mission idles behind it. */
#rts-fmv { position: absolute; left: auto; top: auto; right: 18px; bottom: 18px; z-index: 12; width: min(700px, calc(100vw - 36px)); max-height: 76vh; background-color: #060809; background-size: cover; background-position: center; display: flex; padding: 0; border: 1px solid #6b5322; border-radius: 12px; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.75); }
#rts-fmv::before { content: ""; position: absolute; inset: 0; background: rgba(3,5,7,.72); }
.fmv-frame { position: relative; display: flex; gap: 18px; align-items: stretch; width: 100%; background: rgba(8,10,13,.92); padding: 16px; overflow-y: auto; }
.fmv-portrait-wrap { flex: 0 0 176px; border: 2px solid #6b5322; border-radius: 6px; overflow: hidden; }
.fmv-portrait-wrap img { width: 100%; height: 100%; min-height: 212px; object-fit: cover; object-position: 50% 18%; display: block; }
.fmv-body { flex: 1; display: flex; flex-direction: column; text-align: left; }
#fmv-who { font-family: var(--fh, sans-serif); letter-spacing: .22em; font-size: 12px; color: #57e6d9; text-transform: uppercase; }
#fmv-title { margin: 8px 0 10px; font-size: 26px; }
#fmv-script { color: #d8d2c2; line-height: 1.65; font-size: 16.5px; flex: 1; }
/* ---------- CUTSCENES (#883) ---------- */
#rts-cutscene { position: fixed; inset: 0; z-index: 40; background: #000; display: flex; align-items: center; justify-content: center; }
#rts-cutscene.hidden { display: none; }
.cs-frame { width: min(1120px, 96vw); display: flex; flex-direction: column; gap: 10px; align-items: center; }
#cs-title { color: #d8c690; letter-spacing: .14em; font-size: 15px; text-align: center; }
.cs-video-wrap { position: relative; width: 100%; }
#cs-video { width: 100%; aspect-ratio: 16 / 9; background: #000; display: block; }
#cs-play-big { position: absolute; inset: 0; margin: auto; width: 150px; height: 64px; font-size: 20px; background: rgba(8,10,13,.88); color: #e8d9a8; border: 1px solid #6b5322; border-radius: 8px; cursor: pointer; }
#cs-sound { position: absolute; right: 12px; bottom: 12px; background: rgba(8,10,13,.88); color: #e8d9a8; border: 1px solid #6b5322; border-radius: 8px; padding: 8px 12px; cursor: pointer; }
.cs-replay883 { margin-left: 8px; }
/* ---------- COMMS POP-UP (#883) ---------- */
#rts-comms { position: fixed; left: 14px; bottom: 14px; width: 280px; z-index: 30; background: rgba(6,9,11,.92); border: 1px solid #2e6f6a; border-radius: 8px; padding: 8px; box-shadow: 0 14px 44px rgba(0,0,0,.65); }
#rts-comms.hidden { display: none; }
.comms-head { display: flex; justify-content: space-between; align-items: center; color: #7fe8dc; font-size: 12px; letter-spacing: .1em; margin-bottom: 6px; }
#comms-x { background: none; border: none; color: #7fe8dc; cursor: pointer; font-size: 14px; }
#comms-video { width: 100%; aspect-ratio: 1 / 1; background: #000; display: block; }
#comms-line { color: #cfd8d4; font-size: 12.5px; line-height: 1.45; margin: 6px 2px 2px; }
@media (max-width: 720px) { .fmv-frame { flex-direction: column; } .fmv-portrait-wrap { flex: none; } .fmv-portrait-wrap img { min-height: 0; height: 220px; } }

/* ---------- #893 — UI OVERHAUL (Brody: "the ui is shit") ----------
   C&C grammar: a solid command bar up top, a fixed sidebar that never
   scrolls as one long list — build palettes as tile grids in their own
   scroll region, and the selection card pinned to the sidebar foot. */
#rts-top { right: 264px; background: rgba(5,8,10,.95); border-bottom: 1px solid #37474a; padding: 8px 12px; }
#hud-msg { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#rts-side { width: 264px; display: flex; flex-direction: column; overflow: hidden; padding: 0; background: rgba(8,12,14,.97); }
#side-scroll { flex: 1 1 auto; overflow-y: auto; padding: 4px 10px 10px; scrollbar-width: thin; scrollbar-color: #41534c #0b0f11; }
#side-scroll::-webkit-scrollbar { width: 8px; }
#side-scroll::-webkit-scrollbar-thumb { background: #41534c; border-radius: 4px; }
#side-scroll::-webkit-scrollbar-track { background: #0b0f11; }
.side-sec h3 { font-size: 13px; letter-spacing: 2px; margin: 12px 0 7px; padding-bottom: 5px; border-bottom: 1px solid rgba(201,143,46,.35); }
#build-structures { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.b-btn { position: relative; display: block; width: 100%; min-height: 56px; margin: 0; padding: 7px 8px; text-align: left; background: linear-gradient(180deg, #1b2622, #141d1a); border: 1px solid #4a5d54; border-radius: 8px; color: #ffd98a; font-size: 12.5px; line-height: 1.35; cursor: pointer; }
.b-btn b { display: block; color: #f2ead6; font-size: 13px; line-height: 1.25; margin-bottom: 2px; }
.b-btn small { display: block; color: #8fa398; font-size: 10.5px; line-height: 1.3; margin-top: 2px; }
.b-btn:hover { background: linear-gradient(180deg, #26352e, #1a2621); border-color: #c98f2e; }
.b-btn:disabled { background: #0c1013; border-color: #232b2e; color: #66766c; cursor: default; }
.b-btn:disabled b { color: #7e8f85; }
.b-btn:disabled small { color: #55645c; }
.b-btn .q { position: absolute; top: 5px; right: 6px; float: none; background: #123a36; border: 1px solid #2e7f86; border-radius: 9px; padding: 0 6px; font-size: 11px; color: #7fe8dc; }
#side-selection { flex: 0 0 auto; border-top: 2px solid #37474a; background: rgba(13,19,22,.85); padding: 2px 12px 12px; max-height: 38%; overflow-y: auto; }
#side-selection h3 { font-size: 13px; letter-spacing: 2px; color: #ffd98a; margin: 10px 0 6px; padding-bottom: 5px; border-bottom: 1px solid rgba(201,143,46,.35); }
#sel-info { font-size: 13.5px; }
#sel-info .b-btn { margin-top: 8px; }
.top-btn, .b-btn, .set-btn, .big-btn { outline: none; }
.top-btn:focus-visible, .b-btn:focus-visible, .set-btn:focus-visible, .big-btn:focus-visible { outline: 2px solid #57e6d9; outline-offset: 1px; }

/* #894 — palette icons + drag box */
.b-ico { width: 100%; height: 46px; object-fit: cover; border-radius: 5px; display: block; margin-bottom: 5px; }
#rts-dragbox { position: fixed; border: 1.5px solid #57e6d9; background: rgba(87,230,217,.10); z-index: 6; pointer-events: none; }

/* #931 command pass */
#side-minimap931 { padding: 10px 12px 2px; }
#minimap931 { display: block; width: 236px; max-width: 100%; height: auto; background: #1c2316; border: 1px solid #41534c; border-radius: 6px; cursor: pointer; }
.q-chip931 { display: inline-block; background: #123a36; border: 1px solid #2e7f86; border-radius: 9px; padding: 0 4px 0 7px; margin: 0 2px; font-size: 11.5px; color: #7fe8dc; }
.q-cancel931 { background: none; border: none; color: #ff9a8a; cursor: pointer; font-size: 11px; padding: 0 3px; margin-left: 5px; }
.q-cancel931:hover { color: #ffc4bb; }
#side-cmd931 { padding: 4px 12px 12px; }
.cmd-row931 { display: flex; align-items: center; gap: 8px; color: #cfe0d6; font-size: 13px; margin: 7px 0; cursor: pointer; }
.cmd-row931 input[type="range"] { flex: 1; accent-color: #c98f2e; }
.cmd-row931 input[type="checkbox"] { accent-color: #c98f2e; }
.cmd-help931 { color: #77877e; font-size: 11.5px; line-height: 1.5; margin-top: 6px; }
.cmd-help-wrap { margin-top: 8px; }
.cmd-help-wrap summary { color: #9fb3ab; font-size: 12.5px; cursor: pointer; letter-spacing: .4px; }
.cmd-help-wrap summary:hover { color: #ffd98a; }
#prod-lines { margin-top: 7px; }
.prod-line931 { color: #9fb3ab; font-size: 12.5px; margin: 3px 0; }

/* Phase 3 — production radial: the building wears its wares.
   The ring is anchored to the building's screen position by
   positionRadial(); the container never eats clicks, its
   buttons do. */
#rts-radial { position: absolute; width: 0; height: 0; z-index: 7; pointer-events: none; }
#rts-radial.hidden { display: none; }
.rad-hub { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); min-width: 92px; max-width: 168px; text-align: center; background: rgba(8,12,14,.92); border: 1px solid #c98f2e; border-radius: 10px; padding: 6px 8px; color: #f2ead6; pointer-events: auto; }
.rad-hub b { display: block; font-size: 13px; color: #ffd98a; line-height: 1.25; }
.rad-hub small { color: #9fb3ab; font-size: 11px; }
.rad-queue { margin-top: 4px; }
.rad-btn { position: absolute; left: 0; top: 0; width: 58px; height: 58px; border-radius: 50%; transform: translate(-50%, -50%) rotate(var(--a)) translateY(-96px) rotate(calc(-1 * var(--a))); background: radial-gradient(circle at 50% 36%, #24332e, #0b1113 78%); border: 2px solid #4a5d54; color: #ffd98a; cursor: pointer; pointer-events: auto; padding: 0; overflow: hidden; }
.rad-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rad-btn:hover { border-color: #c98f2e; }
/* The disabled dimming used to be a filter on the whole button, which
   crushed the cost strip's contrast along with the art (Gemini Phase 3
   note). The art greys; the price stays readable. */
.rad-btn:disabled { cursor: default; border-color: #232b2e; background: radial-gradient(circle at 50% 36%, #1a2422, #0b1113 78%); }
.rad-btn:disabled img { filter: grayscale(.85) brightness(.55); }
.rad-btn:disabled .rad-cost { background: rgba(5,8,10,.88); color: #ffd98a; }
.rad-btn .rad-cost { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(5,8,10,.82); font-size: 10.5px; line-height: 1.5; color: #ffd98a; text-align: center; }
.rad-btn.rad-res { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.rad-res-t { font-size: 12px; font-weight: bold; color: #f2ead6; }
.rad-btn.rad-res .rad-cost { position: static; background: none; font-size: 10px; }
#rts-paused931 { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(4,6,8,.55); z-index: 8; color: #f2ead6; text-align: center; }
#rts-paused931 h2 { font-size: 34px; letter-spacing: 3px; margin: 0 0 6px; }

/* #946 painted UI icon tiles (ICON LAW) */
.tico{width:32px;height:32px;vertical-align:-9px;flex:none;pointer-events:none}
.tico.sm{width:28px;height:28px;vertical-align:-7px}
.tico.lg{width:40px;height:40px;vertical-align:-11px}
.tico.cart{width:36px;height:36px;vertical-align:-10px}
button .tico{vertical-align:middle}
