:root {
  --ink: #17201e;
  --muted: #68716d;
  --paper: #f3f1ea;
  --panel: #fffdf8;
  --line: #dedbd2;
  --soft-line: #ebe8e0;
  --green: #0f6b5b;
  --green-dark: #084b40;
  --green-soft: #dceddf;
  --coral: #e26850;
  --blue: #2b6f8e;
  --shadow: 0 18px 60px rgba(24, 38, 34, 0.11);
  color-scheme: light;
  font-family: Inter, "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
}

button, input, select { font: inherit; }
button { color: inherit; }

.app-shell { height: 100%; display: flex; flex-direction: column; }

.topbar {
  height: 68px;
  flex: 0 0 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.95);
  backdrop-filter: blur(18px);
  z-index: 1000;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 17px; letter-spacing: 0.01em; }
.brand small { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; }

.brand-mark {
  width: 38px;
  height: 38px;
  position: relative;
  border-radius: 11px;
  background: var(--green);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.12);
}
.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  top: 9px;
  width: 7px;
  height: 8px;
  border-radius: 2px 2px 1px 1px;
  background: #e8f6ec;
}
.brand-mark::before { left: 9px; }
.brand-mark::after { right: 9px; }
.brand-mark span:first-child {
  position: absolute; left: 8px; right: 8px; bottom: 9px; height: 3px; border-radius: 2px; background: #e8f6ec;
}
.brand-mark span:last-child::before, .brand-mark span:last-child::after {
  content: ""; position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: #f5c84c;
}
.brand-mark span:last-child::before { left: 8px; }
.brand-mark span:last-child::after { right: 8px; }

