/* ───────────────────────── base ───────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--app-bg);
  color: var(--ink-900);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; }

/* One consistent, calm focus ring everywhere. */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink-900); color: #fff;
  padding: var(--s2) var(--s4); border-radius: 0 0 var(--r-md) 0;
}
.skip-link:focus { left: 0; }

.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;
}

/* Mono numerals — an identity element. Glow only in full mode. */
.led {
  font-family: var(--font-led);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.led-lit {
  color: var(--num);
  text-shadow: var(--glow-text);
}

/* ───────────────────────── layout ───────────────────────── */
.app {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-columns: var(--rail-w) 1fr;
  grid-template-areas: "topbar topbar" "rail map";
  height: 100vh;
  height: 100dvh;
}

/* ───────────────────────── topbar ───────────────────────── */
.topbar {
  grid-area: topbar;
  display: flex; align-items: center; gap: var(--s3);
  padding: 0 var(--s4);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  position: relative; z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: var(--s3);
  text-decoration: none; color: var(--topbar-fg); flex-shrink: 0;
}
.brand .mark { display: grid; place-items: center; }
.brand h1 {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--topbar-fg);
}
.brand h1 .up { color: var(--accent); }

/* search — the hero */
.search {
  position: relative; flex: 1; min-width: 0; max-width: 560px; margin: 0 auto;
}
.search input {
  width: 100%; min-height: var(--tap);
  padding: 10px 80px 10px 40px;
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: var(--r-md);
  color: var(--field-fg); font: inherit; font-size: 15px;
  transition: border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}
.search input::placeholder { color: var(--field-placeholder); }
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--glow);
}
.search .s-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--field-placeholder); pointer-events: none;
}
.search .kbd {
  position: absolute; right: 44px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-led); font-size: 10.5px;
  color: var(--topbar-muted);
  border: 1px solid var(--field-border); border-radius: var(--r-sm);
  padding: 2px 6px; pointer-events: none;
}
.search.has-value .kbd { display: none; }
.clear-btn {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px;
  border: none; background: var(--control-hover); border-radius: 50%;
  cursor: pointer; color: var(--control-fg);
  display: none; place-items: center;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.clear-btn:hover { background: var(--field-border); color: var(--field-fg); }
.search.has-value .clear-btn { display: grid; }

/* palette dropdown */
.palette {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--pop-bg);
  border: 1px solid var(--pop-border);
  border-radius: var(--r-md);
  box-shadow: var(--pop-shadow);
  overflow: hidden;
  display: none;
  z-index: 60;
}
.palette.open { display: block; }
.palette .p-row {
  display: flex; align-items: center; gap: var(--s3);
  width: 100%;
  padding: 12px 16px;
  background: none; border: none; text-align: left; cursor: pointer;
  border-top: 1px solid var(--pop-border);
}
.palette .p-row:first-child { border-top: none; }
.palette .p-row[aria-selected="true"],
.palette .p-row:hover { background: var(--pop-hover); }
.palette .p-row[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--accent); }
.p-main { flex: 1; min-width: 0; }
.p-name {
  color: var(--pop-fg); font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.p-sub { display: flex; gap: var(--s3); color: var(--pop-muted); font-size: 12px; margin-top: 2px; }
.p-data { font-size: 11.5px; white-space: nowrap; color: var(--accent); }
.p-hint {
  display: flex; gap: var(--s4);
  padding: 9px 16px;
  font-size: 11.5px; color: var(--pop-muted);
  background: var(--pop-hover);
  border-top: 1px solid var(--pop-border);
}
.p-hint .led { font-size: 10.5px; color: var(--accent); }

/* secondary control buttons (Near me, Resources, Full detail) */
.ctrl {
  display: flex; align-items: center; gap: var(--s2);
  min-height: var(--tap); padding: 8px 14px;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: var(--r-md);
  color: var(--control-fg); font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-med) var(--ease);
}
.ctrl:hover { border-color: var(--accent); color: var(--accent-strong); }
.ctrl.on {
  color: var(--accent); border-color: var(--accent);
  box-shadow: var(--glow);
}

/* ───────────────────────── rail ───────────────────────── */
.rail {
  grid-area: rail;
  display: flex; flex-direction: column;
  min-height: 0;
  background: var(--paper);
  border-right: 1px solid var(--steel-200);
  z-index: 20;
}

/* cab panel — type filter plate + stories */
.cab {
  display: flex; flex-direction: column; gap: var(--s4);
  padding: var(--s5);
  background: var(--cab-bg);
  border-bottom: 1px solid var(--cab-border);
}
.cab-label {
  font-family: var(--font-body); font-weight: 700;
  font-size: 11px; letter-spacing: 0.06em;
  color: var(--cab-label); text-transform: uppercase;
  margin-bottom: var(--s3);
}

