/* ==========================================================================
   RailNav phone guide
   Dark navy / glass, matching the kiosk. Mobile first: designed at 360 px wide.
   ========================================================================== */

:root {
  --bg: #0B1730;
  --bg-deep: #071021;
  --panel: #122544;
  --panel-strong: #0E1D38;
  --panel-soft: rgba(18, 37, 68, 0.72);
  --stroke: rgba(143, 166, 200, 0.18);
  --stroke-strong: rgba(143, 166, 200, 0.34);
  --accent: #2F80FF;
  --accent-soft: rgba(47, 128, 255, 0.16);
  --text: #E8F0FF;
  --muted: #8FA6C8;
  --route: #22E3C8;
  --danger: #FF5A5A;
  --ok: #38D996;
  --warn: #F2C14E;

  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 12px;
  --tap: 48px;

  --header-h: 58px;
  --tabbar-h: 62px;

  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-deep);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Noto Sans", "Noto Sans Tamil", "Noto Sans Devanagari", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background:
    radial-gradient(1100px 620px at 12% -10%, rgba(47, 128, 255, 0.20), transparent 62%),
    radial-gradient(900px 520px at 92% 4%, rgba(34, 227, 200, 0.10), transparent 58%),
    linear-gradient(180deg, #0C1A34 0%, #0B1730 46%, #081226 100%);
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
svg { display: block; }

/* The `hidden` attribute must beat the flex/grid display of the sheets and drawers. */
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -72px;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ shell */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-top: var(--safe-top);
  max-width: 720px;
  margin: 0 auto;
  background: rgba(7, 16, 33, 0.35);
}

.app-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: var(--header-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(14, 29, 56, 0.92), rgba(11, 23, 48, 0.7));
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(150deg, #4A97FF, #1F62D6);
  box-shadow: 0 6px 16px rgba(47, 128, 255, 0.4);
  flex: 0 0 auto;
}

.brand-text { min-width: 0; }
.brand-text h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.brand-text p {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

/* Step-free is a full-width switch row under the chips: it is a route mode, not a header
   control, and at 360 px a header pill squeezed the language select. */
.stepfree-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: rgba(16, 33, 62, 0.66);
  color: var(--muted);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.stepfree-row[aria-pressed="true"] {
  border-color: rgba(56, 217, 150, 0.55);
  background: rgba(56, 217, 150, 0.12);
  color: #DCFBEF;
}
.stepfree-icon {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: rgba(143, 166, 200, 0.16);
  color: var(--muted);
}
.stepfree-row[aria-pressed="true"] .stepfree-icon {
  background: rgba(56, 217, 150, 0.22);
  color: var(--ok);
}
.stepfree-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.25;
}

.switch {
  position: relative;
  display: block;
  width: 46px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(143, 166, 200, 0.28);
  transition: background 0.16s ease;
}
.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #C6D6EE;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  transition: transform 0.16s ease, background 0.16s ease;
}
.stepfree-row[aria-pressed="true"] .switch { background: rgba(56, 217, 150, 0.55); }
.stepfree-row[aria-pressed="true"] .switch-knob {
  transform: translateX(18px);
  background: #FFFFFF;
}

.lang-wrap { position: relative; display: inline-flex; align-items: center; }
.lang-select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 48px;
  min-width: 84px;
  padding: 0 28px 0 13px;
  border: 1px solid var(--stroke-strong);
  border-radius: 999px;
  background: rgba(18, 37, 68, 0.6);
  font-size: 12.5px;
  font-weight: 600;
}
.lang-caret {
  position: absolute;
  right: 10px;
  pointer-events: none;
  color: var(--muted);
}

/* ----------------------------------------------------------------- banner */
.banner {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--stroke);
  background: linear-gradient(90deg, rgba(47, 128, 255, 0.18), rgba(47, 128, 255, 0.04) 60%, transparent);
}
.banner-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.banner-pulse {
  position: relative;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}
