/* Permanent HUD stays at the edges. The center belongs to the city. */
.game-hud{z-index:20;isolation:isolate}
.district-hud{position:absolute;left:16px;top:16px;width:284px;height:204px;padding:11px 14px 10px;background:linear-gradient(120deg,#193a39fa,#132c30fa);border:1px solid #bdb38aaa;border-radius:9px 4px 9px 4px;box-shadow:inset 0 2px 0 #f6dea51a,0 3px 0 #0c222880,0 5px 12px #00161b44;pointer-events:auto}
.district-seal{position:absolute;left:4px;top:4px;width:52px;height:52px;padding:0;background:none;filter:drop-shadow(0 3px 2px #001b22)}
.district-seal img{width:52px;height:52px;object-fit:contain}
.district-title{height:38px;padding-left:43px;padding-right:23px}
.district-title small{display:block;font-size:9px;line-height:13px;color:#b9cbb3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.district-title h2{font:24px/1.15 var(--game-font);color:#f5e4b9;white-space:nowrap;text-shadow:0 2px 1px #092629}
.district-title h2>span{font:9px 'Malgun Gothic',sans-serif;color:#bdb88b;margin-left:7px;vertical-align:middle}
.district-hud>p{display:none}
.asset-total{display:flex;align-items:baseline;gap:8px;margin-top:5px}
.asset-total small{font-size:10px;color:#b9cbb2}
.asset-total strong{font:21px var(--game-font);color:#f5e8c4;white-space:nowrap}
.asset-total>span{margin-left:auto;font-size:10px;color:#d8c796}
.progress-track{height:6px;margin-top:6px;overflow:hidden;border:1px solid #819e7d77;border-radius:5px;background:#0b242a}
.progress-track>div{height:100%;border-radius:4px;background:linear-gradient(#e9d192,#b99d61);transition:width .2s}
.goal-caption{display:flex;justify-content:space-between;gap:8px;font-size:10px;color:#b7c6ad;margin-top:5px}
.goal-caption b{font-weight:400;color:#ddc58e}
.stage-route{display:flex;align-items:center;justify-content:center;gap:6px;margin:7px 25px 0}
.stage-route span{display:grid;place-items:center;flex:0 0 14px;min-width:14px;width:14px;height:14px;aspect-ratio:1;border:1px solid #728a7577;border-radius:50%;font-size:8px;line-height:1;color:#8ba08d;background:#122d30}
.stage-route span.active{color:#203d36;background:#e9ce92;border-color:#ffe8b2;font-weight:700}
.stage-route span.passed{color:#123a34;background:#78b99b;border-color:#c3dca5}
.stage-route i{flex:1 1 0;min-width:0;max-width:13px;height:1px;background:#859a7b66}
#move-button{position:absolute;left:auto;right:9px;top:10px;width:30px;height:30px;min-height:30px;max-height:30px;gap:0;padding:5px;border:1px solid #edce8b;border-radius:6px;background:linear-gradient(#ead49a,#ad8a53);color:#183a32;box-shadow:inset 0 2px 0 #fff4,0 2px 0 #0b2529;animation:advance-beacon 2s ease-in-out infinite}
#move-button>svg{width:18px;height:18px;flex:0 0 18px}
#move-button:disabled{display:none}
@keyframes advance-beacon{0%,100%{filter:brightness(1);box-shadow:inset 0 2px 0 #fff3,0 2px 0 #0b2529,0 0 0 #efce8a00}50%{filter:brightness(1.18);box-shadow:inset 0 2px 0 #fff5,0 2px 0 #0b2529,0 0 9px #efce8a77}}

.resource-hud{position:absolute;left:12px;right:12px;bottom:9px;display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);gap:6px;padding-top:9px;border-top:1px solid #a9bb8e44}
.cash-hud,.time-hud{position:relative;display:flex;align-items:center;min-width:0;height:43px;border:0;border-radius:4px;background:none;box-shadow:none}
.cash-hud{width:auto;padding:4px 5px 4px 39px;text-align:left}
.cash-hud:hover{background:#d5d6a611}
.cash-hud>img{position:absolute;left:0;top:1px;width:37px;height:40px;max-width:none;object-fit:contain;filter:drop-shadow(0 2px 2px #001a20)}
.cash-hud small,.time-hud small{display:block;font-size:9px;color:#b5c5b2;margin-bottom:1px}
.cash-hud strong{font:17px var(--game-font);color:#fff0c6;white-space:nowrap}
.time-hud{width:auto;padding:4px 0 4px 34px}
.time-hud>img{position:absolute;left:0;top:1px;width:31px;height:40px;max-width:none;object-fit:contain}
.time-hud strong{font-size:14px;font-variant-numeric:tabular-nums;white-space:nowrap;color:#ecdfba}
.hud-buttons{position:absolute;top:16px;right:16px;display:flex;gap:8px}
.icon-button{display:grid;place-items:center;width:36px;height:36px;border:1px solid #bcbb9288;border-radius:50%;background:linear-gradient(#36534b,#163137);box-shadow:inset 0 2px 0 #fff2,0 2px 0 #0c2028;color:#e2d8b2}
.icon-button>svg{width:19px;height:19px}
.icon-button[aria-pressed=false]{color:#7e9488}
.icon-button:hover{filter:brightness(1.2)}
.save-indicator{position:absolute;right:17px;top:60px;display:flex;align-items:center;gap:5px;font-size:9px;color:#aac1ac;text-shadow:0 2px 2px #001c24;opacity:.75;pointer-events:none}
.save-indicator>i{width:4px;height:4px;border-radius:50%;background:#aad9ae}
.save-indicator.error{font-size:11px;color:#ffb69a;opacity:1}
.save-indicator.error>i{background:#ffb69a}

/* One quiet headline in the lower-left corner. Details require a click. */
#news-ticker{position:absolute;left:16px;bottom:16px;top:auto;width:300px;height:28px;padding:4px 8px;display:flex;align-items:center;gap:7px;transform:none;overflow:hidden;border:1px solid #93a48666;border-radius:4px;background:#123236d9;box-shadow:0 2px 5px #00182033;pointer-events:auto;text-align:left;color:#d5dcc0;opacity:.88}
#news-ticker:hover,#news-ticker:focus-visible{opacity:1;border-color:#dbc28a;background:#1b3a3df5}
.news-stamp{display:flex;align-items:center;gap:4px;flex:0 0 auto;font-size:10px;color:#e6cb92}
.news-stamp>b{font-weight:500}
.live-dot{display:block;width:4px;height:4px;flex-shrink:0;border-radius:50%;background:#ddc58b}
.news-stamp>small,.market-copy>span,.news-index{display:none}
.market-copy{min-width:0;flex:1}
.market-copy>b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:500;line-height:18px}
.breaking{animation:news-arrival .7s ease-out}
@keyframes news-arrival{from{border-color:#e6ce91;opacity:1}to{border-color:#93a48666;opacity:.88}}

/* Map, overview and camera controls form one dock in the lower-right corner. */
.city-navigation{position:absolute;right:16px;bottom:16px;width:224px;height:174px;display:grid;grid-template-rows:minmax(0,1fr) 32px;gap:6px;padding:8px;border:1px solid #aaa67f88;border-radius:7px 4px 7px 4px;background:linear-gradient(#203e39e8,#102d31ef);box-shadow:inset 0 2px 0 #e5d5a51a,0 3px 0 #0a242a77;pointer-events:auto}
.city-radar{display:flex;flex-direction:column;min-height:0;width:100%;height:100%;padding:0;border:0;background:none;box-shadow:none;text-align:left}
.radar-title{display:flex;align-items:center;justify-content:space-between;flex:0 0 18px;height:18px;color:#ddcfaa;margin-bottom:3px}
.radar-title>b{font:13px var(--game-font)}
.radar-title>span{font-size:9px;color:#9fb79e}
.city-radar>canvas{display:block;flex:1;min-height:0;width:100%;height:96px;object-fit:contain;border:1px solid #82927633;border-radius:3px}
.radar-legend{display:none}
.map-controls{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:4px;align-items:stretch;min-height:0}
.map-controls button{display:grid;place-items:center;width:100%;height:32px;padding:0;border:1px solid #98a38077;border-radius:4px;background:linear-gradient(#314d48,#112c32);box-shadow:inset 0 1px 0 #fff1,0 2px 0 #0b2228;font-size:21px;line-height:1;color:#dfd9b0}
.map-controls button:hover{border-color:#e8ce92;filter:brightness(1.15)}
.map-controls>span{display:none}
.game-hud:has(.trade-panel:not([hidden]),.ledger-drawer:not([hidden]),.tutorial:not([hidden])) .city-navigation{visibility:hidden;pointer-events:none}

.command-belt{position:absolute;bottom:16px;left:50%;height:66px;transform:translateX(-50%);display:flex;align-items:start;gap:4px;padding:0 6px;pointer-events:auto;isolation:isolate}
.command-belt:before{content:'';position:absolute;left:0;right:0;bottom:0;height:43px;z-index:-1;border:1px solid #b8b08a88;border-radius:8px 8px 15px 15px;background:linear-gradient(#2e4941ed,#102c31f5);box-shadow:inset 0 2px 0 #f5deb31a,0 3px 0 #091f25}
.belt-button{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:end;gap:2px;width:52px;height:60px;padding:0 1px 5px;border-radius:6px;background:none}
.belt-button>img,.belt-button>.belt-news-icon{width:48px;height:46px;flex-shrink:0;object-fit:contain;filter:drop-shadow(0 3px 2px #061e25);transition:transform .2s}
.belt-button>span{font:11px var(--game-font);white-space:nowrap;text-shadow:0 2px 1px #09252b}
.belt-button:hover:not(:disabled)>img,.belt-button:hover:not(:disabled)>.belt-news-icon{transform:translateY(-3px)}
.belt-button:hover:not(:disabled),.belt-button[aria-expanded=true]{background:linear-gradient(transparent,#e8cf851a)}
.belt-button>b{position:absolute;top:2px;right:-1px;min-width:21px;height:18px;padding:1px 3px;display:grid;place-items:center;border:1px solid #c6b47f;border-radius:5px;background:#183835;color:#f0ddb0;font-size:9px;line-height:1}

#budong-note{--face-size:54px;--note-gap:10px;position:absolute;left:16px;bottom:60px;width:300px;height:56px;display:flex;align-items:center;gap:var(--note-gap);pointer-events:none}
.budong-face{position:relative;width:var(--face-size);height:var(--face-size);flex-shrink:0;overflow:hidden;border:1px solid #cbbb8d;border-radius:50%;background:linear-gradient(#567a6b,#172f33);box-shadow:0 2px 0 #0e2228}
.budong-face img{position:absolute;max-width:none;width:130px;height:190px;left:-39px;top:-15px;object-fit:cover}
#budong-tip{margin:0;font-size:12px;line-height:17px;max-height:51px;color:#ece1bd;text-shadow:0 2px 2px #001a23,0 0 6px #001a23;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.budong-history{position:absolute;left:calc(var(--face-size) + var(--note-gap));right:0;bottom:calc(100% + 8px);height:88px;pointer-events:none}
.budong-history>p[data-age]{position:absolute;left:0;right:0;bottom:calc((var(--age) - 1)*31px);height:26px;margin:0;font-size:11px;line-height:13px;color:#b2b7b3;opacity:var(--line-opacity);text-shadow:0 2px 3px #061e24;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;transition:bottom .25s ease-out,opacity .25s ease-out;animation:budong-recede .25s ease-out}
.budong-history>p[data-age="1"]{--age:1;--line-opacity:.65}.budong-history>p[data-age="2"]{--age:2;--line-opacity:.42}.budong-history>p[data-age="3"]{--age:3;--line-opacity:.23}
@keyframes budong-recede{from{transform:translateY(18px);opacity:.85}to{transform:translateY(0);opacity:var(--line-opacity)}}

/* User-opened panels keep their fixed frame geometry. */
.ledger-drawer{position:absolute;left:26px;bottom:143px;width:365px;height:475px;padding:25px 29px;display:grid;grid-template-rows:44px 29px 150px 30px minmax(0,1fr);gap:5px;border:1px solid #c1bc8b;border-radius:10px 5px 10px 5px;background:#183737;box-shadow:0 5px 0 #0a212888,0 12px 30px #00171b88;pointer-events:auto;isolation:isolate;animation:panel-in .22s ease-out}
.ledger-drawer h2{font:26px var(--game-font)}
.ledger-drawer>.panel-close{position:absolute;right:13px;top:13px}
.ledger-holdings,.ledger-history{overflow-y:auto;min-height:0;scrollbar-color:#718875 #193733;scrollbar-width:thin;overscroll-behavior:contain}
.holding{display:flex;align-items:center;width:100%;height:66px;gap:5px;padding:5px;background:transparent;text-align:left;border-bottom:1px solid #9cb39522}
.holding:hover{background:#e2d3a611}.holding>img{width:46px;height:50px;object-fit:contain}.holding>div{flex:1}.holding b{font-size:13px;display:block;font-weight:500;margin-bottom:5px}.holding small,.holding>span{font-size:12px}.holding small{color:#d5c595}
.history-row{display:grid;grid-template-columns:1fr auto;gap:4px;padding:9px 2px;border-bottom:1px solid #9cb39522;font-size:12px}.history-row>b{font-size:12px;font-weight:500}.history-row small{grid-column:1/-1;color:#8ea899;font-size:10px}
.tutorial{position:absolute;left:50%;top:52%;transform:translate(-50%,-50%);width:390px;height:230px;padding:25px 25px 22px 105px;border:2px solid #d6c18b;border-radius:12px;background:linear-gradient(#24453ff5,#102e34fa);box-shadow:0 5px 0 #0b222a,0 12px 30px #001b2388;pointer-events:auto;z-index:20}
.tutorial>img{position:absolute;left:8px;top:25px;width:102px;height:120px;object-fit:contain}.tutorial>b{display:block;font:24px var(--game-font)}.tutorial>p{font-size:14px;line-height:1.9;color:#d7dfc6;margin-top:12px}.tutorial .primary{position:absolute;left:25px;right:25px;bottom:22px;height:45px;font-size:20px}
@keyframes panel-in{from{opacity:0;translate:15px 12px}to{opacity:1;translate:0 0}}

html[data-layout=portrait] .district-hud{left:14px;top:14px;width:270px;height:202px;padding:9px 12px}
html[data-layout=portrait] .district-title{height:35px}
html[data-layout=portrait] .district-title h2{font-size:23px}
html[data-layout=portrait] .district-seal{width:48px;height:48px}
html[data-layout=portrait] .district-seal img{width:48px;height:48px}
html[data-layout=portrait] .asset-total{margin-top:4px}
html[data-layout=portrait] .asset-total strong{font-size:20px}
html[data-layout=portrait] .stage-route{margin-top:6px}
html[data-layout=portrait] .hud-buttons{top:14px;right:14px;flex-direction:column;gap:8px}
html[data-layout=portrait] .save-indicator{top:150px;right:14px;font-size:8px}
html[data-layout=portrait] #news-ticker{left:14px;bottom:86px;width:250px;height:28px}
html[data-layout=portrait] .city-navigation{right:14px;bottom:86px;width:176px;height:142px;padding:6px;gap:4px;grid-template-rows:minmax(0,1fr) 28px}
html[data-layout=portrait] .radar-title{height:16px;flex-basis:16px;margin-bottom:2px}
html[data-layout=portrait] .radar-title>b{font-size:11px}
html[data-layout=portrait] .radar-title>span{font-size:8px}
html[data-layout=portrait] .city-radar>canvas{height:76px}
html[data-layout=portrait] .map-controls{grid-template-columns:repeat(4,minmax(0,1fr));gap:3px}
html[data-layout=portrait] .map-controls button{height:28px;font-size:21px}
html[data-layout=portrait] #previous-plot,html[data-layout=portrait] #next-plot{display:none}
html[data-layout=portrait] .command-belt{bottom:14px}
html[data-layout=portrait] #budong-note{--face-size:44px;--note-gap:8px;left:14px;bottom:120px;width:250px;height:50px}
html[data-layout=portrait] .budong-face img{width:112px;height:168px;left:-35px;top:-15px}
html[data-layout=portrait] #budong-tip{font-size:11.5px;line-height:16px;max-height:48px}
html[data-layout=portrait] .ledger-drawer{left:20px;bottom:145px;width:400px;height:480px}
html[data-layout=portrait] .tutorial{width:410px}

html[data-layout=compact] .district-hud{width:270px;height:202px;top:14px}
html[data-layout=compact] .hud-buttons{top:14px}
html[data-layout=compact] .city-navigation{width:200px;height:146px;padding:6px;gap:4px;grid-template-rows:minmax(0,1fr) 32px}
html[data-layout=compact] .map-controls{grid-template-columns:repeat(4,minmax(0,1fr))}
html[data-layout=compact] #previous-plot,html[data-layout=compact] #next-plot{display:none}
html[data-layout=compact] #budong-note{--face-size:44px;--note-gap:8px;width:250px;height:50px}
html[data-layout=compact] .budong-face img{width:112px;height:168px;left:-35px;top:-15px}
html[data-layout=compact] #budong-tip{line-height:16px;max-height:48px}
html[data-layout=compact] .ledger-drawer{height:400px;bottom:137px;grid-template-rows:38px 24px 110px 24px minmax(0,1fr)}

@media (pointer: coarse) {
  html[data-layout=portrait] .city-navigation {
    width: 244px; height: 166px; grid-template-rows: minmax(0,1fr) 55px;
  }
  html[data-layout=portrait] .map-controls button { height: 55px; }
  html[data-layout=portrait] .hud-buttons .icon-button { width: 55px; height: 55px; }
  html[data-layout=portrait] .save-indicator { top: 207px; }
  html[data-layout=compact] .city-navigation {
    width: 240px; height: 160px; grid-template-rows: minmax(0,1fr) 51px;
  }
  html[data-layout=compact] .map-controls button { height: 51px; }
}