/* type filter plate */
.plate { flex: 1; min-width: 0; }
.plate-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s3) var(--s2);
}
.cab-close { display: none; }
.pbtn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: none; border: none; cursor: pointer;
  padding: var(--s1) 0;
  -webkit-tap-highlight-color: transparent;
}
.pbtn .ring {
  width: var(--tap); height: var(--tap); border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ring-fg);
  background: var(--ring-bg);
  border: 2px solid var(--ring-border);
  box-shadow: var(--ring-shadow);
  transition: transform var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              box-shadow var(--t-med) var(--ease),
              color var(--t-fast) var(--ease);
}
.pbtn .lbl {
  font-size: 10px; font-weight: 600; line-height: 1.2;
  color: var(--cab-label);
  max-width: 100%; text-align: center;
  transition: color var(--t-fast) var(--ease);
}
.pbtn:hover .ring { border-color: var(--accent); color: var(--accent); }
.pbtn:active .ring { transform: scale(0.96); }
.pbtn[aria-pressed="true"] .ring {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--glow);
}
.pbtn[aria-pressed="true"] .lbl { color: var(--accent-strong); font-weight: 700; }

/* stories row */
.floors { display: flex; flex-direction: row; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.floors .cab-label { margin-bottom: 0; flex-shrink: 0; }
.floors .story-select { width: auto; flex: 0 1 92px; }
.floor-mode {
  display: flex; gap: 3px;
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: var(--r-sm);
  padding: 3px;
  flex-shrink: 0;
}
.floor-mode button {
  min-width: 56px; min-height: 38px;
  font-family: var(--font-body); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--field-placeholder);
  background: none; border: none; border-radius: 5px;
  padding: 4px 10px; cursor: pointer;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.floor-mode button:hover { color: var(--accent-strong); }
.floor-mode button[aria-checked="true"] {
  color: #fff;
  background: var(--accent);
}
.story-select {
  min-height: var(--tap);
  padding: 8px 30px 8px 12px;
  font-family: var(--font-led); font-size: 14px; font-weight: 500;
  color: var(--field-fg);
  background: var(--field-bg) var(--select-caret) no-repeat right 10px center;
  border: 1px solid var(--field-border);
  border-radius: var(--r-sm);
  cursor: pointer; appearance: none; -webkit-appearance: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-med) var(--ease);
  --select-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%236b7872' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.story-select:hover { border-color: var(--accent); }
.story-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.story-select option { background: var(--field-bg); color: var(--field-fg); }

/* YouTube "not filmed yet" toggle */
.firstfilm { display: flex; flex-direction: row; align-items: center; gap: var(--s3); }
.firstfilm .cab-label { margin-bottom: 0; flex-shrink: 0; }
.first-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px;
  font-family: var(--font-body); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--field-placeholder);
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: var(--r-sm);
  padding: 4px 12px; cursor: pointer;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.first-toggle:hover { color: var(--accent-strong); border-color: var(--accent); }
.first-toggle.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.hunt-link {
  font-size: 12px; font-weight: 600; color: var(--accent-strong);
  text-decoration: none; white-space: nowrap; margin-left: auto;
}
.hunt-link:hover { text-decoration: underline; }

/* map pin legend: covered (green) vs be-the-first (amber) */
.map-legend {
  position: absolute; bottom: 28px; left: 12px; z-index: 2;
  display: flex; align-items: center; gap: var(--s2);
  font-size: 11px; font-weight: 600; color: var(--control-fg);
  background: var(--control-bg); border: 1px solid var(--control-border);
  border-radius: 99px; padding: 4px 10px; box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.map-legend .dot { width: 9px; height: 9px; border-radius: 50%; }
.map-legend .dot.covered { background: var(--accent); }
.map-legend .dot.first { background: var(--amber-deep); }
html[data-mode="full"] .map-legend .dot.first { background: var(--amber); }

/* "Be the first" pill: card meta row + drawer footage row */
.pill-first {
  display: inline-flex; align-items: center;
  font-family: var(--font-body); font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--accent-strong);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}

/* drawer footage row */
.footage {
  flex-basis: 100%;
  display: flex; align-items: center; gap: var(--s2);
  font-size: 12px; color: var(--cab-label);
  padding-top: var(--s2);
}
.footage a { color: var(--accent-strong); font-weight: 600; }

/* radius row (location mode) */
.radius {
  display: none;
  align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s5);
  background: var(--card);
  border-bottom: 1px solid var(--steel-150);
  font-size: 13px; color: var(--ink-600);
}
.radius.show { display: flex; }
.radius input[type="range"] { flex: 1; accent-color: var(--accent); height: var(--tap); cursor: pointer; }
.radius .val { font-size: 13px; min-width: 48px; text-align: right; color: var(--num); }