.banner-pulse::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(47, 128, 255, 0.55);
  animation: pulse-ring 2s ease-out infinite;
}
.banner-text { min-width: 0; }
.banner-title {
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.banner-sub {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.offline-banner {
  flex: 0 0 auto;
  padding: 7px 14px;
  font-size: 12px;
  text-align: center;
  color: #FFE8B0;
  background: rgba(242, 193, 78, 0.14);
  border-bottom: 1px solid rgba(242, 193, 78, 0.3);
}

/* ------------------------------------------------------------------- main */
.main {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.view {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px 24px;
  scrollbar-width: thin;
}

.view-map {
  padding: 0;
  overflow: hidden;
  position: relative;
}

/* --------------------------------------------------------------- home view */
.search-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 58px;
  padding: 0 6px 0 14px;
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius);
  background: rgba(18, 37, 68, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.search-row:focus-within {
  border-color: rgba(47, 128, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(47, 128, 255, 0.18);
}
.search-icon { color: var(--muted); flex: 0 0 auto; }
.search-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  font-size: 15px;
  outline: none;
}
.search-input::placeholder { color: #6E86AB; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-clear {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(143, 166, 200, 0.16);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.chips {
  display: flex;
  gap: 8px;
  margin: 12px -14px 0;
  padding: 2px 14px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 17px;
  border: 1px solid var(--stroke-strong);
  border-radius: 999px;
  background: rgba(18, 37, 68, 0.62);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(47, 128, 255, 0.35);
}

.section-label {
  margin: 18px 0 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.quick-block { margin-top: 4px; }
.quick-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.quick-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 12px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(26, 50, 90, 0.85), rgba(16, 33, 62, 0.85));
  text-align: left;
}
.quick-btn:active { transform: scale(0.985); }
.quick-icon {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 10px;
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 700;
  color: #0B1730;
}
.quick-text { min-width: 0; }
.quick-name {
  display: block;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quick-meta { display: block; font-size: 11px; color: var(--muted); }

.location-list { display: flex; flex-direction: column; gap: 8px; }

.location-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 60px;
  padding: 9px 12px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: rgba(16, 33, 62, 0.66);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.location-item:active { background: rgba(24, 48, 88, 0.85); }
.location-item.is-current {
  border-color: rgba(47, 128, 255, 0.7);
  background: rgba(47, 128, 255, 0.14);
}
.location-icon {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 12px;
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 700;
  color: #08142A;
}
.location-body { min-width: 0; flex: 1 1 auto; }
.location-name {
  display: block;
  font-size: 14.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.location-meta { display: block; font-size: 11.5px; color: var(--muted); }
.location-chev { color: #5D7699; flex: 0 0 auto; }

.empty-state {
  padding: 26px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

/* ---------------------------------------------------------------- map view */
.map-host {
  position: absolute;
  inset: 0;
  /* Fallback only: map.js measures the destination card and overrides this so the map never sits
     under the card, even when the card is taller in another language. */
  padding-bottom: 120px;
  background: var(--panel-strong);
  touch-action: none;
}
.map-svg { width: 100%; height: 100%; display: block; }

/* Font sizes are in "pin units": the counter-scale turns one unit into about 1.1 px. */
.map-svg .zone-label {
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.09em;
  fill: rgba(11, 23, 48, 0.3);
  pointer-events: none;
  font-size: 7.5px;
}

.pin { cursor: pointer; }
/* The pin you are standing on is replaced by the pulsing "You are here" marker. */
.pin.is-here { display: none; }
.pin .pin-body {
  stroke: rgba(255, 255, 255, 0.94);
  stroke-width: 1.3;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
  transition: filter 0.15s ease;
}
.pin .pin-label {
  font-size: 9px;
  font-weight: 700;
  fill: #FFFFFF;
  paint-order: stroke;
  stroke: rgba(7, 16, 33, 0.9);
  stroke-width: 2.4px;
  stroke-linejoin: round;
  pointer-events: none;
}
.pin.is-selected .pin-body,
.pin.is-destination .pin-body {
  stroke: #FFFFFF;
  stroke-width: 2.2;
  filter: drop-shadow(0 0 5px rgba(47, 128, 255, 0.95));
}
.pin.is-destination .pin-label { fill: #EAF3FF; }

.yah-body { stroke: #FFFFFF; stroke-width: 1.6; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
.yah-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  fill: #FFFFFF;
  paint-order: stroke;
  stroke: rgba(7, 16, 33, 0.92);
  stroke-width: 2.6px;
  stroke-linejoin: round;
  pointer-events: none;
}
.yah-ring, .yah-ring-inner {
  transform-box: fill-box;
  transform-origin: center;
  animation: map-pulse 2.4s ease-out infinite;
}
.yah-ring-inner { animation-delay: 1.2s; }

.chevron {
  animation: chevron-flow 1.1s linear infinite;
}

.destination-flag { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); }

.map-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3;
}
.map-btn {
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  border: 1px solid var(--stroke-strong);
  border-radius: 13px;
  background: rgba(11, 23, 48, 0.82);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 19px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.map-btn:active { background: rgba(24, 48, 88, 0.95); }

.map-card {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  padding: 12px 14px;
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius-lg);
  background: rgba(11, 23, 48, 0.9);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.map-card-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.map-card-title {
  margin-top: 2px;
  font-size: 16.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}
.map-card-meta { font-size: 12.5px; color: var(--muted); }

/* ----------------------------------------------------------------- tabbar */
.tabbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: var(--tabbar-h);
  border-top: 1px solid var(--stroke);
  background: rgba(9, 20, 40, 0.94);
  backdrop-filter: blur(14px);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  min-height: var(--tap);
}
.tab.is-active { color: var(--text); }
.tab.is-active svg { color: var(--accent); }
.tab:active { background: rgba(47, 128, 255, 0.08); }

.app-footer {
  flex: 0 0 auto;
  padding: 6px 14px calc(7px + var(--safe-bottom));
  border-top: 1px solid var(--stroke);
  background: rgba(7, 16, 33, 0.9);
  text-align: center;
  font-size: 10.5px;
  color: #6E86AB;
}

/* ------------------------------------------------------------------ buttons */
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(150deg, #4A97FF, #2268DE);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(47, 128, 255, 0.34);
}
.primary-btn:active { filter: brightness(0.94); }
.primary-btn.small { min-height: 48px; padding: 0 18px; font-size: 13px; border-radius: 12px; }
.primary-btn[disabled] { opacity: 0.45; box-shadow: none; }

.ghost-btn {
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid var(--stroke-strong);
  border-radius: 999px;
  background: rgba(18, 37, 68, 0.5);
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  flex: 0 0 auto;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(18, 37, 68, 0.6);
  color: var(--muted);
}

/* ---------------------------------------------------------------- backdrop */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(3, 8, 18, 0.62);
  backdrop-filter: blur(2px);
  animation: fade-in 0.18s ease;
}

/* ---------------------------------------------------- drawers and sheets */
.drawer,
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  max-height: 88dvh;
  padding-bottom: var(--safe-bottom);
  border: 1px solid var(--stroke-strong);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, #13284A 0%, #0E1D38 22%, #0B1730 100%);
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.55);
  animation: sheet-up 0.24s cubic-bezier(0.22, 0.9, 0.3, 1);
  overflow: hidden;
}
.drawer { max-height: 90vh; max-height: 90dvh; }
.sheet { max-height: 84vh; max-height: 84dvh; }

.drawer-grip {
  width: 42px;
  height: 4px;
  margin: 9px auto 2px;
  border-radius: 999px;
  background: rgba(143, 166, 200, 0.4);
  flex: 0 0 auto;
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px 12px;
  flex: 0 0 auto;
}
.drawer-head-text { min-width: 0; }
.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}
.drawer-title {
  margin-top: 2px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 20px;
  overscroll-behavior: contain;
}

/* In the directions drawer the controls stay put and only the step list scrolls, so the current
   instruction is never pushed off screen when the active step changes. */
#directionsDrawer .drawer-scroll {
  display: flex;
  flex-direction: column;
}
#directionsDrawer .drawer-scroll > * { flex: 0 0 auto; }
#directionsDrawer .step-list {
  flex: 1 1 auto;
  min-height: 96px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

