:root {
  color-scheme: dark;
  --ink: #ede4cf;
  --muted: #b9ae95;
  --brass: #bc9a57;
  --line: rgba(215, 194, 145, 0.24);
  --plaque: rgba(25, 25, 22, 0.94);
  font-family: Georgia, 'Times New Roman', serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #171815;
}

body { min-width: 280px; }

button { font: inherit; }

.atlas {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: 320px;
  overflow: hidden;
  isolation: isolate;
  background: #171815;
}

.map {
  position: absolute;
  inset: 0;
  outline: none;
  background: #26251f;
}

.map:focus-visible { box-shadow: inset 0 0 0 2px var(--brass); }
.map .maplibregl-canvas { outline: none; }

.plaque {
  position: absolute;
  z-index: 2;
  top: max(22px, env(safe-area-inset-top));
  left: max(22px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 215px;
  padding: 13px 20px 14px 15px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  background: var(--plaque);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.24), inset 0 0 0 2px rgba(215, 194, 145, 0.035);
  pointer-events: none;
}

.plaque::before,
.plaque::after {
  position: absolute;
  width: 5px;
  height: 5px;
  content: '';
  border: 1px solid var(--brass);
  transform: rotate(45deg);
  opacity: 0.75;
}
.plaque::before { top: 5px; left: 5px; }
.plaque::after { right: 5px; bottom: 5px; }

.plaque-mark {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid rgba(188, 154, 87, 0.7);
  border-radius: 50%;
  transform: rotate(45deg);
}
.plaque-mark::before,
.plaque-mark::after,
.plaque-mark span {
  position: absolute;
  display: block;
  content: '';
  background: var(--brass);
}
.plaque-mark::before { width: 1px; height: 24px; }
.plaque-mark::after { width: 24px; height: 1px; }
.plaque-mark span { width: 5px; height: 5px; border: 1px solid #d6bc7d; background: #27241c; }

.plaque-copy p,
.plaque-copy h1 { margin: 0; }
.eyebrow {
  color: #c1aa75;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.19em;
  line-height: 1.2;
  text-transform: uppercase;
}
.plaque-copy h1 {
  margin-top: 3px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.015em;
  line-height: 1.1;
}
.subtitle {
  margin-top: 3px !important;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.map-tools {
  position: absolute;
  z-index: 3;
  top: max(22px, env(safe-area-inset-top));
  right: max(22px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--plaque);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.22);
}
.tool-button {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 0;
  color: #ded4bd;
  background: transparent;
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease;
}
.tool-button:hover { color: #f0d89d; background: rgba(188, 154, 87, 0.12); }
.tool-button:focus-visible { position: relative; z-index: 1; outline: 2px solid var(--brass); outline-offset: -3px; }
.tool-button:active { background: rgba(188, 154, 87, 0.2); }
.tool-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.45; }
.tool-divider { height: 1px; margin: 0 8px; background: var(--line); }

.help-chip {
  position: absolute;
  z-index: 2;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: #d4c8ad;
  background: rgba(25, 25, 22, 0.88);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  letter-spacing: 0.025em;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}
.help-chip i { padding: 0 2px; color: var(--brass); font-style: normal; }
.drag-icon { display: flex; color: var(--brass); }
.drag-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.15; }

.map-credit {
  position: absolute;
  z-index: 2;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  display: flex;
  gap: 6px;
  align-items: center;
  color: rgba(235, 225, 204, 0.78);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
  text-shadow: 0 1px 3px #111;
}
.map-credit a { color: inherit; text-decoration-color: rgba(235, 225, 204, 0.45); text-underline-offset: 2px; }
.map-credit a:hover { color: #f0d89d; }
.credit-dot { color: var(--brass); }

.loading {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--ink);
  background: rgba(25, 25, 22, 0.9);
  font-size: 13px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.loading[hidden], .fatal[hidden], .tile-notice[hidden] { display: none; }
.spinner {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(188, 154, 87, 0.35);
  border-top-color: #d5b66e;
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.fatal {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  width: min(360px, calc(100vw - 40px));
  padding: 26px 25px 24px;
  border: 1px solid rgba(188, 154, 87, 0.38);
  border-radius: 3px;
  color: var(--ink);
  background: rgba(25, 25, 22, 0.97);
  box-shadow: 0 15px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
  transform: translate(-50%, -50%);
}
.fatal-symbol {
  display: grid;
  width: 30px;
  height: 30px;
  margin: 0 auto 13px;
  place-items: center;
  border: 1px solid #bc9a57;
  border-radius: 50%;
  color: #d2ae66;
  font-size: 17px;
}
.fatal h2 { margin: 0; font-size: 19px; font-weight: 500; }
.fatal p { margin: 10px 0 19px; color: var(--muted); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 1.6; }
.retry-button {
  min-height: 38px;
  padding: 0 17px;
  border: 1px solid rgba(188, 154, 87, 0.6);
  border-radius: 2px;
  color: #ead7aa;
  background: rgba(188, 154, 87, 0.12);
  cursor: pointer;
}
.retry-button:hover { background: rgba(188, 154, 87, 0.22); }
.retry-button:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

.tile-notice {
  position: absolute;
  z-index: 4;
  top: 82px;
  left: 50%;
  max-width: calc(100vw - 32px);
  padding: 8px 12px;
  border: 1px solid rgba(188, 154, 87, 0.35);
  border-radius: 2px;
  color: #e1d0ad;
  background: rgba(25, 25, 22, 0.93);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  text-align: center;
  transform: translateX(-50%);
}

.noscript {
  position: absolute;
  z-index: 9;
  top: 50%;
  left: 50%;
  padding: 16px;
  color: var(--ink);
  background: #191916;
  transform: translate(-50%, -50%);
}

.map:fullscreen { width: 100%; height: 100%; }
.atlas:fullscreen { width: 100%; height: 100%; }

@media (max-width: 600px) {
  .plaque { top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); min-width: 0; gap: 9px; padding: 9px 13px 10px 10px; }
  .plaque-mark { width: 29px; height: 29px; flex-basis: 29px; }
  .plaque-mark::before { height: 19px; }
  .plaque-mark::after { width: 19px; }
  .plaque-copy h1 { font-size: 17px; }
  .eyebrow { font-size: 8px; }
  .subtitle { font-size: 10px; }
  .map-tools { top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
  .tool-button { width: 38px; height: 38px; }
  .help-chip { bottom: max(16px, env(safe-area-inset-bottom)); padding: 8px 10px; font-size: 10px; }
  .map-credit { right: max(12px, env(safe-area-inset-right)); bottom: max(63px, calc(env(safe-area-inset-bottom) + 55px)); font-size: 9px; }
  .tile-notice { top: 69px; font-size: 10px; }
}

@media (max-width: 365px) {
  .plaque { gap: 7px; padding-right: 9px; }
  .plaque-mark { display: none; }
  .help-chip { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
