:root {
  --bg: #eef3f7;
  --panel: #ffffff;
  --ink: #162430;
  --muted: #5a6b78;
  --line: #dbe3ea;
  --accent: #0e607c;
  --accent-ink: #ffffff;
  --soft: #e6f2f6;
  --mint: #dffaf4;
  --warn-bg: #fff6dd;
  --warn-line: #ecd28a;
  --shadow: 0 8px 28px rgba(15, 32, 48, 0.18);
  --shadow-sm: 0 2px 10px rgba(15, 32, 48, 0.14);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: #dce5ec;
  color: var(--ink);
  font: 14.5px/1.45 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
button:focus-visible, input:focus-visible, .table-wrapper:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Full-viewport map ---------- */
#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  z-index: 0;
  background: #eaeff3;
}
#map.winter-mode .leaflet-tile-pane {
  filter: contrast(0.98) brightness(1.01);
}
.leaflet-control-attribution {
  font-size: 10px !important;
  background: rgba(255, 255, 255, 0.78) !important;
  padding: 1px 6px !important;
}

/* ---------- Prominent Search & Planner Shell (Desktop Left Card) ---------- */
.search-shell {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 620;
  width: 400px;
  max-width: calc(100vw - 80px);
  max-height: calc(100dvh - 24px);
  background: var(--panel);
  border: 1px solid rgba(14, 96, 124, 0.14);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.search-shell.collapsed .results-sheet {
  display: none;
}

.search-top {
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex: none;
  position: relative;
  z-index: 5;
}
.search-shell.collapsed .search-top { border-bottom: 0; }

.shell-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.brand-left { display: flex; align-items: center; gap: 7px; min-width: 0; }
.brand-icon { color: var(--accent); flex: none; }
.brand-left h1 {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.season-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--soft);
  padding: 1px 6px;
  border-radius: 999px;
  flex: none;
}
.brand-right { display: flex; align-items: center; gap: 6px; flex: none; }

.lang {
  display: inline-flex;
  background: #f2f6f9;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
}
.lang button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.lang button.on { background: var(--accent); color: #fff; }

.collapse-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 14px;
}
.collapse-btn:hover { background: var(--soft); color: var(--accent); }

