:root{color-scheme:dark;--bg:#0b1220;--panel:#121e30;--line:#293c54;--muted:#a1b2c8;--gold:#e8c27c}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:#edf3fc;font:16px/1.6 system-ui,-apple-system,sans-serif}a{color:var(--gold);text-decoration:none}header{height:66px;display:flex;align-items:center;justify-content:space-between;padding:0 4%;border-bottom:1px solid var(--line)}header span{font-size:12px;letter-spacing:3px;color:var(--muted)}main{max-width:1350px;margin:auto;padding:30px 24px}.heading{display:flex;justify-content:space-between;align-items:center;gap:16px}h1{font-size:clamp(26px,4vw,40px);letter-spacing:-1.5px;margin:0 0 24px}h2{font-size:19px;margin:0 0 14px}.eyebrow{color:var(--gold);font-size:13px;letter-spacing:2px;margin:0 0 5px}#nationTitle{color:var(--gold)}#status{padding:10px 14px;background:#1b2d43;border-left:3px solid var(--gold);margin-bottom:18px;min-height:45px}.resources{display:grid;grid-template-columns:repeat(5,1fr);gap:12px;margin-bottom:20px}.stat{background:var(--panel);padding:14px 18px;border:1px solid var(--line);border-radius:10px}.stat small{display:block;color:var(--muted);font-size:13px}.stat strong{font-size:23px}.layout{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:20px}.map-panel,.panel{background:var(--panel);border:1px solid var(--line);border-radius:12px;overflow:hidden}.panel{padding:20px;margin-bottom:16px}.map-top{padding:16px 20px;display:flex;justify-content:space-between;gap:12px;border-bottom:1px solid var(--line)}.map-top span{font-size:13px;color:var(--muted)}.map-scroll{overflow:auto;background:radial-gradient(ellipse at center,#1c3048,#0c1727);max-height:650px;min-height:360px;touch-action:pan-x pan-y}svg{display:block;margin:auto;min-width:680px;width:100%;height:auto}svg g{cursor:pointer;outline:none}svg g:hover polygon,svg g:focus polygon{stroke:#fff;stroke-width:3}svg text{pointer-events:none;fill:#fff;font-family:system-ui;text-anchor:middle}.legend{display:flex;flex-wrap:wrap;gap:20px;padding:14px 20px;color:var(--muted);font-size:14px}button,input,select{font:inherit;border-radius:7px;border:1px solid #405773;padding:10px 12px;color:#edf3fc;background:#1b2d43}button{cursor:pointer}button:hover{border-color:var(--gold)}button:disabled{opacity:.45;cursor:wait}.primary{background:var(--gold);color:#192233;border:0;font-weight:700;width:100%;margin-top:12px}input,select{width:100%;margin:6px 0 12px}label{font-size:14px;color:var(--muted)}p{color:var(--muted);margin:8px 0 16px}.facts{display:grid;grid-template-columns:1fr 1fr;gap:8px;font-size:14px;margin:16px 0}.facts div{padding:9px;background:#0b1728;border-radius:6px}.facts b{display:block;font-size:17px;color:#edf3fc}.bottom{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:20px}.log{padding:10px 0;border-bottom:1px solid var(--line);font-size:14px}.log small{color:var(--muted);margin-right:10px}summary{cursor:pointer;font-weight:700}#battle{margin-top:20px}.battle-row{display:grid;grid-template-columns:80px 1fr 1fr;gap:10px;padding:9px;border-bottom:1px solid var(--line);font-size:14px}.dice{color:var(--gold);font-size:24px}.scroll-rounds{max-height:360px;overflow:auto}.selected polygon{stroke:var(--gold)!important;stroke-width:4!important}@media(max-width:800px){main{padding:20px 12px}.layout,.bottom{grid-template-columns:1fr}.resources{grid-template-columns:repeat(3,1fr);gap:7px}.stat{padding:10px}.stat strong{font-size:19px}.heading{align-items:flex-start;flex-direction:column;gap:0}#nationTitle{margin-bottom:15px}header span{display:none}.map-top{padding:12px;font-size:14px}.map-top span{max-width:145px}.panel{padding:16px}}
.serverbar{display:flex;gap:20px;align-items:flex-end;margin-bottom:16px;flex-wrap:wrap}.serverbar>label{min-width:240px}#serverAdmin{display:flex;align-items:center;gap:10px}#serverAdmin input{margin-bottom:0}#hall{border-color:var(--gold)}
.chronicle{border-left:3px solid var(--gold)}.chronicle p{max-width:850px;line-height:1.9}.chronicle p:first-of-type{margin-top:20px}.chronicle-end{color:var(--gold);font-weight:600}
.map-controls{display:flex;align-items:center;gap:8px;padding:10px 16px;border-bottom:1px solid var(--line);flex-wrap:wrap}.map-controls button{min-height:44px;min-width:44px;padding:6px 12px}.map-controls output{min-width:54px;text-align:center;font-size:14px;color:var(--gold)}.map-controls span{font-size:13px;color:var(--muted);margin-left:auto}.map-scroll{height:clamp(360px,55vh,620px);min-height:0;max-height:none;overscroll-behavior:contain}.map-scroll #map{min-width:0;max-width:none;margin:0 auto;flex-shrink:0}.map-scroll.dragging{cursor:grabbing;user-select:none}@media(max-width:480px){.map-controls{padding:8px;gap:5px}.map-controls span{flex-basis:100%;margin:0}.map-scroll{height:400px}}
.legend span{display:inline-flex;align-items:center;gap:6px}.legend img{width:24px;height:24px}
.flag-preview{display:flex;align-items:center;gap:10px;padding:12px;border:1px solid #60a5fa;border-radius:8px;background:#60a5fa33;font-size:14px;margin-bottom:10px}.flag-preview img{width:36px;height:36px}.battle-heading{display:flex;justify-content:space-between;gap:16px;align-items:flex-start}.practice-inputs{display:flex;align-items:center;gap:14px;flex-wrap:wrap}.practice-inputs label{flex:1;min-width:100px}.practice-inputs input{max-width:160px}.battle-stage{display:grid;grid-template-columns:1fr 1.4fr 1fr;gap:14px;margin:20px 0;padding:24px 16px;background:#091321;border:1px solid #30455f;border-radius:12px}.army{display:flex;align-items:center;flex-direction:column;gap:3px}.army img{width:38px;height:38px}.army strong{font-size:42px;line-height:1.3;font-variant-numeric:tabular-nums}.army small{color:var(--muted);font-size:13px}.attack-army strong{color:#60a5fa}.defend-army strong{color:#fb7185}.dice-center{text-align:center;align-self:center}#whose-turn{font-size:15px;color:var(--gold)}#dice-cup{display:flex;justify-content:center;gap:8px;margin:8px 0}.die{display:inline-flex;align-items:center;justify-content:center;background:#f6f1e8;color:#172435;border-radius:10px;width:64px;height:68px;font:58px/1 system-ui;box-shadow:0 5px 0 #9e9689}.rolling .die{animation:dice-roll .16s linear infinite}.rolling .die:nth-child(2){animation-direction:reverse}#defend-bonus{font-size:14px;color:#fb7185}#battle-event{min-height:54px;text-align:center;padding:12px;background:#1b2d43;color:#eef3fc;border-radius:8px}.battle-actions{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:20px}.battle-actions .primary{width:auto;margin:0;flex:1}.battle-actions button{min-height:46px}@keyframes dice-roll{0%{transform:rotate(-12deg) translateY(-2px)}50%{transform:rotate(12deg) translateY(2px)}100%{transform:rotate(-12deg) translateY(-2px)}}@media(max-width:520px){.battle-stage{gap:6px;padding:18px 6px;grid-template-columns:1fr 1.2fr 1fr}.die{width:43px;height:49px;font-size:42px}.army strong{font-size:30px}.army small{font-size:12px}.army span{font-size:14px}#whose-turn{font-size:13px}}@media(prefers-reduced-motion:reduce){.rolling .die{animation:none}}
.flag-preview svg{width:36px;height:36px;min-width:36px;margin:0}.color-palette{display:grid;grid-template-columns:repeat(8,1fr);gap:6px;margin-bottom:14px}.color-palette button{padding:0;min-height:28px;border-radius:5px;color:#101827;font-weight:700}.color-palette button:focus-visible{outline:3px solid white;outline-offset:2px}.color-palette button:disabled{opacity:.22;cursor:not-allowed}#nationColor{height:44px;padding:4px;cursor:pointer}
.odds-table{width:100%;border-collapse:collapse;margin:12px 0;text-align:center}.odds-table th,.odds-table td{padding:10px;border-bottom:1px solid var(--line)}.odds-table th:first-child,.odds-table td:first-child{text-align:left}#practice-estimate{color:var(--muted);margin:12px 0}.practice-inputs select{max-width:180px}
#dice-count{display:block;color:var(--muted);font-size:12px}#allocation{border-color:var(--gold);margin-top:20px}#allocation input{max-width:240px}@media(max-width:520px){#dice-cup{gap:4px}.die{width:32px;height:38px;font-size:32px}}
.odds-scroll{overflow-x:auto}.odds-scroll .odds-table{min-width:660px}

.beta-notice{padding:12px 20px;text-align:center;background:#302819;border-bottom:1px solid #796039;color:#f4dfb4;font-size:14px;line-height:1.6}.beta-notice strong{display:inline-block;margin-right:8px;color:#ffda87}
/* Compact resource and territory facts bars. */
.resources{display:flex;align-items:center;gap:0;overflow-x:auto;flex-wrap:nowrap;border:1px solid var(--line);border-radius:7px;background:var(--panel);margin-bottom:12px;scrollbar-width:thin}
.resources .stat{display:flex;align-items:baseline;gap:5px;flex:1 0 auto;background:none;border:0;border-radius:0;padding:7px 10px;white-space:nowrap;line-height:1.4}
.resources .stat+.stat{border-left:1px solid var(--line)}
.resources .stat small{display:inline;font-size:12px;line-height:1.4}
.resources .stat strong{font-size:14px;line-height:1.4;font-weight:600;font-variant-numeric:tabular-nums}
.resources #turnClock{font-size:10px}
#selection .facts{display:flex;align-items:center;gap:10px;flex-wrap:nowrap;overflow-x:auto;margin:10px 0 12px;padding:7px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line);font-size:11px;line-height:1.5;scrollbar-width:thin}
#selection .facts div{display:flex;align-items:baseline;gap:3px;flex:0 0 auto;padding:0;background:none;border-radius:0;white-space:nowrap;color:var(--muted)}
#selection .facts b{display:inline;font-size:12px;font-weight:600;line-height:1.5}
@media(max-width:800px){.resources .stat{padding:6px 7px;gap:4px}.resources .stat small{font-size:11px}.resources .stat strong{font-size:12px}.resources #turnClock{font-size:10px}#selection .facts{gap:9px}}
.resources .stat:has(.tax-compact){display:grid;grid-template-columns:auto auto;column-gap:5px;row-gap:1px;padding-top:4px;padding-bottom:4px}
.resources .stat:has(.tax-compact) #turnClock{grid-column:1/-1}
.resources .tax-compact{grid-column:1/-1;margin:1px 0 0;padding:2px 5px;font-size:10px;line-height:1.3;border-radius:4px;color:var(--gold);background:#1b2d43;white-space:nowrap}

.resources .stat:has(.tax-compact){row-gap:4px;padding-top:6px;padding-bottom:6px;align-self:stretch;align-content:start}.resources .tax-compact{min-height:44px;min-width:86px;padding:5px 8px;font-size:13px;font-weight:600;line-height:1.35;border-radius:6px;touch-action:manipulation}.resources .tax-compact span{display:block;font-size:11px;font-weight:400}.resources #turnClock{grid-row:3}.resources .tax-compact{grid-row:2}@media(max-width:800px){.resources .stat{padding-left:5px;padding-right:5px}.resources .stat:has(.tax-compact){column-gap:3px}.resources .tax-compact{min-width:82px;padding-left:5px;padding-right:5px}}

/* Readable type while retaining compact single-row stats. */
.resources .stat small{font-size:14px}.resources .stat strong{font-size:17px}.resources #turnClock{font-size:12px}#selection .facts{font-size:14px;gap:14px;padding:8px 0}#selection .facts b{font-size:16px}#selection .facts div{gap:5px}.resources .tax-compact span{font-size:12px}@media(max-width:800px){.resources .stat small{font-size:14px}.resources .stat strong{font-size:16px}.resources #turnClock{font-size:12px}#selection .facts{font-size:14px;gap:12px}#selection .facts b{font-size:16px}}

/* Four aligned balances, separate actions, and whole-nation totals. */
#resources{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));overflow:visible;margin-bottom:8px;align-items:stretch}
#resources[hidden],.nation-overview[hidden]{display:none}
#resources .stat{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;padding:7px 4px;min-width:0}
#resources .stat small{font-size:14px}#resources .stat strong{font-size:17px;max-width:100%;overflow-x:auto;white-space:nowrap}
.nation-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 12px}
.nation-actions:empty{display:none}.nation-actions button{flex:1;min-height:46px;padding:8px 12px;color:var(--gold);font-size:15px;font-weight:600;touch-action:manipulation}
.nation-actions button span{display:block;font-size:12px;font-weight:400;color:var(--muted)}
.nation-actions #turnClock{font-size:12px;color:var(--muted)}
.nation-overview{border:1px solid var(--line);background:var(--panel);border-radius:7px;padding:10px 14px;margin-bottom:16px;font-size:14px}
.nation-totals,.nation-production{display:flex;align-items:baseline;flex-wrap:wrap;gap:8px 20px}
.nation-production{margin-top:6px;color:var(--muted)}.nation-overview strong{font-size:16px;color:#edf3fc;font-weight:600}.production-label{font-size:13px}
@media(max-width:520px){.nation-actions #turnClock{flex-basis:100%;text-align:right}.nation-totals,.nation-production{gap:6px 14px}.production-label{flex-basis:100%}#resources .stat strong{font-size:16px}}

.world-clock{padding:7px 16px;text-align:center;font-size:14px;color:var(--gold);background:#101d2e;border-bottom:1px solid var(--line);font-variant-numeric:tabular-nums}
#selection .facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 14px;overflow:visible;white-space:normal}
#selection .facts div{display:flex;flex-wrap:wrap;min-width:0;white-space:normal;overflow-wrap:anywhere;gap:3px 6px}
#selection .facts b{overflow-wrap:anywhere;min-width:0}