/* ------------------------------------------------------- instruction card */
.instruction-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 14px;
  border: 1px solid rgba(47, 128, 255, 0.38);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(47, 128, 255, 0.2), rgba(18, 37, 68, 0.75) 62%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.turn-icon {
  display: grid;
  place-items: center;
  width: 54px; height: 54px;
  flex: 0 0 auto;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(47, 128, 255, 0.4);
  transition: transform 0.2s ease;
}
.turn-icon svg { transition: transform 0.2s ease; }
.turn-icon[data-turn="left"] svg,
.turn-icon[data-turn="sharp-left"] svg { transform: rotate(-90deg); }
.turn-icon[data-turn="right"] svg,
.turn-icon[data-turn="sharp-right"] svg { transform: rotate(90deg); }
.turn-icon[data-turn="slight-left"] svg { transform: rotate(-45deg); }
.turn-icon[data-turn="slight-right"] svg { transform: rotate(45deg); }
.turn-icon[data-turn="uturn"] svg { transform: rotate(180deg); }
.turn-icon[data-kind="arrive"] { background: var(--ok); box-shadow: 0 8px 20px rgba(56, 217, 150, 0.36); }
.turn-icon[data-kind="gate"],
.turn-icon[data-kind="door"] { background: #2EC4B6; box-shadow: 0 8px 20px rgba(46, 196, 182, 0.32); }
.turn-icon[data-kind="stairs"],
.turn-icon[data-kind="ramp"] { background: #A46BFF; box-shadow: 0 8px 20px rgba(164, 107, 255, 0.32); }

.instruction-main { min-width: 0; }
.instruction-text {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.01em;
}
.instruction-meta {
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: #9FC4FF;
}
.instruction-landmark {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.summary-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 10px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  background: rgba(16, 33, 62, 0.6);
}
.summary-value { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.summary-label { font-size: 10.5px; color: var(--muted); letter-spacing: 0.04em; }

.progress-track {
  height: 5px;
  margin: 12px 2px 0;
  border-radius: 999px;
  background: rgba(143, 166, 200, 0.2);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2F80FF, #22E3C8);
  transition: width 0.25s ease;
}

.move-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 9px;
  margin-top: 13px;
}
.move-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  border: 1px solid var(--stroke-strong);
  border-radius: 15px;
  background: rgba(18, 37, 68, 0.7);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 700;
}
.move-btn-primary {
  border-color: transparent;
  background: linear-gradient(150deg, #4A97FF, #2268DE);
  box-shadow: 0 10px 22px rgba(47, 128, 255, 0.3);
}
.move-btn[disabled] { opacity: 0.38; box-shadow: none; }
.move-btn:active:not([disabled]) { transform: scale(0.99); }

.control-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 9px;
}
.control-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 58px;
  padding: 7px 6px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  background: rgba(16, 33, 62, 0.55);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}