/* Hero Search Bar */
.hero-search {
  display: flex;
  align-items: center;
  gap: 6px;
}
.combo {
  position: relative;
  flex: 1;
  min-width: 0;
}
.search-lead-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  pointer-events: none;
}
.combo input {
  width: 100%;
  height: 42px;
  padding: 0 10px 0 36px;
  border: 1.5px solid #c3d5e2;
  border-radius: 11px;
  background: #f8fbfd;
  font-size: 14.5px;
  transition: border-color 0.15s, background 0.15s;
}
.combo input:focus {
  border-color: var(--accent);
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(14, 96, 124, 0.14);
}
.suggest {
  position: absolute;
  z-index: 1200;
  left: 0;
  right: 0;
  top: 46px;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 280px;
  overflow: auto;
}
.suggest li { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.suggest li:hover, .suggest li.on { background: var(--soft); }
.suggest small { display: block; color: var(--muted); font-size: 11.5px; }
.suggest .group { padding: 5px 10px 2px; font-size: 11px; font-weight: 700; color: var(--muted); cursor: default; background: none; }

.btn {
  height: 42px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: #fff; color: var(--accent); }
.btn.ghost:hover { background: var(--soft); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.icon-only { width: 42px; padding: 0; flex: none; }
.btn.sm { height: 34px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.preview-btn {
  background: #162430;
  border-color: #162430;
  color: #fff;
}
.btn.preview-btn:hover { background: #263b4d; }

/* Resort Pills */
.resorts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.resorts button {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}
.resorts button:hover { border-color: var(--accent); }
.resorts button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Compact Trip Options */
.trip-options-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  height: 32px;
}
.seg button {
  border: 0;
  background: #fff;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.seg button.on { background: var(--soft); color: var(--accent); }

.dt-pill {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.dt-pill:hover { border-color: var(--accent); }
.guide-pill {
  background: #edf7fa;
  border-color: #b4d8e4;
  color: var(--accent);
}
.guide-pill:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.mobile-quick-tools { display: none; margin-left: auto; gap: 5px; }
.mini-tool-btn {
  position: relative;
  height: 32px;
  min-width: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 0;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mini-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e03131;
  border: 1.5px solid #fff;
}
.mini-dot[hidden] { display: none; }

.dt-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 2px;
}
.dt-row[hidden] { display: none; }
.field { display: grid; gap: 3px; min-width: 0; }
label { font-size: 11.5px; font-weight: 600; color: var(--muted); }
input[type=date], input[type=time] {
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  width: 100%;
  min-width: 0;
}

/* Results Sheet (Inline on Desktop) */
.results-sheet {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.sheet-handle { display: none; }
.sheet-scroll {
  padding: 12px 14px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sheet-scroll > * { flex: none; }

.hint { font-size: 12px; color: var(--muted); }
.origin-bar[hidden] { display: none; }

.notice {
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  font-size: 12px;
  color: #554007;
}
.notice[hidden] { display: none; }

/* Trip Summary Card + Preview Action */
.tripcard {
  background: #fbfdff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--c);
  border-radius: 12px;
  padding: 11px 12px;
  display: grid;
  gap: 6px;
}
.tripcard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tripcard .k { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.tripcard .od { font-size: 14.5px; font-weight: 800; line-height: 1.3; }
.tripcard ol { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 4px; }
.tripcard li { display: grid; grid-template-columns: 56px 1fr; gap: 8px; align-items: center; }
.tripcard .tm { text-align: right; font-variant-numeric: tabular-nums; }
.tripcard .tm.big { font-size: 20px; font-weight: 800; line-height: 1.15; }
.tripcard li small { display: block; font-size: 11px; color: var(--muted); line-height: 1.2; }
.tripcard li b { line-height: 1.25; display: block; font-size: 13.5px; }
.tripcard .walk, .tripcard .via { font-size: 12.5px; color: var(--muted); }
.tripcard .later { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tripcard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.results { display: grid; gap: 9px; }
.empty {
  padding: 14px 12px;
  text-align: center;
  color: var(--muted);
  background: #f5f9fc;
  border: 1px dashed #c8d8e4;
  border-radius: 10px;
  font-size: 13px;
}

.stop {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 7px;
}
.stop header { display: flex; align-items: flex-start; gap: 9px; }
.num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.stop h3 { font-size: 14px; line-height: 1.3; }
.stop h3 button {
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
}
.stop h3 button:hover { color: var(--accent); text-decoration: underline; }
.stop .meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 2px; }
.stop .meta a { color: var(--accent); }
.nextline { font-size: 13px; }
.nextline b { font-size: 15px; }
.deps { display: flex; flex-wrap: wrap; gap: 5px; }
.dep {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 3px 7px 3px 4px;
  font-size: 12.5px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.dep.past { opacity: 0.42; }
.dep.next { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 700; }
.dep.open { background: var(--soft); border-color: var(--accent); }
.badge {
  display: inline-block;
  min-width: 24px;
  text-align: center;
  padding: 1px 5px;
  border-radius: 4px;
  background-color: var(--badge-bg, #0e607c);
  color: #fff;
  --wcag-y-threshold: 0.17913;
  --y: max(0, sign(var(--wcag-y-threshold) - y));
  color: color(from var(--badge-bg, #0e607c) xyz-d65 calc(var(--y) * 0.9505) var(--y) calc(var(--y) * 1.089));
  color: contrast-color(var(--badge-bg, #0e607c));
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: 0.01em;
}
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.trip { border-top: 1px dashed var(--line); padding-top: 8px; font-size: 12.5px; }
.trip h4 { margin: 0 0 5px; font-size: 13px; }
.trip ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.trip li { display: grid; grid-template-columns: 46px 1fr; gap: 8px; color: var(--muted); }
.trip li.on { color: var(--ink); font-weight: 600; }
.trip li time { font-variant-numeric: tabular-nums; text-align: right; }
.note { font-size: 11.5px; color: var(--muted); }
.more { justify-self: center; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 5px 10px; text-decoration: underline; font-size: 13px; }

.panel-footer {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-size: 11px;
  color: var(--muted);
  display: grid;
  gap: 2px;
}
.panel-footer a { color: var(--accent); }

/* ---------- Floating Map Status Pill & Route Legend ---------- */
.map-status-bar {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 424px;
  z-index: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.map-status-bar > * { pointer-events: auto; }
.map-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  border: 1px solid rgba(14, 96, 124, 0.22);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.map-mode-pill:hover { border-color: var(--accent); color: var(--accent); }
.map-mode-pill.on {
  background: #162430;
  color: #fff;
  border-color: #162430;
}
.route-legend {
  position: fixed;
  left: 424px;
  right: 88px;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 590;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(14, 96, 124, 0.16);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  overflow-x: auto;
  scrollbar-width: none;
  max-width: fit-content;
}
.route-legend::-webkit-scrollbar { display: none; }
.legend-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
  padding-right: 4px;
  border-right: 1px solid var(--line);
  margin-right: 2px;
}
.legend-chip {
  flex: none;
  border: 1.5px solid transparent;
  background-color: var(--badge-bg, #0e607c);
  color: #fff;
  --wcag-y-threshold: 0.17913;
  --y: max(0, sign(var(--wcag-y-threshold) - y));
  color: color(from var(--badge-bg, #0e607c) xyz-d65 calc(var(--y) * 0.9505) var(--y) calc(var(--y) * 1.089));
  color: contrast-color(var(--badge-bg, #0e607c));
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 5px;
  cursor: pointer;
  line-height: 1.45;
  opacity: 0.92;
  transition: transform 0.12s, opacity 0.12s, box-shadow 0.12s;
}
.legend-chip:hover { transform: translateY(-1px); opacity: 1; }
.legend-chip.dim { opacity: 0.28; }
.legend-chip.on {
  opacity: 1;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--badge-bg);
}
.legend-all-btn {
  flex: none;
  border: 1px solid var(--line);
  background: #f4f7fa;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  cursor: pointer;
}
.legend-all-btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2f9e44;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 10px 6px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.filter-pill[hidden] { display: none; }
.pill-close {
  border: 0;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
}

/* ---------- Right-side Utility Dock (Geomark style) ---------- */
.dock {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  top: max(12px, env(safe-area-inset-top));
  z-index: 620;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dock-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid #fff;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.dock-btn:hover { transform: scale(1.06); box-shadow: var(--shadow); }
.dock-btn[aria-expanded="true"] {
  transform: scale(1.08);
  box-shadow: 0 0 0 3px rgba(14, 96, 124, 0.35), var(--shadow);
}
.dock-filter { background: #74c64b; }
.dock-stops  { background: #4cbce3; }

.dock-tip {
  position: absolute;
  right: 54px;
  background: rgba(22, 36, 48, 0.9);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.dock-btn:hover .dock-tip { opacity: 1; }
.dock-badge {
  position: absolute;
  top: -5px;
  left: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e03131;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 1.5px solid #fff;
}
.dock-badge[hidden] { display: none; }

/* ---------- Floating Side Panels (Filter & Stops) ---------- */
.float-panel {
  position: fixed;
  top: 12px;
  right: 68px;
  z-index: 640;
  width: 340px;
  max-width: calc(100vw - 84px);
  max-height: calc(100dvh - 32px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.float-panel[hidden] { display: none; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.filter-panel .panel-head { background: #f3f7d4; border-bottom-color: #dde3a9; }
.stops-panel  .panel-head { background: #e9f6fc; border-bottom-color: #c8e5f2; }
.panel-head h2 { font-size: 15px; font-weight: 700; }
.panel-head-actions { display: flex; align-items: center; gap: 6px; }
.chip-btn {
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.panel-body {
  padding: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel-body > * { flex: none; }

/* Line Filter */
.line-filters { display: grid; gap: 10px; }
.line-group { display: grid; gap: 6px; }
.line-group-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.line-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.line-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.line-chip {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--c, var(--line));
  background: #f8fafc;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.line-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c, var(--accent));
}
.line-chip.on {
  background: var(--c);
  border-color: var(--c);
  color: #fff;
  --wcag-y-threshold: 0.17913;
  --y: max(0, sign(var(--wcag-y-threshold) - y));
  color: color(from var(--c) xyz-d65 calc(var(--y) * 0.9505) var(--y) calc(var(--y) * 1.089));
  color: contrast-color(var(--c));
}
.line-chip.on::before { background: currentColor; opacity: 0.8; }

/* Stops Directory */
.stops-filter-input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.stops-directory { display: grid; gap: 10px; }
.area-group h3 {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 5px;
}
.area-list { display: grid; gap: 5px; }
.stop-dir-btn {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 7px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
}
.stop-dir-btn:hover { background: var(--soft); border-color: var(--accent); }
.stop-dir-num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.stop-dir-info { min-width: 0; flex: 1; }
.stop-dir-name { font-weight: 600; font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-dir-badges { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.stop-dir-badges .badge { font-size: 10px; padding: 0 4px; min-width: 20px; }

/* ---------- Bottom-right Map Controls ---------- */
.hud-bottom-right {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 600;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.map-switcher {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 2px solid #fff;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  width: 60px;
}
.map-thumb {
  width: 50px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line);
  display: block;
  background: linear-gradient(135deg, #dceefb 0%, #f1f6fa 52%, #d4e4ef 100%);
  position: relative;
  overflow: hidden;
}
.map-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(65deg, transparent 42%, #2f7f8f 42%, #2f7f8f 48%, transparent 48%),
    linear-gradient(-25deg, transparent 58%, #e2483d 58%, #e2483d 63%, transparent 63%);
  opacity: 0.75;
}
.map-thumb.osm-preview {
  background: linear-gradient(135deg, #d8ecd0 0%, #f5efe0 55%, #c5ddf0 100%);
}
.map-switcher-label { font-size: 10px; font-weight: 700; color: var(--ink); line-height: 1.15; text-align: center; }

.map-ctrl-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
}
.zoom-stack {
  display: flex;
  flex-direction: column;
  border-radius: 9px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
.zoom-stack .map-ctrl-btn { border: 0; border-radius: 0; box-shadow: none; }
.zoom-stack .map-ctrl-btn:first-child { border-bottom: 1px solid var(--line); }

/* ---------- Map Markers (Geomark Transit Style) ---------- */
.bus-pin-wrap { position: relative; width: 28px; height: 34px; display: flex; flex-direction: column; align-items: center; }
.bus-pin {
  width: 26px;
  height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: #ffffff;
  border: 2px solid #222b33;
  box-shadow: 0 2px 6px rgba(15, 30, 45, 0.28);
  display: grid;
  place-items: center;
  transition: transform 0.14s ease;
}
.bus-pin span { transform: rotate(45deg); font-size: 11px; font-weight: 800; color: #162430; line-height: 1; }
.bus-pin-wrap:hover .bus-pin { transform: rotate(-45deg) scale(1.18); border-color: var(--accent); }
.bus-pin.resort { background: #0e607c; border-color: #ffffff; box-shadow: 0 0 0 1.5px #0e607c, 0 3px 8px rgba(14, 96, 124, 0.35); }
.bus-pin.resort span { color: #ffffff; }
.bus-pin.near-stop { background: #162430; border-color: #ffffff; box-shadow: 0 0 0 1.5px #162430, 0 3px 8px rgba(15, 30, 45, 0.35); }
.bus-pin.near-stop span { color: #ffffff; }
.bus-pin.trip-stop { background: #e03131; border-color: #ffffff; box-shadow: 0 0 0 2px #e03131, 0 3px 9px rgba(224, 49, 49, 0.4); }
.bus-pin.trip-stop span { color: #ffffff; }
.bus-pin.dim-stop { opacity: 0.55; }

.stop-track-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #222b33;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.pin-me {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1a73e8;
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.25), 0 2px 6px rgba(0, 0, 0, 0.3);
}

.stop-map-label { pointer-events: none; white-space: nowrap; }
.stop-map-label .sml-box {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}
.stop-map-label.align-left .sml-box { align-items: flex-end; text-align: right; }
.stop-map-label .sml-name {
  display: block;
  font-size: 11.5px;
  font-weight: 800;
  color: #15242f;
  text-shadow: -1.5px -1.5px 0 #fff, 1.5px -1.5px 0 #fff, -1.5px 1.5px 0 #fff, 1.5px 1.5px 0 #fff, 0 0 5px #fff;
  line-height: 1.18;
}
.stop-map-label .sml-sub {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  color: #465866;
  text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 0 0 4px #fff;
  line-height: 1.15;
  margin-top: 1px;
}
.stop-map-label .sml-badges { display: flex; flex-wrap: nowrap; gap: 2px; margin-top: 2px; }
.stop-map-label .sml-b {
  font-size: 9px;
  font-weight: 800;
  background-color: var(--badge-bg, #0e607c);
  color: #fff;
  --wcag-y-threshold: 0.17913;
  --y: max(0, sign(var(--wcag-y-threshold) - y));
  color: color(from var(--badge-bg, #0e607c) xyz-d65 calc(var(--y) * 0.9505) var(--y) calc(var(--y) * 1.089));
  color: contrast-color(var(--badge-bg, #0e607c));
  padding: 0 4px;
  border-radius: 3px;
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.route-line-tag {
  pointer-events: auto;
  cursor: pointer;
}
.route-line-tag span {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background-color: var(--badge-bg, #0e607c);
  color: #fff;
  --wcag-y-threshold: 0.17913;
  --y: max(0, sign(var(--wcag-y-threshold) - y));
  color: color(from var(--badge-bg, #0e607c) xyz-d65 calc(var(--y) * 0.9505) var(--y) calc(var(--y) * 1.089));
  color: contrast-color(var(--badge-bg, #0e607c));
  border: 1.5px solid #ffffff;
  box-shadow: 0 1px 4px rgba(15, 30, 45, 0.3);
  line-height: 1.3;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.resort-map-label { pointer-events: none; text-align: center; white-space: nowrap; }
.resort-map-label .rml-title {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0b5375;
  background: linear-gradient(180deg, rgba(224, 242, 254, 0.92), rgba(255, 255, 255, 0.92));
  border: 1.5px solid rgba(14, 96, 124, 0.32);
  padding: 3px 10px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(14, 96, 124, 0.16);
  transform: translate(-50%, -50%);
}
.resort-map-label .rml-sub {
  font-size: 9.5px;
  font-weight: 700;
  color: #36647c;
  letter-spacing: 0;
  text-transform: none;
}

/* ---------- Native Dialogs (<dialog>) ---------- */
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(15, 28, 40, 0.54);
  backdrop-filter: blur(3px);
}
#stopModal, #previewModal, #guideModal {
  border: 0;
  padding: 0;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(10, 24, 38, 0.34);
  background: #fff;
  color: var(--ink);
  overflow: hidden;
}
#stopModal { width: min(860px, calc(100vw - 20px)); max-height: min(88dvh, 760px); }
#previewModal { width: min(460px, calc(100vw - 20px)); max-height: min(92dvh, 840px); }
#guideModal { width: min(920px, calc(100vw - 20px)); max-height: min(92dvh, 820px); }
#stopModal[open], #previewModal[open], #guideModal[open] {
  display: flex;
  flex-direction: column;
}
.modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--mint);
  border-bottom: 1px solid #bcebe0;
  flex: none;
}
.preview-title { font-size: 14.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-topbar-right { display: flex; align-items: center; gap: 6px; flex: none; }
.modal-lang {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(14, 96, 124, 0.2);
  border-radius: 999px;
  padding: 2px;
  flex: none;
}
.modal-lang button {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.modal-lang button.on { background: var(--accent); color: #fff; }
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.modal-body {
  padding: 16px 18px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-body > * { flex: none; }

.modal-stop-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.modal-stop-title-wrap { display: flex; align-items: flex-start; gap: 10px; }
.modal-stop-num {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.modal-stop-head h2 { font-size: 19px; line-height: 1.25; }
.modal-stop-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.modal-line-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.modal-line-tab {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.modal-line-tab.on { background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); color: #fff; }

/* Responsive Timetable Table */
.svc-block { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.svc-block-head {
  padding: 9px 12px;
  background: #f7fafc;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.svc-block-title { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13.5px; }
.svc-block-meta { font-size: 11.5px; color: var(--muted); }
.table-wrapper { overflow: auto; max-inline-size: 100%; max-block-size: min(340px, 48vh); container-type: inline-size; }
.tt-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tt-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.tt-table thead { position: sticky; inset-block-start: 0; z-index: 2; }
.tt-table th, .tt-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid #edf2f6; text-align: center; white-space: nowrap; }
.tt-table thead th { background: #fef8e4; font-weight: 700; font-size: 12px; }
.tt-table thead th.cur-stop { background: #d7eef8; color: #0b4c66; }
.tt-table tbody th { position: sticky; inset-inline-start: 0; z-index: 1; background: #f8fafc; font-weight: 700; color: var(--muted); font-size: 11.5px; }
.tt-table tbody tr { cursor: pointer; }
.tt-table tbody tr:hover td { background: #f2f8fb; }
.tt-table tbody td.cur-stop { background: #ebf7fc; font-weight: 700; color: #0b4c66; }
.svc-block-note { padding: 8px 12px; font-size: 12px; color: var(--muted); background: #fafcfd; border-top: 1px solid #edf2f6; }

/* Preview Image Modal */
.preview-body {
  padding: 14px 16px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.preview-body > * { flex: none; }
.preview-img-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  background: #edf3f7;
  border-radius: 12px;
  padding: 10px;
}
#previewImg {
  display: block;
  max-width: 100%;
  max-height: 60dvh;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(15, 32, 48, 0.2);
}
.preview-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

/* Accommodation Manager All-Resorts Guide Modal */
.guide-body {
  padding: 16px 18px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.guide-body > * { flex: none; }
.guide-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.guide-prop-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.guide-prop-input {
  height: 36px;
  padding: 0 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  min-width: 210px;
}
.guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.guide-card {
  border: 1px solid var(--line);
  border-top: 4px solid var(--c, var(--accent));
  border-radius: 11px;
  padding: 11px 12px;
  background: #fbfdff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.guide-card h3 {
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.guide-stop-line { font-size: 12.5px; color: var(--muted); }
.guide-times-row {
  font-size: 12.5px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.guide-times-row strong {
  display: inline-block;
  font-size: 11px;
  color: var(--muted);
  margin-right: 4px;
}
.guide-promo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #162430;
  color: #fff;
  font-size: 13px;
}
.guide-promo a {
  color: #7ee8d4;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.guide-poster-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: #edf3f7;
  border-radius: 12px;
  padding: 12px;
}
.guide-poster-wrap img {
  max-width: 100%;
  max-height: 58dvh;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(15, 32, 48, 0.2);
}

/* ---------- Mobile Responsive Layout (<= 768px) ---------- */
@media (max-width: 768px) {
  .search-shell {
    position: static;
    width: auto;
    max-width: none;
    max-height: none;
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }
  .search-shell.collapsed .results-sheet { display: flex; }
  .collapse-btn { display: none; }

  /* Prominent Top Search Bar fixed at top */
  .search-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 630;
    padding: max(8px, env(safe-area-inset-top)) 10px 8px;
    gap: 7px;
    border-radius: 0 0 16px 16px;
    box-shadow: var(--shadow-sm);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
  }
  .brand-left h1 { font-size: 14px; }
  .season-badge { display: none; }
  .combo input {
    height: 44px;
    font-size: 16px; /* prevents iOS Safari auto-zoom */
  }
  .btn { height: 44px; }
  .btn.icon-only { width: 44px; }
  input[type=date], input[type=time] { height: 42px; font-size: 16px; }

  /* Single-row horizontal scrollable resort pills */
  .resorts {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 1px;
  }
  .resorts::-webkit-scrollbar { display: none; }
  .resorts button { padding: 6px 12px; font-size: 12.5px; min-height: 34px; flex: none; }

  .mobile-quick-tools { display: inline-flex; }
  .dock { display: none; }

  /* Active filter pill below top bar */
  .map-status-bar {
    top: 178px;
    left: 10px;
  }
  .route-legend {
    display: none;
  }

  /* Bottom-right map controls sit neatly above the bottom sheet */
  .hud-bottom-right {
    right: 10px;
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 70px));
    gap: 6px;
  }
  .map-switcher { width: 54px; }
  .map-thumb { width: 44px; height: 30px; }

  /* Mobile Collapsible Bottom Sheet */
  .results-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 625;
    background: #fff;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 26px rgba(15, 32, 48, 0.2);
    max-height: 74dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sheet-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 8px 14px 10px;
    border: 0;
    background: #fff;
    border-radius: 18px 18px 0 0;
    cursor: pointer;
    text-align: left;
  }
  .handle-bar {
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: #cbd5df;
  }
  .sheet-summary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
  }
  .results-sheet:not(.expanded) .sheet-scroll {
    display: none;
  }
  .results-sheet.expanded .sheet-handle {
    border-bottom: 1px solid var(--line);
  }

  /* Floating Filter & Stops panels become bottom sheets on mobile */
  .float-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: 76dvh;
    border-radius: 18px 18px 0 0;
    z-index: 660;
  }

  .dep { min-height: 40px; padding: 6px 10px 6px 7px; font-size: 14.5px; }
}
