/* Travel Helper — mobile-first, high contrast. Tokens follow design/screens (Kite Transit). */
:root {
  --bg: #f8f9ff;
  --surface: #ffffff;
  --surface-low: #eff4ff;
  --surface-mid: #e5eeff;
  --surface-high: #dce9ff;
  --surface-highest: #d3e4fe;
  --text: #0b1c30;
  --text-muted: #45464d;
  --outline: #76777d;
  --outline-soft: #c6c6cd;
  --border: #e2e8f0;
  --ink: #0f172a;
  --on-ink: #ffffff;
  --ink-soft: #dae2fd;
  --blue: #0051d5;
  --blue-bright: #2563eb;
  --on-blue: #ffffff;
  --blue-soft: #dbe1ff;
  --error: #ba1a1a;
  --error-soft: #ffdad6;
  --on-error-soft: #93000a;
  --warn: #c2410c;
  --warn-soft: #ffedd5;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --info-soft: #e5eeff;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.12);
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --tap: 44px;
  --font: "Inter", "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --ja: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --header-h: 60px;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #131c2e;
    --surface-low: #111a2b;
    --surface-mid: #1a2640;
    --surface-high: #22304d;
    --surface-highest: #2a3a5c;
    --text: #eaf1ff;
    --text-muted: #b4bfd3;
    --outline: #8b93a6;
    --outline-soft: #3a4660;
    --border: #2a3650;
    --ink: #eaf1ff;
    --on-ink: #0b1220;
    --ink-soft: #334155;
    --blue: #7aa2ff;
    --blue-bright: #4f86ff;
    --on-blue: #06122e;
    --blue-soft: #1d2d57;
    --error: #ffb4ab;
    --error-soft: #5c1a16;
    --on-error-soft: #ffdad6;
    --warn: #fdba74;
    --warn-soft: #4a2610;
    --ok: #86efac;
    --ok-soft: #133d24;
    --info-soft: #1a2640;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  overscroll-behavior-y: none;
}
main { max-width: 560px; margin: 0 auto; }
[hidden] { display: none !important; }
a { color: var(--blue); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: var(--mono); font-weight: 600; letter-spacing: -0.01em; }
.ja { font-family: var(--ja); }
.muted { color: var(--text-muted); }
.small { font-size: 13px; line-height: 18px; }
.kicker { font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

/* Material Symbols; width is fixed so the ligature name never spills out if the font is missing. */
.ms {
  font-family: "Material Symbols Outlined";
  font-weight: normal; font-style: normal; font-size: 20px; line-height: 1;
  display: inline-block; width: 1em; height: 1em; overflow: hidden;
  white-space: nowrap; direction: ltr; flex-shrink: 0;
  font-feature-settings: "liga"; -webkit-font-feature-settings: "liga";
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  vertical-align: middle;
}
.ms.fill { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

/* ---------- Header / nav ---------- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 16px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 36px; height: 36px; border-radius: 0.5rem; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-kicker { font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--blue); }
.brand-text h1 { margin: 0; font-size: 20px; line-height: 26px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hotel-card-btn {
  min-height: var(--tap); padding: 0 14px; border-radius: 999px; border: 0;
  background: var(--ink); color: var(--on-ink); font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 900;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.05);
}
.bottom-nav button {
  flex: 1; max-width: 160px; height: var(--nav-h); border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.bottom-nav button .ms { font-size: 24px; }
.bottom-nav button[aria-current="page"] { color: var(--blue); }
.bottom-nav button[aria-current="page"] .ms { font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24; }

/* ---------- Buttons ---------- */
.btn {
  min-height: var(--tap); padding: 0 14px; border-radius: 0.5rem;
  border: 1.5px solid var(--outline-soft); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 600; font-size: 14px; text-decoration: none; line-height: 1.2; text-align: center;
}
.btn:active { background: var(--surface-low); }
.btn-dark { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn-blue { background: var(--blue); color: var(--on-blue); border-color: var(--blue); }
.btn-soft { background: var(--surface-high); border-color: transparent; color: var(--text); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--blue); }
.btn-big { min-height: 56px; font-size: 17px; font-weight: 700; border-radius: 0.75rem; width: 100%; }
.btn-sm { min-height: 44px; padding: 0 10px; font-size: 13px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 0; min-width: 0; }
.link-btn { background: none; border: 0; color: var(--blue); font-weight: 700; min-height: var(--tap); padding: 0 4px; }

/* ---------- Cards, banners, pills ---------- */
.pad { padding: 12px 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--surface); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); border: 1.5px solid var(--border); }
.card-soft { background: var(--surface-mid); border-radius: var(--radius-lg); padding: 16px; }
.card h2, .card-soft h2 { margin: 0 0 8px; font-size: 17px; line-height: 24px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.pill-ink { background: var(--ink); color: var(--on-ink); }
.pill-blue { background: var(--blue); color: var(--on-blue); }
.pill-soft { background: var(--surface-high); color: var(--blue); }
.pill-grey { background: var(--surface-mid); color: var(--text-muted); }
.pill-error { background: var(--error-soft); color: var(--on-error-soft); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.banner {
  margin: 8px 16px 0; padding: 10px 12px; border-radius: var(--radius);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface-high); color: var(--text); font-weight: 600; font-size: 14px;
}
.banner .grow { flex: 1; min-width: 60%; }
.banner .btn { min-height: 44px; }
.banner-warn { background: var(--warn-soft); color: var(--warn); }
.tz-notice { margin: 8px auto 0; max-width: 528px; }
.tz-notice .banner { margin: 0 16px; }

.w-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.w { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; line-height: 18px; font-weight: 600; padding: 6px 10px; border-radius: 0.5rem; }
.w .ms { font-size: 18px; }
.w-error { background: var(--error-soft); color: var(--on-error-soft); }
.w-warn { background: var(--warn-soft); color: var(--warn); }
.w-info { background: var(--info-soft); color: var(--text-muted); font-weight: 400; }

/* ---------- Day tabs ---------- */
.day-tabs {
  position: sticky; top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); z-index: 800;
  display: flex; gap: 8px; overflow-x: auto; padding: 6px 16px 10px;
  background: color-mix(in srgb, var(--bg) 95%, transparent); scrollbar-width: none;
}
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab {
  flex-shrink: 0; min-height: var(--tap); padding: 0 16px; border-radius: 999px; border: 0;
  background: var(--surface-mid); color: var(--text-muted);
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 6px; position: relative;
}
.day-tab[aria-selected="true"] { background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-lg); }
.day-tab .today-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue-bright); }
.day-tab .tag { font-size: 10px; opacity: 0.85; }
.day-tab .warn-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #dc2626; box-shadow: 0 0 0 2px var(--bg); }