/* mode chip */
.mode {
  display: none;
  align-items: center; gap: var(--s2);
  padding: var(--s3) var(--s5);
  background: var(--card);
  border-bottom: 1px solid var(--steel-150);
  font-size: 13px; color: var(--accent-strong); font-weight: 600;
}
.mode.show { display: flex; }
.mode .x {
  margin-left: auto; border: none; background: none; cursor: pointer;
  color: var(--ink-600); font-size: 13px; text-decoration: underline;
  padding: 6px 4px; min-height: var(--tap);
}
.mode .x:hover { color: var(--ink-900); }

/* ───────────────────────── list ───────────────────────── */
.listwrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.readout {
  display: flex; align-items: baseline; gap: var(--s2);
  padding: var(--s3) var(--s5);
  background: var(--indicator-bg);
  border-bottom: 1px solid var(--indicator-border);
}
.readout .n { font-size: 17px; }
.readout .cap {
  font-family: var(--font-body); font-weight: 700;
  font-size: 11px; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--indicator-label);
}
.readout .sort {
  margin-left: auto;
  font-family: var(--font-body); font-weight: 500;
  font-size: 11px; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--indicator-label);
}
.list {
  flex: 1; overflow-y: auto;
  padding: var(--s3) var(--s4) var(--s8);
  scrollbar-width: thin; scrollbar-color: var(--steel-300) transparent;
}
.list::-webkit-scrollbar { width: 6px; }
.list::-webkit-scrollbar-thumb { background: var(--steel-300); border-radius: 99px; }

.card {
  background: var(--card);
  border: 1px solid var(--steel-200);
  border-radius: var(--r-md);
  padding: var(--s4);
  margin: var(--s3) 0;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-med) var(--ease), transform var(--t-fast) var(--ease);
}
.card:first-child { margin-top: 0; }
.card:hover, .card.hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-sm); }
.card .top { display: flex; justify-content: space-between; gap: var(--s3); align-items: flex-start; }
.card .bname {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em;
  color: var(--ink-900);
}
.card .type {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 700; color: var(--ink-600); margin-top: 5px;
}
.card .type .ticon { display: flex; color: var(--accent); }
.card .addr { font-size: 12.5px; color: var(--ink-600); margin-top: var(--s3); line-height: 1.5; }
.card .meta {
  display: flex; gap: var(--s4); align-items: center;
  margin-top: var(--s3);
  font-size: 11.5px; color: var(--ink-600);
}
.card .meta .led { font-size: 12px; color: var(--ink-900); }
.card .meta .u { font-size: 9.5px; letter-spacing: 0.07em; text-transform: uppercase; margin-left: 3px; }
.stars { color: var(--amber-deep); letter-spacing: 1px; font-size: 13px; white-space: nowrap; }
.stars .n { color: var(--ink-900); margin-left: 5px; font-size: 12.5px; }

/* skeletons — flat + still in calm, shimmering in full */
.skeleton-card {
  background: var(--card); border: 1px solid var(--steel-150);
  border-radius: var(--r-md); padding: var(--s4); margin: var(--s3) 0;
}
.skel {
  background: var(--skel-bg);
  border-radius: var(--r-sm);
}
.skel-title { height: 15px; width: 68%; margin-bottom: 10px; }
.skel-sub { height: 11px; width: 40%; margin-bottom: 12px; }
.skel-row { display: flex; gap: var(--s2); }
.skel-badge { height: 18px; width: 66px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* empty + error states */
.state {
  margin: var(--s4) var(--s1);
  padding: var(--s6);
  background: var(--card);
  border: 1px dashed var(--steel-300);
  border-radius: var(--r-md);
  text-align: center;
}
.state p { font-size: 14px; color: var(--ink-600); }
.state .actions {
  display: flex; gap: var(--s2); justify-content: center;
  flex-wrap: wrap; margin-top: var(--s4);
}
.state.error { border-color: var(--red-600); background: var(--red-soft); }
.state.error p { color: var(--red-600); font-weight: 600; }

.ghost-btn {
  background: var(--card);
  border: 1px solid var(--steel-300);
  border-radius: var(--r-md);
  padding: 10px 16px; min-height: var(--tap);
  font-size: 13px; font-weight: 600; color: var(--ink-900);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.ghost-btn:hover { border-color: var(--accent); background: var(--paper); }

/* ───────────────────────── map ───────────────────────── */
.mapwrap { grid-area: map; position: relative; min-height: 0; }
#map { position: absolute; inset: 0; }
.map-shimmer {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background: var(--map-load-bg);
  opacity: 1;
  transition: opacity 400ms var(--ease);
}
.map-shimmer.done { opacity: 0; }
.map-error {
  position: absolute; left: 50%; top: 40%;
  transform: translate(-50%, -50%);
  z-index: 6; margin: 0; min-width: 260px;
}
.loc-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--accent), 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* map control chrome */
.maplibregl-ctrl-group {
  background: var(--control-bg) !important;
  box-shadow: 0 0 0 1px var(--control-border), 0 2px 8px rgba(22, 33, 29, 0.18) !important;
}
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--control-border) !important; }
.maplibregl-ctrl-attrib {
  background: rgba(255, 255, 255, 0.78) !important;
  color: var(--ink-600) !important;
}
.maplibregl-ctrl-attrib a { color: var(--ink-700) !important; }

