:root {
  color-scheme: dark;
  --ink: #e8eee8;
  --muted: #96a79f;
  --muted-2: #70827a;
  --panel: rgba(18, 29, 29, .91);
  --panel-2: rgba(24, 37, 36, .94);
  --line: rgba(212, 230, 218, .12);
  --line-strong: rgba(212, 230, 218, .22);
  --accent: #9cc9a8;
  --accent-bright: #c6e1c8;
  --gold: #d7bb80;
  --danger: #db8e82;
  --shadow: 0 18px 48px rgba(7, 15, 15, .28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #101a1c; color: var(--ink); }
body { font-size: 13px; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.topbar { height: 70px; width: 100%; display: flex; align-items: center; gap: 22px; padding: 0 20px; background: rgba(15, 24, 25, .98); border-bottom: 1px solid rgba(228, 238, 227, .1); position: relative; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: 0 0 222px; min-width: 180px; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(145deg, #263a34, #172725); border: 1px solid rgba(196, 225, 200, .18); display: grid; place-items: center; }
.brand-mark svg { width: 31px; height: 31px; }
.brand-copy { display: flex; flex-direction: column; gap: 3px; }
.brand-copy strong { font-size: 14px; letter-spacing: .19em; font-weight: 750; }
.brand-copy small { color: #879a91; font-size: 8px; letter-spacing: .12em; white-space: nowrap; }
.world-heading { display: flex; align-items: center; gap: 8px; min-width: 155px; max-width: 215px; padding-left: 4px; }
.live-dot, .status-pip { width: 7px; height: 7px; border-radius: 50%; background: #92c9a0; box-shadow: 0 0 0 4px rgba(146, 201, 160, .09); flex: 0 0 auto; }
.world-name { border: 0; padding: 4px 0; background: transparent; font-weight: 650; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.chevron { color: #879a91; margin-left: 4px; }
.save-status { font-size: 9px; color: #75877f; white-space: nowrap; }
.resource-bar { display: flex; align-items: center; justify-content: center; gap: 7px; flex: 1; min-width: 0; }
.resource-chip { height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid rgba(214, 231, 218, .08); background: rgba(255,255,255,.025); border-radius: 11px; min-width: 80px; }
.resource-symbol { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 15px; background: rgba(255,255,255,.055); }
.resource-symbol.people { color: #d6c18c; }
.resource-symbol.food { color: #c6d59a; }
.resource-symbol.wood { color: #a7c49d; }
.resource-symbol.stone { color: #c2c8c2; }
.resource-symbol.gold { color: #e2c37c; }
.resource-copy { display: flex; flex-direction: column; gap: 3px; min-width: 28px; }
.resource-copy small { color: #81938a; font-size: 8px; letter-spacing: .1em; }
.resource-copy strong { font-size: 13px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.top-actions { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.icon-button, .subtle-icon { width: 31px; height: 31px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: #9fb0a8; font-size: 20px; display: grid; place-items: center; transition: .16s ease; }
.icon-button:hover, .subtle-icon:hover { color: var(--ink); border-color: var(--line); background: rgba(255,255,255,.06); }
.action-divider { height: 23px; width: 1px; background: var(--line); margin: 0 4px; }
.new-world-button { display: flex; align-items: center; gap: 6px; border: 1px solid rgba(167, 207, 172, .24); border-radius: 9px; padding: 8px 10px; margin-left: 5px; background: rgba(119, 167, 129, .13); color: #c6e1c8; font-size: 11px; font-weight: 650; white-space: nowrap; }
.new-world-button:hover { background: rgba(119, 167, 129, .22); }
.new-world-button > span:first-child { font-size: 16px; line-height: 10px; }
.game-shell { height: calc(100% - 70px); width: 100%; position: relative; overflow: hidden; background: #a9c7b8; }
#worldCanvas { width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
.glass-panel { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.tool-panel { position: absolute; left: 16px; top: 16px; bottom: 18px; width: 222px; border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; z-index: 10; }
.panel-heading, .inspector-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 15px 12px; }
.panel-heading h2, .inspector-top h2 { margin: 4px 0 0; font-size: 15px; letter-spacing: -.02em; font-weight: 680; }
.eyebrow { color: #83978d; font-size: 8px; letter-spacing: .15em; font-weight: 750; text-transform: uppercase; }
.subtle-icon { width: 26px; height: 26px; font-size: 19px; }
.tool-section { padding: 0 12px 12px; }
.section-label { font-size: 8px; letter-spacing: .14em; font-weight: 750; color: #73867d; margin: 3px 0 9px 2px; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 5px; }
.tool-button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 51px; padding: 7px 2px 6px; background: rgba(255,255,255,.025); border: 1px solid rgba(219,233,221,.07); border-radius: 10px; color: #9baea4; font-size: 9px; transition: background .14s, border-color .14s, color .14s; }
.tool-button:hover { background: rgba(255,255,255,.07); color: var(--ink); }
.tool-button.active { color: #d8ebd8; border-color: rgba(156,201,168,.38); background: rgba(119,167,129,.18); box-shadow: inset 0 0 0 1px rgba(156,201,168,.04); }
.tool-icon { font-size: 19px; line-height: 18px; font-weight: 500; color: #c1d3c6; }
.tool-button.active .tool-icon { color: #b7dcbc; }
.building-section { min-height: 0; flex: 1; display: flex; flex-direction: column; padding-top: 1px; }
.building-list { overflow: auto; min-height: 0; padding-right: 2px; scrollbar-width: thin; scrollbar-color: #40534b transparent; }
.building-button { width: 100%; display: flex; align-items: center; gap: 9px; border: 1px solid transparent; border-radius: 10px; padding: 7px 7px; background: transparent; text-align: left; color: #c7d3cb; margin-bottom: 3px; }
.building-button:hover { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.06); }
.building-button.active { background: rgba(119,167,129,.15); border-color: rgba(156,201,168,.3); }
.building-thumb { width: 35px; height: 35px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; font-size: 21px; border: 1px solid rgba(255,255,255,.07); }
.house-thumb { background: linear-gradient(145deg,#53473b,#302f29); color: #d6b38a; }
.farm-thumb { background: linear-gradient(145deg,#45573b,#293a2d); color: #c2d99b; }
.lumber-thumb { background: linear-gradient(145deg,#5a4935,#34382e); color: #c5c08c; }
.quarry-thumb { background: linear-gradient(145deg,#4c5350,#30383a); color: #c6ccc7; }
.warehouse-thumb { background: linear-gradient(145deg,#555044,#33362f); color: #d2c5a1; }
.market-thumb { background: linear-gradient(145deg,#5a4439,#37332f); color: #d7ae83; }
.hall-thumb, .castle-thumb { background: linear-gradient(145deg,#514f46,#303632); color: #d8c69b; }
.building-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.building-copy strong { font-size: 10px; font-weight: 650; }
.building-copy small { font-size: 8px; color: #809188; white-space: nowrap; }
.building-add { color: #738a7d; font-size: 15px; }
.tool-panel-footer { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; align-items: center; gap: 5px; color: #71847a; font-size: 8px; white-space: nowrap; }
.keycap { padding: 3px 4px; border: 1px solid rgba(225,236,226,.12); border-radius: 4px; background: rgba(255,255,255,.035); color: #a3b3a8; font-size: 8px; }
.footer-dot { margin: 0 2px; color: #54685d; }
.inspector-panel { position: absolute; right: 16px; top: 16px; bottom: 160px; width: 248px; border-radius: 16px; display: flex; flex-direction: column; z-index: 9; overflow: hidden; }
.inspector-top { padding: 16px 15px 14px; border-bottom: 1px solid rgba(220,235,222,.08); }
.inspector-top h2 { max-width: 180px; font-size: 14px; }
.inspector-content { overflow: auto; padding: 13px 14px; flex: 1; scrollbar-width: thin; scrollbar-color: #40534b transparent; }
.inspector-bottom { height: 37px; border-top: 1px solid var(--line); padding: 0 14px; display: flex; align-items: center; gap: 8px; color: #84968d; font-size: 9px; flex: 0 0 auto; }
.status-pip { width: 6px; height: 6px; box-shadow: none; background: #d7bb80; }
.inspector-card { border: 1px solid rgba(220,235,222,.09); background: rgba(255,255,255,.027); border-radius: 11px; padding: 12px; margin-bottom: 10px; }
.inspector-card-title { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 11px; margin-bottom: 8px; }
.inspector-emblem { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; background: rgba(156,201,168,.12); color: #b8d8bc; font-size: 17px; }
.inspector-description { color: #8ea096; font-size: 10px; line-height: 1.55; margin: 6px 0 0; }
.metric-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(220,235,222,.065); color: #91a39a; font-size: 10px; }
.metric-row:last-child { border-bottom: 0; padding-bottom: 0; }
.metric-row strong { color: #e1e9e1; font-weight: 650; font-variant-numeric: tabular-nums; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 10px; }
.metric-tile { padding: 10px; border-radius: 10px; background: rgba(255,255,255,.035); border: 1px solid rgba(220,235,222,.06); }
.metric-tile small { display: block; color: #82968a; font-size: 8px; margin-bottom: 7px; }
.metric-tile strong { font-size: 18px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric-tile em { display: block; font-style: normal; color: #8da195; font-size: 8px; margin-top: 3px; }
.progress-track { width: 100%; height: 4px; border-radius: 5px; background: rgba(255,255,255,.08); overflow: hidden; margin: 9px 0 4px; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg,#719c7b,#c0d7a2); }
.inspector-section-label { margin: 14px 0 8px; color: #71867b; font-size: 8px; letter-spacing: .14em; font-weight: 750; }
.inspector-button { width: 100%; border: 1px solid rgba(156,201,168,.2); background: rgba(119,167,129,.1); border-radius: 8px; padding: 9px 10px; text-align: center; font-size: 10px; color: #c3ddc5; margin-top: 8px; }
.inspector-button:hover { background: rgba(119,167,129,.2); }
.inspector-button.danger { color: #e3a69b; border-color: rgba(219,142,130,.18); background: rgba(219,142,130,.07); }
.worker-control { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; color: #9bada2; font-size: 10px; }
.worker-actions { display: flex; align-items: center; gap: 8px; }
.worker-actions button { width: 23px; height: 23px; border: 1px solid var(--line); background: rgba(255,255,255,.04); border-radius: 6px; }
.worker-actions strong { min-width: 12px; text-align: center; color: #e5ece5; }
.world-label { position: absolute; top: 22px; left: 256px; display: flex; flex-direction: column; gap: 4px; z-index: 4; pointer-events: none; text-shadow: 0 1px 8px rgba(20,36,30,.4); }
.world-label .eyebrow { color: #f2f6e9; text-shadow: 0 1px 6px rgba(0,0,0,.3); }
.world-label strong { font-size: 15px; letter-spacing: .12em; font-weight: 800; color: #fffef3; }
.world-subtitle { font-size: 9px; color: #f1f5e8; }
.camera-tools { position: absolute; right: 282px; top: 20px; display: flex; gap: 6px; z-index: 5; }
.camera-button { display: flex; align-items: center; gap: 6px; border: 1px solid rgba(26,48,38,.14); background: rgba(245,249,236,.72); color: #31463b; padding: 7px 10px; border-radius: 9px; font-size: 10px; box-shadow: 0 5px 18px rgba(20,38,28,.08); backdrop-filter: blur(10px); }
.camera-button:hover { background: #f7f8eb; }
.minimap-card { position: absolute; right: 16px; bottom: 16px; width: 248px; border-radius: 13px; padding: 10px 11px 8px; z-index: 10; }
.minimap-heading, .minimap-footer { display: flex; justify-content: space-between; align-items: center; color: #82958a; font-size: 8px; letter-spacing: .12em; font-weight: 750; }
.minimap-live { display: flex; align-items: center; gap: 5px; color: #91c5a0; }
.minimap-live i { width: 5px; height: 5px; border-radius: 50%; background: #91c5a0; }
#miniMap { display: block; width: 100%; height: 92px; margin: 8px 0 7px; border-radius: 7px; background: #354b3e; image-rendering: auto; }
.minimap-footer { font-size: 7px; color: #71857b; }
.bottom-dock { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 12; min-height: 60px; padding: 8px 10px; display: flex; align-items: center; gap: 12px; border-radius: 15px; white-space: nowrap; }
.play-button { width: 38px; height: 38px; border: 1px solid rgba(174,218,179,.28); border-radius: 11px; background: #8fbc98; color: #173324; font-size: 14px; display: grid; place-items: center; padding-left: 2px; box-shadow: 0 4px 14px rgba(69,116,80,.18); }
.play-button:hover { background: #add0ac; }
.play-button.is-playing { background: rgba(156,201,168,.15); color: #c4e1c7; border-color: rgba(156,201,168,.28); }
.time-block { display: flex; flex-direction: column; gap: 5px; min-width: 100px; }
.time-block .eyebrow { font-size: 7px; }
.time-block strong { font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; }
.dock-divider { width: 1px; height: 30px; background: var(--line); }
.speed-controls { display: flex; gap: 3px; padding: 3px; border: 1px solid rgba(220,235,222,.07); border-radius: 9px; background: rgba(0,0,0,.13); }
.speed-button { border: 0; background: transparent; color: #899b90; padding: 6px 7px; border-radius: 6px; font-size: 9px; }
.speed-button.active { color: #d9e9d8; background: rgba(156,201,168,.17); }
.mode-switch { display: flex; align-items: center; gap: 3px; background: rgba(0,0,0,.16); padding: 3px; border: 1px solid rgba(220,235,222,.07); border-radius: 10px; }
.mode-button { border: 0; border-radius: 7px; padding: 7px 9px; background: transparent; color: #8c9f94; font-size: 9px; }
.mode-button span { margin-right: 4px; }
.mode-button.active { background: rgba(156,201,168,.16); color: #d3e6d2; }
.mode-button[data-mode="managed"].active { background: rgba(215,187,128,.15); color: #e5d1a5; }
.bottom-hint { position: absolute; left: 258px; bottom: 28px; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 620px); color: #eef4e7; font-size: 10px; text-shadow: 0 1px 7px rgba(0,0,0,.45); z-index: 4; pointer-events: none; }
.bottom-hint strong { font-weight: 750; }
.hint-orb { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: rgba(31,52,40,.4); border: 1px solid rgba(244,248,228,.18); color: #fff3c7; flex: 0 0 auto; }
.toast { position: absolute; top: 75px; left: 50%; transform: translate(-50%, -10px); opacity: 0; pointer-events: none; z-index: 50; border: 1px solid rgba(208,229,209,.2); background: rgba(17,29,28,.94); color: #e2eee2; border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 11px; transition: opacity .2s, transform .2s; max-width: min(420px, calc(100vw - 30px)); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.ui-hidden .topbar, body.ui-hidden .tool-panel, body.ui-hidden .inspector-panel, body.ui-hidden .world-label, body.ui-hidden .camera-tools, body.ui-hidden .minimap-card, body.ui-hidden .bottom-dock, body.ui-hidden .bottom-hint { opacity: 0; pointer-events: none; transition: opacity .2s; }
body.ui-hidden .topbar { transform: translateY(-100%); }
@media (max-width: 1320px) {
  .topbar { gap: 13px; padding: 0 14px; }
  .brand { flex-basis: 190px; min-width: 160px; }
  .resource-chip { min-width: 66px; padding: 0 7px; gap: 5px; }
  .resource-symbol { width: 19px; height: 19px; }
  .resource-copy small { font-size: 7px; }
  .inspector-panel { width: 226px; }
  .minimap-card { width: 226px; }
  .camera-tools { right: 245px; }
  .bottom-hint { max-width: calc(100% - 560px); }
}
@media (max-width: 1080px) {
  .world-heading { display: none; }
  .brand { flex-basis: 190px; }
  .resource-bar { justify-content: flex-start; gap: 4px; }
  .resource-chip { min-width: 58px; padding: 0 5px; }
  .resource-symbol { display: none; }
  .tool-panel { width: 200px; left: 10px; top: 10px; bottom: 10px; }
  .inspector-panel { right: 10px; top: 10px; bottom: 150px; width: 210px; }
  .world-label { left: 225px; top: 17px; }
  .camera-tools { right: 228px; top: 68px; }
  .minimap-card { right: 10px; bottom: 10px; width: 210px; }
  .bottom-hint { left: 225px; bottom: 18px; max-width: calc(100% - 470px); }
  .bottom-dock { bottom: 14px; }
}
@media (max-width: 760px) {
  .topbar { height: 58px; padding: 0 10px; gap: 8px; }
  .brand { min-width: 0; flex: 0 0 auto; gap: 7px; }
  .brand-mark { width: 33px; height: 33px; border-radius: 10px; }
  .brand-mark svg { width: 27px; height: 27px; }
  .brand-copy strong { font-size: 11px; letter-spacing: .13em; }
  .brand-copy small { display: none; }
  .resource-bar { justify-content: flex-end; gap: 3px; }
  .resource-chip { min-width: 0; height: 34px; padding: 0 5px; border-radius: 8px; background: transparent; border-color: transparent; }
  .resource-copy small { display: none; }
  .resource-copy strong { font-size: 11px; }
  .top-actions { gap: 0; }
  .top-actions .icon-button:nth-child(1), .top-actions .icon-button:nth-child(2), .top-actions .action-divider, #importBtn, .new-world-label { display: none; }
  .icon-button { width: 27px; height: 29px; font-size: 17px; }
  .new-world-button { margin-left: 0; padding: 6px 8px; }
  .game-shell { height: calc(100% - 58px); }
  .tool-panel { left: 7px; top: 7px; bottom: 7px; width: 158px; border-radius: 12px; }
  .panel-heading { padding: 11px 10px 8px; }
  .panel-heading h2 { font-size: 13px; }
  .tool-section { padding: 0 8px 8px; }
  .tool-grid { gap: 3px; }
  .tool-button { min-height: 43px; font-size: 8px; gap: 3px; border-radius: 8px; }
  .tool-icon { font-size: 16px; }
  .building-button { padding: 5px 4px; gap: 6px; }
  .building-thumb { width: 28px; height: 29px; font-size: 17px; }
  .building-copy strong { font-size: 9px; }
  .building-copy small { font-size: 7px; }
  .building-add { display: none; }
  .tool-panel-footer { padding: 7px; font-size: 7px; gap: 3px; }
  .keycap { font-size: 7px; padding: 2px; }
  .inspector-panel { right: 7px; top: 7px; bottom: 119px; width: 175px; border-radius: 12px; }
  .inspector-top { padding: 11px 9px 9px; }
  .inspector-top h2 { font-size: 11px; }
  .inspector-content { padding: 8px; }
  .inspector-card { padding: 8px; margin-bottom: 7px; }
  .metric-grid { gap: 4px; }
  .metric-tile { padding: 7px; }
  .metric-tile strong { font-size: 15px; }
  .world-label { left: 174px; top: 12px; }
  .world-label strong { font-size: 11px; }
  .world-subtitle { font-size: 7px; }
  .camera-tools { left: 174px; right: auto; top: 65px; }
  .camera-button { padding: 6px 7px; font-size: 9px; }
  .camera-button span { display: none; }
  .minimap-card { display: none; }
  .bottom-dock { bottom: 8px; min-height: 48px; gap: 6px; padding: 5px 6px; border-radius: 12px; }
  .play-button { width: 30px; height: 30px; border-radius: 9px; }
  .time-block { min-width: 72px; gap: 3px; }
  .time-block strong { font-size: 8px; }
  .time-block .eyebrow { font-size: 6px; }
  .dock-divider { height: 23px; }
  .speed-controls { gap: 0; padding: 2px; }
  .speed-button { padding: 5px; font-size: 8px; }
  .mode-button { padding: 6px; font-size: 8px; }
  .mode-button span { display: none; }
  .bottom-hint { left: 174px; bottom: 65px; max-width: calc(100% - 190px); font-size: 8px; }
}
@media (max-width: 460px) {
  .resource-chip:nth-child(4), .resource-chip:nth-child(5) { display: none; }
  .tool-panel { width: 142px; }
  .world-label, .camera-tools, .bottom-hint { left: 153px; }
  .inspector-panel { width: 156px; }
  .inspector-top h2 { max-width: 120px; }
  .bottom-dock { left: 50%; }
  .mode-button { padding: 6px 5px; }
  .time-block { min-width: 63px; }
}