/* ---------- Map ---------- */
.map-wrap { position: relative; height: 40vh; min-height: 220px; background: var(--surface-high); overflow: hidden; margin: 0 16px; border-radius: var(--radius-lg); }
.map-canvas { position: absolute; inset: 0; background: var(--surface-high); }
.map-wrap.tiles-failed .leaflet-tile-pane { display: none; }
.map-wrap.tiles-failed .map-canvas { background: repeating-linear-gradient(45deg, var(--surface-mid) 0 12px, var(--surface-high) 12px 24px); }
.map-missing { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--text-muted); font-weight: 600; }
.map-controls { position: absolute; top: 10px; right: 10px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.map-btn {
  min-width: var(--tap); height: var(--tap); border-radius: 0.5rem; border: 0; padding: 0 10px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-weight: 700;
}
.map-btn[aria-pressed="true"], .map-wrap.locating [data-action="map-locate"] { background: var(--blue); color: var(--on-blue); }
.map-caption {
  position: absolute; left: 8px; bottom: 22px; z-index: 450; pointer-events: none;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--text-muted);
}
.map-distance, .map-progress, .map-note {
  position: absolute; left: 8px; right: 64px; z-index: 460;
  padding: 8px 10px; border-radius: 0.5rem; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg);
}
.map-distance { top: 10px; background: var(--ink); color: var(--on-ink); }
.map-progress { top: 10px; background: var(--surface); color: var(--text); }
.map-distance:not([hidden]) ~ .map-progress { top: 56px; }
.map-note { bottom: 48px; background: var(--warn-soft); color: var(--warn); }
.map-strip { display: none; }
.map-wrap .only-expanded { display: none; }
.map-wrap.collapsed { height: 48px; min-height: 48px; }
.map-wrap.collapsed .map-canvas, .map-wrap.collapsed .map-controls, .map-wrap.collapsed .map-caption,
.map-wrap.collapsed .map-distance, .map-wrap.collapsed .map-note, .map-wrap.collapsed .map-progress { display: none !important; }
.map-wrap.collapsed .map-strip {
  display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px; cursor: pointer;
  font-weight: 700; background: var(--surface-high); color: var(--text);
}
.map-wrap.collapsed .map-strip-text { flex: 1; }
.map-wrap.expanded { position: fixed; inset: 0; z-index: 1000; height: auto; margin: 0; border-radius: 0; }
.map-wrap.expanded .only-normal { display: none; }
.map-wrap.expanded .only-expanded { display: inline-flex; }
.map-wrap.expanded .map-controls { top: calc(10px + env(safe-area-inset-top, 0px)); }
.map-wrap.expanded .map-distance, .map-wrap.expanded .map-progress { top: calc(10px + env(safe-area-inset-top, 0px)); }
.map-wrap.expanded .map-caption { bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
body.map-expanded { overflow: hidden; }

.mk-wrap { background: none; border: 0; }
.mk {
  width: 30px; height: 30px; border-radius: 50%; position: relative;
  display: grid; place-items: center; font: 700 13px/1 var(--mono);
  background: #ffffff; color: #0b1c30; border: 2px solid #0f172a; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
}
.mk .ms { font-size: 18px; }
.mk-hotel { background: #213145; color: #eaf1ff; border-color: #213145; border-radius: 0.5rem; }
.mk.is-done { opacity: 0.45; background: #e5eeff; border-color: #76777d; }
.mk.is-next { background: #0f172a; color: #fff; transform: scale(1.12); }
.mk.is-current { background: #2563eb; color: #fff; border-color: #fff; box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.35), 0 2px 6px rgba(15, 23, 42, 0.35); }
.mk.is-selected { outline: 3px solid #2563eb; outline-offset: 2px; }
.mk-backup { width: 22px; height: 22px; font-size: 11px; background: #cbd5e1; color: #334155; border: 1.5px solid #64748b; }
.mk-dot { position: absolute; top: -4px; right: -4px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; }
.mk-dot.error { background: #dc2626; }
.mk-dot.warn { background: #ea580c; }
.mk-label {
  position: absolute; top: 33px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font: 700 11px/14px var(--font); padding: 2px 8px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.mk-label.current { background: #0f172a; color: #fff; }
.mk-label.next { background: #fff; color: #0051d5; }
.leaflet-tooltip.leg-label {
  background: rgba(255, 255, 255, 0.92); color: #0b1c30; border: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  font: 600 10px/13px var(--mono); padding: 2px 6px; border-radius: 999px;
}
.leaflet-tooltip.leg-label.emph { background: #2563eb; color: #fff; }
.leaflet-tooltip.leg-label::before { display: none; }
.leaflet-popup-content-wrapper { border-radius: 0.75rem; }
.leaflet-popup-content { margin: 12px; }
.pop { font: 14px/1.4 var(--font); color: #0b1c30; min-width: 200px; }
.pop-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.pop-sub { color: #45464d; font-size: 12px; margin-top: 2px; }
.pop-note { margin-top: 6px; font-size: 13px; }
.pop-warn { margin-top: 6px; font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 0.5rem; }
.pop-warn.error { background: #ffdad6; color: #93000a; }
.pop-warn.warn { background: #ffedd5; color: #c2410c; }
.pop-warn.info { background: #e5eeff; color: #45464d; }
.pop-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pop .btn { color: #0b1c30; background: #fff; border-color: #c6c6cd; }
.pop .btn-blue { background: #0051d5; color: #fff; border-color: #0051d5; }
.pop .btn-dark { background: #0f172a; color: #fff; border-color: #0f172a; }
.num { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 50%; background: #0f172a; color: #fff; font: 700 11px/1 var(--mono); padding: 0 4px; }
.num.grey { background: #cbd5e1; color: #334155; }

/* ---------- Status bar ---------- */
.status {
  margin: 12px 16px 0; padding: 14px 16px; border-radius: var(--radius-lg);
  background: #0f172a; color: #fff; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 8px;
}
.status-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.status-day { display: flex; align-items: center; gap: 8px; color: #dae2fd; }
.status-day .live-dot { width: 10px; height: 10px; border-radius: 50%; background: #b4c5ff; }
.status-clock { font-family: var(--mono); font-weight: 600; font-size: 13px; background: rgba(211, 228, 254, 0.2); padding: 2px 8px; border-radius: 0.25rem; }
.status-now { font-size: 16px; line-height: 22px; font-weight: 600; }
.status-now b { color: #dae2fd; }
.status-now .arrow { color: #b4c5ff; margin: 0 4px; }
.status-now .t { font-family: var(--mono); color: #b4c5ff; font-size: 13px; }
.status-src { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status-src .pill { background: rgba(219, 225, 255, 0.18); color: #dbe1ff; }
.status .link-btn { color: #b4c5ff; min-height: 44px; }
.summary {
  width: 100%; border: 0; text-align: left; border-radius: 0.5rem; padding: 8px 12px; min-height: var(--tap);
  display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px;
  background: #370e00; color: #ffb599;
}
.summary.only-warn { background: #4a2610; color: #fdba74; }

/* ---------- Route list ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 20px 16px 8px; }
.section-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.seg { display: inline-flex; background: var(--surface-mid); border-radius: 999px; padding: 3px; }
.seg button { min-height: 44px; border: 0; background: none; border-radius: 999px; padding: 0 12px; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.route { padding: 0 16px; }
.row { display: flex; gap: 12px; }
.rail { width: 32px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }
.rail-line { width: 2px; flex: 1; background: var(--outline-soft); margin: 4px 0; min-height: 8px; }
.rail-line.active { background: var(--blue-bright); width: 3px; }
.rail-line.dashed { background: repeating-linear-gradient(var(--outline) 0 5px, transparent 5px 10px); }
.node {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--surface-high); color: var(--text-muted); font: 700 13px/1 var(--mono);
}
.node.done { color: var(--blue); }
.node.next { background: var(--ink); color: var(--on-ink); }
.node.current { background: var(--blue-bright); color: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue-bright) 30%, transparent); }
.node.hotel { background: #213145; color: #eaf1ff; border-radius: 0.5rem; }
.row-body { flex: 1; min-width: 0; padding-bottom: 4px; }
.stop-card {
  background: var(--surface); border-radius: var(--radius-lg); padding: 12px 14px; box-shadow: var(--shadow);
  border: 1.5px solid var(--border); display: flex; flex-direction: column; gap: 6px; cursor: pointer;
}
.stop-card.is-done { opacity: 0.7; }
.stop-card.is-current { box-shadow: var(--shadow-lg); border-color: var(--blue-bright); }
.stop-card.is-selected { box-shadow: inset 0 0 0 2px var(--blue-bright), var(--shadow); }
.stop-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stop-time { font-family: var(--mono); font-weight: 600; font-size: 13px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.stop-card.is-current .stop-time { color: var(--blue); }
.stop-name { margin: 0; font-size: 17px; line-height: 23px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stop-name .ms { font-size: 18px; color: var(--blue); }
.stop-ja { font-size: 13px; color: var(--text-muted); font-family: var(--ja); }
.stop-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.stop-actions .btn { flex: 1 1 auto; }
.hotel-row .stop-card { background: var(--surface-mid); border-color: transparent; }
.leg {
  display: flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 4px 4px 8px;
  color: var(--text-muted); text-decoration: none; font-family: var(--mono); font-size: 12px; font-weight: 600;
}
.leg .ms { color: var(--blue); font-size: 18px; }
.leg .go { margin-left: auto; color: var(--blue); font-family: var(--font); font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.arrow-view { margin: 0 16px; padding: 14px 16px; background: var(--surface); border-radius: var(--radius-lg); border: 1.5px solid var(--border); font-family: var(--mono); font-size: 14px; line-height: 24px; word-break: break-word; }
.arrow-view .arr { color: var(--blue); }
.arrow-view .h { color: var(--text-muted); }
.links { display: flex; flex-direction: column; gap: 8px; }
.links .btn { justify-content: flex-start; text-align: left; }
.nearby { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; scrollbar-width: none; }
.nearby::-webkit-scrollbar { display: none; }
.nearby a {
  flex-shrink: 0; min-height: var(--tap); padding: 0 14px; border-radius: 0.75rem;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow); text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700;
}
.nearby a .ms { color: var(--blue); }
.nearby-wrap { background: var(--surface-low); margin-top: 16px; }
.nearby-wrap .kicker { padding: 10px 16px 0; color: var(--text-muted); }
.not-on-map { font-size: 13px; }
.not-on-map ul { margin: 6px 0; padding-left: 20px; }
.empty { margin: 24px 16px; text-align: center; color: var(--text-muted); }

/* ---------- Now / Next ---------- */
.now-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 12px 16px 0; }
.now-clock { display: flex; align-items: baseline; gap: 8px; padding: 4px 16px 0; }
.now-clock .big { font: 600 40px/1.1 var(--mono); letter-spacing: -0.02em; }
.next-card { margin: 12px 16px 0; }
.card .next-name { margin: 4px 0 0; display: block; font-size: 28px; line-height: 34px; font-weight: 800; letter-spacing: -0.01em; }
.next-ja { font-family: var(--ja); color: var(--text-muted); font-size: 15px; }
.next-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.time-pill { font-family: var(--mono); font-weight: 600; font-size: 14px; background: var(--surface-high); padding: 6px 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.notes { margin: 10px 0 0; padding: 12px 14px; list-style: none; background: var(--surface-low); border-radius: var(--radius); display: flex; flex-direction: column; gap: 6px; }
.notes li { display: flex; gap: 8px; align-items: flex-start; font-size: 15px; line-height: 21px; }
.notes li .ms { color: var(--blue); font-size: 18px; margin-top: 1px; }
.now-mini { margin: 12px 16px 0; display: flex; align-items: center; gap: 12px; }
.now-mini .grow { flex: 1; min-width: 0; }
.now-mini .title { font-weight: 700; font-size: 16px; }
.two-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 16px 0; }
.two-btns .btn { min-height: 56px; font-size: 16px; }
.complete { margin: 12px 16px 0; text-align: center; }
.complete .big-ms { font-size: 48px; color: var(--ok); }

/* ---------- Import ---------- */
.imp-head { padding: 16px 16px 0; }
.imp-head h2 { margin: 4px 0; font-size: 28px; line-height: 34px; font-weight: 800; letter-spacing: -0.01em; }
.tabs2 { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-high); border-radius: 0.75rem; padding: 4px; margin: 16px 16px 0; }
.tabs2 button { min-height: 44px; border: 0; background: none; border-radius: 0.5rem; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.tabs2 button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.field { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 0.5rem; border: 1.5px solid var(--outline); background: var(--surface); font-size: 16px; }
textarea.field { min-height: 220px; font-family: var(--mono); font-size: 13px; line-height: 20px; resize: vertical; }
.help { margin-top: 8px; padding: 8px 10px; border-radius: 0.5rem; background: var(--surface-low); font-size: 13px; color: var(--text-muted); display: flex; gap: 6px; align-items: flex-start; }
.err { padding: 12px 14px; border-radius: var(--radius); background: var(--error-soft); color: var(--on-error-soft); font-weight: 600; }
.err pre { margin: 8px 0 0; padding: 10px; border-radius: 0.5rem; background: var(--surface); color: var(--text); font: 600 12px/18px var(--mono); white-space: pre-wrap; }
.warn-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow: auto; }
.warn-list li { font-size: 13px; padding: 6px 10px; background: var(--warn-soft); color: var(--warn); border-radius: 0.5rem; }
.warn-list .ln { font-family: var(--mono); font-weight: 600; margin-right: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.stats div { background: var(--surface-high); border-radius: 0.5rem; padding: 8px; text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.stats b { display: block; font: 600 18px/1.3 var(--mono); color: var(--blue); }
.radio { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 600; }
.radio input { width: 22px; height: 22px; accent-color: var(--blue-bright); }

/* ---------- Bottom sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 1100; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(11, 28, 48, 0.45); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; max-width: 560px; margin: 0 auto;
  background: var(--bg); border-radius: 1.25rem 1.25rem 0 0; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: up 0.18s ease-out;
}
@keyframes up { from { transform: translateY(24px); } to { transform: none; } }
.sheet-grab { display: flex; align-items: center; justify-content: center; position: relative; padding: 10px 0 4px; }
.sheet-grab::before { content: ""; width: 44px; height: 5px; border-radius: 999px; background: var(--outline-soft); }
.sheet-close { position: absolute; right: 10px; top: 6px; width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: var(--surface-high); display: grid; place-items: center; }
.sheet-scroll { overflow-y: auto; padding: 4px 16px 16px; -webkit-overflow-scrolling: touch; }
.sheet-scroll h2 { margin: 6px 0 0; font-size: 24px; line-height: 30px; font-weight: 700; }
.sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1.5px solid var(--border); background: var(--bg); display: flex; flex-direction: column; gap: 8px; }
.info-box { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-high); display: flex; gap: 10px; align-items: flex-start; }
.info-box .ms { color: var(--blue); }
.info-box .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.info-box .val { font-family: var(--mono); font-weight: 600; font-size: 16px; }
.sub-h { margin: 18px 0 8px; font-size: 18px; font-weight: 700; }
.backup { background: var(--surface-mid); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.backup .name { font-weight: 700; font-size: 16px; }
.backup .btn { align-self: flex-end; }

/* ---------- Show-to-staff card ---------- */
.staff { position: fixed; inset: 0; z-index: 1200; background: var(--bg); overflow: hidden; display: flex; flex-direction: column; }
.staff-bar { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: var(--surface-high); }
.staff-bar .grow { flex: 1; font-weight: 600; font-size: 15px; line-height: 20px; }
.staff-bar .btn { min-height: var(--tap); }
.staff-body { flex: 1; min-height: 0; padding: 16px; display: flex; flex-direction: column; gap: calc(14px * var(--fit, 1)); overflow: hidden; }
.staff-phrase { background: var(--surface-low); border-radius: var(--radius-lg); padding: calc(14px * var(--fit, 1)) 16px; }
.staff-phrase .jp { font-family: var(--ja); font-weight: 700; font-size: calc(26px * var(--fit, 1)); line-height: 1.35; }
.staff-phrase .en { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.staff-name { font-family: var(--ja); font-weight: 800; font-size: calc(64px * var(--fit, 1)); line-height: 1.15; letter-spacing: 0.02em; word-break: keep-all; overflow-wrap: anywhere; }
.staff-name.latin { font-family: var(--font); letter-spacing: -0.01em; }
.staff-en { color: var(--text-muted); font-size: 16px; }
.staff-addr { background: var(--surface-low); border-radius: var(--radius-lg); padding: calc(14px * var(--fit, 1)) 16px; }
.staff-addr .lbl { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.staff-addr .jp { font-family: var(--ja); font-weight: 700; font-size: calc(26px * var(--fit, 1)); line-height: 1.35; overflow-wrap: anywhere; }
.staff-missing { font-size: 14px; color: var(--warn); background: var(--warn-soft); padding: 10px 12px; border-radius: var(--radius); }
@media (orientation: landscape) and (max-height: 600px) {
  .staff-body { display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "name name" "phrase addr"; align-content: start; }
  .staff-namebox { grid-area: name; }
  .staff-phrase { grid-area: phrase; }
  .staff-addr { grid-area: addr; }
  .staff-missing { grid-column: 1 / -1; }
}

/* ---------- Dialog / toast ---------- */
.dialog { position: fixed; inset: 0; z-index: 1300; display: grid; place-items: center; padding: 16px; background: rgba(11, 28, 48, 0.5); }
.dialog-box { width: 100%; max-width: 400px; background: var(--bg); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-lg); }
.dialog-box h3 { margin: 0 0 12px; font-size: 18px; }
.dialog-box .choices { display: flex; flex-direction: column; gap: 8px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 1400;
  bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg);
  max-width: calc(100% - 32px);
}

/* ---------- Food options ---------- */
.food-ic { color: var(--warn); margin-right: 2px; }
.stop-name .food-ic { color: var(--warn); }
.food-type { font-size: 13px; font-weight: 600; color: var(--warn); text-transform: capitalize; }
.btn-tabelog { background: #fff4e5; color: #9a3412; border-color: #fdba74; }
.btn-tabelog .ms { color: #ea580c; }
@media (prefers-color-scheme: dark) {
  .btn-tabelog { background: #3a1f0b; color: #fed7aa; border-color: #9a3412; }
  .btn-tabelog .ms { color: #fdba74; }
}
.food-fallback {
  margin-top: 8px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--warn-soft); color: var(--text); display: flex; flex-direction: column; gap: 8px;
}
.food-fallback .ff-title { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--warn); }
.food-fallback .btn-row .btn { flex: 1 1 auto; }
.food-fallback code, .sheet code { font-family: var(--mono); font-size: 12px; }
.ff-backup { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.ff-backup .grow { flex: 1 1 100%; }
.ff-backup .btn { flex: 1 1 auto; }
.backup .btn-row .btn { flex: 0 1 auto; }
.mk-food {
  position: absolute; bottom: -6px; right: -8px; width: 18px; height: 18px; border-radius: 50%;
  background: #ea580c; color: #fff; border: 2px solid #fff; display: grid; place-items: center;
}
.mk-food .ms { font-size: 11px; }

/* ---------- Place details (photo + map in the sheet) ---------- */
.sheet-media { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.sheet-photo img { width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--radius); display: block; background: var(--surface-high); }
.sheet-extract { margin: 6px 0 0; font-size: 14px; line-height: 20px; color: var(--text); }
.photo-credit { font-size: 12px; color: var(--text-muted); }
.sheet-map { width: 100%; height: 200px; border: 0; border-radius: var(--radius); background: var(--surface-high); }
.val.ja { font-family: var(--ja); font-size: 15px; }

/* Mouse users can drag the horizontal strips (day tabs, nearby buttons). */
@media (hover: hover) and (pointer: fine) {
  .day-tabs, .nearby { cursor: grab; }
  .day-tabs.dragging, .nearby.dragging { cursor: grabbing; user-select: none; }
}

/* ---------- Weather ---------- */
.status-wx { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; font-weight: 600; color: #dae2fd; }
.status-wx .wx-icon { font-size: 18px; line-height: 1; }
.status-wx .wx-text { flex: 1 1 0; min-width: 0; }
.status-wx .wx-ago { margin-left: auto; font-size: 11px; font-weight: 600; color: #b4c5ff; }
.status-wx.muted-wx { color: #b4c5ff; font-weight: 600; }
.tab-wx { font-size: 14px; line-height: 1; }
.wx-chip { margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: var(--surface-high); color: var(--text); font-family: var(--font); font-size: 12px; font-weight: 600; white-space: nowrap; }
.rain-alert { margin-top: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--info-soft); border: 1.5px solid var(--blue-bright); display: flex; flex-direction: column; gap: 8px; }
.rain-alert .ff-title { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--blue); }

/* ---------- Train timer ---------- */
.btn-train { background: var(--surface); border-color: var(--blue); color: var(--blue); }
.btn-big.btn-train { min-height: 48px; font-size: 16px; }
.leg-train { flex-shrink: 0; align-self: center; margin-bottom: 4px; color: var(--blue); }
.row > .leg { flex: 1 1 auto; min-width: 0; }

.train-bar {
  position: sticky; z-index: 850; top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  max-width: 560px; margin: 8px auto 0; padding: 0 16px;
}
.tb-inner {
  border-radius: var(--radius-lg); padding: 10px 12px; box-shadow: var(--shadow-lg);
  background: var(--ink); color: var(--on-ink); display: flex; flex-direction: column; gap: 8px;
}
.tb-main { display: flex; align-items: center; gap: 10px; min-height: var(--tap); color: inherit; text-decoration: none; }
.tb-main .ms { font-size: 22px; }
.tb-head { display: block; font-size: 18px; line-height: 22px; font-weight: 800; }
.tb-sub { display: block; font-size: 13px; line-height: 18px; opacity: 0.85; }
.tb-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.tb-btns .btn { flex: 1 1 auto; background: transparent; color: inherit; border-color: currentColor; }
.tb-btns .btn[aria-pressed="true"] { background: rgba(255, 255, 255, 0.18); }
.tb-soon .tb-inner { background: var(--warn-soft); color: var(--warn); border: 2px solid var(--warn); }
.tb-leave-now .tb-inner, .tb-missed .tb-inner { background: var(--error); color: #fff; }
.tb-at-station .tb-inner { background: var(--ok-soft); color: var(--ok); border: 2px solid var(--ok); }
.tb-missed .tb-next { background: #fff; color: var(--error); border-color: #fff; font-weight: 700; }

.tt-box { max-height: calc(100dvh - 32px); overflow-y: auto; }
.tt-box h3 { display: flex; align-items: center; gap: 8px; }
.tt-status, .tt-from { display: flex; align-items: center; gap: 6px; }
.tt-from .ms, .tt-status .ms { font-size: 18px; }
.tt-msg { margin: 0 0 12px; }
.tt-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tt-station {
  width: 100%; min-height: 56px; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 8px 12px; border-radius: var(--radius); border: 1.5px solid var(--border); background: var(--surface); cursor: pointer;
}
.tt-name { display: block; font-weight: 700; }
.tt-sub { display: block; font-size: 13px; color: var(--text-muted); }
.tt-ja { font-family: var(--ja); }
.tt-walk { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; color: var(--blue); white-space: nowrap; }
.tt-walk .ms { font-size: 18px; }
.tt-ask { margin: 8px 0; font-weight: 600; }
.tt-links { margin-bottom: 10px; }
.tt-chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.tt-chip {
  min-height: var(--tap); border-radius: 0.5rem; border: 1.5px solid var(--outline-soft); background: var(--surface);
  font-family: var(--mono); font-weight: 700; font-size: 15px; cursor: pointer;
}
.tt-chip:active, .tt-station:active { background: var(--blue-soft); }
.tt-close { width: 100%; margin-top: 4px; }

/* ---------- Saved trains ---------- */
.tt-walk-line { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px; font-size: 14px; }
.tt-walk-line .ms { color: var(--blue); }
.tt-note { display: flex; gap: 6px; align-items: flex-start; background: var(--warn-soft); color: var(--warn); padding: 8px 10px; border-radius: 0.5rem; margin: 0 0 10px; }
.tt-options { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tt-option { border: 1.5px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.tt-opt-head { display: flex; align-items: baseline; gap: 8px; }
.tt-opt-dep { font-family: var(--mono); font-size: 22px; font-weight: 800; }
.tt-ride-line { font-weight: 700; font-size: 14px; }
.tt-ride-times { font-size: 13px; color: var(--text-muted); }
.tt-xfer { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--warn); }
.tt-xfer .ms { font-size: 16px; }
.tt-use { width: 100%; }
.tb-train { display: block; font-size: 13px; line-height: 18px; font-weight: 700; }
.tt-planned { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.tt-opt-head .pill { margin-left: auto; }

/* Hotel card: directions back to the hotel, below the card (not scaled with it) */
.staff-actions { padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--surface-high); display: flex; flex-direction: column; gap: 6px; }
.staff-actions .btn { min-height: 52px; font-size: 16px; }