/* ───────────────────────── drawer + doors ───────────────────────── */
.scrim {
  position: fixed; inset: 0;
  background: rgba(22, 33, 29, 0.40);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-door) var(--ease);
  z-index: 45;
}
.scrim.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0;
  width: 460px; max-width: 100vw;
  height: 100vh; height: 100dvh;
  background: var(--paper);
  box-shadow: var(--shadow-drawer);
  transform: translateX(100%);
  transition: transform var(--t-door) var(--ease-out);
  z-index: 50;
  display: flex; flex-direction: column;
  overflow: hidden;
  visibility: hidden;
}
.drawer.open { transform: translateX(0); visibility: visible; }

/* door reveal — full mode only */
.doors { position: absolute; inset: 0; z-index: 10; pointer-events: none; display: none; }
.door {
  flex: 1;
  background: linear-gradient(105deg, var(--ink-800) 0%, var(--ink-900) 55%, var(--ink-800) 100%);
  transition: transform var(--t-door) var(--ease-out) 60ms;
}
.door.l { border-right: 2px solid var(--steel-400); box-shadow: inset -8px 0 16px rgba(0,0,0,0.35); }
.door.r { border-left: 2px solid var(--steel-400); box-shadow: inset 8px 0 16px rgba(0,0,0,0.35); }

.dhead {
  padding: var(--s6) var(--s6) var(--s5);
  background: var(--card);
  border-bottom: 1px solid var(--steel-150);
  position: relative;
}
.close-btn {
  position: absolute; top: var(--s4); right: var(--s4);
  border: 1px solid var(--steel-200); background: var(--paper);
  border-radius: var(--r-md);
  width: var(--tap); height: var(--tap);
  cursor: pointer; color: var(--ink-600);
  display: grid; place-items: center;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.close-btn:hover { background: var(--steel-150); color: var(--ink-900); }
.drawer h2 {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; line-height: 1.2;
  padding-right: 56px;
}
.dtype {
  display: inline-flex; align-items: center; gap: var(--s3);
  margin-top: var(--s3);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent-strong);
}
.dtype .town { color: var(--ink-600); font-weight: 600; }
.daddr { color: var(--ink-600); font-size: 13px; margin-top: var(--s2); }

/* data strip — indicator panel */
.datastrip {
  display: flex; flex-wrap: wrap;
  background: var(--indicator-bg);
  border-bottom: 1px solid var(--indicator-border);
}
.datastrip .footage {
  border-top: 1px solid var(--indicator-border);
  padding: var(--s2) var(--s4);
}
.datastrip .cell {
  flex: 1; text-align: center;
  padding: var(--s4) var(--s2);
  border-left: 1px solid var(--indicator-border);
}
.datastrip .cell:first-child { border-left: none; }
.datastrip .cell .v { font-size: 22px; display: block; }
.datastrip .cell .k {
  font-family: var(--font-body); font-weight: 700;
  font-size: 9.5px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--indicator-label);
  margin-top: 2px;
}

.dbody {
  flex: 1; overflow-y: auto;
  padding: var(--s5) var(--s6) var(--s8);
  scrollbar-width: thin; scrollbar-color: var(--steel-300) transparent;
}
.dbody::-webkit-scrollbar { width: 6px; }
.dbody::-webkit-scrollbar-thumb { background: var(--steel-300); border-radius: 99px; }

.sec { margin-top: var(--s7); }
.sec:first-child { margin-top: 0; }
.sec h3 {
  font-family: var(--font-body);
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-600); margin-bottom: var(--s4); font-weight: 700;
}
.sec-hint { font-size: 13px; color: var(--ink-600); margin: calc(-1 * var(--s2)) 0 var(--s4); }
.sec .field { margin-bottom: var(--s3); }

