    :root {
      --bg: #f8fafc;
      --panel: rgba(13, 16, 23, 0.82);
      --text: #e8edf2;
      --accent: #cbd5f5;
      --muted: #94a3b8;
      --safe-top: max(12px, env(safe-area-inset-top, 0px));
      --safe-right: max(12px, env(safe-area-inset-right, 0px));
      --safe-bottom: max(10px, env(safe-area-inset-bottom, 0px));
      --safe-left: max(12px, env(safe-area-inset-left, 0px));
    }
    * { box-sizing: border-box; }
    body, html { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: "Work Sans", -apple-system, "Segoe UI", sans-serif; }
    #map { position: fixed; inset: 0; }
    #hud {
      position: fixed; top: 12px; left: 12px; right: 12px; max-width: 520px;
      padding: 14px 16px; background: var(--panel); border: 1px solid rgba(255,255,255,0.06);
      border-radius: 12px; backdrop-filter: blur(12px); box-shadow: 0 8px 30px rgba(0,0,0,0.25); z-index: 10;
    }
    #hud h1 { margin: 0 0 4px; font-weight: 600; letter-spacing: -0.02em; font-size: 18px; }
    #hud p { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.4; }
    #hud .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
    #hud button {
      background: var(--accent); color: #0b0c10; border: none; border-radius: 15px; padding: 14px 18px;
      font-weight: 700; cursor: pointer; transition: transform 120ms ease, box-shadow 120ms ease; font-size: 20px;
    }
    #hud button.secondary { background: rgba(255,255,255,0.08); color: var(--text); }
    #hud button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,0.25); }
    #legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
    .chip {
      display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted);
      background: rgba(255,255,255,0.05); padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.06);
    }
    .chip i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
    #dock {
      position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 64px); transform: translateX(-50%);
      display: flex; flex-direction: column; gap: 6px; z-index: 11;
      width: min(94dvw, 1120px);
      max-width: 94dvw;
    }
    .dock-panel {
      background: rgba(15, 23, 42, 0.62); border: 1px solid rgba(255,255,255,0.06);
      border-radius: 12px; padding: 6px 8px; backdrop-filter: blur(10px);
      box-shadow: 0 8px 18px rgba(0,0,0,0.24);
      width: 100%;
      opacity: 0.95;
    }
    .dock-row { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; min-height: 24px; width: 100%; }
    .dock-row input {
      flex: 1 1 auto; min-width: 0; background: rgba(255,255,255,0.08); border: 1px solid transparent;
      color: var(--text); padding: 14px 12px; border-radius: 12px; font-size: clamp(18px, 2.4vw, 22px);
    }
    .dock-row select {
      background: rgba(255,255,255,0.08);
      border: 1px solid rgba(255,255,255,0.08);
      color: var(--text);
      padding: 3px 8px;
      border-radius: 8px;
      font-size: clamp(11px, 2.7vw, 13px);
      min-width: 104px;
      flex-shrink: 0;
    }
    .dock-row input::placeholder { color: rgba(226,232,240,0.6); }
    .dock-row button {
      background: rgba(226, 232, 240, 0.16); color: #e2e8f0; border: 1px solid rgba(255,255,255,0.08);
      border-radius: 12px; padding: 7px 14px; font-weight: 700; cursor: pointer;
      transition: transform 120ms ease, box-shadow 120ms ease; font-size: clamp(16px, 3.2vw, 18px);
    }
    .dock-row button.secondary { background: rgba(255,255,255,0.12); color: var(--text); }
    .dock-row button:hover { transform: translateY(-1px); box-shadow: 0 8px 16px rgba(0,0,0,0.3); }
    .dock-cities-row { align-items: center; }
    .dock-cities {
      display: flex;
      gap: 6px;
      flex-wrap: nowrap;
      width: 100%;
      overflow-x: auto;
      overflow-y: hidden;
      padding-bottom: 4px;
      flex: 1;
      cursor: grab;
      touch-action: pan-x;
      overscroll-behavior-x: contain;
      scrollbar-width: thin;
      scrollbar-color: rgba(148,163,184,0.4) rgba(15,23,42,0.2);
      -webkit-overflow-scrolling: touch;
    }
    .dock-cities.dragging { cursor: grabbing; }
    .dock-cities::-webkit-scrollbar {
      height: 8px;
      background: rgba(15,23,42,0.2);
    }
    .dock-cities::-webkit-scrollbar-thumb {
      background: rgba(148,163,184,0.4);
      border-radius: 4px;
    }
    .dock-cities::-webkit-scrollbar-thumb:hover {
      background: rgba(148,163,184,0.6);
    }
    .dock-chip {
      background: rgba(148,163,184,0.14); color: var(--text); border: 1px solid rgba(255,255,255,0.05);
      padding: 3px 9px; border-radius: 999px; font-size: clamp(11px, 2.7vw, 13px); cursor: pointer;
      transition: transform 120ms ease, background 120ms ease;
    }
    .dock-chip:hover { transform: translateY(-1px); background: rgba(148,163,184,0.28); }
    .dock-row + .dock-row { margin-top: 4px; }
    .streetview {
      width: 100%;
      height: min(260px, 34vh);
      min-width: 180px;
      min-height: 160px;
      max-width: 100%;
      max-height: 72vh;
      border-radius: 10px;
      overflow: hidden;
      background: rgba(15, 23, 42, 0.8);
      color: #e2e8f0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      margin-top: 8px;
      resize: both;
      position: relative;
      cursor: default;
      touch-action: none;
    }
    .streetview.expanded {
      width: min(960px, 92vw);
      height: min(630px, 72vh);
    }
    .maplibregl-popup-content {
      max-width: min(1080px, 92vw);
      background: rgba(15, 23, 42, 0.72);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 16px;
      box-shadow: 0 18px 32px rgba(0,0,0,0.22);
      color: #e2e8f0;
      overflow: hidden;
      cursor: grab;
    }
    .maplibregl-popup-tip {
      display: none;
    }
    .maplibregl-popup-content.dragging {
      cursor: grabbing;
    }
    .maplibregl-popup-close-button {
      width: 28px;
      height: 28px;
      font-size: 20px;
      line-height: 26px;
      border-radius: 999px;
      color: #f8fafc;
      background: rgba(15, 23, 42, 0.6);
    }
    .popup-actions .streetview-expand {
      background: rgba(15, 23, 42, 0.85);
      border-color: rgba(255,255,255,0.2);
      color: #f8fafc;
      font-weight: 700;
      box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    }
    .popup-drag-toast {
      position: absolute;
      left: 50%;
      top: 10px;
      transform: translateX(-50%);
      padding: 6px 12px;
      border-radius: 999px;
      background: rgba(15, 23, 42, 0.88);
      border: 1px solid rgba(255,255,255,0.16);
      color: #e2e8f0;
      font-size: 12px;
      opacity: 0;
      transition: opacity 200ms ease;
      pointer-events: none;
      z-index: 2;
    }
    .popup-drag-toast.visible {
      opacity: 0.9;
    }
    .popup-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 8px;
    }
    .popup-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 6px;
      cursor: grab;
      user-select: none;
    }
    .popup-header.dragging { cursor: grabbing; }
    .popup-title {
      font-weight: 600;
      color: #e2e8f0;
      font-size: 14px;
    }
    .popup-drag-hint {
      font-size: 11px;
      color: #cbd5f5;
      letter-spacing: 0.02em;
    }
    .popup-actions a,
    .popup-actions button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 9px;
      padding: 8px 12px;
      border-radius: 12px;
      border: 1px solid rgba(255,255,255,0.12);
      background: rgba(15, 23, 42, 0.45);
      color: #e2e8f0;
      font-size: 17px;
      text-decoration: none;
      cursor: pointer;
    }
    .sv-resize-handle {
      position: absolute;
      right: 6px;
      bottom: 6px;
      width: 18px;
      height: 18px;
      background: rgba(15, 23, 42, 0.65);
      border: 1px solid rgba(255,255,255,0.55);
      border-radius: 5px;
      cursor: nwse-resize;
      z-index: 3;
      box-shadow: 0 2px 6px rgba(0,0,0,0.25);
      display: grid;
      place-items: center;
      color: #e2e8f0;
      font-size: 11px;
      line-height: 1;
      font-weight: 700;
      user-select: none;
      pointer-events: auto;
    }
    #corner-info {
      position: fixed;
      left: var(--safe-left);
      bottom: var(--safe-bottom);
      z-index: 13;
      display: flex;
      align-items: flex-end;
    }
    #corner-info-toggle {
      width: 55px;
      height: 55px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.08);
      background: rgba(15, 23, 42, 0.6);
      color: #e2e8f0;
      font-size: 20px;
      font-weight: 600;
      display: grid;
      place-items: center;
      cursor: pointer;
      box-shadow: 0 6px 14px rgba(0,0,0,0.25);
      opacity: 0.85;
      padding: 0;
    }
    #corner-info-toggle svg {
      width: 30px;
      height: 30px;
      display: block;
    }
    #corner-info-toggle:hover {
      opacity: 1;
    }
    #corner-info-menu {
      position: absolute;
      left: 0;
      bottom: 32px;
      display: grid;
      gap: 4px;
      padding: 6px;
      min-width: 170px;
      border-radius: 10px;
      border: 1px solid rgba(255,255,255,0.12);
      background: rgba(15, 23, 42, 0.6);
      box-shadow: 0 10px 20px rgba(0,0,0,0.35);
      opacity: 0.85;
    }
    #corner-info-menu[hidden] {
      display: none;
    }
    #corner-info-menu a {
      display: block;
      padding: 9px 12px;
      border-radius: 12px;
      color: #e2e8f0;
      font-size: 15px;
      text-decoration: none;
      white-space: nowrap;
      background: rgba(15, 23, 42, 0.45);
    }
    #corner-info-menu button {
      display: block;
      width: 100%;
      text-align: left;
      padding: 9px 12px;
      border-radius: 12px;
      color: #e2e8f0;
      font-size: 15px;
      background: rgba(15, 23, 42, 0.45);
      border: none;
      cursor: pointer;
      white-space: nowrap;
    }
    #corner-info-menu a:hover,
    #corner-info-menu button:hover,
    #corner-info-menu a:focus-visible {
      background: rgba(148, 163, 184, 0.28);
    }
    #corner-reset {
      position: fixed;
      left: var(--safe-left);
      top: var(--safe-top);
      z-index: 13;
      transform: none;
      background: rgba(15, 23, 42, 0.6);
      border: 1px solid rgba(255,255,255,0.06);
      color: #e2e8f0;
      border-radius: 999px;
      width: 69px;
      height: 69px;
      padding: 0;
      text-decoration: none;
      opacity: 0.85;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    #corner-reset svg {
      width: 50px;
      height: 50px;
      display: block;
    }
    #theme-menu {
      position: fixed;
      right: var(--safe-right);
      top: auto;
      bottom: var(--safe-bottom);
      z-index: 13;
      display: flex;
      align-items: center;
      gap: 6px;
      background: rgba(15, 23, 42, 0.6);
      border: 1px solid rgba(255,255,255,0.06);
      color: #e2e8f0;
      border-radius: 999px;
      padding: 4px 10px;
      font-size: 14px;
      text-decoration: none;
      opacity: 0.85;
    }
    #basemapSelect {
      background: transparent;
      border: none;
      color: #e2e8f0;
      font-size: 16px;
      cursor: pointer;
      padding: 2px 0;
      text-align: right;
      text-align-last: right;
    }
    #basemapSelect:focus { outline: none; }
    #tile-status {
      position: fixed;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      background: rgba(15, 23, 42, 1);
      border: 1px solid rgba(255,255,255,0.08);
      color: #e2e8f0;
      border-radius: 999px;
      padding: 3px 8px;
      font-size: 8px;
      opacity: 0;
      pointer-events: none;
      transition: opacity 200ms ease;
      z-index: 11;
    }
    #tile-status.visible { opacity: 0.5; }
    #click-hint {
      position: fixed;
      left: 50%;
      top: 48%;
      transform: translate(-50%, -50%);
      background: rgba(15, 23, 42, 0.72);
      border: 1px solid rgba(255,255,255,0.12);
      color: #e2e8f0;
      border-radius: 999px;
      padding: 10px 18px;
      font-size: 28px;
      opacity: 0;
      pointer-events: none;
      transition: opacity 180ms ease;
      z-index: 12;
      white-space: nowrap;
    }
    #click-hint.visible { opacity: 0.8; }
    #onboard {
      position: fixed;
      left: var(--safe-left);
      top: calc(var(--safe-top) + 8px);
      z-index: 14;
      display: none;
      max-width: min(320px, 88vw);
      background: rgba(15, 23, 42, 0.78);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 16px;
      padding: 12px 14px;
      color: #e2e8f0;
      box-shadow: 0 12px 24px rgba(0,0,0,0.3);
    }
    #onboard.visible { display: block; }
    #onboard h3 {
      margin: 0 0 6px;
      font-size: 16px;
      font-weight: 600;
    }
    #onboard p {
      margin: 0 0 8px;
      font-size: 13px;
      color: #cbd5f5;
    }
    #onboard ul {
      margin: 0 0 10px;
      padding-left: 16px;
      font-size: 13px;
      color: #cbd5f5;
    }
    #onboard li { margin-bottom: 4px; }
    #onboard .onboard-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    #onboard .onboard-actions a,
    #onboard .onboard-actions button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 6px 10px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.12);
      background: rgba(15, 23, 42, 0.35);
      color: #e2e8f0;
      font-size: 12px;
      text-decoration: none;
      cursor: pointer;
    }
    #onboard .onboard-actions button {
      background: rgba(255,255,255,0.9);
      color: #0b0c10;
      border-color: rgba(15, 23, 42, 0.35);
      font-weight: 600;
    }
    #dock-toggle {
      position: fixed;
      left: 50%;
      bottom: var(--safe-bottom);
      top: auto;
      transform: translateX(-50%);
      z-index: 13;
      padding: 12px 22px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.08);
      background: rgba(15,23,42,0.72);
      color: #e2e8f0;
      font-size: 18px;
      cursor: pointer;
      box-shadow: 0 6px 14px rgba(0,0,0,0.25);
      opacity: 0.85;
    }
    #counts-wrap {
      position: fixed;
      left: 0;
      right: 0;
      top: var(--safe-top);
      z-index: 13;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      pointer-events: none;
    }
    #counts-wrap > * {
      pointer-events: auto;
    }
    #counts-bar {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    #counts-toggle {
      z-index: 12;
      padding: 10px 22px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.08);
      background: rgba(15,23,42,0.72);
      color: #e2e8f0;
      font-size: 18px;
      cursor: pointer;
      display: inline-flex;
      width: auto;
      min-width: 200px;
      justify-content: center;
      box-shadow: 0 8px 16px rgba(0,0,0,0.28);
      letter-spacing: 0.01em;
      opacity: 0.85;
      white-space: nowrap;
    }
    #counts {
      display: none;
      z-index: 11;
      background: rgba(15, 23, 42, 0.62);
      border: 1px solid rgba(255,255,255,0.06);
      border-radius: 24px;
      padding: 12px 16px;
      font-size: 20px;
      color: #e2e8f0;
      width: min(260px, 30vw);
      min-width: 236px;
    }
    #counts h3 {
      margin: 0 0 12px;
      font-size: 20px;
      font-weight: 600;
      letter-spacing: 0.01em;
    }
    #counts ul {
      list-style: none;
      padding: 0;
      margin: 0;
      display: grid;
      gap: 6px;
    }
    #countsHint {
      display: none;
      text-align: center;
      color: #cbd5f5;
      font-size: 18px;
      padding: 4px 0 12px;
    }
    #counts li {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      color: #cbd5f5;
      align-items: center;
    }
    #counts .legend {
      display: inline-flex;
      align-items: center;
      gap: 12px;
    }
    #counts .dot {
      width: 16px;
      height: 16px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.25);
    }
    #counts .count-total {
      margin-top: 12px;
      font-weight: 600;
      color: #f1f5f9;
    }
    .maplibregl-ctrl-attrib,
    .maplibregl-ctrl-attrib.maplibregl-compact {
      background: rgba(255,255,255,0.82);
      color: #0f172a;
      border: 1px solid rgba(15,23,42,0.2);
      border-radius: 6px;
      padding: 0 3px;
      font-size: 7px;
      line-height: 1.05;
      box-shadow: 0 5px 10px rgba(15,23,42,0.2);
    }
    body:not(.show-attribution) .maplibregl-ctrl-attrib {
      display: none;
    }
    .maplibregl-ctrl-attrib a {
      color: #0f172a;
    }
    .maplibregl-ctrl-attrib a:hover {
      color: #1e293b;
    }
    .maplibregl-ctrl-bottom-right { bottom: 56px; }
    .compass-btn {
      position: fixed;
      right: 12px;
      top: 12px;
      z-index: 12;
      width: 54px;
      height: 54px;
      border-radius: 50%;
      border: 1px solid rgba(255,255,255,0.12);
      background: rgba(15,23,42,0.7);
      color: #e2e8f0;
      font-size: 17px;
      cursor: pointer;
      display: none;
      align-items: center;
      justify-content: center;
      box-shadow: 0 6px 14px rgba(0,0,0,0.25);
    }
    .compass-btn.hidden { display: none !important; }
    @media (max-width: 640px) {
      #hud { max-width: 94vw; }
      #dock {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: 86dvw;
        max-width: 86dvw;
      }
      #corner-info { left: var(--safe-left); bottom: var(--safe-bottom); }
      #onboard {
        left: 50%;
        transform: translateX(-50%);
        top: calc(var(--safe-top) + 10px);
        max-width: min(88vw, 360px);
      }
      .dock-cities-row { display: none; }
      .maplibregl-ctrl-bottom-right { bottom: 80px; }
      #counts {
        display: none;
        width: min(86vw, 480px);
        top: 44px;
        bottom: auto;
        max-height: min(50vh, 480px);
        overflow-y: auto;
        padding: 12px 16px;
        font-size: 22px;
        opacity: 0.85;
      }
      #counts h3 { font-size: 22px; }
      #counts ul { gap: 6px; }
      #counts li { font-size: 22px; }
      #counts .dot { width: 12px; height: 12px; }
      #theme-menu {
        display: flex;
        padding: 2px 5px;
        font-size: 10px;
        bottom: var(--safe-bottom);
      }
      #basemapSelect {
        font-size: 11px;
        max-width: 110px;
        text-overflow: ellipsis;
      }
      #cityChips { display: none; }
      .dock-row { gap: 4px; }
      .dock-row input { padding: 12px 12px; font-size: 19px; }
      .dock-row button { padding: 5px 9px; font-size: clamp(11px, 3vw, 12px); }
      .dock-cities { gap: 6px; }
      .dock-chip { font-size: clamp(9px, 2.1vw, 11px); padding: 3px 6px; }
      #dock-toggle {
        display: inline-flex;
        left: 50%;
        bottom: var(--safe-bottom);
        top: auto;
        transform: translateX(-50%);
      }
      #counts-wrap {
        left: 0;
        right: 0;
        top: var(--safe-top);
      }
      #counts-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 9px;
        font-size: 14px;
        padding: 6px 20px;
        white-space: nowrap;
        width: auto;
        min-width: max-content;
      }
      .maplibregl-ctrl { transform: scale(0.85); transform-origin: bottom right; }
      #corner-reset {
        display: inline-flex;
        width: 54px;
        height: 54px;
      }
      #corner-reset svg {
        width: 44px;
        height: 44px;
      }
      #corner-info-toggle {
        width: 50px;
        height: 50px;
      }
      #corner-info-toggle svg {
        width: 26px;
        height: 26px;
      }
    }
