:root {
  color-scheme: dark;
  font: 16px/1.5 system-ui, "Microsoft YaHei", sans-serif;
  --surface: #151d25;
  --line: #2c3a46;
  --muted: #adbac5;
  --accent: #ffc477;
  background: #0b1117;
  color: #eff4f8;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.shell { max-width: 1480px; margin: auto; padding: 28px clamp(14px, 4vw, 52px); }
.masthead { display: flex; align-items: center; gap: 16px; margin-bottom: 25px; }
.brand { background: var(--accent); color: #1c1914; padding: 8px 12px; font-size: 1.25rem; font-weight: 900; border-radius: 4px; }
h1, h2, p { margin: 0; }
h1 { font-size: 1.6rem; line-height: 1.2; }
.masthead p, .viewer p, #empty { color: var(--muted); }
.layout { display: grid; grid-template-columns: minmax(210px, 265px) minmax(0, 1fr); gap: 16px; }
.library, .viewer { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.library { display: flex; flex-direction: column; min-height: 0; }
.library-top, .viewer-top, .viewer-bottom { padding: 15px 19px; }
.library-title, .viewer-top, .viewer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.library-title h2 { font-size: 1rem; }
#count, .map-meta { color: var(--muted); font-size: .875rem; }
#search { width: 100%; margin-top: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #0c131b; color: inherit; }
#maps { list-style: none; margin: 0; padding: 0 9px 9px; max-height: max(370px, calc(72vh - 50px)); overflow-y: auto; }
.map-row { width: 100%; text-align: left; display: grid; gap: 2px; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 8px 10px; overflow-wrap: anywhere; }
.map-row:hover, .modes button:not(:disabled):hover, .zoom button:not(:disabled):hover { background: #25333e; }
.map-row[aria-current="true"] { background: #30281f; border-color: #6c5235; color: var(--accent); }
#empty { padding: 8px 19px 20px; }
.viewer-top { min-height: 84px; flex-wrap: wrap; }
#map-name { font-size: clamp(1.2rem, 4vw, 1.75rem); overflow-wrap: anywhere; }
#map-detail, #hint { font-size: .875rem; }
.modes, .zoom { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.modes button, .zoom button { background: #101820; border: 1px solid var(--line); border-radius: 5px; min-height: 40px; padding: 4px 10px; }
.modes button[aria-pressed="true"] { border-color: #a97642; color: var(--accent); }
.walk-link { display: inline-block; border-radius: 5px; background: var(--accent); color: #21190e; font-weight: 700; padding: 8px 12px; text-decoration: none; white-space: nowrap; }
.walk-stage { height: clamp(320px, 73vh, 900px); position: relative; background: #0e171e; }
.walk-stage canvas { display: block; width: 100%; height: 100%; }
.walk-overlay { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 12px; padding: 20px; background: #0b11174a; text-shadow: 0 1px 5px #000; }
.walk-overlay button { justify-self: center; border: 0; }
.walk-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 18px; margin-top: 12px; }
.walk-help { color: var(--muted); }
.walk-options { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.exposure { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: .875rem; }
.exposure input { width: 104px; accent-color: var(--accent); }
.exposure select { color: inherit; font: inherit; border: 1px solid var(--line); border-radius: 5px; background: #101820; padding: 5px 8px; }
.exposure output { min-width: 3.5ch; font-variant-numeric: tabular-nums; }
.crosshair { pointer-events: none; color: white; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.stage {
  height: clamp(340px, 66vh, 750px);
  position: relative;
  overflow: auto;
  background: #0e171e radial-gradient(#2b3944 1px, transparent 1px) 0 0 / 19px 19px;
  border-block: 1px solid var(--line);
}
.picture { display: grid; place-items: center; width: max-content; height: max-content; min-width: 100%; min-height: 100%; padding: 14px; }
.picture img { display: block; box-shadow: 0 6px 34px #0008; }
.stage.can-pan { cursor: grab; }
.stage.dragging { cursor: grabbing; user-select: none; }
#placeholder { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; pointer-events: none; }
.viewer-bottom { min-height: 68px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 700px) {
  .shell { padding-top: 16px; }
  .masthead { margin-bottom: 14px; }
  .layout { grid-template-columns: 1fr; }
  #maps { max-height: 146px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage { height: 52vh; min-height: 275px; }
  .viewer-top, .viewer-bottom, .library-top { padding: 12px; }
}