/* rating block + primary CTA */
.rating-block {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s5);
  background: var(--card);
  border: 1px solid var(--steel-200);
  border-radius: var(--r-md);
}
.rating-block .big { font-size: 28px; color: var(--num); }
.rating-block .of { font-size: 13px; color: var(--ink-600); }
.rating-block .stars { font-size: 16px; }
.rating-block .stars.empty { color: var(--steel-200); }
.rcount { font-size: 13px; color: var(--ink-600); }
/* Unrated: no fabricated score — just empty stars + "No reviews yet" */
.stars.unrated { color: var(--ink-600); font-size: 12px; font-style: italic; letter-spacing: 0; }

/* Unverified data: don't present unconfirmed specs as fact */
.badge-unverified {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: var(--ink-600); background: var(--steel-150);
  border: 1px solid var(--steel-300); border-radius: 999px;
  vertical-align: middle;
}
.dot-unverified {
  display: inline-block; width: 6px; height: 6px; margin-left: 6px;
  background: var(--steel-300); border-radius: 50%; vertical-align: middle;
}
.cell.est .v, .cell.est .k { color: var(--ink-600); }

.cta {
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  width: 100%; min-height: 48px;
  margin-top: var(--s4);
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--r-md);
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.cta:hover { background: var(--accent-strong); }
.cta:active { transform: scale(0.98); }

/* review form */
.rform { display: none; margin-top: var(--s4); }
.rform.open { display: block; }
.starpick { display: flex; gap: 4px; margin-bottom: var(--s3); }
.starpick button {
  font-size: 28px; color: var(--star-off);
  width: var(--tap); height: var(--tap); border-radius: var(--r-sm);
  background: none; border: none; cursor: pointer;
  display: grid; place-items: center;
  transition: color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.starpick button:hover { transform: scale(1.12); }
.starpick button.on { color: var(--amber-deep); }
.form-error {
  display: none;
  color: var(--red-600); font-size: 13px; font-weight: 600;
  margin-bottom: var(--s3);
}
.form-error.show { display: block; }

.field { display: flex; flex-direction: column; gap: var(--s2); }
.field label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--ink-600); font-weight: 400; }
textarea, .text-input {
  width: 100%;
  border: 1px solid var(--steel-300); border-radius: var(--r-md);
  padding: var(--s3); font: inherit; font-size: 14px;
  background: var(--card); color: var(--ink-900);
  line-height: 1.5;
  transition: border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}
textarea { resize: vertical; }
.text-input { min-height: var(--tap); padding: var(--s2) var(--s3); }
textarea:focus, .text-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea::placeholder, .text-input::placeholder { color: var(--ink-600); opacity: 0.75; }

.btn {
  background: var(--ink-900); color: #fff;
  border: none; border-radius: var(--r-md);
  padding: var(--s3) var(--s5); min-height: var(--tap); width: 100%;
  font-size: 14px; font-weight: 600; cursor: pointer;
  margin-top: var(--s4);
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:hover { background: var(--ink-700); }
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* reviews */
.review { border-top: 1px solid var(--steel-150); padding: var(--s4) 0; }
.review:first-of-type { border-top: none; padding-top: 0; }
.review .rhead { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); }
.review .who { font-weight: 600; font-size: 13.5px; }
.review .rstars { color: var(--amber-deep); font-size: 13px; letter-spacing: 1px; }
.review p { font-size: 13.5px; color: var(--ink-700); margin-top: var(--s2); line-height: 1.55; }
.empty { color: var(--ink-600); font-size: 13.5px; padding: var(--s1) 0; }

.savednote {
  display: none;
  align-items: center; gap: var(--s2);
  margin-top: var(--s3);
  color: var(--accent-strong); font-size: 13px; font-weight: 600;
}
.savednote.show { display: flex; }

