:root {
  --sea: #8fbfc9;
  --ink: #163a45;
  --ink-soft: #4b6a72;
  --paper: #fbf5e9;
  --paper-edge: #e6d9bf;
  --sun: #f2c879;
  --coral: #d9644a;
  --shadow: 0 6px 18px rgb(22 58 69 / 0.18), 0 1px 3px rgb(22 58 69 / 0.2);
  --radius: 14px;
  --gutter: max(14px, env(safe-area-inset-left));
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--sea);
  color: var(--ink);
  font: 15px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
}

svg {
  display: block;
}

.map {
  position: fixed;
  inset: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  outline: none;
}

.map:active {
  cursor: grabbing;
}

.map canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.brand {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: var(--gutter);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  max-width: calc(100vw - 2 * var(--gutter) - 64px);
}

.brand-name {
  padding: 6px 14px 7px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow);
  font: 600 22px/1.1 var(--display);
  letter-spacing: 0.01em;
  text-decoration: none;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 11px;
  border: 1px solid var(--paper-edge);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

.menu-toggle svg,
.zoom svg,
.popup-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.menu-toggle[aria-expanded="true"] {
  background: var(--sun);
  border-color: var(--sun);
}

.menu {
  flex-basis: 100%;
  width: min(300px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100vh - 140px);
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
  padding: 6px 0;
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.menu section + section {
  border-top: 1px dashed var(--paper-edge);
}

.menu h2 {
  margin: 10px 16px 4px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.menu ul {
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
}

.menu-item,
.menu-check {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 6px 16px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover,
.menu-item:focus-visible,
.menu-check:hover {
  background: rgb(242 200 121 / 0.35);
  outline: none;
}

.menu-link {
  margin: 6px 0;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.menu-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--coral);
}

.menu-item small {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
}

.menu-item:has(small) {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.search {
  display: flex;
  gap: 6px;
  margin: 10px 12px 6px;
}

.search input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--paper-edge);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.search input:focus-visible {
  outline: 2px solid var(--sun);
  outline-offset: 1px;
}

.search button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--paper-edge);
  border-radius: 10px;
  background: var(--sun);
  cursor: pointer;
}

.search svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
}

.menu-empty {
  padding: 6px 16px 10px;
  color: var(--ink-soft);
  font-style: italic;
}

.controls {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.compass {
  width: 48px;
  height: 48px;
  padding: 4px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.compass circle {
  fill: none;
  stroke: var(--paper-edge);
  stroke-width: 1.5;
}

.compass .needle-north {
  fill: var(--coral);
}

.compass .needle-south {
  fill: var(--ink);
  opacity: 0.35;
}

.compass text {
  fill: var(--ink);
  font: 700 6px var(--font);
  text-anchor: middle;
  dominant-baseline: middle;
}

.zoom {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.zoom button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 42px;
  border: 0;
  background: none;
  cursor: pointer;
}

.zoom button + button {
  border-top: 1px solid var(--paper-edge);
}

.zoom button:hover,
.zoom button:focus-visible {
  background: rgb(242 200 121 / 0.45);
  outline: none;
}

.footer {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.footer p {
  margin: 0;
  pointer-events: auto;
}

.clock {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgb(22 58 69 / 0.86);
  color: var(--paper);
  font: 600 14px/1.2 var(--display);
  white-space: nowrap;
}

.attribution {
  max-width: 55%;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgb(251 245 233 / 0.82);
  color: var(--ink-soft);
  font-size: 12px;
  text-align: right;
}

.credits-link {
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.credits-link:hover {
  color: var(--ink-soft);
}

.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: max-content;
  min-width: 160px;
  max-width: min(280px, calc(100vw - 24px));
  padding: 10px 34px 10px 14px;
  border: 1px solid var(--paper-edge);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.popup h3 {
  margin: 0 0 2px;
  font: 600 16px/1.25 var(--display);
}

.popup ul {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
  font-size: 13px;
}

.popup-close {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.popup-close:hover {
  background: rgb(22 58 69 / 0.08);
}

[hidden] {
  display: none !important;
}

@media (max-width: 600px) {
  .brand-name {
    font-size: 19px;
  }

  .menu-toggle span {
    display: none;
  }

  .menu-toggle {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .attribution {
    max-width: 100%;
    text-align: left;
  }
}