.control-btn[aria-pressed="true"] { color: #FFD9D9; border-color: rgba(255, 90, 90, 0.4); background: rgba(255, 90, 90, 0.12); }

.voice-notice {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(242, 193, 78, 0.32);
  background: rgba(242, 193, 78, 0.12);
  color: #FFE8B0;
  font-size: 12px;
}

.arrival-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px;
  padding: 11px 13px;
  border: 1px solid rgba(56, 217, 150, 0.45);
  border-radius: var(--radius);
  background: rgba(56, 217, 150, 0.14);
  color: #D6FBEC;
  font-size: 14px;
  font-weight: 700;
  animation: fade-in 0.25s ease;
}
.arrival-check {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--ok);
  color: #06301F;
  flex: 0 0 auto;
}

.step-list { display: flex; flex-direction: column; gap: 2px; }

.step-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.step-row.is-active {
  border-color: rgba(47, 128, 255, 0.45);
  background: rgba(47, 128, 255, 0.13);
}
.step-row.is-done { opacity: 0.52; }

.step-badge {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(143, 166, 200, 0.16);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.step-row.is-active .step-badge { background: var(--accent); color: #fff; }
.step-row.is-done .step-badge { background: rgba(56, 217, 150, 0.2); color: var(--ok); }

.step-body { min-width: 0; flex: 1 1 auto; }
.step-text { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.step-meta { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }

.drawer-note {
  margin-top: 18px;
  font-size: 10.5px;
  color: #62799B;
  text-align: center;
}

/* --------------------------------------------------------------- ask sheet */
.ask-log {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 12px;
}
.ask-bubble {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 15px;
  font-size: 13.5px;
  line-height: 1.4;
}
.ask-bubble.is-user {
  align-self: flex-end;
  border-bottom-right-radius: 5px;
  background: var(--accent);
  color: #fff;
}
.ask-bubble.is-guide {
  align-self: flex-start;
  border: 1px solid var(--stroke);
  border-bottom-left-radius: 5px;
  background: rgba(16, 33, 62, 0.8);
}
.ask-bubble.is-guide strong { color: #9FC4FF; }

.ask-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.suggestion-chip {
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid rgba(47, 128, 255, 0.45);
  border-radius: 999px;
  background: rgba(47, 128, 255, 0.13);
  color: #CFE1FF;
  font-size: 12.5px;
  font-weight: 600;
}

.ask-form {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 4px;
  background: linear-gradient(180deg, rgba(11, 23, 48, 0) 0%, #0B1730 38%);
}
.ask-form .search-input {
  height: 52px;
  padding: 0 13px;
  border: 1px solid var(--stroke-strong);
  border-radius: 13px;
  background: rgba(18, 37, 68, 0.8);
}
.mic-btn { width: 52px; height: 52px; border-radius: 13px; }
.mic-btn.is-listening { color: #FFD9D9; border-color: rgba(255, 90, 90, 0.5); animation: pulse-soft 1.4s ease-in-out infinite; }

.sheet-hint {
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

/* ------------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  z-index: 90;
  transform: translateX(-50%);
  max-width: min(92vw, 460px);
  padding: 11px 16px;
  border: 1px solid var(--stroke-strong);
  border-radius: 999px;
  background: rgba(11, 23, 48, 0.96);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow);
  animation: fade-in 0.18s ease;
}

/* ---------------------------------------------------------------- boot help
   Only visible when the app cannot start (opened from disk, or scripts blocked). */
.boot-help {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(47, 128, 255, 0.18), transparent 60%),
    var(--bg-deep);
  overflow: auto;
}

.boot-help-card {
  width: min(100%, 440px);
  padding: 24px 22px;
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.boot-help-kicker {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.boot-help-card h1 {
  margin: 0 0 12px;
  font-size: 21px;
  line-height: 1.25;
  color: var(--text);
}

.boot-help-card p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.boot-help-card code {
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(143, 166, 200, 0.14);
  color: var(--text);
  font-size: 12.5px;
  word-break: break-word;
}

.boot-help-card a { color: var(--accent); }

.boot-help-steps {
  margin: 0 0 14px;
  padding-left: 22px;
  list-style: decimal;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.6;
}

.boot-help-steps li {
  margin-bottom: 8px;
  padding-left: 4px;
}

.boot-help-steps li::marker {
  color: var(--accent);
  font-weight: 700;
}

.boot-help-note {
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
  font-size: 12.5px !important;
}

.boot-help-btn {
  width: 100%;
  min-height: var(--tap);
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.boot-help-btn:active { transform: translateY(1px); }

/* -------------------------------------------------------------- animations */
@keyframes pulse-ring {
  0% { transform: scale(0.7); opacity: 0.9; }
  70% { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}
@keyframes map-pulse {
  0% { transform: scale(0.55); opacity: 0.95; }
  70% { transform: scale(2.1); opacity: 0; }
  100% { transform: scale(2.1); opacity: 0; }
}
@keyframes chevron-flow {
  0% { opacity: 0.35; }
  50% { opacity: 1; }
  100% { opacity: 0.35; }
}
@keyframes sheet-up {
  from { transform: translateY(22px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ------------------------------------------------------------- small print */
@media (max-width: 374px) {
  .brand-text p { display: none; }
  .lang-select { min-width: 64px; }
  .stepfree-label { font-size: 12.5px; }
  .instruction-text { font-size: 16.5px; }
  .summary-value { font-size: 14.5px; }
  .control-btn { font-size: 9.5px; }
}

@media (min-width: 560px) {
  .quick-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .drawer, .sheet { max-width: 560px; margin: 0 auto; border-radius: 24px 24px 0 0; }
}

/* Short screens (small phones in portrait): the chrome must leave the map room to breathe. */
@media (max-height: 720px) and (orientation: portrait) {
  :root { --header-h: 54px; --tabbar-h: 56px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
  .brand-text h1 { font-size: 14px; }
  .banner { padding: 6px 12px; }
  .banner-title { font-size: 12.5px; }
  .banner-sub { font-size: 10px; }
  .map-card { padding: 8px 12px; bottom: 8px; }
  .map-card-label { font-size: 9px; }
  .map-card-title { font-size: 15px; }
  .map-card-row { margin-top: 4px; }
  .app-footer { padding: 4px 12px calc(5px + var(--safe-bottom)); font-size: 9.5px; }
}

/* Landscape phones: keep the map usable. */
@media (max-height: 460px) and (orientation: landscape) {
  :root { --header-h: 50px; --tabbar-h: 54px; }
  .banner { padding: 5px 14px; }
  .banner-sub { display: none; }
  .map-card { padding: 6px 12px; }
  .map-card-label { display: none; }
  .map-card-row { margin-top: 2px; }
  .app-footer { display: none; }
  .drawer, .sheet { max-height: 96vh; }
}