/* ───────────────────────── resources modal ───────────────────────── */
.resmodal {
  position: fixed; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(0.98);
  width: 540px; max-width: calc(100vw - 32px);
  max-height: 82vh; max-height: 82dvh;
  display: flex; flex-direction: column;
  background: var(--pop-bg);
  border: 1px solid var(--pop-border);
  border-radius: var(--r-lg);
  box-shadow: var(--pop-shadow);
  z-index: 70;
  opacity: 0; visibility: hidden;
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease-out), visibility 0s var(--t-med);
}
.resmodal.open {
  opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1);
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease-out), visibility 0s;
}
#resScrim { z-index: 65; }
.res-head {
  position: relative;
  padding: var(--s5) var(--s5) var(--s4);
  border-bottom: 1px solid var(--pop-border);
}
.res-head h2 {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 700; color: var(--pop-fg);
}
.res-head p { font-size: 13px; color: var(--pop-muted); margin-top: var(--s1); padding-right: 48px; }
.res-head .close-btn { background: var(--control-bg); border-color: var(--control-border); color: var(--control-fg); }
.res-head .close-btn:hover { background: var(--pop-hover); color: var(--pop-fg); }
.res-body {
  overflow-y: auto;
  padding: var(--s3) var(--s3) var(--s5);
  scrollbar-width: thin; scrollbar-color: var(--steel-300) transparent;
}
.res-group { margin-top: var(--s3); }
.res-group h3 {
  font-family: var(--font-body); font-weight: 700;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); padding: 0 var(--s2);
  margin-bottom: var(--s1);
}
.res-row {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s2);
  border-radius: var(--r-md);
  text-decoration: none; cursor: pointer;
  color: var(--pop-muted);
  transition: background var(--t-fast) var(--ease);
}
.res-row:hover { background: var(--pop-hover); }
.res-row:hover .res-name { color: var(--accent); }
.res-main { flex: 1; min-width: 0; }
.res-name {
  display: block; font-size: 14px; font-weight: 600; color: var(--pop-fg);
  transition: color var(--t-fast) var(--ease);
}
.res-desc { display: block; font-size: 12px; color: var(--pop-muted); margin-top: 2px; }

@media (max-width: 860px) {
  .resmodal {
    left: 0; right: 0; top: auto; bottom: 0;
    width: 100vw; max-width: none;
    transform: translateY(8px);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    max-height: 80vh; max-height: 80dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .resmodal.open { transform: translateY(0); }
}

/* ───────────────────────── toasts ───────────────────────── */
.toasts {
  position: fixed; bottom: var(--s5); left: var(--s5);
  display: flex; flex-direction: column; gap: var(--s2);
  z-index: 80; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--s3);
  background: var(--toast-bg); color: var(--toast-fg);
  border: 1px solid var(--toast-border);
  border-radius: var(--r-md);
  padding: var(--s3) var(--s4);
  font-size: 13.5px;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toast-in 200ms var(--ease-out);
}
.toast .tick { color: var(--accent); }
.toast.err { border-color: var(--red-600); }
.toast .t-act {
  background: none; border: none; cursor: pointer;
  color: var(--accent); font-weight: 700; font-size: 13.5px;
  text-decoration: underline; padding: 2px 4px;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ───────────────────────── mobile ───────────────────────── */
.sheet-handle, .filters-fab { display: none; }

@media (max-width: 860px) {
  .app {
    grid-template-rows: auto 1fr;
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "map";
  }
  .topbar { flex-wrap: nowrap; gap: var(--s2); padding: var(--s2) var(--s3); height: auto; min-height: var(--topbar-h); }
  .brand h1 { display: none; }
  .search { max-width: none; }
  .search .kbd { display: none; }
  .search input { padding-right: 44px; }
  /* >=16px keeps iOS Safari from auto-zooming the page when a field is focused */
  .search input, textarea, .text-input, .story-select, .floor-mode button { font-size: 16px; }
  .ctrl span { display: none; }
  .ctrl { padding: 8px; min-width: var(--tap); justify-content: center; }

  /* rail becomes a bottom sheet */
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0;
    top: auto; height: 72vh; height: 72dvh;
    transform: translateY(calc(100% - 124px)); /* peek: readout + handle */
    transition: transform 240ms var(--ease-out);
    border-right: none; border-top: 1px solid var(--steel-200);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    box-shadow: 0 -8px 32px rgba(22, 33, 29, 0.18);
    z-index: 30;
  }
  .rail.half { transform: translateY(38%); }
  .rail.full { transform: translateY(0); }
  .sheet-handle {
    display: grid; place-items: center;
    min-height: 32px; width: 100%;
    background: var(--paper); border: none; cursor: pointer;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    touch-action: none;
  }
  .sheet-handle::before {
    content: ""; width: 44px; height: 5px; border-radius: 99px;
    background: var(--steel-300);
  }

  .cab {
    display: none;
    position: fixed; left: 0; right: 0; bottom: 0;
    flex-direction: column;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding-bottom: max(var(--s6), env(safe-area-inset-bottom));
    z-index: 55;
    max-height: 72vh; overflow-y: auto;
  }
  .cab.open { display: flex; }
  .cab-close {
    position: absolute; top: var(--s2); right: var(--s2);
    width: var(--tap); height: var(--tap);
    background: none; border: none; color: var(--cab-label); cursor: pointer;
    display: grid !important; place-items: center;
  }
  .plate-grid { grid-template-columns: repeat(4, 1fr); }
  .floors { margin-top: var(--s3); }
  .story-select { min-height: var(--tap); }

  .filters-fab {
    display: flex; align-items: center; gap: var(--s2);
    position: absolute; top: var(--s3); left: var(--s3); z-index: 25;
    background: var(--card); color: var(--ink-900);
    border: 1px solid var(--steel-300); border-radius: 999px;
    padding: 10px 16px; min-height: var(--tap);
    font-size: 13px; font-weight: 600; cursor: pointer;
    box-shadow: var(--shadow-md);
  }
  .filters-fab .dot {
    display: none;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent);
  }
  .filters-fab.active .dot { display: block; }

  .drawer { width: 100vw; }
  .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: 128px; }
  .toasts { left: 50%; transform: translateX(-50%); bottom: var(--s4); width: max-content; max-width: calc(100vw - 32px); }
}

