* { box-sizing: border-box; }
:root {
  color-scheme: light;
  font: 15px/1.35 Inter, "Segoe UI", sans-serif;
  color: #2d2a24;
  --surface: #f8f4ec;
  --panel: #fdfaf4;
  --control: #ece5d8;
  --hover: #e4dccb;
  --line: #d9d0be;
  --muted: #6b6459;
  --accent: #215c83;
  --city-colors: #007fba 0 33.33%, #ff9100 33.33% 66.66%, #079c37 66.66%;
  --tool-size: 28px;
  --bottom-inset: max(.8rem, env(safe-area-inset-bottom));
}
:root[data-theme="charcoal"] {
  color-scheme: dark;
  color: #f6efe1;
  --surface: #292722;
  --panel: #302d27;
  --control: #37342d;
  --hover: #463e31;
  --line: #625a4b;
  --muted: #cec4b2;
  --accent: #a7d5f2;
}
body { margin: 0; background: #121922; }
main { position: relative; height: 100dvh; }
#map { width: 100%; height: 100%; }
#map img, #map canvas { image-rendering: pixelated; }
.brand, .map-tools, #credits, #attribution, #status { position: absolute; }
.brand, .map-tools, #credits summary, #credits section, #attribution, .tool-tip {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px #080f1866;
}
.brand {
  top: 1rem; left: 1rem;
  max-width: calc(100% - 2rem);
  padding: .5rem .7rem;
  border-radius: .7rem;
  display: flex; align-items: center; gap: .8rem;
  border-block-start: 3px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(90deg, var(--city-colors)) border-box;
}
.brand button, #about form button {
  border: 1px solid var(--line); background: var(--control); color: inherit; border-radius: .45rem;
}
.brand button { padding: .3rem .55rem; font-size: .8rem; }
.brand button:hover, #about form button:hover { background: var(--hover); color: var(--accent); }
#about {
  width: min(33rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem);
  padding: 1.35rem; border: 1px solid var(--line); border-radius: .85rem;
  background: var(--panel); color: inherit; line-height: 1.55;
}
#about::backdrop { background: #080f1890; }
#about form { float: right; margin-left: .55rem; }
#about h2 { font-size: 1.3rem; margin: 0 0 .55rem; line-height: 1.2; }
#about p { margin: 0; color: var(--muted); }
#about .about-author { margin: 1rem 0 .4rem; }
.about-author a { margin-inline-start: .5rem; }
.about-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-top: .65rem; }
.coffee-link { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .6rem; border-radius: .35rem; background: #ffdd00; color: #2d2a24; font-size: .82rem; font-weight: 650; text-decoration: none; }
.coffee-link:hover { text-decoration: underline; }
.themes { position: relative; display: inline-flex; gap: 2px; margin: 0; padding: 3px; border: 1px solid var(--line); border-radius: .6rem; background: var(--control); }
.themes legend { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
.themes label { position: relative; display: grid; place-items: center; width: 2rem; height: 2rem; cursor: pointer; border-radius: .4rem; color: var(--muted); }
.themes label:hover { background: var(--hover); }
.themes label:has(input:checked) { background: var(--panel); color: var(--accent); box-shadow: inset 0 0 0 1px var(--line); }
.themes label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.themes input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.themes svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.brand h1 { margin: 0; font-size: 1.25rem; line-height: 1.08; letter-spacing: -.035em; }
.brand span { display: block; margin-top: .2rem; color: var(--muted); font-size: .74rem; }
#status {
  top: 5.4rem; left: 1rem; margin: 0; padding: .3rem .55rem;
  border-radius: .4rem; background: var(--surface); color: var(--muted);
}
#status:empty { display: none; }
.map-tools {
  left: 50%; bottom: var(--bottom-inset); translate: -50% 0;
  display: flex; align-items: center; gap: 2px;
  padding: 2px; border-radius: .6rem; z-index: 1;
}
button, summary { cursor: pointer; font: inherit; color: inherit; }
.tool {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tool-size); height: var(--tool-size); padding: 0; border-radius: .4rem;
  transition: background-color .15s, color .15s;
}
.map-tools .tool { background: transparent; border: 0; }
.tool:hover, .tool:focus-visible, #credits[open] summary {
  background: var(--hover); color: var(--accent);
}
.tool svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.tool-tip {
  position: absolute; bottom: calc(100% + 12px); left: 50%; translate: -50% 3px;
  display: flex; align-items: center; gap: .5rem; white-space: nowrap;
  padding: .35rem .5rem; border-radius: .45rem;
  color: inherit; font-size: .75rem;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .15s, translate .15s, visibility .15s;
}
.tool:focus-visible .tool-tip { opacity: 1; visibility: visible; translate: -50% 0; }
@media (hover: hover) {
  .tool:hover .tool-tip {
    opacity: 1; visibility: visible; translate: -50% 0; transition-delay: .25s;
  }
}
.tool-tip kbd {
  padding: .08rem .28rem; border: 1px solid var(--line);
  border-radius: .25rem; color: var(--muted); font: inherit;
}
#fullscreen .contract, #fullscreen[data-active="true"] .expand { display: none; }
#fullscreen[data-active="true"] .contract { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#credits { right: .8rem; bottom: calc(var(--bottom-inset) + 3px); z-index: 2; }
#credits summary::-webkit-details-marker { display: none; }
#credits .tool-tip { left: auto; right: 0; translate: 0 0; }
#credits[open] .tool-tip { display: none; }
#credits section {
  position: absolute; right: 0; bottom: calc(var(--tool-size) + 8px);
  width: min(21rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 5.5rem); overflow: auto;
  padding: .9rem 1rem; border-radius: .9rem;
}
#attribution {
  right: calc(1.25rem + var(--tool-size)); bottom: calc(var(--bottom-inset) + 6px);
  padding: .2rem .45rem;
  border-radius: .4rem; font-size: .7rem; color: var(--muted);
}
h2 { font-size: 1rem; margin: 0 0 .65rem; }
dl, dd { margin: 0; }
dt { color: var(--muted); font-size: .75rem; margin-top: .65rem; }
dd { margin-top: .16rem; font-size: .85rem; }
a { color: var(--accent); }
[hidden] { display: none !important; }
@media (max-width: 480px) {
  #attribution { right: .8rem; bottom: calc(var(--bottom-inset) + var(--tool-size) + 10px); }
}
@media (pointer: coarse) {
  :root { --tool-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .tool, .tool-tip { transition: none; }
}
