:root{color-scheme:dark;--bg:#0a1322;--panel:#142237;--line:#31435a;--gold:#e2c18a;--muted:#a9bbcf;--text:#edf3fc}*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at top,#213958 0,var(--bg) 48%);color:var(--text);font:15px/1.6 system-ui,'Yu Gothic',sans-serif;min-height:100vh}header{display:flex;gap:16px;align-items:center;padding:16px clamp(16px,4vw,60px);border-bottom:1px solid var(--line);background:#0b1424}.brand{font-family:Georgia,serif;color:var(--gold);font-size:clamp(20px,3vw,29px);font-weight:bold;letter-spacing:2px;text-decoration:none;margin-right:auto}.brand small{font:11px system-ui;color:var(--muted);letter-spacing:1px}main{max-width:1500px;margin:auto;padding:20px clamp(12px,3vw,44px)}h1{font-size:clamp(27px,4vw,49px);line-height:1.22;margin:8px 0 14px}h2{font-size:19px;margin:0 0 12px;color:var(--gold)}p{margin:8px 0 16px}small,.muted{color:var(--muted)}.eyebrow{font-size:12px;color:var(--gold);letter-spacing:3px;font-weight:bold;margin:0}.hero{max-width:750px;margin:5vh auto;text-align:center}.hero form{max-width:460px;margin:28px auto;text-align:left}.panel{border:1px solid var(--line);background:linear-gradient(145deg,#182a41,#111d30);padding:18px;border-radius:12px;box-shadow:0 8px 24px #0003}.sectionhead{margin:16px 0 22px}.sectionhead button{float:right}.modes{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:16px}.modes .panel{min-height:180px}.layout{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:16px;align-items:start}aside .panel{margin-bottom:12px}label{display:block;font-size:13px;color:var(--muted);margin:12px 0}input,select{display:block;width:100%;background:#091526;border:1px solid #415671;border-radius:6px;color:var(--text);padding:10px;margin-top:4px;font:inherit}button{background:var(--gold);color:#172033;border:1px solid var(--gold);border-radius:6px;font:600 14px system-ui;padding:10px 15px;cursor:pointer}button:hover{filter:brightness(1.12)}button:disabled{opacity:.5;cursor:not-allowed}.secondary{background:#21344c;color:var(--text);border-color:#425776}.actions{display:flex;gap:8px;flex-wrap:wrap}.maphead{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:12px}.maphead h2{margin:0}#map{display:block;background:radial-gradient(ellipse,#1c3951,#0a1b2e);border:1px solid #35475d;border-radius:7px;width:100%;touch-action:none;cursor:grab;min-height:200px}#map path{stroke:#a9c0d0;stroke-width:.55;vector-effect:non-scaling-stroke;cursor:pointer;fill-rule:evenodd}#map path:hover,#map path:focus{stroke:#fff;stroke-width:1.6;outline:none}#map path.active{fill:#e2c18a;stroke:#fff;stroke-width:1.5}.selected{padding:10px;background:#0c1828;border-radius:6px;margin-top:10px}.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px;margin-bottom:16px}.stat{padding:12px;background:#182a41;border:1px solid var(--line);border-radius:9px}.stat strong{display:block;font-size:22px}.policy{display:flex;align-items:center;justify-content:space-between;gap:6px;margin:10px 0}.policy button{padding:8px}.admin{margin:24px 0;max-width:450px}#notice:not(:empty){background:#243750;border:1px solid #6d83a2;padding:10px 16px;border-radius:8px;margin-bottom:16px}footer{text-align:center;color:var(--muted);font-size:12px;padding:24px;border-top:1px solid var(--line)}[hidden]{display:none!important}@media(max-width:780px){.layout{grid-template-columns:1fr}header{gap:8px}.brand small{display:none}main{padding:14px}.mapPanel{padding:10px}}
.homeDaily{margin-bottom:18px;display:grid;gap:8px;max-width:640px}.homeDaily progress{width:100%;accent-color:var(--gold)}.homeDaily p{margin:0}.homeDaily button{justify-self:start}.matchSetup{margin-top:16px;max-width:640px}.game-open{overflow:hidden}.game-open header,.game-open footer{display:none}.game-open main{max-width:none;padding:0;margin:0}.game-open #notice:not(:empty){position:fixed;top:72px;left:50%;transform:translateX(-50%);z-index:20;max-width:90vw}.game-open #game{position:fixed;inset:0;background:#0b1d30;isolation:isolate}.game-open .layout,.game-open .mapPanel{display:block;position:absolute;inset:0;padding:0;margin:0;border:0;border-radius:0;box-shadow:none;background:none}.game-open #map{width:100%;height:100%;border:0;border-radius:0;min-height:0}.game-open .sectionhead{position:absolute;z-index:4;left:12px;top:10px;right:12px;margin:0;pointer-events:none;display:flex;gap:8px;align-items:center;flex-wrap:wrap}.game-open .sectionhead button{float:none;pointer-events:auto;padding:8px 10px}.game-open .sectionhead h1{font-size:18px;margin:0;text-shadow:0 2px 5px #000}.game-open .sectionhead .eyebrow{font-size:10px}.game-open #stats{position:absolute;z-index:3;top:58px;left:12px;right:12px;display:flex;flex-wrap:wrap;gap:5px;pointer-events:none;margin:0}.game-open .stat{background:#0b182bd9;border:0;border-radius:3px;padding:5px 10px}.game-open .stat strong{font-size:15px}.game-open .stat small{font-size:10px}.game-open .maphead{position:absolute;z-index:4;bottom:22px;left:12px;margin:0}.game-open .maphead h2{display:none}.game-open .mapPanel>small{position:absolute;bottom:2px;left:12px;font-size:9px;pointer-events:none}.game-open .selected{position:absolute;z-index:2;bottom:75px;left:12px;background:#0b182bcc;border-radius:4px;max-width:50vw;margin:0;padding:5px 10px;font-size:13px;pointer-events:none}.game-open aside{position:absolute;right:12px;top:125px;bottom:18px;z-index:5;width:min(310px,85vw);overflow-y:auto;pointer-events:auto}.game-open aside .panel{background:#102037eb;border:0;border-radius:5px;box-shadow:0 5px 20px #0005;padding:12px;margin-bottom:8px}.game-open aside label{margin:7px 0}.game-open aside h2{font-size:16px}.game-open aside input,.game-open aside select{padding:7px}.game-open #sidePanel.closed{display:none}.scoreRow{display:flex;justify-content:space-between;gap:8px;border-bottom:1px solid #415671;padding:8px 0}.game-open #map path.own{fill:#58bcb2;stroke:#e4ffff;stroke-width:1.4}.game-open #map path.rival{fill:#be825d}.game-open #map path.active{stroke:#fff;stroke-width:2}.game-open #map path.active:not(.own):not(.rival){fill:#e2c18a}@media(max-width:650px){.game-open .sectionhead h1{font-size:14px}.game-open .sectionhead .eyebrow{display:none}.game-open #stats{top:82px}.game-open aside{top:180px;bottom:60px;width:min(290px,82vw)}.game-open .stat{padding:3px 6px}.game-open .stat strong{font-size:12px}.game-open .maphead button{padding:7px 10px}}
.profileGrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px}.profileGrid article p{font-size:18px}.buildBar{position:absolute;bottom:8px;left:50%;transform:translateX(-50%);z-index:6;width:min(590px,90vw);padding:7px;background:#102037ed;color:#edf3fc;border-radius:5px;box-shadow:0 4px 16px #0004}.buildTitle{font-size:12px;padding:0 5px 3px;color:#d8c39d}.buildButtons{display:flex;gap:5px;flex-wrap:wrap;justify-content:center}.buildButtons button{padding:6px 9px;font-size:12px;background:#223955;color:#fff;border-color:#536d88}.buildButtons button.chosen{background:#e2c18a;color:#142237}.game-open .maphead{bottom:100px}.game-open .selected{bottom:149px}.game-open .mapPanel>small{bottom:2px;left:auto;right:8px}.countryMenu,.eventBox{position:absolute;z-index:5;background:#102037eb;color:#edf3fc;border-radius:5px;padding:10px 12px;box-shadow:0 4px 16px #0004;max-width:min(275px,80vw);font-size:13px}.countryMenu{left:12px;top:125px;width:260px}.countryMenu p{margin:5px 0}.countryMenu button{padding:6px 9px;margin:2px;font-size:12px}.countryHead{display:flex;justify-content:space-between;align-items:center;gap:8px}.eventBox{right:12px;bottom:85px;width:260px;z-index:4;pointer-events:auto}.game-open aside:not(.closed){z-index:7;bottom:85px}.eventBox button{padding:3px 9px}.eventBox p{margin:3px 0;font-size:11px}.logIncome{color:#9de8bc}.railLink{stroke:#ffe09a;stroke-width:1.6;vector-effect:non-scaling-stroke;stroke-dasharray:4 2;pointer-events:none}.railRange{fill:#eed18b22;stroke:#f1d797;stroke-width:1;vector-effect:non-scaling-stroke;stroke-dasharray:4 3;pointer-events:none}.facilityDot{fill:#142237;stroke:#e4c48d;stroke-width:1.1;vector-effect:non-scaling-stroke}.facilityDot.connected{stroke:#6ef0b2}.facility text{fill:#fff;pointer-events:none;font-weight:bold}.facility .facilityLevel{fill:#fff;stroke:#132238;stroke-width:.12;paint-order:stroke}.facility{cursor:pointer}.facility.rail .facilityDot{fill:#6e5229}.facility.port .facilityDot{fill:#1d5c84}.facility.factory .facilityDot{fill:#574c66}.facility.city .facilityDot{fill:#1c695e}#map.building,#map.building path{cursor:crosshair}.light{color-scheme:light;--bg:#f0f3f7;--panel:#fff;--line:#c9d2de;--gold:#82551c;--muted:#52647a;--text:#172b43;background:var(--bg)}.light header{background:#fff}.light .panel{background:#fff;box-shadow:0 5px 15px #40508012}.light input,.light select{background:#fff;color:#142237;border-color:#a7b6c8}.light button{background:#b17b35;border-color:#9b682e;color:#fff}.light .secondary{background:#e9eef5;color:#172b43;border-color:#a7b6c8}.light.game-open #map{background:#d7eaf4}.light.game-open .stat,.light.game-open aside .panel,.light .buildBar,.light .eventBox,.light .countryMenu,.light.game-open .selected{background:#fffffff0;color:#162b42}.light .buildTitle,.light .logIncome{color:#236447}.light.game-open .sectionhead h1{color:#182a41;text-shadow:0 1px 2px #fff}.light .buildButtons button{background:#e7edf3;color:#172b43}.light .buildButtons button.chosen{background:#b17b35;color:white}.light .railLink{stroke:#8c5c23}.light #notice:not(:empty){background:#fff;color:#162b42}.light .scoreRow{border-color:#ccd5df}@media(max-width:650px){.buildBar{width:96vw;bottom:5px}.buildButtons button{font-size:11px;padding:5px 6px}.game-open .maphead{bottom:105px}.game-open .selected{bottom:146px}.eventBox{bottom:155px;right:5px;width:170px;max-height:130px;overflow:auto}.countryMenu{top:137px;left:5px;max-width:75vw}.game-open aside:not(.closed){bottom:100px}.game-open .mapPanel>small{display:none}}
/* v0.4 command HUD */
.game-open #stats{top:auto;bottom:112px;left:50%;right:auto;transform:translateX(-50%);width:max-content;max-width:96vw;justify-content:center;gap:3px}.game-open .stat{border:1px solid #64748b80;box-shadow:0 3px 10px #0006;background:#102037ee}.game-open .stat strong{color:#f0ce89}.game-open .buildBar{width:min(720px,96vw);border:1px solid #b9945e88;background:linear-gradient(155deg,#26374f,#111e31);padding:8px}.buildButtons button{border-radius:4px;box-shadow:inset 0 1px 0 #ffffff22,0 2px 3px #0005;transition:background .15s,transform .12s,box-shadow .15s}.buildButtons button:hover:not(:disabled){transform:translateY(-2px);box-shadow:0 0 12px #dbbd6966}.buildButtons button:active:not(:disabled){transform:translateY(1px)}.constructionInfo{position:absolute;z-index:5;bottom:178px;left:50%;transform:translateX(-50%);background:#102037e8;color:#f5d69b;border:1px solid #8e7754;border-radius:5px;padding:5px 12px;font-size:12px;pointer-events:none;text-align:center}.constructionRing{fill:none;stroke:#ffd16c;stroke-width:2;stroke-dasharray:3 2;vector-effect:non-scaling-stroke;animation:constructionPulse 1.1s infinite alternate}.facility.pending .facilityDot{opacity:.65}.facility text[data-countdown]{fill:#ffd16c;paint-order:stroke;stroke:#142237;stroke-width:.08}.placementGhost{stroke-width:2;vector-effect:non-scaling-stroke}.placementGhost.valid{stroke:#85f5b9;fill:#35c98744}.placementGhost.invalid{stroke:#ff565e;fill:#ff465a55}.placementSymbol{fill:white;font-weight:bold}.placementRejected{animation:rejectFlash .45s ease-out}@keyframes constructionPulse{from{opacity:.5}to{opacity:1}}@keyframes rejectFlash{0%,35%{filter:drop-shadow(0 0 18px #ff344e);box-shadow:inset 0 0 35px #ff344e}100%{filter:none}}.game-open #notice:not(:empty){border-color:#d19b6a}.game-open aside{top:65px}.game-open .maphead{bottom:150px}.game-open .selected{bottom:195px}.eventBox{bottom:170px}.light.game-open .stat strong{color:#82551c}.light.game-open .buildBar{background:#fffffff0}.light .constructionInfo{background:white;color:#82551c}.facility.research_center .facilityDot{fill:#534887}.facility.resilience .facilityDot{fill:#326f65}@media(max-width:650px){.game-open #stats{bottom:145px}.game-open .stat strong{font-size:11px}.game-open .maphead{bottom:206px}.game-open .selected{bottom:250px}.constructionInfo{bottom:205px;left:50%;max-width:65vw}.eventBox{bottom:270px}.game-open aside{top:85px}.game-open aside:not(.closed){bottom:205px}}@media(prefers-reduced-motion:reduce){.constructionRing,.placementRejected{animation:none}.placementRejected{outline:4px solid #ff565e}.buildButtons button{transition:none}}
/* v0.5 match center and in-game menu */
#gameMenu{background:#132338;color:#edf3ff;border:1px solid #ac905f;border-radius:16px;max-width:min(90vw,440px);width:100%;padding:24px;box-shadow:0 16px 70px #000a}#gameMenu::backdrop{background:#07121dc9;backdrop-filter:blur(5px)}#gameMenu button{display:block;width:100%;margin:8px 0}#gameMenu .menuHead{display:flex;align-items:center;justify-content:space-between}#gameMenu .menuHead button{width:auto}#gameMenu label{display:flex;align-items:center;justify-content:space-between;margin:14px 0}#gameMenu input{width:auto}#gameMenu small{display:block;color:#aabbd0}#matchLobby{max-width:1080px;margin:0 auto}.stageStatus{text-align:center;padding:24px}.bigCount{font-size:clamp(1.5rem,4vw,3rem);font-weight:800;letter-spacing:.04em;margin:12px}.stageStatus progress{width:min(100%,540px)}.stageStatus .actions{justify-content:center}.pickerGrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(185px,1fr));gap:10px;max-height:48vh;overflow:auto;margin:16px 0;padding:3px}.nationCard{display:flex;flex-direction:column;text-align:left;align-items:flex-start;gap:8px;min-height:105px;border:1px solid #566681;background:#1b3048;color:#f5f7fb}.nationCard small{color:#bdcbe0}.nationCard.chosen{border-color:#f2ce83;box-shadow:0 0 0 2px #f2ce83}.nationCard:disabled{opacity:.5}.light .nationCard{background:#f1f5fa;color:#24344d}.light .nationCard small{color:#4b5c70}#pickerConfirm{margin-top:12px}#matchCountry[hidden]{display:none!important}
#land path{vector-effect:non-scaling-stroke}.facilityDot,.railLink,.railRange{vector-effect:non-scaling-stroke}.facility text[data-countdown]{stroke-width:0;paint-order:normal}#gameMenu input[type=checkbox]{accent-color:#e5c17b;width:20px;height:20px}

.nationMapLabel{pointer-events:none;user-select:none}.nationMapName,.nationMapPower{paint-order:stroke fill;stroke:#0b1624;stroke-width:3px;stroke-linejoin:round;fill:#fff;font-family:system-ui,sans-serif}.nationMapName{font-size:11px;font-weight:650}.nationMapPower{font-size:9px;fill:#dfc68e;stroke-width:2.5px}.rivalMeter{display:grid;gap:5px;padding:9px 0}.rivalMeter progress{width:100%;accent-color:#d8bb80}.buildButtons{flex-wrap:wrap}.civicPowerStat strong{color:var(--gold,#e5c17b)}

/* v0.7: touch-friendly, compact game controls. */
.game-open #game{--dock:95px;--gap:8px;--safe:env(safe-area-inset-bottom,0px)}
.game-open .sectionhead{top:max(8px,env(safe-area-inset-top,0px));left:8px;right:8px;gap:5px}.game-open .sectionhead .eyebrow{display:none}.game-open .sectionhead h1{font-size:clamp(12px,2vw,17px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:35vw}.game-open .sectionhead button{min-height:40px;padding:7px 10px;font-size:12px}.game-open .buildBar{width:min(760px,calc(100% - 16px));bottom:calc(8px + var(--safe));padding:6px}.buildButtons{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:4px}.buildButtons button{min-width:0;min-height:46px;padding:4px 2px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:11px;line-height:1.15}.buildButtons button span{overflow-wrap:anywhere}.buildButtons button small{font-size:9px;color:inherit;opacity:.85;white-space:nowrap}.buildTitle{font-size:11px;min-height:15px;margin:0 0 4px;text-align:center}.game-open #stats{bottom:calc(var(--dock) + var(--safe));max-width:calc(100% - 16px);gap:3px;width:max-content;flex-wrap:nowrap}.game-open .stat{min-width:0;padding:4px 7px;white-space:nowrap}.game-open .stat strong{font-size:clamp(11px,2vw,15px)}.game-open .stat small{font-size:10px}.game-open .secondaryStat{display:none}.game-open .maphead{bottom:calc(var(--dock) + 48px + var(--safe));left:8px}.game-open .maphead button{min-height:38px;padding:5px 9px}.game-open .selected{display:none}.constructionInfo{bottom:calc(var(--dock) + 49px + var(--safe));max-width:45vw;max-height:70px;overflow:hidden}.eventBox{bottom:calc(var(--dock) + 100px + var(--safe));max-height:120px;overflow:auto;width:min(200px,45vw)}.game-open aside,.game-open aside:not(.closed){top:58px;bottom:calc(var(--dock) + 50px + var(--safe));max-width:calc(100vw - 16px)}.countryMenu{top:58px;max-height:calc(100dvh - var(--dock) - 100px);overflow:auto;max-width:calc(100vw - 16px)}.militaryLine{font-size:12px;color:var(--gold);margin:5px 0}.game-open .mapPanel>small{display:none}
@media(max-width:700px){.game-open #game{--dock:146px}.buildButtons{grid-template-columns:repeat(4,minmax(0,1fr))}.game-open .sectionhead h1{max-width:100%;flex-basis:100%;font-size:13px}.game-open aside,.game-open aside:not(.closed),.countryMenu{top:82px}.eventBox{width:140px;max-height:72px}.game-open .stat small{font-size:9px}.game-open .stat{padding:4px}.constructionInfo{max-width:36vw;font-size:10px}.game-open .sectionhead button{min-height:42px}.game-open .maphead{bottom:calc(var(--dock) + 47px + var(--safe))}}
@media(max-height:470px) and (orientation:landscape){.game-open #game{--dock:82px}.buildButtons{grid-template-columns:repeat(8,minmax(0,1fr))}.buildButtons button{min-height:36px;font-size:10px}.game-open .sectionhead h1{flex-basis:auto}.eventBox{max-height:60px}.game-open aside,.game-open aside:not(.closed),.countryMenu{top:52px}}
/* v0.8 responsive compact dock */
.game-open #game{--dock08:78px;--stats08:42px;--bottom08:calc(8px + env(safe-area-inset-bottom,0px));--hud08:calc(var(--dock08) + var(--bottom08) + 6px);--tools08:calc(var(--hud08) + var(--stats08) + 8px);--top08:calc(56px + env(safe-area-inset-top,0px))}
.game-open .buildBar{bottom:var(--bottom08);width:min(520px,calc(100% - 16px));padding:5px;border-radius:8px}
.dockTabs{display:flex;gap:4px;margin-bottom:4px}.dockTabs button{flex:1;min-height:32px;padding:3px 7px;font-size:12px;background:#243950;color:#e9f1fc;border-color:#4d647e}.dockTabs button[aria-pressed=true]{background:#e2c18a;color:#142237;border-color:#e2c18a}.dockTabs #dockCollapse{flex:0 0 44px}.light .dockTabs button{background:#e6edf4;color:#172b43}.light .dockTabs button[aria-pressed=true]{background:#82551c;color:white}
.game-open .buildButtons{grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}.game-open .buildButtons button{min-height:44px;font-size:12px}.game-open .buildTitle{font-size:10px;margin:2px 0;line-height:1.3;min-height:0}
.game-open #stats{top:auto;bottom:var(--hud08);max-width:calc(100% - 16px);display:flex;flex-wrap:wrap;justify-content:center;gap:3px}.game-open .stat{padding:3px 6px}.game-open .stat strong{font-size:clamp(11px,2vw,15px)}.game-open .stat small{font-size:9px}
.game-open .maphead{bottom:var(--tools08);left:8px}.game-open .maphead .actions{gap:3px}.game-open .maphead button{min-width:42px;min-height:40px;padding:4px 8px}
.game-open .sectionhead{flex-wrap:nowrap;top:max(8px,env(safe-area-inset-top,0px));gap:4px}.game-open .sectionhead button{white-space:nowrap;min-height:42px;padding:5px 7px;font-size:12px}.game-open .sectionhead h1{flex:1;min-width:0;max-width:none;font-size:clamp(12px,2.5vw,17px)}
.game-open aside,.game-open aside:not(.closed){top:var(--top08);bottom:calc(var(--tools08) + 6px);width:min(310px,calc(100vw - 16px));right:8px}.game-open .countryMenu{top:var(--top08);bottom:auto;left:8px;max-height:max(80px,calc(100dvh - var(--top08) - var(--tools08) - 6px));max-width:calc(100vw - 16px);overflow:auto}.game-open .countryMenu button{min-height:40px}.game-open .eventBox{bottom:calc(var(--tools08) + 48px);right:8px;width:min(175px,46vw);max-height:80px}.game-open .constructionInfo{bottom:calc(var(--tools08) + 48px);left:8px;transform:none;max-width:48vw;max-height:60px;font-size:10px;text-align:left}.game-open #notice:not(:empty){top:var(--top08);font-size:12px;max-width:92vw;pointer-events:none}.compare08{width:100%;margin-bottom:4px}#scoreWatch progress{width:100%;accent-color:var(--gold)}#watchValues,#watchStatus{font-size:12px;margin:6px 0}.game-open #scoreWatch{width:min(270px,calc(100vw - 16px));z-index:6}
@media(max-width:380px){.game-open .buildButtons button{font-size:10px}.game-open .buildButtons button small{font-size:8px}.game-open .sectionhead button{font-size:10px;padding:5px}.game-open .sectionhead h1{font-size:11px}.game-open .stat{padding:2px 4px}}
@media(max-height:470px) and (orientation:landscape){.game-open .buildBar{width:min(420px,70vw)}.game-open .buildButtons button{min-height:35px;font-size:10px}.dockTabs button{min-height:27px}.game-open .sectionhead button{min-height:35px}.game-open #game{--top08:45px}.game-open .eventBox{right:8px;bottom:var(--tools08);max-height:54px}.game-open .constructionInfo{bottom:calc(var(--tools08) + 42px)}}