/* ═══════════════ FULL DETAIL — motion + depth restored ═══════════════ */
html[data-mode="full"] body { background: var(--paper); }

/* lit topbar gets the brushed-steel hairline */
html[data-mode="full"] .topbar {
  box-shadow: inset 0 1px 0 rgba(201, 206, 208, 0.12);
}
html[data-mode="full"] .search input {
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}
html[data-mode="full"] .search input:focus {
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0 3px var(--accent-soft), var(--glow);
}
html[data-mode="full"] .cab {
  border-bottom-width: 2px;
  box-shadow: inset 0 1px 0 rgba(201, 206, 208, 0.14);
}
html[data-mode="full"] .readout {
  border-bottom-width: 2px;
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.3);
}
html[data-mode="full"] .datastrip {
  border-top: 1px solid var(--ink-700);
  border-bottom-width: 2px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}
html[data-mode="full"] .story-select {
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
  --select-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23aab2b3' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
html[data-mode="full"] .story-select:focus {
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5), 0 0 0 3px var(--accent-soft);
}
html[data-mode="full"] .floor-mode button[aria-checked="true"] {
  color: var(--led-text);
  background: var(--led-soft);
  text-shadow: var(--glow-text);
}
html[data-mode="full"] .pbtn[aria-pressed="true"] .ring {
  filter: drop-shadow(0 0 4px var(--led-glow));
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--led), var(--glow);
}

/* shimmer comes back as a motion accent in full mode */
html[data-mode="full"] .skel {
  background: linear-gradient(90deg, var(--steel-150) 25%, #f0f2f1 50%, var(--steel-150) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
html[data-mode="full"] .map-shimmer {
  background: linear-gradient(90deg, rgba(22,33,29,0.7) 25%, rgba(29,43,38,0.7) 50%, rgba(22,33,29,0.7) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

/* door reveal */
html[data-mode="full"] .doors { display: flex; }
html[data-mode="full"] .drawer.open .door.l { transform: translateX(-101%); }
html[data-mode="full"] .drawer.open .door.r { transform: translateX(101%); }
html[data-mode="full"] .drawer:not(.open) .door { transition: none; }

/* dark map control chrome */
html[data-mode="full"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(0.88); }
html[data-mode="full"] .maplibregl-ctrl-attrib {
  background: rgba(22, 33, 29, 0.75) !important;
  color: var(--steel-400) !important;
}
html[data-mode="full"] .maplibregl-ctrl-attrib a { color: var(--steel-300) !important; }

/* ───────────────────────── voice overlay ─────────────────────────
   "Step into the cab." A focused, low-stimulation modal for the spoken
   conversation. Always rendered as a calm dark cab interior (in both themes)
   so it reads as a distinct, immersive moment. Soft LED glow, gentle motion,
   neutralised by the reduced-motion guard below. */
.voice-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  padding: var(--s4);
  background: rgba(16, 23, 20, 0.55);
  backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--t-door) var(--ease), visibility var(--t-door) var(--ease);
}
.voice-overlay.show { opacity: 1; visibility: visible; pointer-events: auto; }

.vc-cab {
  position: relative;
  width: min(440px, 100%);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--ink-800) 0%, var(--ink-900) 100%);
  border: 1px solid var(--ink-700);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(201, 206, 208, 0.10);
  overflow: hidden;
  transform: translateY(10px) scale(0.98);
  transition: transform var(--t-door) var(--ease-out);
}
.voice-overlay.show .vc-cab { transform: translateY(0) scale(1); }

