@font-face {
  font-family: Inter;
  src: url('assets/Inter.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --paper: #f6f5ef;
  --ink: #161616;
  --muted: #6f6b63;
  --accent: #8e3b2f;
  --panel: rgba(255, 253, 247, .88);
  --line: rgba(22, 22, 22, .08);
  --shadow: rgba(22, 22, 22, .08);
  --track: #d7d1c0;
  --knob: #fffdf7;
  --page-background: linear-gradient(180deg, #fbfaf6 0%, var(--paper) 100%);
  --soft-fill: rgba(22, 22, 22, .055);
  --field-fill: rgba(22, 22, 22, .025);
  --selected-text: #f6f5ef;
  --selected-muted: #d7d1c0;
  --hover-fill: #35332f;
  --sidebar: 280px;
  --viewer-height: max(500px, calc(100dvh - 88px));
  font-family: Inter, "Segoe UI", sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background: var(--paper);
}
:root[data-theme="dark"] {
  --paper: #111315;
  --ink: #ece7df;
  --muted: #9e988f;
  --accent: #ff8a74;
  --panel: #17191c;
  --line: rgba(236, 231, 223, .08);
  --shadow: transparent;
  --track: #2a2d31;
  --knob: #111315;
  --page-background: #111315;
  --soft-fill: rgba(236, 231, 223, .06);
  --field-fill: rgba(236, 231, 223, .025);
  --selected-text: #111315;
  --selected-muted: #514d47;
  --hover-fill: #d9d2c7;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
#theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border-radius: 50%; color: var(--ink); }
#theme-toggle:hover { background: var(--soft-fill); }
#theme-toggle svg { width: 21px; height: 21px; }
.sun-icon { display: none; }
:root[data-theme="dark"] .sun-icon { display: block; }
:root[data-theme="dark"] .moon-icon { display: none; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--page-background); }
button, input { font: inherit; }
button, a, .import-button { touch-action: manipulation; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { border: 0; background: none; color: inherit; cursor: pointer; }
button:disabled { opacity: .38; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, .import-button:focus-within {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
[hidden] { display: none !important; }
main { width: 100%; margin: auto; padding: 0 20px 20px; }
.intro { display: flex; align-items: center; justify-content: space-between; height: 66px; }
h1 { font-size: 28px; font-weight: 800; line-height: 1; letter-spacing: -.025em; margin: 0; }
.atlas { display: grid; grid-template-columns: minmax(0, 1fr) var(--sidebar); gap: 16px; align-items: start; }
.viewer-shell, .sidebar { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 .8rem 2rem var(--shadow); }
.viewer-shell { min-width: 0; overflow: hidden; }
.viewer { position: relative; height: var(--viewer-height); overflow: hidden; background: #161616; isolation: isolate; }
#scene { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; }
#scene.dragging { cursor: grabbing; }
#scene.drawing { cursor: crosshair; }
.building-shape { fill: transparent; stroke: transparent; stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: all; cursor: pointer; }
.show-outlines .building-shape { fill: rgba(255, 253, 247, .03); stroke: rgba(255, 253, 247, .5); }
.building-shape.active, .building-shape:focus-visible { fill: rgba(142, 59, 47, .38); stroke: #fffdf7; stroke-width: 2; outline: none; }
.hit-shape { fill: transparent; stroke: transparent; stroke-width: 10; vector-effect: non-scaling-stroke; pointer-events: all; cursor: pointer; }
.drawing .hit-shape, .drawing .building-shape { pointer-events: none; }
.marker-stem { stroke: rgba(255, 253, 247, .8); stroke-width: 1; }
.marker-circle { fill: var(--ink); stroke: var(--knob); stroke-width: 1; pointer-events: all; cursor: pointer; }
.drawing .marker-circle { pointer-events: none; }
.marker-number { fill: var(--paper); font-size: 9px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.marker { pointer-events: none; opacity: .95; }
.top-controls { position: absolute; top: 16px; right: 16px; display: flex; gap: 7px; }
.top-controls button { min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 700; backdrop-filter: blur(10px); }
.top-controls button[aria-pressed=true] { background: var(--ink); color: var(--selected-text); }
.top-controls button:hover { background: var(--knob); color: var(--ink); }
.top-controls button[aria-pressed=true]:hover { background: var(--hover-fill); color: var(--selected-text); }
#fullscreen, #reset-view { width: 38px; padding: 0; font-size: 19px; }
.navigation { position: absolute; bottom: 20px; left: 20px; right: 20px; display: flex; justify-content: space-between; gap: 12px; pointer-events: none; }
.navigation > div { pointer-events: auto; display: flex; align-items: center; padding: 4px; gap: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); backdrop-filter: blur(10px); }
.view-modes button { padding: 9px 13px; font-size: 12px; font-weight: 700; border: 1px solid transparent; border-radius: 999px; }
.view-modes button.active { background: var(--ink); color: var(--selected-text); }
.view-modes button:hover:not(.active) { color: var(--ink); background: var(--soft-fill); }
.zoom-controls button { font-size: 22px; width: 32px; height: 32px; border-radius: 50%; color: var(--ink); }
.zoom-controls button:hover:not(:disabled) { background: var(--track); }
.zoom-controls output { width: 42px; text-align: center; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.sidebar { display: flex; flex-direction: column; height: calc(var(--viewer-height) + 2px); min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--track) transparent; }
.building-detail { flex: none; min-height: 0; padding: 22px 20px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 12px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; line-height: 1.4; }
.building-detail h2 { margin: 0 0 16px; font-size: 25px; font-weight: 800; line-height: 1.08; letter-spacing: -.015em; overflow-wrap: break-word; }
.building-detail p:not(.eyebrow) { margin: 0; font-size: 13px; line-height: 1.65; color: var(--muted); }
.building-detail p.caveat { margin-top: 12px; font-size: 11px; color: var(--accent); }
.detail-actions { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-top: 17px; }
.detail-actions button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: 11px; font-weight: 700; }
.detail-actions button:hover { background: var(--track); }
.detail-actions #clear-selection { font-size: 23px; padding: 0; width: 32px; height: 32px; border: 0; }
.directory { display: flex; flex-direction: column; flex: 1; min-height: 230px; padding: 23px 14px 0; }
.directory-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 10px; margin-bottom: 16px; }
.directory h3 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: normal; }
.directory-heading > span { border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; color: var(--muted); font-size: 11px; font-weight: 700; }
.search { display: flex; align-items: center; gap: 8px; margin: 0 8px 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--field-fill); }
.search > span { font-size: 20px; line-height: 1; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search input::placeholder { color: var(--muted); }
.search kbd { padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 10px; }
.list { flex: 1; min-height: 110px; overflow-y: auto; padding: 0 3px; scrollbar-width: thin; scrollbar-color: var(--track) transparent; }
.building-row { display: flex; align-items: center; gap: 0; width: 100%; min-height: 39px; padding: 0 3px 0 0; border-radius: 9px; color: var(--ink); font-size: 12px; font-weight: 500; text-align: left; transition: background 140ms ease; }
.building-select { display: flex; align-items: center; align-self: stretch; gap: 12px; flex: 1; min-width: 0; min-height: inherit; padding: 9px 10px; text-align: left; border-radius: 9px; }
.building-row .num { font-size: 10px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.building-row .arrow { display: flex; flex: 0 0 32px; min-height: 32px; align-items: center; justify-content: center; color: inherit; text-decoration: none; border-radius: 50%; font-size: 17px; }
.building-row .arrow:hover { background: var(--soft-fill); }
.building-row:hover, .building-row:focus-within { background: var(--soft-fill); }
.building-row.selected { background: var(--ink); color: var(--selected-text); }
.building-row.selected .num { color: var(--selected-muted); }
.sidebar-bottom { flex: none; display: flex; flex-direction: column; gap: 12px; padding: 17px 24px; margin-top: 14px; border-top: 1px solid var(--line); }
.sidebar-bottom button { width: fit-content; padding: 0; color: var(--ink); font-size: 11px; font-weight: 700; text-align: left; }
.empty { padding: 0 12px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.tooltip { position: absolute; z-index: 5; max-width: min(280px, 90%); padding: 13px 17px; border: 1px solid rgba(255, 253, 247, .2); border-radius: 12px; background: var(--ink); color: var(--selected-text); box-shadow: 0 .5rem 1.5rem var(--shadow); font-size: 13px; line-height: 1.4; pointer-events: none; }
.tooltip strong { font-weight: 700; }
.tooltip small { display: block; margin-top: 5px; color: var(--selected-muted); font-size: 11px; }
.editor { flex: none; padding: 0 24px 24px; }
.editor h3 { margin: 10px 0; font-size: 20px; font-weight: 800; letter-spacing: -.025em; }
.editor p { color: var(--muted); font-size: 12px; line-height: 1.65; }
.editor #edit-target { color: var(--ink); font-weight: 600; }
.edit-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.edit-buttons button, .import-button { padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; }
.edit-buttons button:hover:not(:disabled), .import-button:hover { background: var(--track); color: var(--ink); }
#save-outline:not(:disabled) { background: var(--ink); color: var(--selected-text); }
.edit-buttons.secondary { margin-top: 15px; }
.import-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drawing-banner { position: absolute; top: 70px; left: 16px; right: 16px; width: fit-content; margin: auto; padding: 10px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--knob); color: var(--ink); font-size: 12px; box-shadow: 0 .5rem 1.5rem var(--shadow); pointer-events: none; }
.draft-polygon { fill: rgba(142, 59, 47, .25); stroke: #fffdf7; stroke-width: 2; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.draft-point { fill: #fffdf7; stroke: #161616; stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.noscript { padding: 25px; background: var(--track); }
.viewer:fullscreen { width: 100vw; height: 100vh; }
.viewer:fullscreen .navigation { bottom: 25px; }
@media (min-width: 1600px) {
  :root { --sidebar: 300px; }
  .building-detail { padding: 24px; }
  .building-detail h2 { font-size: 28px; }
  .building-row { min-height: 42px; font-size: 13px; }
}
@media (max-width: 1100px) {
  :root { --sidebar: 260px; }
  .atlas { gap: 18px; }
  .building-detail { padding: 24px 20px; }
  .building-detail h2 { font-size: 27px; }
  .sidebar-bottom { padding: 16px 20px; }
}
@media (max-width: 760px) {
  main { padding: 0 10px 12px; }
  .intro { height: 54px; padding: 0 4px; }
  h1 { font-size: 25px; }
  .atlas { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .viewer { height: min(calc(100dvh - 72px), 135vw); min-height: 380px; }
  .sidebar { height: auto; max-height: none; }
  .building-detail { min-height: 0; padding: 25px 24px; }
  .building-detail h2 { font-size: 27px; }
  .directory { min-height: 280px; padding: 23px 14px 0; }
  .list { max-height: 280px; min-height: 180px; }
  .building-row { min-height: 44px; font-size: 13px; }
  .search input { font-size: 16px; }
  .sidebar-bottom { padding: 20px 24px; }
  .top-controls { top: 13px; right: 12px; gap: 6px; }
  .top-controls button { padding: 0 10px; min-height: 36px; font-size: 11px; }
  .top-controls #fullscreen, .top-controls #reset-view { width: 36px; padding: 0; font-size: 19px; }
  .navigation { left: 12px; right: 12px; bottom: 15px; gap: 8px; }
  .view-modes button { padding: 9px 10px; font-size: 11px; }
  .zoom-controls button { width: 28px; }
  .zoom-controls output { width: 34px; font-size: 11px; }
  .editor { padding: 0 24px 25px; }
  .edit-buttons button, .import-button { min-height: 40px; }
  .drawing-banner { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