.top-actions { display: flex; align-items: center; gap: 18px; }
.nav-action { position: relative; display: flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.nav-action:hover { border-color: var(--line); background: white; color: var(--green); }
.nav-action span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: var(--green-soft); color: var(--green); font-size: 10px; font-weight: 900; }
.nav-action b { font-size: 11px; font-weight: 700; }
.nav-action i { position: absolute; right: 4px; top: 3px; width: 7px; height: 7px; border: 2px solid var(--panel); border-radius: 50%; background: var(--coral); }
.network-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.network-status > span:first-child { width: 7px; height: 7px; border-radius: 50%; background: #35a875; box-shadow: 0 0 0 4px rgba(53,168,117,.12); }
.network-status.offline > span:first-child { background: var(--coral); }

.language-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.language-control select { border: 1px solid var(--line); border-radius: 8px; background: white; padding: 6px 28px 6px 9px; color: var(--ink); }

.workspace {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 350px minmax(420px, 1fr) 420px;
  background: var(--paper);
}

.planner-panel, .itinerary-panel {
  min-width: 0;
  background: var(--panel);
  position: relative;
  z-index: 500;
}
.planner-panel { border-right: 1px solid var(--line); padding: 24px 22px 32px; }
.itinerary-panel { border-left: 1px solid var(--line); }
.panel-scroll { overflow-y: auto; overscroll-behavior: contain; }

.eyebrow, .section-label {
  color: var(--green);
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .14em;
}
.planner-heading h1 { margin: 7px 0 22px; font-family: Georgia, "Yu Mincho", serif; font-size: 28px; font-weight: 600; letter-spacing: -.02em; }

.search-stack { position: relative; padding-left: 24px; }
.search-field { position: relative; margin-bottom: 14px; }
.search-field label { display: block; margin: 0 0 6px 1px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.endpoint-rail { position: absolute; left: 5px; top: 33px; bottom: 33px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.endpoint-rail b { flex: 1; width: 1px; margin: 4px 0; background: repeating-linear-gradient(to bottom, var(--green) 0 3px, transparent 3px 7px); }
.endpoint-rail i { width: 11px; height: 11px; border: 2px solid var(--green); border-radius: 50%; background: white; }
.endpoint-rail i:last-child { border-radius: 2px; background: var(--green); }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-icon { position: absolute; left: 12px; color: var(--green); font-size: 11px; font-weight: 800; z-index: 1; }
.input-wrap input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 0 38px 0 36px;
  color: var(--ink);
  outline: none;
  transition: border .16s, box-shadow .16s;
}
.input-wrap input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(15,107,91,.1); }
.input-wrap input::placeholder { color: #9ba19f; }
.clear-search { position: absolute; right: 8px; width: 28px; height: 28px; border: 0; background: transparent; color: #a5aaa8; cursor: pointer; font-size: 18px; }
.clear-search:hover { color: var(--ink); }
.current-location-button {
  position: absolute;
  right: 36px;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 0;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green);
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}
.current-location-button:hover:not(:disabled) { background: var(--green); color: white; }
.current-location-button:disabled { cursor: wait; opacity: .7; }
.current-location-button span { font-size: 13px; }
.search-field[data-search="origin"] .input-wrap input { padding-right: 142px; }

.swap-button { position: absolute; z-index: 4; right: 11px; top: 76px; width: 29px; height: 29px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--green); cursor: pointer; box-shadow: 0 3px 12px rgba(0,0,0,.08); }
.swap-button:hover { transform: rotate(180deg); transition: transform .25s; }

.search-results {
  position: absolute;
  z-index: 1200;
  top: 73px;
  left: 0;
  right: 0;
  max-height: 290px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: var(--shadow);
}
.result-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--soft-line); background: white; }
.result-row:last-child { border-bottom: 0; }
.result-item { flex: 1; min-width: 0; display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 8px; padding: 10px 12px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.result-item:hover { background: #f0f7f3; }
.result-star { flex: 0 0 auto; width: 38px; border: 0; background: transparent; color: #b9a23a; cursor: pointer; font-size: 16px; line-height: 1; }
.result-star:hover { color: #9c861f; }
.result-star.active { color: #e0a92a; }
.result-section { padding: 9px 12px 4px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.result-symbol { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); font-weight: 800; font-size: 11px; }
.result-item strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.result-item small { display: block; margin-top: 3px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.result-empty { padding: 18px; color: var(--muted); text-align: center; font-size: 12px; }

.form-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--soft-line); }
.section-label-row { display: flex; align-items: center; justify-content: space-between; }
.date-input { width: 100%; height: 44px; margin-top: 10px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); }
.route-api-options { display: grid; gap: 9px; margin-top: 10px; }
.route-api-options label { display: grid; grid-template-columns: minmax(0, 1fr) minmax(135px, 1.15fr); align-items: center; gap: 10px; color: var(--muted); font-size: 10px; font-weight: 700; }
.route-api-options select { width: 100%; height: 36px; padding: 0 28px 0 9px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); font-size: 10px; }

.segmented { display: grid; gap: 3px; margin-top: 9px; padding: 3px; border-radius: 10px; background: #eae8e1; }
.segmented-four { grid-template-columns: repeat(4, 1fr); }
.segmented button { min-width: 0; border: 0; border-radius: 7px; padding: 8px 3px; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 700; }
.segmented button.active { background: white; color: var(--green); box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.text-button { padding: 0; border: 0; background: none; color: var(--green); font-size: 11px; font-weight: 700; cursor: pointer; }
.preset-row { display: flex; gap: 7px; margin: 10px 0; }
.preset-row button { border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; background: white; color: var(--muted); font-size: 10px; cursor: pointer; }
.preset-row button:hover { border-color: var(--green); color: var(--green); }

.transport-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.transport-grid label { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 6px 8px; border: 1px solid var(--soft-line); border-radius: 8px; background: white; cursor: pointer; font-size: 11px; }
.transport-grid label:has(input:not(:checked)) { opacity: .48; background: #f1efe9; }
.transport-grid input { position: absolute; opacity: 0; pointer-events: none; }
.mode-icon { width: 23px; height: 23px; flex: 0 0 23px; display: grid; place-items: center; border-radius: 6px; background: #e9efed; color: #3c625a; font-size: 10px; font-weight: 800; }
.mode-icon.shinkansen { background: #dceaf3; color: var(--blue); }
.mode-icon.express { background: #f8e5da; color: #a34e35; }
.mode-icon.train { background: #e1eee5; color: var(--green); }

.primary-button { width: 100%; height: 49px; display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 22px; border: 0; border-radius: 12px; background: var(--green); color: white; cursor: pointer; font-weight: 800; box-shadow: 0 9px 24px rgba(15,107,91,.22); transition: transform .15s, background .15s; }
.primary-button:hover:not(:disabled) { background: var(--green-dark); transform: translateY(-1px); }
.primary-button:disabled { background: #a9b3b0; box-shadow: none; cursor: not-allowed; }
.primary-button b { font-size: 18px; }

.route-results { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--soft-line); }
.results-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.results-heading > span:last-child { color: var(--muted); font-size: 10px; }
.route-card { width: 100%; margin-bottom: 8px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: white; text-align: left; cursor: pointer; transition: border .15s, transform .15s, box-shadow .15s; }
.route-card:hover { transform: translateY(-1px); box-shadow: 0 7px 22px rgba(0,0,0,.07); }
.route-card.active { border-color: var(--green); box-shadow: 0 0 0 2px rgba(15,107,91,.09); }
.route-card-top { display: flex; align-items: baseline; justify-content: space-between; }
.route-card-time { font-family: Georgia, serif; font-size: 17px; font-weight: 700; }
.route-card-fare { color: var(--green); font-size: 12px; font-weight: 800; }
.route-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 10px; }
.route-card-meta i { width: 3px; height: 3px; border-radius: 50%; background: #b6bbb9; }
.route-icons { display: flex; gap: 3px; margin-top: 9px; }
.route-icons span { min-width: 22px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 5px; background: #edf0ee; color: #52605c; font-size: 9px; font-weight: 800; }

.map-panel { min-width: 0; position: relative; overflow: hidden; background: #dfe6df; }
#map { position: absolute; inset: 0; z-index: 1; }
.map-placeholder { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; pointer-events: none; background: radial-gradient(circle at 45% 45%, rgba(255,255,255,.74), transparent 30%), linear-gradient(135deg, #e5ebe3, #d8e1da); }
.map-placeholder::before, .map-placeholder::after { content: ""; position: absolute; width: 120%; height: 1px; background: rgba(80,113,100,.14); transform: rotate(-28deg); }
.map-placeholder::after { transform: rotate(33deg); }
.map-placeholder-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: white; font-family: serif; font-size: 24px; box-shadow: 0 12px 30px rgba(15,107,91,.23); z-index: 1; }
.map-placeholder strong, .map-placeholder span { z-index: 1; }
.map-placeholder strong { margin-top: 7px; font-family: Georgia, serif; font-size: 20px; }
.map-placeholder span { max-width: 260px; color: var(--muted); font-size: 12px; }
.map-legend { position: absolute; z-index: 450; left: 16px; bottom: 16px; display: flex; gap: 14px; padding: 8px 11px; border: 1px solid rgba(0,0,0,.08); border-radius: 9px; background: rgba(255,253,248,.92); box-shadow: 0 5px 16px rgba(0,0,0,.09); backdrop-filter: blur(12px); }
.map-legend span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.map-legend i { display: block; width: 22px; height: 4px; border-radius: 4px; }
.map-legend b { font-weight: 600; }
.legend-selected { background: var(--green); }
.legend-alternative { background: #8c9994; opacity: .6; }
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 5px 18px rgba(0,0,0,.13) !important; }
.leaflet-control-zoom a { color: var(--green) !important; border-color: var(--soft-line) !important; }
.station-marker { width: 13px; height: 13px; border: 3px solid white; border-radius: 50%; background: var(--green); box-shadow: 0 1px 7px rgba(0,0,0,.35); }
.station-marker.terminal { width: 17px; height: 17px; border-radius: 4px; background: var(--coral); }

.itinerary-empty { min-height: 100%; padding: 48px 34px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-icon { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 18px; background: var(--green-soft); color: var(--green); font-family: serif; font-size: 25px; }
.itinerary-empty h2 { margin: 18px 0 7px; font-family: Georgia, serif; font-size: 23px; }
.itinerary-empty p { max-width: 290px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.itinerary-header { padding: 26px 26px 21px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fffdf8, #f9f7f1); }
.itinerary-header h2 { margin: 7px 0 3px; font-family: Georgia, "Yu Mincho", serif; font-size: 23px; }
.itinerary-header p { margin: 0; color: var(--muted); font-size: 11px; }
.itinerary-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 16px; }
.metric { padding: 9px; border: 1px solid var(--soft-line); border-radius: 9px; background: white; }
.metric small { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.metric strong { display: block; margin-top: 4px; font-size: 12px; }

.trip-start { margin-top: 16px; height: 44px; }
.trip-panel { margin: 16px; padding: 18px; border: 1px solid var(--green); border-radius: 14px; background: var(--green-soft); box-shadow: 0 9px 24px rgba(15,107,91,.12); }
.trip-panel h2 { margin: 6px 0 8px; font-family: Georgia, "Yu Mincho", serif; font-size: 20px; color: var(--green-dark); }
.trip-status { margin: 0 0 14px; color: var(--ink); font-size: 13px; font-weight: 600; min-height: 1.2em; }

.timeline { padding: 22px 24px 40px; }
.timeline-point, .timeline-move { position: relative; margin-left: 17px; padding-left: 27px; }
.timeline-point { padding-bottom: 14px; }
.timeline-move { padding-bottom: 18px; border-left: 2px solid var(--line); }
.timeline-point::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border: 2px solid white; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px var(--green); z-index: 2; }
.timeline-point.terminal::before { border-radius: 2px; background: var(--coral); box-shadow: 0 0 0 2px var(--coral); }
.point-time { color: var(--green); font-size: 11px; font-weight: 800; }
.point-name { margin-top: 2px; font-size: 14px; font-weight: 800; }
.point-meta { margin-top: 3px; color: var(--muted); font-size: 10px; }
.timeline-point.direct-through { padding-top: 7px; padding-bottom: 17px; }
.timeline-point.direct-through::before { border-color: var(--blue); background: white; box-shadow: 0 0 0 2px var(--blue); }
.direct-train-label { color: var(--blue); font-size: 11px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.direct-train-instruction { margin-top: 5px; color: var(--blue); font-size: 11px; }
.direct-through .point-name { margin-top: 8px; }
.direct-train-popup { margin-top: 5px; padding-top: 5px; border-top: 1px dashed var(--line); color: var(--blue); }
.move-card { position: relative; top: 0; margin: 0 0 0 10px; padding: 11px 12px; border: 1px solid var(--soft-line); border-radius: 10px; background: #fff; cursor: pointer; transition: border .15s, box-shadow .15s; }
.move-card:hover, .move-card.focused { border-color: var(--green); box-shadow: 0 5px 18px rgba(0,0,0,.06); }
.move-heading { display: flex; align-items: center; gap: 8px; }
.line-swatch { width: 5px; height: 28px; flex: 0 0 5px; border-radius: 4px; background: var(--green); }
.move-heading-main { min-width: 0; flex: 1; }
.move-heading strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.move-heading small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.move-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; color: var(--muted); font-size: 10px; }
.move-stats span { display: inline-flex; align-items: center; gap: 3px; }
.stops-button { margin-top: 9px; padding: 5px 8px; border: 0; border-radius: 6px; background: var(--green-soft); color: var(--green); cursor: pointer; font-size: 9px; font-weight: 800; }
.stops-list { margin-top: 9px; padding: 8px 9px; border-radius: 7px; background: #f4f5f1; }
.stop-row { display: grid; grid-template-columns: 45px 8px minmax(0,1fr); align-items: center; gap: 6px; padding: 3px 0; color: var(--muted); font-size: 10px; }
.stop-row i { width: 5px; height: 5px; border-radius: 50%; background: #9ca8a3; }
.stop-row.active { color: var(--ink); font-weight: 800; }
.stop-row.active i { background: var(--green); }

.loading-overlay { position: fixed; inset: 68px 0 0; z-index: 3000; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(243,241,234,.78); backdrop-filter: blur(5px); }
.loading-overlay[hidden] { display: none; }
.loading-overlay p { margin-top: 14px; color: var(--green-dark); font-size: 12px; font-weight: 700; }
.train-loader { width: 62px; height: 42px; position: relative; border-radius: 12px 12px 8px 8px; background: var(--green); box-shadow: inset 0 -7px 0 rgba(0,0,0,.13); animation: train-bob .7s ease-in-out infinite alternate; }
.train-loader::before, .train-loader::after { content: ""; position: absolute; top: 9px; width: 17px; height: 12px; border-radius: 3px; background: #d9f0e5; }
.train-loader::before { left: 9px; }.train-loader::after { right: 9px; }
.train-loader span:nth-child(1), .train-loader span:nth-child(2) { position: absolute; bottom: -4px; width: 10px; height: 10px; border-radius: 50%; background: #1d2b27; }
.train-loader span:nth-child(1) { left: 9px; }.train-loader span:nth-child(2) { right: 9px; }
.train-loader span:nth-child(3) { position: absolute; left: -80px; right: -80px; bottom: -10px; border-bottom: 2px solid #71827c; }
@keyframes train-bob { from { transform: translateY(-2px); } to { transform: translateY(2px); } }

.toast { position: fixed; z-index: 4000; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: 460px; padding: 11px 16px; border-radius: 10px; background: #1f2a27; color: white; box-shadow: var(--shadow); font-size: 12px; }
.toast.error { background: #8f392d; }

.drawer-backdrop { position: fixed; inset: 68px 0 0; z-index: 3200; background: rgba(17,29,25,.25); backdrop-filter: blur(2px); }
.insights-drawer { position: fixed; z-index: 3300; top: 68px; right: 0; bottom: 0; width: min(520px, 92vw); display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--panel); box-shadow: -20px 0 60px rgba(20,35,30,.16); transform: translateX(102%); transition: transform .24s ease; }
.insights-drawer.open { transform: translateX(0); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 26px 17px; }
.drawer-header h2 { margin: 7px 0 0; font-family: Georgia, "Yu Mincho", serif; font-size: 27px; }
.drawer-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--muted); cursor: pointer; font-size: 21px; }
.drawer-close:hover { border-color: var(--green); color: var(--green); }
.drawer-panel { min-height: 0; flex: 1; overflow-y: auto; padding: 20px 26px 35px; }
.drawer-intro { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.drawer-loading, .drawer-empty { padding: 42px 20px; color: var(--muted); text-align: center; font-size: 12px; }
.secondary-button { width: 100%; height: 42px; border: 1px solid var(--green); border-radius: 10px; background: var(--green-soft); color: var(--green); cursor: pointer; font-weight: 800; }
.secondary-button:hover { background: var(--green); color: white; }
.alert-list { display: grid; gap: 12px; margin-top: 15px; }
.alert-location { border: 1px solid var(--soft-line); border-radius: 12px; background: white; }
.alert-location h3 { margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--soft-line); font-size: 13px; }
.alert-clear { display: flex; align-items: center; gap: 9px; padding: 17px 14px; color: var(--green); font-size: 11px; }
.alert-clear span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); font-weight: 900; }
.alert-item { margin: 10px; padding: 11px; border-left: 4px solid var(--coral); border-radius: 7px; background: #fff3ef; font-size: 10px; line-height: 1.5; }

.results-heading-right { display: flex; align-items: center; gap: 8px; }

/* Visible keyboard focus for custom controls (mouse clicks stay ring-free). */
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }
.route-card:focus-visible, .move-card:focus-visible, .result-item:focus-visible, .nav-action:focus-visible, .segmented button:focus-visible, .preset-row button:focus-visible, .swap-button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

[hidden] { display: none !important; }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 330px minmax(360px, 1fr) 365px; }
}

@media (max-width: 960px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100%; }
  .workspace { display: grid; grid-template-columns: 350px 1fr; grid-template-rows: 58vh auto; }
  .planner-panel { grid-row: 1 / 3; }
  .map-panel { grid-column: 2; min-height: 58vh; }
  .itinerary-panel { grid-column: 2; min-height: 500px; border-left: 1px solid var(--line); }
  .panel-scroll { overflow: visible; }
}

/* Mobile bottom tabs navigation styling */
.mobile-tabs {
  display: none;
}

@media (max-width: 720px) {
  .topbar { padding: 0 13px; }
  .network-status { display: none; }
  .nav-action b { display: none; }

  .mobile-tabs {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(1.8);
    -webkit-backdrop-filter: blur(20px) saturate(1.8);
    border-top: 1px solid var(--line);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 6px 0;
    gap: 4px;
    color: var(--muted);
    cursor: pointer;
    position: relative;
    flex: 1;
    font-size: 11px;
    font-weight: 550;
    transition: color 0.2s ease;
  }

  .tab-item svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
  }

  .tab-item.active {
    color: var(--green);
  }

  .tab-item.active svg {
    transform: scale(1.1);
  }

  .tab-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 28px;
    height: 3px;
    background: var(--green);
    border-radius: 0 0 2px 2px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .tab-item.active::before {
    transform: translateX(-50%) scaleX(1);
  }

  /* Pulse badge for trip active */
  .trip-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 16px);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--green);
  }

  .trip-badge::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 50%;
    background-color: inherit;
    opacity: 0.8;
    animation: tabPulse 1.6s infinite ease-in-out;
  }

  @keyframes tabPulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.5); opacity: 0; }
  }

  .app-shell {
    padding-bottom: 64px;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
  }

  /* Toggling visible panel */
  .workspace {
    display: block;
    height: calc(100vh - var(--toolbar-height, 68px) - 64px);
    overflow: hidden;
  }

  .workspace:not([data-active-tab="plan"]) .planner-panel {
    display: none !important;
  }
  .workspace:not([data-active-tab="map"]) .map-panel {
    display: none !important;
  }
  .workspace:not([data-active-tab="trip"]) .itinerary-panel {
    display: none !important;
  }

  .planner-panel, .map-panel, .itinerary-panel {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    border: none !important;
    margin: 0 !important;
    box-sizing: border-box;
  }

  .planner-panel {
    padding: 16px 16px 30px !important;
    overflow-y: auto !important;
  }

  .itinerary-panel {
    padding: 16px 16px 30px !important;
    overflow-y: auto !important;
  }

  .map-panel {
    display: flex;
    flex-direction: column;
    position: relative;
  }

  .map-panel #map {
    flex: 1;
    height: 100% !important;
    width: 100% !important;
  }
}

@media (prefers-color-scheme: dark) and (max-width: 720px) {
  .mobile-tabs {
    background: rgba(41, 41, 44, 0.85);
    border-top-color: var(--line);
  }
}

/* Input search loading spinner */
.input-wrap.loading::after {
  content: "";
  position: absolute;
  right: 42px;
  top: calc(50% - 8px);
  width: 16px;
  height: 16px;
  border: 2px solid var(--soft-line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  z-index: 5;
}

.search-field[data-search="origin"] .input-wrap.loading::after {
  right: 148px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Real-time native geolocation pulsing marker */
.user-location-pulse {
  width: 16px;
  height: 16px;
  background: var(--blue, #2b6f8e);
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(43, 111, 142, 0.6);
  position: relative;
}

.user-location-pulse::after {
  content: "";
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border-radius: 50%;
  background: rgba(43, 111, 142, 0.24);
  animation: userLocationPulse 2s infinite ease-out;
}

@keyframes userLocationPulse {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* Active Trip Timeline Progress States */
.timeline-point.completed,
.timeline-move.completed {
  opacity: 0.55;
  transition: opacity 0.3s ease;
}

.timeline-point.completed .point-name {
  text-decoration: line-through;
  color: var(--muted);
}

.timeline-point.completed::before {
  background: var(--muted) !important;
  box-shadow: 0 0 0 2px var(--muted) !important;
}

.timeline-point.current::before {
  background: var(--coral) !important;
  box-shadow: 0 0 0 2px var(--coral) !important;
  animation: pointPulse 1.8s infinite ease-in-out;
}

@keyframes pointPulse {
  0% { box-shadow: 0 0 0 2px var(--coral); }
  50% { box-shadow: 0 0 0 6px rgba(226, 104, 80, 0.4); }
  100% { box-shadow: 0 0 0 2px var(--coral); }
}

.timeline-point.current .point-name {
  color: var(--coral);
  font-weight: 900;
}

.timeline-move.current {
  border-left-color: var(--coral) !important;
}

.timeline-move.current .move-card {
  border-color: var(--coral);
  box-shadow: 0 4px 12px rgba(226, 104, 80, 0.1);
}

.timeline-move.completed {
  border-left-color: var(--muted) !important;
}

/* Prevent window bounce scrolling on PWA app shell */
html, body, .app-shell {
  overscroll-behavior-y: none;
  overscroll-behavior-x: none;
}

/* Smooth Inertia Momentum scrolling for touch panels */
.panel-scroll,
.search-results,
.drawer-panel,
.stops-list {
  -webkit-overflow-scrolling: touch;
}

/* Springy native-like tactile active tap feedback */
.route-card,
.result-item,
.stops-button,
.segmented button,
.nav-action,
.swap-button,
.current-location-button,
.primary-button,
.secondary-button {
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s, opacity 0.15s;
}

.route-card:active,
.result-item:active,
.segmented button:active,
.nav-action:active,
.swap-button:active,
.current-location-button:active,
.primary-button:active,
.secondary-button:active {
  transform: scale(0.97) !important;
  opacity: 0.82;
}

.stops-button:active {
  transform: scale(0.95) !important;
  opacity: 0.85;
}