/* cab doors — part on connect, full-detail mode only (matches the drawer) */
.vc-doors { position: absolute; inset: 0; z-index: 3; display: none; pointer-events: none; }
.vc-door {
  position: absolute; top: 0; bottom: 0; width: 50%;
  background: linear-gradient(105deg, var(--ink-700) 0%, var(--ink-900) 55%, var(--ink-700) 100%);
  transition: transform var(--t-door) var(--ease-out) 80ms;
}
.vc-door.l { left: 0;  border-right: 2px solid var(--steel-400); box-shadow: inset -8px 0 16px rgba(0,0,0,0.35); }
.vc-door.r { right: 0; border-left: 2px solid var(--steel-400);  box-shadow: inset 8px 0 16px rgba(0,0,0,0.35); }
html[data-mode="full"] .vc-doors { display: block; }
html[data-mode="full"] .vc-cab[data-vstate="listening"] .vc-door.l,
html[data-mode="full"] .vc-cab[data-vstate="speaking"]  .vc-door.l { transform: translateX(-100%); }
html[data-mode="full"] .vc-cab[data-vstate="listening"] .vc-door.r,
html[data-mode="full"] .vc-cab[data-vstate="speaking"]  .vc-door.r { transform: translateX(100%); }

.vc-inner {
  position: relative; z-index: 4;
  display: flex; flex-direction: column; align-items: center;
  padding: var(--s7) var(--s6) var(--s6);
  text-align: center;
}

.vc-close {
  position: absolute; top: var(--s3); right: var(--s3);
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  background: transparent; border: 0; border-radius: var(--r-sm);
  color: var(--steel-400); cursor: pointer;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.vc-close:hover { color: var(--paper); background: rgba(255,255,255,0.06); }

.vc-heading {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 500; color: var(--paper);
  margin: var(--s2) 0 var(--s6);
}

/* the listening orb */
.vc-orb {
  position: relative;
  width: 132px; height: 132px;
  display: grid; place-items: center;
  margin-bottom: var(--s5);
}
.vc-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid var(--led);
  opacity: 0;
}
.vc-core {
  position: relative; z-index: 2;
  width: 88px; height: 88px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, var(--ink-700), var(--ink-900) 72%);
  border: 1px solid var(--ink-600);
  color: var(--steel-400);
  transition: color var(--t-med) var(--ease), border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}

/* listening — soft, slow breathing (your turn) */
.vc-cab[data-vstate="listening"] .vc-core {
  color: var(--led-text);
  border-color: var(--led-dim);
  box-shadow: 0 0 0 1px var(--led-soft), 0 0 24px var(--led-glow);
}
.vc-cab[data-vstate="listening"] .vc-ring { animation: vc-breathe 2.8s var(--ease) infinite; }
.vc-cab[data-vstate="listening"] .vc-ring:nth-child(2) { animation-delay: 1.4s; }

/* speaking — gentle ripple outward (the guide is talking) */
.vc-cab[data-vstate="speaking"] .vc-core {
  color: var(--paper);
  border-color: var(--led);
  box-shadow: 0 0 0 1px var(--led-soft), 0 0 30px var(--led-glow);
}
.vc-cab[data-vstate="speaking"] .vc-ring { animation: vc-ripple 1.6s var(--ease-out) infinite; }
.vc-cab[data-vstate="speaking"] .vc-ring:nth-child(2) { animation-delay: 0.8s; }

@keyframes vc-breathe {
  0%, 100% { transform: scale(0.92); opacity: 0; }
  50%      { transform: scale(1.06); opacity: 0.45; }
}
@keyframes vc-ripple {
  0%   { transform: scale(0.82); opacity: 0.55; }
  100% { transform: scale(1.35); opacity: 0; }
}

.vc-status {
  font-size: 16px; font-weight: 600; color: var(--paper);
  margin: 0 0 var(--s3); min-height: 1.4em;
}

/* live caption — read along with the conversation */
.vc-caption {
  width: 100%; min-height: 3.2em;
  font-size: 14.5px; line-height: 1.45; color: var(--steel-300);
  margin-bottom: var(--s6);
}
.vc-caption .vc-who { display: block; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--steel-400); margin-bottom: 2px; }
.vc-caption:empty { min-height: 1.6em; }

.vc-end {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: var(--tap); padding: 10px 20px;
  border-radius: 999px;
  background: var(--red-600); color: #fff; border: 0;
  font-family: var(--font-body); font-size: 14.5px; font-weight: 600;
  cursor: pointer;
  transition: filter var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.vc-end:hover { filter: brightness(1.08); }
.vc-end:active { transform: scale(0.98); }
.vc-end-icon { display: grid; place-items: center; }

:focus-visible { outline-offset: 2px; }
.vc-close:focus-visible, .vc-end:focus-visible { outline: 2px solid var(--led); outline-offset: 2px; }

@media (max-width: 520px) {
  .voice-overlay { padding: 0; }
  .vc-cab { width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .vc-inner { height: 100%; justify-content: center; }
}

/* ───────────────────────── reduced motion ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .doors, .vc-doors { display: none !important; }
}
