:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d9dee5;
  --line-strong: #bfc7d2;
  --text: #1f2937;
  --muted: #5d6673;
  --accent: #2563eb;
  --accent-soft: #edf4ff;
  --control-bg: #ffffff;
  --control-hover: #edf4ff;
  --placeholder: #6b7280;
  --positive: #197346;
  --negative: #b42318;
  --shadow: 0 4px 16px #172a451f;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 13px/1.5 "Segoe UI", "Microsoft YaHei", sans-serif; color: var(--text); background: var(--bg); }
button, input, select { font: inherit; -webkit-tap-highlight-color: transparent; }
button { color: var(--text); cursor: pointer; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--control-bg); transition: border-color .12s, background .12s, color .12s; }
button:hover:not(:disabled) { color: var(--accent); background: var(--control-hover); border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, canvas:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 13px; font-weight: 600; }
input, select { color: var(--text); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 4px; }
input::placeholder { color: var(--placeholder); }
input:focus, select:focus { border-color: var(--accent); }
select { width: 100%; height: 35px; padding: 0 8px; font-size: 12px; cursor: pointer; }
label:not(.check) { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.topbar { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 15px; font-weight: 600; }
.map-actions { display: flex; align-items: center; gap: 7px; }
.map-actions button { padding: 5px 11px; font-size: 12px; }
.app-layout { display: grid; grid-template-columns: 272px minmax(0, 1fr) 336px; height: calc(100dvh - 56px); min-height: 480px; }
.controls { min-width: 0; min-height: 0; overflow-y: auto; padding: 16px 14px 20px; background: var(--panel); border-right: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: #b6bfcb transparent; }
#seed-form, .layer-section, .feature-section { padding: 13px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
.seed-input { height: 41px; display: flex; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--panel); }
.seed-input:focus-within { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.seed-input input { width: 100%; min-width: 0; padding: 8px 10px; border: 0; outline: none; font: 15px Consolas, monospace; letter-spacing: .5px; text-transform: uppercase; background: none; }
.seed-input input:focus-visible { outline: none; }
.seed-input button { width: 35px; flex-shrink: 0; display: grid; place-items: center; border: 0; border-left: 1px solid var(--line); border-radius: 0; color: var(--muted); }
.form-row { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 9px; margin-top: 13px; }
.primary { width: 100%; height: 37px; margin-top: 14px; color: #ffffff; font-weight: 600; background: var(--accent); border-color: var(--accent); }
.primary:hover:not(:disabled) { color: #ffffff; background: #1d4ed8; border-color: #1d4ed8; }
.layer-section, .feature-section { margin-top: 12px; }
.layers { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.layers button { padding: 5px 9px; font-size: 12px; }
.layers button.active { color: #1d4ed8; background: var(--accent-soft); border-color: #8aafea; }
.map-toggles { display: flex; flex-wrap: wrap; gap: 10px 15px; margin-top: 12px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; cursor: pointer; }
.check input { width: 13px; height: 13px; margin: 0; accent-color: var(--accent); }
.section-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.text-button { padding: 0; border: 0; background: none; color: #1d4ed8; font-size: 11px; white-space: nowrap; }
.text-button:hover:not(:disabled) { color: #163da4; background: none; text-decoration: underline; }
.search { width: 100%; height: 33px; padding: 6px 9px; margin: 10px 0; font-size: 12px; }
.filter-group { margin-top: 9px; padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-soft); }
.filter-group:first-child { margin-top: 0; }
.group-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.group-heading button { padding: 0; border: 0; background: none; color: #1d4ed8; font-size: 11px; }
.group-heading button:hover:not(:disabled) { color: #163da4; background: none; text-decoration: underline; }
.filter-items { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.resource-filter { display: flex; align-items: center; gap: 5px; min-width: 0; padding: 6px; border-color: #aec6eb; border-radius: 3px; color: #244a82; background: var(--accent-soft); font-size: 11px; text-align: left; }
.resource-filter:hover:not(:disabled) { color: #1d4ed8; border-color: var(--accent); }
.resource-filter .swatch { width: 7px; height: 7px; border-radius: 2px; flex-shrink: 0; }
.resource-filter .filter-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resource-filter .count { margin-left: auto; font-size: 10px; font-variant-numeric: tabular-nums; }
.resource-filter:has(.resource-status) { grid-column: 1/-1; }
.resource-filter.off { color: var(--muted); background: var(--panel); border-color: var(--line); }
.resource-filter.off .swatch { background: transparent!important; border: 1px solid #8c97a6; }
.resource-status { padding: 1px 5px; border: 1px solid #e1cfac; border-radius: 3px; color: #79591c; background: #faf5e9; font-size: 10px; white-space: nowrap; }
.filter-empty { padding: 8px 0; color: var(--muted); font-size: 12px; }
.resource-list-panel { margin-top: 13px; padding-top: 10px; border-top: 1px solid var(--line); }
.resource-list-panel summary { display: flex; align-items: center; gap: 7px; color: var(--text); cursor: pointer; font-size: 12px; list-style: none; }
.resource-list-panel summary:before { content: "›"; font-size: 17px; line-height: 1; }
.resource-list-panel[open] summary:before { transform: rotate(90deg); }
.resource-list-panel summary::-webkit-details-marker { display: none; }
.resource-list-panel summary span { margin-left: auto; color: var(--muted); font-size: 11px; }
.resource-list { display: grid; gap: 3px; padding-top: 7px; max-height: 240px; overflow-y: auto; scrollbar-width: thin; }
.resource-row { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 6px; border-color: transparent; background: none; font-size: 11px; text-align: left; }
.resource-row .swatch { width: 6px; height: 6px; flex-shrink: 0; border-radius: 2px; }
.resource-row small { margin-left: auto; color: var(--muted); font-size: 10px; white-space: nowrap; }
.resource-row.active { color: #1d4ed8; border-color: #8aafea; background: var(--accent-soft); }
.list-more { padding: 6px; color: #1d4ed8; background: var(--panel-soft); font-size: 11px; }
.map-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 14px 16px 0; background: var(--bg); }
.map-viewport { position: relative; flex: 1; min-height: 340px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 4px; background: #1a1d1f; }
.map-viewport.planning-only { background: #171a1e; }
canvas { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
canvas:focus-visible { outline-offset: -3px; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; pointer-events: none; color: #bdc5cf; }
.empty svg { width: 54px; height: 42px; fill: none; stroke: #8d9bae; stroke-width: 1.2; }
.empty p { font-size: 13px; }
.map-coordinate { position: absolute; left: 12px; bottom: 12px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 3px; background: #fffffff5; color: var(--muted); font: 11px/1.4 Consolas, monospace; pointer-events: none; }
.zoom-controls { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 1px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--line); }
.zoom-controls button { display: grid; place-items: center; width: 33px; height: 33px; padding: 0; border: 0; border-radius: 0; background: var(--panel); color: var(--text); font-size: 19px; }
.zoom-controls button:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
.zoom-controls button:last-child svg { width: 16px; height: 16px; }
.map-bottom { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; min-height: 48px; padding: 10px 2px; flex-shrink: 0; color: var(--muted); font-size: 11px; }
.legend { display: flex; align-items: center; gap: 10px; flex-shrink: 0; white-space: nowrap; }
.legend-values { width: 130px; }
.legend-scale { height: 5px; border-radius: 2px; }
.legend-values>div:last-child { display: flex; justify-content: space-between; margin-top: 3px; color: var(--muted); font-size: 10px; }
.biome-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; flex: 1 1 300px; color: var(--muted); font-size: 11px; }
.biome-key { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.biome-key i, .biome-key .swatch { width: 11px; height: 11px; flex-shrink: 0; border: 1px solid #00000029; border-radius: 2px; }
.scale-label { color: var(--muted); font-size: 10px; }
.tooltip { position: absolute; z-index: 3; pointer-events: none; max-width: min(300px, calc(100% - 16px)); padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fffffff5; color: var(--text); box-shadow: var(--shadow); font-size: 12px; overflow-wrap: anywhere; }
.tooltip strong { font-weight: 600; }
.tooltip span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.inspector { position: absolute; z-index: 4; top: 12px; left: 12px; width: 232px; max-height: calc(100% - 74px); padding: 12px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--panel); box-shadow: var(--shadow); scrollbar-width: thin; scrollbar-color: #b6bfcb transparent; }
.inspector-head { position: sticky; top: -12px; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -12px -12px 0; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.inspector-head h2 { min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.inspector-head button { width: 32px; height: 32px; flex-shrink: 0; padding: 0; color: var(--muted); font-size: 21px; line-height: 1; }
.inspect-coord { margin-top: 10px; color: var(--muted); font: 11px/1.5 Consolas, monospace; }
.land-type { margin: 6px 0 12px; color: var(--muted); font-size: 11px; }
.feature-detail { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.detail-chip { display: inline-flex; padding: 2px 6px; border: 1px solid var(--line); border-radius: 3px; color: var(--text); background: var(--panel-soft); font-size: 11px; }
.inspect-metric { margin-top: 10px; }
.metric-top { display: flex; justify-content: space-between; gap: 9px; color: var(--muted); font-size: 11px; }
.metric-top strong { font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.metric-bar { height: 3px; margin-top: 5px; overflow: hidden; border-radius: 2px; background: #e7ebf0; }
.metric-bar i { display: block; height: 100%; background: #6287ba; }
.metric-positive .metric-top strong { color: var(--positive); }
.metric-positive .metric-bar i { background: #3d9862; }
.metric-negative .metric-top strong { color: var(--negative); }
.metric-negative .metric-bar i { background: #c84439; }
.nearest { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.nearest button { padding: 0; border: 0; background: none; color: #1d4ed8; text-align: left; font-size: 11px; }
.nearest button:hover:not(:disabled) { color: #163da4; background: none; text-decoration: underline; }
.loading { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; flex-direction: column; background: #fffffff0; }
.loader { width: 30px; height: 30px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
.loading p { margin: 16px 0 6px; color: var(--text); font-size: 14px; }
.loading small { color: var(--muted); font-size: 11px; }
.loading button { margin-top: 18px; padding: 5px 12px; font-size: 11px; }
.error { position: absolute; bottom: 58px; left: 12px; right: 12px; z-index: 9; display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid #d92d20; border-radius: 4px; background: #fff1f0; color: #8f1d18; font-size: 12px; }
.error span { flex: 1; overflow-wrap: anywhere; white-space: pre-wrap; }
.error button { padding: 0 4px; border: 0; background: none; color: #8f1d18; font-size: 20px; }
.toast { position: fixed; z-index: 100; bottom: 22px; left: 50%; max-width: 90%; transform: translateX(-50%); padding: 8px 15px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--text); background: var(--panel); box-shadow: var(--shadow); font-size: 12px; }
.layer-progress { margin-top: 7px; color: #1d4ed8; font-size: 11px; }
.layers button[aria-busy="true"] { border-color: var(--accent); }
.layers button[aria-busy="true"]:before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 5px; border: 1px solid #b8c7df; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
.building-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--panel); border-left: 1px solid var(--line); }
.building-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-shrink: 0; min-height: 51px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.building-title { display: flex; align-items: center; gap: 9px; }
.building-title h2 { font-size: 14px; font-weight: 600; }
.layout-counter { padding: 1px 6px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); background: var(--panel-soft); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#toggle-buildings, #close-buildings, .building-backdrop { display: none; }
.cancel-placement { flex-shrink: 0; margin: 10px 12px 0; padding: 6px 9px; border-color: #8aafea; background: var(--accent-soft); color: #1d4ed8; font-size: 12px; }
.building-search { width: calc(100% - 24px); margin: 10px 12px; flex-shrink: 0; }
.building-categories { display: flex; flex-wrap: wrap; gap: 5px; flex-shrink: 0; padding: 0 12px 11px; border-bottom: 1px solid var(--line); }
.building-categories button { padding: 4px 7px; font-size: 11px; color: var(--muted); }
.building-categories button.active, .building-categories button[aria-pressed="true"] { color: #1d4ed8; background: var(--accent-soft); border-color: #8aafea; }
.building-list { min-height: 0; min-width: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 9px 10px 14px; scrollbar-width: thin; scrollbar-color: #b6bfcb transparent; background: var(--panel-soft); }
.building-category { min-width: 0; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); }
.building-category>summary { display: flex; align-items: center; gap: 6px; padding: 8px 10px; color: var(--text); cursor: pointer; font-size: 12px; list-style: none; }
.building-category>summary::-webkit-details-marker { display: none; }
.building-category>summary:before { content: "›"; font-size: 16px; line-height: 1; }
.building-category[open]>summary:before { transform: rotate(90deg); }
.building-category>summary>span:last-child { margin-left: auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.building-category[open]>summary { border-bottom: 1px solid var(--line); }
.building-category>summary:hover { background: #f2f5fa; }
.building-items { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: flex-start; gap: 14px 9px; padding: 11px 7px; }
.building-entry { display: flex; align-items: center; flex-direction: column; width: max(88px, calc(var(--footprint-width, 60px) + 16px)); min-width: 0; }
.building-card { display: flex; align-items: center; flex-direction: column; justify-content: flex-start; gap: 6px; width: 100%; min-height: 44px; padding: 6px; border: 0; background: transparent; border-radius: 3px; color: var(--text); cursor: grab; user-select: none; touch-action: pan-y; }
.building-card:hover:not(:disabled) { color: var(--text); background: var(--panel-soft); }
.building-footprint { display: flex; align-items: center; justify-content: center; width: var(--footprint-width); height: var(--footprint-height); flex-shrink: 0; overflow: hidden; border: 1px solid #ffffff25; border-radius: 1px; background-color: color-mix(in srgb, var(--building-fill, #92b8dc) 60%, #000000); color: #ffffff; text-shadow: 0 1px 2px #0009; font-size: 12px; line-height: 1.1; box-shadow: inset 0 0 0 1px #0001; }
.building-footprint-size { color: #ffffff; font: 10px/1 Consolas, monospace; white-space: nowrap; }
.building-card:hover:not(:disabled) .building-footprint { border-color: #2563eb; box-shadow: 0 0 0 1px #2563eb; }
.building-card.active .building-footprint, .building-card[aria-pressed="true"] .building-footprint { border-color: #2563eb; box-shadow: 0 0 0 2px #2563eb; }
.building-card.is-dragging .building-footprint, .building-card.dragging .building-footprint { opacity: .5; border-style: dashed; }
.building-card:active { cursor: grabbing; }
.building-card-caption { display: flex; align-items: center; flex-direction: column; width: 100%; color: var(--text); font-size: 12px; text-align: center; line-height: 1.45; }
.building-name { max-width: 100%; overflow-wrap: anywhere; }
.building-size { flex-shrink: 0; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.building-empty { padding: 18px 5px; color: var(--muted); font-size: 12px; text-align: center; }
.layout-selection { position: absolute; top: 12px; right: 12px; z-index: 5; display: flex; flex-direction: column; width: 352px; max-width: calc(100% - 24px); max-height: calc(100% - 75px); overflow: hidden; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--panel); box-shadow: var(--shadow); }
.selected-building-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; flex-shrink: 0; border-bottom: 1px solid var(--line); background: var(--panel); }
.selected-building-title { flex: 1; min-width: 0; }
.selected-building-title h3 { color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.building-edit-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.building-edit-actions button { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; padding: 0; font-size: 20px; line-height: 1; }
.building-edit-actions button svg { width: 17px; height: 17px; }
.building-edit-actions .delete-building { color: var(--negative); }
.building-edit-actions .delete-building:hover:not(:disabled) { color: #8f1d18; background: #fff1f0; border-color: #d92d20; }
.building-detail-scroll { flex: 1; min-height: 0; padding: 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #b6bfcb transparent; }
.building-summary { color: var(--text); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.building-summary p+p { margin-top: 7px; }
.building-summary:empty, .selected-building-info:empty, .building-analysis:empty { display: none; }
.building-alerts { margin-top: 12px; border: 1px solid #d92d20; border-left-width: 4px; border-radius: 4px; color: #8f1d18; background: #fff1f0; }
.building-issues { margin: 0; padding: 9px 11px 9px 25px; color: #8f1d18; font-size: 12px; line-height: 1.6; }
.building-alerts .building-issues { padding: 0; list-style: none; }
.building-issues li+li { border-top: 1px solid #efc9c6; }
.building-issue { display: flex; align-items: flex-start; gap: 7px; padding: 9px 10px; overflow-wrap: anywhere; }
.building-issue svg { width: 16px; height: 16px; margin-top: 2px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.building-issue>span { min-width: 0; }
.building-analysis { margin-top: 12px; color: var(--text); font-size: 12px; line-height: 1.6; }
.analysis-section { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.analysis-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.analysis-title { margin-bottom: 4px; color: var(--text); font-size: 12px; font-weight: 600; }
.analysis-row, .analysis-total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 5px 0; }
.analysis-row>span:first-child { min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.analysis-value, .analysis-row strong, .analysis-total strong { max-width: 65%; color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.analysis-total { padding: 7px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.analysis-total strong { font-size: 18px; font-weight: 600; }
.analysis-positive, .analysis-row strong.analysis-positive, .analysis-total strong.analysis-positive, .analysis-source .positive, .knowledge-rows dd.analysis-positive { color: var(--positive); }
.analysis-negative, .analysis-row strong.analysis-negative, .analysis-total strong.analysis-negative, .analysis-source .negative, .knowledge-rows dd.analysis-negative { color: var(--negative); }
.analysis-sources, .analysis-requirements, .knowledge-section { width: 100%; min-width: 0; margin-top: 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
.analysis-sources>summary, .analysis-requirements>summary, .knowledge-section>summary { padding: 8px 10px; color: var(--text); background: var(--panel-soft); cursor: pointer; font-size: 12px; }
.analysis-sources[open]>summary, .analysis-requirements[open]>summary, .knowledge-section[open]>summary { border-bottom: 1px solid var(--line); }
.analysis-source { display: flex; align-items: baseline; justify-content: space-between; width: 100%; gap: 10px; padding: 7px 10px; border: 0; border-bottom: 1px solid #e9edf2; border-radius: 0; background: none; text-align: left; font: inherit; cursor: pointer; }
.analysis-source:hover:not(:disabled) { color: var(--text); background: var(--accent-soft); }
.analysis-source>span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.analysis-source>b { flex-shrink: 0; font-weight: 500; font-variant-numeric: tabular-nums; }
.analysis-source:last-child { border-bottom: 0; }
.analysis-source.muted { color: var(--muted); }
.analysis-requirements .analysis-row { margin: 0 10px; }
.selected-building-info { min-height: 0; font-size: 12px; line-height: 1.6; }
.selected-building-info>.detail-chip { margin: 8px 4px 0 0; }
.selected-building-info dl { margin: 0; }
.selected-building-info dt { color: var(--muted); }
.selected-building-info dd { margin: 0; color: var(--text); }
.building-dimensions { display: grid; grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr); gap: 6px; align-items: end; margin-top: 10px; }
.building-dimensions label { margin: 0; color: var(--muted); font-size: 11px; }
.building-dimensions input { display: block; width: 100%; height: 31px; padding: 4px 7px; margin-top: 3px; font-size: 12px; }
.building-dimensions>span { text-align: center; line-height: 31px; color: var(--muted); }
.detail-row, .building-info-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid #e9edf2; }
.detail-row>span:first-child, .detail-row dt { color: var(--muted); }
.detail-row>strong, .detail-row dd, .building-info-row strong { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.detail-section, .building-info-title { margin: 10px 0 5px; color: var(--text); font-size: 12px; font-weight: 600; }
.detail-section:first-child, .building-info-title:first-child { margin-top: 0; }
.detail-list { display: grid; gap: 5px; margin: 5px 0; padding-left: 16px; color: var(--muted); }
.detail-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.detail-table th, .detail-table td { padding: 5px 6px; border: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.detail-table th { color: var(--text); background: var(--panel-soft); font-weight: 500; }
.building-info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 10px; }
.building-costs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.building-cost, .building-tag { padding: 2px 5px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); background: var(--panel-soft); font-size: 11px; }
.knowledge-section>.knowledge-rows { display: grid; gap: 0; margin: 0; padding: 5px 10px; }
.knowledge-rows>div { display: grid; grid-template-columns: minmax(70px, .45fr) minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid #e9edf2; }
.knowledge-rows>div:last-child { border-bottom: 0; }
.knowledge-rows dt { color: var(--muted); font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; }
.knowledge-rows dd { margin: 0; color: var(--text); font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.knowledge-section>p { margin: 0; padding: 7px 10px; color: var(--text); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.feature-detail .knowledge-section { flex: 1 0 100%; margin-top: 5px; }
.inspector .knowledge-rows>div { grid-template-columns: minmax(57px, .42fr) minmax(0, 1fr); gap: 6px; }
.resource-icon { display: block; width: 24px; height: 24px; flex-shrink: 0; object-fit: contain; }
.resource-symbol { display: grid; place-items: center; width: 24px; height: 24px; flex-shrink: 0; border-radius: 3px; color: var(--text); font-size: 13px; font-style: normal; font-weight: 600; }
.resource-portrait { display: block; width: 100%; max-height: 140px; object-fit: contain; padding: 6px; border: 1px solid var(--line); border-radius: 3px; background: #f2f4f7; }
/* 科技树保留原有黑底和暖金交互色，不继承外框的浅色主题。 */
.technology-dialog {
  color-scheme: dark;
  --bg: #17150f;
  --panel: #211e18;
  --panel-soft: #29251d;
  --line: #3e3629;
  --line-strong: #5c4c36;
  --text: #e1d8c5;
  --muted: #aa9f8c;
  --accent: #bc9556;
  --accent-soft: #3d3020;
  --control-bg: #29251e;
  --control-hover: #3b3022;
  --placeholder: #8b8e94;
  --shadow: 0 6px 20px #0005;
}
[hidden] { display: none!important; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 1600px) {
  .app-layout { grid-template-columns: 284px minmax(0, 1fr) 352px; }
  .controls { padding: 18px; }
  .map-main { padding: 18px 20px 0; }
}
@media (max-width: 1180px) {
  .app-layout { grid-template-columns: 264px minmax(0, 1fr); }
  #toggle-buildings { display: inline-block; color: #1d4ed8; border-color: #8aafea; background: var(--accent-soft); }
  #toggle-buildings[aria-expanded="true"] { color: #163da4; border-color: var(--accent); background: #dbe9ff; }
  #close-buildings { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; font-size: 21px; line-height: 1; }
  .building-panel { position: fixed; inset: 0 0 0 auto; z-index: 40; width: min(360px, calc(100vw - 18px)); height: 100dvh; visibility: hidden; pointer-events: none; transform: translateX(100%); transition: transform .18s ease, visibility .18s; box-shadow: -8px 0 28px #172a4529; }
  .building-panel.is-open { visibility: visible; pointer-events: auto; transform: translateX(0); }
  .building-backdrop { display: block; position: fixed; inset: 0; z-index: 30; width: 100%; height: 100%; border: 0; border-radius: 0; background: #172a4566; cursor: default; }
  .building-backdrop:hover:not(:disabled) { border: 0; background: #172a4566; }
  body:has(.building-panel.is-open) { overflow: hidden; }
}
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 242px minmax(0, 1fr); }
  .controls { padding: 13px 10px; }
  #seed-form, .layer-section, .feature-section { padding: 11px; }
  .map-main { padding: 12px 12px 0; }
  .filter-items { grid-template-columns: 1fr; }
  .biome-legend { flex-basis: 100%; }
}
@media (max-width: 620px) {
  html, body { height: auto; min-height: 100%; }
  .topbar { position: sticky; top: 0; z-index: 20; height: auto; min-height: 52px; flex-wrap: wrap; padding: 9px 12px; gap: 7px; }
  .topbar h1 { font-size: 14px; }
  .map-actions { flex-wrap: wrap; gap: 5px; }
  .map-actions button { padding: 5px 7px; font-size: 11px; }
  .app-layout { height: auto; min-height: 0; display: flex; flex-direction: column; }
  .controls { padding: 11px 10px; overflow: visible; border: 0; border-bottom: 1px solid var(--line); }
  #seed-form, .layer-section, .feature-section { padding: 11px; }
  #seed-form { display: grid; grid-template-columns: minmax(0, 1fr) 99px; gap: 8px 10px; }
  #seed-form>label { grid-column: 1/-1; margin: 0; }
  #seed-form .seed-input { grid-column: 1; grid-row: 2; }
  #seed-form .primary { grid-column: 2; grid-row: 2; height: 41px; margin: 0; }
  .form-row { grid-column: 1/-1; grid-template-columns: 1fr 1.6fr; margin-top: 3px; }
  .layer-section, .feature-section { margin-top: 9px; }
  .layer-section h2 { display: none; }
  .layers { margin-top: 0; }
  .resource-filters { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: thin; }
  .filter-group { flex-shrink: 0; min-width: max-content; margin: 0; }
  .filter-items { grid-template-columns: repeat(2, minmax(82px, 1fr)); }
  .resource-list-panel { margin-top: 7px; padding-top: 7px; }
  .resource-list { grid-template-columns: 1fr 1fr; max-height: 175px; }
  .resource-row>span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .map-main { padding: 10px 9px 0; }
  .map-viewport { flex: none; height: max(420px, 63dvh); min-height: 380px; }
  .map-bottom { padding: 9px 3px 14px; gap: 8px 14px; }
  .legend-values { width: 114px; }
  .layout-selection { top: 9px; right: 9px; max-height: 60%; }
  .selected-building-head { padding: 9px; gap: 8px; }
  .building-detail-scroll { padding: 10px; }
  .inspector { top: 9px; left: 9px; width: 210px; }
  .map-coordinate { left: 9px; bottom: 9px; }
  .zoom-controls { right: 9px; bottom: 9px; }
  .tooltip { max-width: calc(100% - 18px); white-space: normal; }
  .toast { bottom: 14px; }
}
@media (max-width: 360px) {
  .topbar h1 { font-size: 13px; }
  .map-actions button { padding: 5px; font-size: 10px; }
  #seed-form { grid-template-columns: minmax(0, 1fr) 88px; gap: 8px; }
}
@media (pointer: coarse) { .building-card, .building-card:active { cursor: pointer; } .building-categories button { min-height: 33px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none!important; } .loader { animation-duration: 2s; } }
