﻿:root {
      color-scheme: light;
      --border: #d8dde3;
      --text: #15202b;
      --muted: #5b6775;
      --surface: #ffffff;
      --surface-soft: #f4f6f8;
      --accent: #0b7fab;
      --accent-dark: #075f80;
      --selected: #fff4c2;
      --focus: #ffbf47;
    }

    * {
      box-sizing: border-box;
    }

    html,
    body {
      width: 100%;
      height: 100%;
      margin: 0;
      overflow: hidden;
      color: var(--text);
      font-family: Arial, Helvetica, sans-serif;
      background: var(--surface);
    }

    button,
    input {
      font: inherit;
    }

    .app {
      display: flex;
      width: 100%;
      height: 100vh;
      height: 100dvh;
      min-height: 0;
      overflow: hidden;
    }

    #map {
      width: 66.666%;
      height: 100%;
      min-width: 0;
    }

    #menu {
      display: flex;
      flex-direction: column;
      width: 33.333%;
      height: 100%;
      min-width: 320px;
      overflow: visible;
      border-left: 1px solid var(--border);
      background: var(--surface);
    }

    .menu-header {
      padding: 5px;
    }

    .menu-actions {
      padding: 8px;
    }

    /* Sits outside the tab panels, so it stays put whichever tab is open --
       it describes the map itself, not the panel above it. */
    .menu-hint {
      margin: 0;
      padding: 0 8px 6px;
      color: var(--muted);
      font-size: 0.78rem;
      line-height: 1.35;
      text-align: center;
      text-wrap: balance;
    }

    .feature-info {
      padding: 16px;
    }

    .menu-header {
      display: grid;
      /* logo box = header height minus its 4px borders; column hugs the scaled logo */
      --logo-h: 120px;
      grid-template-columns: minmax(0, 1fr) calc(var(--logo-h) * 207 / 365);
      height: 128px;
      min-height: 128px;
      padding: 0;
      gap: 0;
      overflow: hidden;
      border: 4px solid #ffffff;
      border-radius: 6px;
      background: var(--surface);
    }

    .menu-brand {
      display: grid;
      grid-column: 2;
      grid-row: 1;
      place-items: center;
      width: 100%;
      min-width: 0;
      padding: 0;
    }

    .menu-logo {
      display: block;
      width: auto;
      height: var(--logo-h);
      margin: 0;
      object-fit: contain;
    }

    .visually-hidden {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0 0 0 0);
      white-space: nowrap;
      border: 0;
    }

    .menu-header-photo {
      grid-column: 1;
      grid-row: 1;
      min-width: 0;
      min-height: 0;
      height: 100%;
      background-image:
        linear-gradient(271deg, rgb(0 0 0 / 30%), transparent 2%),
        url("icons/header.webp");
      background-position: center;
      background-position-y: center;
      background-size: cover;
      background-repeat: no-repeat;
    }

    .menu-tabs {
      display: flex;
      gap: 6px;
      padding: 10px 16px;
      border-bottom: 1px solid var(--border);
      background: #f3f3f3;
    }

    .menu-tablist {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: inherit;
      flex: 2 1 0;
      min-width: 0;
    }

    .menu-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex: 1 1 0;
      min-width: 0;
      text-decoration: none;
    }

    .menu-tab,
    .menu-link {
      min-height: 38px;
      border: 1px solid #cad5d0;
      border-radius: 8px;
      color: var(--text);
      background: #ffffff;
      cursor: pointer;
      font-weight: 700;
      box-shadow: 0 1px 2px rgba(21, 32, 43, 0.08);
      transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, transform 0.16s ease;
    }

    .menu-tab:hover,
    .menu-link:hover {
      border-color: #8fb5a4;
      background: #f4fbf7;
      box-shadow: 0 3px 8px rgba(21, 32, 43, 0.12);
      transform: translateY(-1px);
    }

    .menu-tab:focus-visible,
    .menu-link:focus-visible {
      outline: 3px solid var(--focus);
      outline-offset: 2px;
    }

    .menu-tab[aria-selected="true"] {
      border-color: #1f6f11;
      color: #ffffff;
      background: linear-gradient(180deg, #044f2d, #008c52);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 3px 8px rgba(31, 111, 17, 0.22);
      transform: none;
    }

    .menu-page {
      display: none;
      flex: 1;
      min-height: 0;
      overflow: hidden;
    }

    .menu-page.is-active {
      display: flex;
      flex-direction: column;
    }

    .menu-page[hidden] {
      display: none;
    }

    .menu-page-content {
      flex: 1;
      padding: 16px;
      overflow-y: auto;
      line-height: 1.5;
      background: 
        linear-gradient(rgb(255 255 255 / 91%), rgba(255, 255, 255, 0.9)), 
        url("icons/shaded_relief.webp");
      background-position: right;
      border: 2px solid;
      border-radius: 6px;
      border-color: #ffffff;
    }

    .menu-page-content h2 {
      margin: 0 0 8px;
      font-size: 1.25rem;
      color: #249e61;
    }

    .section-button.has-alternate-route {
      border-style: dashed;
      border-color: #c98b00;
      box-shadow: inset 0 -3px 0 rgba(255, 191, 0, 0.55), 0 1px 2px rgba(21, 32, 43, 0.08);
    }

    .book-page-content {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 14px;
    }

    .book-cover {
      display: block;
      width: 100%;
      max-width: 240px;
      height: auto;
      border-radius: 4px;
      box-shadow: 0 8px 20px rgba(21, 32, 43, 0.22);
    }

    .book-page-content .book-purchase-button {
      margin-top: 0;
    }

    .book-purchase-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 36px;
      margin-top: 8px;
      padding: 8px 12px;
      border: 1px solid var(--accent);
      border-radius: 8px;
      color: #ffffff;
      background: #F2C712 linear-gradient(-180deg, #F2C712 0%, #ED9B21 100%);
      text-decoration: none;
      font-weight: 700;
      line-height: 1.2;
    }

    .book-purchase-button:hover,
    .book-purchase-button:focus-visible {
      background: #f3e62b linear-gradient(-180deg, #e3f212 0%, #ED9B21 100%);
    }

    .menu-actions {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
      position: relative;
      z-index: 10;
      font-size: 15px;
      border-top: 1px solid var(--border);
      border-bottom: 1px solid var(--border);
      background: #e1e1e1;
    }

    .menu-button,
    .basemap-button,
    .layers-button,
    .section-menu-button,
    .section-button,
    .section-mode-button {
      min-height: 44px;
      border: 1px solid #c7d3cd;
      border-radius: 8px;
      color: var(--text);
      background: linear-gradient(180deg, #ffffff, #edf4f1);
      cursor: pointer;
      touch-action: manipulation;
      box-shadow: 0 1px 2px rgba(21, 32, 43, 0.08);
      transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, transform 0.16s ease;
    }

    .menu-button,
    .basemap-button,
    .layers-button,
    .section-menu-button {
      padding: 10px 12px;
      text-align: left;
    }

    .map-view-control,
    .basemap-control,
    .section-nav {
      position: relative;
      min-width: 0;
    }

    .map-view-button,
    .basemap-button,
    .section-menu-button {
      width: 100%;
    }

    .map-view-panel {
      position: absolute;
      z-index: 20;
      bottom: calc(100% + 6px);
      left: 0;
      right: 0;
      display: none;
      gap: 6px;
      padding: 8px;
      border: 1px solid #c7d3cd;
      border-radius: 8px;
      background: var(--surface);
      box-shadow: 0 14px 28px rgba(21, 32, 43, 0.18);
    }

    .basemap-panel {
      position: absolute;
      z-index: 20;
      bottom: calc(100% + 6px);
      left: -50%;
      right: 0;
      display: none;
      gap: 6px;
      padding: 8px;
      border: 1px solid #c7d3cd;
      border-radius: 8px;
      background: var(--surface);
      box-shadow: 0 14px 28px rgba(21, 32, 43, 0.18);
    }

    .section-panel {
      position: absolute;
      z-index: 20;
      bottom: calc(100% + 6px);
      left: calc(-50% - 6px);
      right: 0;
      display: none;
      gap: 6px;
      padding: 8px;
      border: 1px solid #c7d3cd;
      border-radius: 8px;
      background: var(--surface);
      box-shadow: 0 14px 28px rgba(21, 32, 43, 0.18);
    }

    .map-view-panel.is-open,
    .basemap-panel.is-open,
    .section-panel.is-open {
      display: grid;
    }

    .map-view-panel[hidden],
    .basemap-panel[hidden],
    .section-panel[hidden] {
      display: none;
    }

    .map-view-option,
    .basemap-option,
    .section-option {
      min-height: 34px;
      padding: 7px 9px;
      border: 1px solid transparent;
      border-radius: 6px;
      color: var(--text);
      background: transparent;
      cursor: pointer;
      text-align: left;
      font-size: 0.88rem;
      transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
    }

    .basemap-option {
      display: grid;
      grid-template-columns: 26px minmax(0, 1fr);
      gap: 8px;
      align-items: center;
    }

    .basemap-option-icon {
      display: block;
      width: 32px;
      height: 32px;
      border: 1px solid rgba(21, 32, 43, 0.12);
      border-radius: 6px;
      object-fit: cover;
      background: #f7faf8;
    }

    .basemap-option-label {
      min-width: 0;
      overflow-wrap: anywhere;
      margin-left: 15px;
    }

    .map-view-option:hover,
    .map-view-option:focus-visible,
    .basemap-option:hover,
    .basemap-option:focus-visible,
    .section-option:hover,
    .section-option:focus-visible {
      border-color: #9ecab8;
      background: #f3fbf7;
      box-shadow: inset 3px 0 0 #22d398;
    }

    .basemap-option[aria-pressed="true"],
    .section-option[aria-current="true"] {
      border-color: #656565;
      color: #ffffff;
      background: #1f6f11;
    }

    .section-option:disabled,
    .section-button:disabled,
    .feature-picker-button:disabled {
      cursor: not-allowed;
      opacity: 0.5;
    }

    .section-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(38px, 1fr));
      gap: 6px;
    }

    .section-mode-toggle {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 6px;
      margin-top: 6px;
    }

    .section-button,
    .section-mode-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 8px;
      font-weight: 700;
    }

    .menu-button:hover,
    .basemap-button:hover,
    .layers-button:hover,
    .section-menu-button:hover,
    .section-button:hover,
    .section-mode-button:hover {
      border-color: #8fb5a4;
      background: linear-gradient(180deg, #f9fffc, #dcefe7);
      box-shadow: 0 4px 10px rgba(21, 32, 43, 0.14);
      transform: translateY(-1px);
    }

    .menu-button:active,
    .basemap-button:active,
    .layers-button:active,
    .section-menu-button:active,
    .section-button:active,
    .section-mode-button:active {
      transform: translateY(0);
      box-shadow: inset 0 2px 5px rgba(21, 32, 43, 0.14);
    }

    .basemap-button[aria-expanded="true"],
    .layers-button[aria-expanded="true"],
    .map-view-button[aria-expanded="true"],
    .section-menu-button[aria-expanded="true"] {
      border-color: #1f6f11;
      color: #ffffff;
      background: linear-gradient(180deg, #249e61, #1f6f11);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 10px rgba(31, 111, 17, 0.2);
    }

    .menu-button:focus-visible,
    .basemap-button:focus-visible,
    .layers-button:focus-visible,
    .section-menu-button:focus-visible,
    .section-button:focus-visible,
    .section-mode-button:focus-visible {
      outline: 3px solid var(--focus);
      outline-offset: 2px;
    }

    .layers-control {
      position: relative;
      min-width: 0;
    }

    .layers-button {
      width: 100%;
    }

    .layers-panel {
      position: absolute;
      z-index: 25;
      right: 0;
      bottom: calc(100% + 6px);
      display: none;
      width: min(520px, calc(100vw - 32px));
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--surface);
      max-height: min(58dvh, 480px);
      overflow-y: auto;
      box-shadow: 0 8px 20px rgba(21, 32, 43, 0.16);
    }

    .layers-panel.is-open {
      display: block;
    }

    .layers-panel[hidden] {
      display: none;
    }

    .layer-columns,
    .layer-column {
      display: grid;
      gap: 4px;
      padding: 6px;
    }

    .layer-columns {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      background: #fafbfc;
    }

    .layer-column {
      align-content: start;
      padding: 0;
    }

    .layer-group-button {
      min-height: 34px;
      padding: 6px 8px;
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      background: var(--surface-soft);
      cursor: pointer;
      text-align: left;
      touch-action: manipulation;
      font-size: 0.86rem;
    }

    .layer-group-button[aria-pressed="true"] {
      border-color: #656565;
      color: #ffffff;
      background: #1f6f11;
    }

    .layer-group-button:focus-visible,
    .layer-subgroup-button:focus-visible,
    .layer-toggle:focus-within {
      outline: 3px solid var(--focus);
      outline-offset: 2px;
    }

    .layer-dropdown-group {
      display: grid;
      gap: 4px;
      position: relative;
    }

    .layer-dropdown-panel {
      position: absolute;
      z-index: 30;
      top: calc(100% + 6px);
      left: 0;
      right: 0;
      display: none;
      gap: 4px;
      min-width: min(220px, 82vw);
      padding: 6px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--surface);
      box-shadow: 0 8px 20px rgba(21, 32, 43, 0.16);
    }

    .layer-dropdown-panel.is-open {
      display: grid;
    }

    .layer-dropdown-panel .layer-toggle {
      border-color: transparent;
      background: transparent;
    }

    .layer-dropdown-panel .layer-toggle:hover,
    .layer-dropdown-panel .layer-toggle:focus-within {
      background: var(--surface-soft);
    }

    .layer-subgroup {
      display: grid;
      gap: 4px;
      margin-left: 10px;
      padding-left: 8px;
      border-left: 2px solid var(--border);
    }

    .layer-subgroup-button {
      min-height: 30px;
      padding: 5px 8px;
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      background: #eef3f6;
      cursor: pointer;
      text-align: left;
      touch-action: manipulation;
      font-size: 0.8rem;
      font-weight: 700;
    }

    .layer-subgroup-button[aria-pressed="true"] {
      border-color: var(--accent);
      color: #ffffff;
      background: var(--accent);
    }

    .layer-toggle {
      display: flex;
      align-items: center;
      gap: 6px;
      min-height: 34px;
      padding: 6px 8px;
      border: 1px solid var(--border);
      border-radius: 8px;
      cursor: pointer;
    }

    .layer-symbol {
      display: inline-block;
      flex: 0 0 auto;
      width: var(--legend-symbol-width, 24px);
      height: var(--legend-symbol-height, 16px);
      position: relative;
    }

    .layer-symbol.line::before {
      content: "";
      position: absolute;
      top: 50%;
      left: 0;
      width: 100%;
      height: var(--symbol-stroke-width, 3px);
      border-radius: 999px;
      background: var(--symbol-color, var(--accent));
      transform: translateY(-50%);
    }

    .layer-symbol.line.double-line {
      display: inline-grid;
      grid-template-rows: auto auto;
      align-content: center;
      gap: var(--legend-symbol-gap, 2px);
    }

    .layer-symbol.line.double-line::before,
    .layer-symbol.line.double-line::after {
      position: static;
      width: 100%;
      transform: none;
    }

    .layer-symbol.line.double-line::after {
      content: "";
      height: var(--symbol-stroke-width2, 3px);
      border-radius: 999px;
      background: var(--symbol-color2, var(--accent-dark));
    }

    .layer-symbol.line.dashed::before {
      background: repeating-linear-gradient(
        to right,
        var(--symbol-color, var(--accent)) 0 var(--symbol-dash-length, 6px),
        transparent var(--symbol-dash-length, 6px)
          calc(var(--symbol-dash-length, 6px) + var(--symbol-dash-gap, 4px))
      );
    }

    .layer-symbol.line.dashed2::after {
      background: repeating-linear-gradient(
        to right,
        var(--symbol-color2, var(--accent-dark)) 0 var(--symbol-dash-length2, 6px),
        transparent var(--symbol-dash-length2, 6px)
          calc(var(--symbol-dash-length2, 6px) + var(--symbol-dash-gap2, 4px))
      );
    }

    .layer-symbol.point::before,
    .layer-symbol.symbol::before {
      content: "";
      position: absolute;
      top: 50%;
      left: 50%;
      width: var(--legend-mark-size, 10px);
      height: var(--legend-mark-size, 10px);
      border: var(--symbol-stroke-width, 2px) solid var(--symbol-stroke, #ffffff);
      border-radius: var(--legend-mark-radius, 999px);
      background: var(--symbol-color, var(--accent));
      box-shadow: 0 0 0 1px rgba(21, 32, 43, 0.35);
      transform: translate(-50%, -50%);
    }

    .layer-symbol.point.double-color,
    .layer-symbol.symbol.double-color {
      display: inline-grid;
      grid-template-columns: auto auto;
      place-content: center;
      align-items: center;
      gap: var(--legend-symbol-gap, 2px);
    }

    .layer-symbol.point.double-color::before,
    .layer-symbol.symbol.double-color::before,
    .layer-symbol.point.double-color::after,
    .layer-symbol.symbol.double-color::after {
      position: static;
      transform: none;
      box-sizing: border-box;
    }

    .layer-symbol.point.double-color::before,
    .layer-symbol.symbol.double-color::before {
      width: var(--legend-mark-size, 8px);
      height: var(--legend-mark-size, 8px);
      z-index: 2;
    }

    .layer-symbol.point.double-color::after,
    .layer-symbol.symbol.double-color::after {
      content: "";
      width: var(--legend-mark-size2, var(--legend-mark-size, 8px));
      height: var(--legend-mark-size2, var(--legend-mark-size, 8px));
      border: var(--symbol-stroke-width2, 2px) solid var(--symbol-stroke2, #ffffff);
      border-radius: var(--legend-mark-radius2, 999px);
      background: var(--symbol-color2, var(--accent-dark));
      box-shadow: 0 0 0 1px rgba(21, 32, 43, 0.35);
    }

    .layer-symbol.icon::before {
      content: "";
      position: absolute;
      top: 2px;
      left: 6px;
      width: 12px;
      height: 12px;
      border-radius: 3px 3px 8px 8px;
      background: var(--symbol-color, var(--accent));
      transform: rotate(45deg);
    }

    .layer-symbol.has-icon::before {
      display: none;
    }

    .layer-symbol-icon {
      display: block;
      width: var(--legend-icon-width, 18px);
      height: var(--legend-icon-height, 18px);
      margin: auto;
      object-fit: contain;
    }

    .layer-symbol.fill::before {
      content: "";
      position: absolute;
      inset: 2px;
      border: 2px solid var(--symbol-color, var(--accent));
      border-radius: 3px;
      background: color-mix(in srgb, var(--symbol-color, var(--accent)) 22%, transparent);
    }

    .layer-toggle:hover {
      background: var(--surface-soft);
    }

    .layer-toggle input {
      width: 16px;
      height: 16px;
      flex: 0 0 auto;
      order: 3;
      margin-left: auto;
      accent-color: #82868d;
    }

    .layer-toggle .layer-symbol {
      order: 1;
    }

    .layer-toggle span {
      min-width: 0;
      overflow-wrap: anywhere;
      font-size: 0.84rem;
      line-height: 1.25;
    }

    .layer-label {
      display: grid;
      gap: 1px;
      flex: 1 1 auto;
      min-width: 0;
      order: 2;
    }

    #layersPanel .layer-credit {
      color: var(--muted);
      font-size: 0.65rem;
      line-height: 1.15;
    }

    .section-button[aria-current="true"] {
      border-color: #1f6f11;
      color: #ffffff;
      background: linear-gradient(180deg, #249e61, #1f6f11);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 10px rgba(31, 111, 17, 0.2);
    }

    .section-mode-button[aria-pressed="true"] {
      border-color: #1f6f11;
      color: #ffffff;
      background: linear-gradient(180deg, #249e61, #1f6f11);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
    }

    .feature-info {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      background: 
        linear-gradient(rgb(255 255 255), rgba(255, 255, 255, 0.82)),
        url("icons/shaded_relief.webp");
      background-size: auto;
      background-repeat: no-repeat;
      background-position: top;
      border: 2px solid;
      border-radius: 6px;
      border-color: #ffffff;
    }

    .empty-state {
      margin: 0;
      color: var(--muted);
      line-height: 1.5;
    }

    .menu-feature h2,
    .popup-content h3 {
      margin: 0 0 10px;
      line-height: 1.25;
      margin-bottom: 20px;
      background: #ffffff;
      /* border: #f7f7f7; */
      text-align: center;
      /* border-style: double; */
    }

    .menu-feature h2 {
      font-size: 1.2rem;
    }

    .popup-content h3 {
      font-size: 1rem;
    }

    .details-list .feature-category {
      display: inline-block;
      margin: 0;
      padding: 2px 6px;
      border-radius: 999px;
      color: var(--accent-dark);
      background: #dff3f8;
      font-size: 0.8rem;
      font-weight: 700;
      line-height: 1.2;
    }

    .waypoint-photo {
      margin: 0 0 14px;
    }

    .waypoint-photo img {
      display: block;
      width: 100%;
      max-height: min(320px, 36dvh);
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--surface-soft);
      object-fit: contain;
    }

    .details-list {
      display: grid;
      grid-template-columns: minmax(110px, 38%) minmax(0, 1fr);
      align-items: stretch;
      column-gap: 0;
      row-gap: 0;
      margin: 0;
      border-top: 1px solid var(--border);
      font-size: 0.94rem;
      line-height: 1.45;
    }

    .details-list dt,
    .details-list dd {
      min-width: 0;
      padding: 10px 0;
      border-bottom: 1px solid var(--border);
    }

    .details-list dt {
      padding-right: 14px;
      color: var(--muted);
      font-weight: 700;
    }

    .details-list dd {
      padding-left: 14px;
      margin: 0;
      overflow-wrap: anywhere;
    }

    .details-list .temporary-closure-status {
      color: #9b1c1c;
      font-weight: 700;
    }

    .details-list a {
      color: var(--accent-dark);
      font-weight: 700;
    }

    .details-list .website-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 34px;
      padding: 7px 10px;
      border: 1px solid #456b30;
      border-radius: 8px;
      color: #ffffff;
      background: #0a9522;
      text-decoration: none;
      font-size: 0.88rem;
      line-height: 1.2;
    }

    .details-list .website-button:hover,
    .details-list .website-button:focus-visible {
      background: #107100;
    }

    .raw-properties {
      margin-top: 16px;
    }

    .raw-properties summary {
      cursor: pointer;
      color: var(--muted);
      font-weight: 700;
    }

    .raw-properties pre {
      max-height: 260px;
      overflow: auto;
      margin: 10px 0 0;
      padding: 10px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--surface-soft);
      white-space: pre-wrap;
      overflow-wrap: anywhere;
      font-size: 0.78rem;
    }

    .mapboxgl-popup-content {
      max-width: min(320px, 82vw);
      padding: 14px;
      border-radius: 8px;
      max-height: 54vh;
      overflow: auto;
    }

    .feature-picker-popup .mapboxgl-popup-content {
      max-height: none;
      padding: 10px;
      overflow: hidden;
      background: #ffffffff;
      border: 2px solid #d7d7d7;
    }

    .mapboxgl-popup-content .details-list {
      grid-template-columns: minmax(86px, 36%) minmax(0, 1fr);
      font-size: 0.86rem;
    }

    .feature-picker {
      display: grid;
      grid-template-rows: auto auto minmax(0, 1fr);
      gap: 6px;
      min-width: 240px;
      max-width: min(320px, 84vw);
    }

    .feature-picker-title {
      margin: 0;
      color: var(--muted);
      font-size: 0.82rem;
      font-weight: 700;
      line-height: 1.25;
    }

    .feature-picker-controls {
      display: grid;
      grid-template-columns: minmax(0, 1.25fr) repeat(2, minmax(0, 1fr));
      gap: 4px;
      padding-bottom: 2px;
    }

    .feature-picker-field {
      display: grid;
      gap: 3px;
      min-width: 0;
    }

    .feature-picker-search-field {
      grid-column: auto;
    }

    .feature-picker-field-label {
      color: var(--muted);
      font-size: 0.72rem;
      font-weight: 700;
      line-height: 1.15;
    }

    .feature-picker-input,
    .feature-picker-select {
      width: 100%;
      min-width: 0;
      min-height: 32px;
      padding: 5px 6px;
      border: 1px solid var(--border);
      border-radius: 6px;
      color: var(--text);
      background: #ffffff;
      font: inherit;
      font-size: 0.8rem;
    }

    .feature-picker-input:focus-visible,
    .feature-picker-select:focus-visible {
      border-color: #249e61;
      outline: 2px solid rgba(36, 158, 97, 0.28);
      outline-offset: 1px;
    }

    .feature-picker-results {
      display: grid;
      gap: 6px;
      max-height: min(24dvh, 180px);
      padding-right: 2px;
      overflow-y: auto;
      overscroll-behavior: contain;
    }

    .feature-picker-empty {
      margin: 4px 0;
      color: var(--muted);
      font-size: 0.82rem;
      line-height: 1.3;
    }

    .feature-picker-button {
      display: grid;
      grid-template-columns: 32px minmax(0, 1fr);
      gap: 8px;
      align-items: start;
      width: 100%;
      /* min-height: 36px; */
      padding: 7px 9px;
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      background: var(--surface-soft);
      cursor: pointer;
      text-align: left;
      touch-action: manipulation;
      font-size: 0.86rem;
      line-height: 1.25;
    }

    .feature-picker-button:hover,
    .feature-picker-button:focus-visible,
    .feature-picker-button:active,
    .feature-picker-button.is-previewing {
      border-color: #8fb5a4;
      background: #e8f3ed;
      box-shadow: inset 3px 0 0 #249e61;
    }

    .feature-picker-number {
      display: inline-grid;
      place-items: center;
      width: 30px;
      height: 30px;
      border: 1px solid #a4c7ad;
      border-radius: 22px;
      color: #ffffff;
      background: #89bd92;
      font-size: 0.88rem;
      font-weight: 700;
      font-variant-numeric: tabular-nums;
      line-height: 1;
    }

    .feature-picker-label {
      display: grid;
      gap: 2px;
      min-width: 0;
    }

    .feature-picker-name {
      overflow-wrap: anywhere;
      font-weight: 700;
    }

    .feature-picker-category {
      color: var(--muted);
      font-size: 0.76rem;
      line-height: 1.2;
    }

    .feature-picker-status {
      color: #9b1c1c;
      font-size: 0.76rem;
      font-weight: 700;
      line-height: 1.2;
    }

    .elevation-panel {
      margin-top: 3px;
      padding-top: 14px;
      border-top: 1px solid var(--border);
    }

    .elevation-panel h3 {
      margin: 0 0 8px;
      font-size: 1rem;
    }

    .elevation-chart-wrap {
      position: relative;
      height: 190px;
      min-height: 190px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: #fbfcfd;
      overflow: hidden;
    }

    .elevation-chart-wrap canvas {
      display: block;
      width: 100%;
      height: 100%;
    }

    .elevation-note {
      margin: 8px 0 0;
      color: var(--muted);
      font-size: 0.84rem;
      line-height: 1.4;
    }

    .elevation-loading {
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }

    .elevation-spinner {
      width: 16px;
      height: 16px;
      border: 2px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 999px;
      animation: spin 0.8s linear infinite;
    }

    .interaction-lock {
      position: fixed;
      z-index: 10000;
      inset: 0;
      display: grid;
      place-items: center;
      padding: 20px;
      cursor: wait;
      background: rgba(21, 32, 43, 0.36);
      backdrop-filter: blur(1px);
    }

    .interaction-lock[hidden] {
      display: none;
    }

    .interaction-lock-message {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      max-width: min(420px, 90vw);
      padding: 14px 18px;
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text);
      background: var(--surface);
      box-shadow: 0 8px 28px rgba(21, 32, 43, 0.24);
      font-weight: 700;
      line-height: 1.35;
    }

    .map-status {
      position: fixed;
      z-index: 9000;
      top: 12px;
      left: 12px;
      max-width: min(420px, calc(100vw - 24px));
      padding: 10px 12px;
      border: 1px solid #8fb5a4;
      border-radius: 8px;
      color: var(--text);
      background: var(--surface);
      box-shadow: 0 6px 18px rgba(21, 32, 43, 0.2);
      font-size: 0.9rem;
      font-weight: 700;
      line-height: 1.35;
    }

    .map-status.is-error {
      border-color: #b42318;
      color: #7a271a;
      background: #fff4f2;
    }

    .map-status[hidden] {
      display: none;
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    @media (max-width: 1100px) {
      .layer-columns {
        grid-template-columns: 1fr;
      }
    }

    @media (max-width: 900px) {
      .app {
        flex-direction: column;
      }

      #map {
        width: 100%;
        height: 52dvh;
      }

      #menu {
        width: 100%;
        min-width: 0;
        height: 48dvh;
        overflow: visible;
        border-top: 1px solid var(--border);
        border-left: 0;
      }

      .menu-tabs,
      .menu-actions,
      .feature-info {
        padding: 8px 10px;
      }

      .menu-hint {
        padding: 0 10px 5px;
        font-size: 0.72rem;
      }

      .menu-header {
        display: none;
      }

      .menu-tabs {
        gap: 4px;
        padding: 6px 10px;
      }

      .menu-tab,
      .menu-link {
        min-height: 30px;
        font-size: 0.82rem;
        overflow-x: hidden;
      }

      .menu-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
      }

      .menu-button,
      .basemap-button,
      .layers-button,
      .section-menu-button {
        min-height: 36px;
        padding: 5px 4px;
        text-align: center;
        font-size: 0.8rem;
        line-height: 1.15;
      }

      .feature-info {
        padding-top: 10px;
      }

      .map-view-panel,
      .section-panel,
      .basemap-panel,
      .layers-panel {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(44px + env(safe-area-inset-bottom));
        width: auto;
        min-width: 0;
        max-height: min(42dvh, 360px);
        overflow-y: auto;
      }

      .layer-columns {
        grid-template-columns: 1fr;
        padding-top: 3px;
      }

      .feature-picker-popup .mapboxgl-popup-content {
        padding: 8px;
      }

      .feature-picker-results {
        max-height: min(14dvh, 110px);
      }
    }

    @media (max-width: 600px),
      (orientation: landscape) and (max-height: 600px) and (max-width: 1024px) {
      .feature-info .details-list {
        grid-template-columns: 1fr;
        column-gap: 0;
        row-gap: 0;
      }

      .feature-info .details-list dt {
        padding: 12px 0 4px;
        border-bottom: 0;
        color: #46525f;
        font-size: 0.8rem;
        line-height: 1.25;
      }

      .feature-info .details-list dd {
        padding: 0 0 12px;
        border-bottom: 1px solid var(--border);
        line-height: 1.5;
      }

      .feature-info .details-list dd:last-child {
        padding-bottom: 0;
        border-bottom: 0;
      }

      .feature-info .details-list .website-button {
        width: 100%;
        min-height: 44px;
      }
    
    }

    @media (max-width: 420px) {
      .layer-columns {
        grid-template-columns: 1fr;
      }

      .section-grid {
        grid-template-columns: repeat(4, minmax(44px, 1fr));
      }

      .menu-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 3px;
        padding: 3px 4px calc(3px + env(safe-area-inset-bottom));
      }

      .menu-button,
      .basemap-button,
      .layers-button,
      .section-menu-button {
        min-height: 34px;
        padding: 4px 2px;
        font-size: 0.75rem;
        overflow-x: hidden;
      }

    }

    @media (orientation: landscape) and (max-height: 600px) and (max-width: 1024px) {
      html,
      body {
        height: 100%;
        overflow: hidden;
      }

      .app {
        --landscape-menu-width: clamp(280px, 42vw, 360px);
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
        flex-direction: row;
      }

      #map {
        width: calc(100% - var(--landscape-menu-width));
        height: 100dvh;
      }

      #menu {
        width: var(--landscape-menu-width);
        min-width: var(--landscape-menu-width);
        height: 100dvh;
        overflow: visible;
        border-top: 0;
        border-left: 1px solid var(--border);
      }

      .menu-header {
        display: none;
      }

      .menu-tabs {
        gap: 4px;
        padding: 4px 6px;
      }

      .menu-tab,
      .menu-link {
        min-height: 28px;
        font-size: 0.78rem;
      }

      .menu-page-content,
      .feature-info {
        padding: 8px;
      }

      .menu-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 3px;
        padding: 3px 5px calc(3px + env(safe-area-inset-bottom));
      }

      .menu-button,
      .basemap-button,
      .layers-button,
      .section-menu-button {
        min-height: 34px;
        padding: 4px 2px;
        text-align: center;
        font-size: 0.74rem;
        line-height: 1.1;
        overflow: hidden;
      }

      .map-view-panel,
      .section-panel,
      .basemap-panel,
      .layers-panel {
        position: fixed;
        left: auto;
        right: 6px;
        bottom: calc(40px + env(safe-area-inset-bottom));
        width: calc(var(--landscape-menu-width) - 12px);
        min-width: 0;
        max-height: calc(100dvh - 52px - env(safe-area-inset-bottom));
        overflow-y: auto;
      }

      .layer-columns {
        grid-template-columns: 1fr;
        padding-top: 3px;
      }

      .feature-picker-results {
        max-height: min(22dvh, 96px);
      }
    }

    /* Wide desktop window with limited vertical space */
    @media (min-width: 1025px) and (max-height: 700px) {
      #menu {
        min-height: 0;
      }

      .menu-header {
        height: 84px;
        min-height: 84px;
        --logo-h: 76px;
      }

      .menu-brand {
        padding: 0;
      }

      .menu-logo {
        width: auto;
        height: var(--logo-h);
      }

      .menu-header-photo {
        height: 100%;
        min-height: 0;
        background-position: center;
        background-size: cover;
        background-position-y: center;
      }

      .menu-tabs {
        gap: 4px;
        padding: 5px 8px;
      }

      .menu-tab,
      .menu-link {
        min-height: 32px;
        font-size: 0.82rem;
      }

      .menu-page,
      .menu-page.is-active {
        flex: 1 1 auto;
        min-height: 0;
      }

      .feature-info,
      .menu-page-content {
        flex: 1 1 auto;
        min-height: 0;
        padding: 10px;
        overflow-y: auto;
      }

      .menu-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        padding: 5px 6px;
      }

      .menu-button,
      .basemap-button,
      .layers-button,
      .section-menu-button {
        min-height: 36px;
        padding: 5px 4px;
        overflow: hidden;
        font-size: 0.78rem;
        line-height: 1.15;
        text-align: center;
      }

      .map-view-panel,
      .basemap-panel,
      .section-panel,
      .layers-panel {
        position: fixed;
        left: auto;
        right: 6px;
        bottom: 58px;
        width: min(520px, calc(33.333vw - 12px));
        min-width: 0;
        max-height: calc(100dvh - 68px);
        overflow-y: auto;
      }

      .map-view-panel,
      .basemap-panel,
      .section-panel {
        z-index: 30;
      }

      .layers-panel {
        z-index: 35;
      }
    }

    @media (min-width: 1025px) and (max-height: 520px) {
      .menu-header,
      .menu-hint {
        display: none;
      }
    }


    @media (max-width: 900px),
      (orientation: landscape) and (max-height: 600px) and (max-width: 1024px) {
      .feature-info {
        background-image:
          linear-gradient(rgb(255 255 255), rgb(255 255 255 / 82%)),
          url("icons/shaded_relief_mobile.webp");
      }

      .menu-page-content {
        background-image:
          linear-gradient(rgb(255 255 255 / 91%), rgb(255 255 255 / 90%)),
          url("icons/shaded_relief_mobile.webp");
      }

      .feature-info,
      .menu-page-content {
        background-size: cover;
        background-position: center top;
        background-repeat: no-repeat;
      }
    }

