* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  color-scheme: dark;
  --ground: #151714;
  --panel: #1d201c;
  --raised: #272b25;
  --line: #3b4138;
  --ink: #f3f0e6;
  --secondary: #c7cbbd;
  --muted: #a0a79a;
  --accent: #edbb76;
  --sea: #252c24;
  --rail: 292px;
}
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 14px/1.5 "Instrument Sans", "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
}
h1, h2, p, ul { margin: 0; }
h1, h2 { font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
a { color: var(--accent); text-underline-offset: 4px; }
button, input, select { color: inherit; font: inherit; }
button, select {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--raised);
  min-height: 36px;
  padding: 4px 8px;
}
button, summary { cursor: pointer; }
button:hover { background: #31382e; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 60px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid #78694f;
  border-radius: 50%;
}
.brand-mark i, .compass i {
  display: block;
  width: 9px;
  height: 17px;
  background: var(--accent);
  clip-path: polygon(50% 0, 100% 100%, 50% 73%, 0 100%);
}
.brand-mark i { transform: rotate(32deg); }
h1 { font-size: 20px; }
#atlas-title { border-inline-start: 1px solid var(--line); padding-inline-start: 12px; color: var(--muted); }
.top select { max-width: 40%; min-width: 92px; }
.layout { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); align-items: start; }
.catalogue {
  min-width: 0;
  height: calc(100dvh - 60px);
  min-height: 500px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-inline-end: 1px solid var(--line);
  background: var(--panel);
}
.search-controls { display: grid; gap: 8px; }
#search-label, .section-label { color: var(--secondary); font-size: 12px; font-weight: 600; }
.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.search-field:focus-within { border-color: var(--accent); }
.search-field i { position: relative; flex: 0 0 12px; height: 12px; border: 1px solid var(--muted); border-radius: 50%; }
.search-field i::after { content: ""; position: absolute; width: 5px; height: 1px; background: var(--muted); right: -4px; bottom: -2px; transform: rotate(48deg); }
#search { width: 100%; min-width: 0; padding: 8px 0 8px 4px; border: 0; outline: 0; background: transparent; }
.search-field kbd { color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
.filter-section { display: grid; gap: 8px; }
#category { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.category {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  text-align: start;
  font-size: 12px;
  padding: 4px 6px;
  background: transparent;
}
.category span:nth-child(2) { overflow-wrap: anywhere; }
.category[aria-pressed=true] { background: var(--raised); border-color: #97825e; color: var(--accent); }
.number { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.symbol { display: inline-block; width: 9px; height: 9px; background: var(--symbol); margin-inline: 1px; }
.symbol[data-kind=all], .symbol[data-kind=gear] { border-radius: 50%; }
.symbol[data-kind=landmark] { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.symbol[data-kind=blueprint] { transform: rotate(45deg) scale(.82); }
.symbol[data-kind=quest] { clip-path: polygon(0 0,100% 0,100% 62%,50% 100%,0 62%); }
.symbol[data-kind=outfit] { border-radius: 50% 50% 2px 2px; }
.symbol[data-kind=attachment] { clip-path: polygon(34% 0,66% 0,66% 34%,100% 34%,100% 66%,66% 66%,66% 100%,34% 100%,34% 66%,0 66%,0 34%,34% 34%); }
.symbol[data-kind=printer] { clip-path: polygon(22% 0,78% 0,100% 26%,100% 74%,78% 100%,22% 100%,0 74%,0 26%); }
#result-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
#count { color: var(--secondary); font-size: 12px; }
#list-toggle { display: none; }
#result-panel { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.toggle { display: flex; gap: 8px; align-items: center; min-height: 32px; color: var(--secondary); font-size: 12px; }
.toggle input { accent-color: var(--accent); margin: 0; width: 16px; height: 16px; }
#results { display: grid; gap: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 2px; }
.result {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  text-align: start;
  padding: 4px 8px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  overflow-wrap: anywhere;
}
.result[aria-current=true] { background: var(--raised); box-shadow: inset 2px 0 var(--accent); color: var(--accent); }
#empty { color: var(--muted); padding: 12px 4px; }
.atlas { min-width: 0; padding: 16px 16px 8px; }
.map-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
@media (min-width: 1121px) {
  .map-workspace:has(#detail:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(248px, 27%); }
}
.stage { position: relative; background: var(--sea); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; min-width: 0; }
#map { display: block; width: 100%; height: clamp(440px, calc(100dvh - 152px), 1120px); touch-action: none; cursor: grab; }
canvas:active { cursor: grabbing !important; }
.compass {
  position: absolute;
  display: grid;
  justify-items: center;
  gap: 4px;
  inset: 16px auto auto 16px;
  padding: 6px 8px 8px;
  min-width: 38px;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--secondary);
  font-size: 11px;
  pointer-events: none;
}
.toolbar { position: absolute; top: 16px; right: 16px; display: grid; gap: 4px; }
.landmark-toggle {
  position: absolute;
  top: 16px;
  left: 72px;
  min-height: 40px;
  padding-inline: 10px;
  background: var(--ground);
}
.landmark-toggle::before { content: "▵"; margin-inline-end: 6px; }
.landmark-toggle[aria-pressed=true] { border-color: #97825e; color: var(--accent); }
.landmark-toggle[aria-pressed=true]::before { content: "▴"; }
.toolbar button, #hide { width: 40px; height: 40px; min-height: 40px; padding: 0; background: var(--ground); font-size: 21px; line-height: 1; }
.toolbar button:hover, #hide:hover { background: var(--raised); color: var(--accent); }
.scale {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: grid;
  justify-items: start;
  gap: 2px;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--ground);
  color: var(--secondary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.scale::after { content: ""; width: var(--scale-width, 48px); height: 4px; border: 1px solid var(--secondary); border-top: 0; }
.detail { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.detail-content { display: grid; gap: 12px; padding: 16px; overflow: auto; max-height: max(440px, calc(100dvh - 150px)); }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.detail-head > div { min-width: 0; }
.detail-head h2 { font-size: 22px; }
#point-category { margin-bottom: 4px; color: var(--muted); }
#hide { flex: 0 0 40px; }
#task, .landmark-note { max-width: 65ch; overflow-wrap: anywhere; }
:is(#task, .status, .position, .references, .sources, #point-category, #printer-products):empty { display: none; }
.status { width: fit-content; color: var(--accent); font-size: 12px; border-inline-start: 2px solid #a27e50; padding-inline-start: 8px; }
.position { color: var(--secondary); font: 12px/1.5 "IBM Plex Mono", Consolas, monospace; overflow-wrap: anywhere; }
.landmark-note, .coverage, .credits { font-size: 12px; color: var(--muted); }
.direction-guide { display: grid; gap: 4px; padding: 8px 12px; border-inline-start: 2px solid #97825e; background: var(--ground); }
.direction-guide button { padding-inline: 8px; text-align: start; overflow-wrap: anywhere; }
.direction-guide button::after { content: " ↗"; color: var(--accent); }
#direction-anchor { font-weight: 600; overflow-wrap: anywhere; }
#direction-distance { color: var(--secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
.references { display: grid; gap: 4px; }
.references button { text-align: start; overflow-wrap: anywhere; }
.references button::before { content: "↗"; margin-inline-end: 8px; color: var(--accent); }
.sources { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 12px; }
#printer-products { padding-inline-start: 20px; color: var(--secondary); }
.map-footer { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.position-tools summary { color: var(--secondary); font-size: 12px; }
.navigator { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 8px; }
.navigator label { display: flex; align-items: center; gap: 4px; }
.navigator input { width: 88px; min-height: 36px; padding: 4px; background: var(--ground); border: 1px solid var(--line); border-radius: 4px; }
.navigator output { flex-basis: 100%; color: var(--secondary); font-size: 12px; }
.credits { padding-bottom: 8px; }
.credits a { color: inherit; }
@media (max-width:1120px) {
  #map { height: clamp(392px, 68dvh, 820px); }
  .detail-content { max-height: none; }
}
@media (max-width:760px) {
  .top { min-height: 52px; padding: 8px 12px; gap: 8px; }
  .brand { gap: 8px; }
  .brand-mark { width: 24px; height: 24px; }
  h1 { font-size: 17px; }
  #atlas-title, .search-field kbd { display: none; }
  .layout { display: block; }
  .catalogue { height: auto; min-height: 0; padding: 12px; gap: 8px; border: 0; border-bottom: 1px solid var(--line); }
  #search-label, #category-label { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  #category { display: flex; overflow: auto; padding: 2px 2px 4px; }
  .category { flex: 0 0 auto; padding: 4px 8px; }
  #result-toolbar { padding-top: 4px; border: 0; }
  #list-toggle { display: block; }
  #result-panel[data-open=false] { display: none; }
  #results { max-height: 152px; }
  .atlas { padding: 8px; }
  #map { height: clamp(320px, 64dvh, 620px); }
  .compass { top: 12px; left: 12px; }
  .landmark-toggle { top: 12px; left: 64px; }
  .toolbar { top: 12px; right: 12px; }
}
