:root {
  color-scheme: light;
  --bg: #edf5ff;
  --surface: #ffffff;
  --ink: #07122d;
  --muted: #667085;
  --line: #d6e0ee;
  --primary: #07114a;
  --primary-2: #0b5cff;
  --route: #1769ff;
  --route-done: #12a36c;
  --warning: #ab5c00;
  --shadow: 0 14px 44px rgba(16, 36, 64, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #1d2430;
}

body {
  display: flex;
  justify-content: center;
}

button,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  width: min(100vw, 430px);
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

.screen {
  min-height: 100vh;
  padding: max(14px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
}

.loading-screen {
  padding: 48px 24px;
}

.topbar {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  font-size: 13px;
  color: var(--ink);
}

.topbar__center {
  text-align: center;
  font-weight: 700;
}

.inline-progress-row {
  display: grid;
  grid-template-columns: auto minmax(54px, 1fr);
  align-items: center;
  gap: 8px;
  max-width: 180px;
  margin: 0 auto;
}

.inline-progress-row span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.inline-progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #cfdbea;
}

.inline-progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #12a36c, #1769ff);
}

.topbar__right {
  text-align: right;
  color: var(--muted);
  font-weight: 700;
}

.eyebrow {
  margin: 12px 0 10px;
  color: #003b88;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 16px 0 0;
  font-size: 26px;
  line-height: 1.12;
  font-weight: 760;
  letter-spacing: 0;
}

.header-stop-identity {
  margin: 7px 0 0;
  display: grid;
  gap: 2px;
}

.header-stop-identity span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.header-stop-identity strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.18;
}

.instruction {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.next-step-card {
  margin: 14px 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.next-step-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.next-step-card strong {
  display: block;
  margin-top: 5px;
  font-size: 17px;
  line-height: 1.25;
}

.next-step-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.active-stop-identity {
  margin: 8px 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(19, 54, 93, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
}

.active-stop-identity span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.active-stop-identity strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.18;
}

.route-progress {
  position: relative;
  height: 5px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #cfdbea;
}

.route-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #12a36c, #1769ff);
}

.map-card {
  position: relative;
  height: 330px;
  margin: 12px 0;
  border: 1px solid #c5d2e4;
  background: #dfeaf6;
  overflow: hidden;
  overscroll-behavior: contain;
}

.map-card.is-secondary {
  height: 220px;
}

.map-card.is-preview {
  height: 250px;
}

.map-card.is-near-arrival {
  height: 270px;
}

.map-card.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 20;
  width: 100vw;
  height: 100dvh;
  margin: 0;
  border: 0;
}

.map-canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
}

.stop-view-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 12px 0;
  padding: 0;
  border: 1px solid #c9d6e6;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  overflow: hidden;
}

.stop-view-card.is-wait {
  border-color: #abc4e4;
  background: #fbfdff;
}

.stop-view-card img,
.stop-view-card__placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0;
  object-fit: cover;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.4) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.4) 1px, transparent 1px),
    #dce6f2;
  background-size: 18px 18px;
}

.stop-view-card__copy {
  padding: 11px 12px 12px;
}

.stop-view-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.stop-view-card strong {
  display: block;
  margin-top: 3px;
  font-size: 17px;
  line-height: 1.2;
}

.stop-view-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.stop-view-card.is-unavailable {
  display: block;
  border-style: dashed;
  background: #f8fbff;
}

.map-context {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  right: max(72px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 31;
  padding: 12px;
  border: 1px solid rgba(12, 28, 60, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 36px rgba(12, 28, 60, 0.18);
}

.map-context span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.map-context strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
  line-height: 1.15;
}

.map-context p {
  margin: 5px 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.map-empty {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 20px;
  text-align: center;
  color: #304158;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.55) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.55) 1px, transparent 1px),
    #dce8f5;
  background-size: 34px 34px;
}

.map-empty strong {
  display: block;
  margin-bottom: 6px;
}

.map-native-label {
  position: absolute;
  max-width: 190px;
  padding: 7px 10px;
  border: 1px solid rgba(7, 17, 74, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(20, 34, 60, 0.16);
  font: 800 13px/1.15 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: center;
  transform: translate(-50%, calc(-100% - 30px));
  white-space: nowrap;
  pointer-events: none;
}

.map-recenter {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 30;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(12, 28, 60, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: #24324a;
  box-shadow: 0 8px 22px rgba(20, 34, 60, 0.16);
  pointer-events: auto;
  touch-action: manipulation;
}

.map-expand {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 30;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(12, 28, 60, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: #24324a;
  box-shadow: 0 8px 22px rgba(20, 34, 60, 0.16);
  pointer-events: auto;
  touch-action: manipulation;
}

.map-recenter.is-tracking {
  color: var(--primary-2);
}

.map-recenter svg,
.map-expand svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.audio-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 10px;
  margin: 12px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.audio-card.is-story-first {
  grid-template-columns: 32px minmax(0, 1fr) 78px;
  align-items: start;
  padding: 12px;
  border-color: #bcd8ff;
  box-shadow: 0 10px 26px rgba(24, 67, 120, 0.1);
}

.audio-card.is-playing {
  border-color: #9ee3c3;
  background: #fbfffd;
}

.audio-card.is-missing {
  border-color: #ffd69b;
  background: #fffaf2;
}

.audio-icon {
  width: 22px;
  height: 22px;
  color: #0aa36f;
}

.audio-card__body {
  min-width: 0;
}

.audio-card__meta {
  display: flex;
  min-height: 16px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.audio-card span,
.audio-card em {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.audio-card em {
  min-width: 52px;
  text-align: right;
  font-style: normal;
  white-space: nowrap;
}

.audio-card.is-playing span {
  color: #087443;
  font-weight: 800;
}

.audio-card.is-completed span {
  color: #004f9f;
  font-weight: 800;
}

.audio-card strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.25;
}

.audio-progress {
  height: 3px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe6f2;
}

.audio-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #0a56d6;
  transition: width 180ms linear;
}

.audio-card.is-playing .audio-progress span {
  background: #0aa36f;
}

.audio-card.is-completed .audio-progress span {
  background: #004f9f;
}

.audio-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  color: #003b88;
  font-size: 12px;
  font-weight: 800;
}

.audio-button:disabled {
  color: #7a4a00;
  background: #fff6e9;
}

.actions {
  display: grid;
  gap: 8px;
}

.action-button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: #003b88;
  font-weight: 760;
}

.action-button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.action-button.secondary {
  background: var(--surface);
  color: #003b88;
}

.action-button.warning {
  border-color: #ffd69b;
  background: #fff6e9;
  color: #6b3a00;
}

.action-button.compact {
  min-height: 40px;
  width: 100%;
}

.dev-panel {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(109, 130, 158, 0.35);
}

.dev-panel__toggle {
  min-height: 34px;
  width: 100%;
  border: 1px solid rgba(109, 130, 158, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  color: #58677d;
  font-size: 12px;
  font-weight: 760;
}

.dev-panel__controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.dev-panel__controls button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  color: #24324a;
  font-size: 12px;
  font-weight: 750;
}

.notice {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid #ffd69b;
  border-radius: 8px;
  background: #fff8ed;
  color: var(--warning);
  font-size: 13px;
  line-height: 1.35;
}

.notice.is-confirmed {
  border-color: #9ee3c3;
  background: #effbf5;
  color: #05603a;
}

.tour-option {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.tour-option span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.tour-option strong {
  display: block;
  margin-top: 5px;
  font-size: 16px;
}

.tour-option p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.pwa-install-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 10px 0 12px;
  padding: 12px 14px;
  border: 1px solid rgba(18, 163, 108, 0.28);
  border-radius: 8px;
  background: #f5fff9;
}

.pwa-install-card span {
  display: block;
  color: #05603a;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.pwa-install-card strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.2;
}

.pwa-install-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.pwa-install-card button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.poi-montage {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0 12px;
}

.poi-montage__item {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.poi-montage__item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.poi-montage__item figcaption {
  min-height: 34px;
  padding: 6px 7px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.15;
}

.destination-media-card {
  display: grid;
  grid-template-columns: minmax(128px, 39%) 1fr;
  gap: 13px;
  align-items: center;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.destination-media-card img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 7px;
  object-fit: cover;
}

.destination-media-card.is-near-arrival {
  grid-template-columns: minmax(148px, 44%) 1fr;
  border-color: #bcd8ff;
  background: #fbfdff;
}

.destination-media-card span,
.story-media span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.destination-media-card strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
  line-height: 1.18;
}

.destination-media-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.story-media {
  margin: 12px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.story-media img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.story-media div {
  padding: 12px 13px 13px;
}

.story-media p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.completion-recap {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin: 12px 0;
}

.completion-recap img {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface);
}

.route-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0 12px;
}

.route-summary div,
.permission-panel,
.transition-panel,
.story-intro,
.completion-panel,
.instruction-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.route-summary div {
  min-height: 74px;
  padding: 11px 12px;
}

.route-summary span,
.transition-panel span,
.story-intro span,
.instruction-chip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.route-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
  line-height: 1.2;
}

.permission-panel,
.transition-panel,
.story-intro,
.completion-panel,
.instruction-chip {
  margin: 14px 0 12px;
  padding: 13px 14px;
}

.permission-panel strong,
.transition-panel strong,
.story-intro strong,
.completion-panel strong,
.instruction-chip strong {
  display: block;
  font-size: 17px;
  line-height: 1.25;
}

.permission-panel p,
.transition-panel p,
.story-intro p,
.completion-panel p,
.instruction-chip p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.instruction-chip.is-compact {
  margin: 10px 0 8px;
  padding: 10px 12px;
}

.instruction-chip.is-compact strong {
  font-size: 18px;
}

.instruction-chip.is-boarding {
  margin: 12px 0;
  padding: 13px 14px;
  border-color: #b7c9e2;
  background: #fbfdff;
}

.instruction-chip.is-boarding strong {
  margin-top: 2px;
  font-size: 26px;
  line-height: 1.05;
}

.instruction-chip.is-boarding p {
  font-size: 14px;
}

.layout-selection .tour-option {
  margin-top: 18px;
}

.layout-permission .actions,
.layout-transition .actions,
.layout-completion .actions {
  margin-top: 18px;
}

.layout-story .audio-card {
  margin-top: 10px;
}

.layout-story .story-media {
  margin-bottom: 0;
  border-bottom: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.layout-story .audio-card.is-story-first {
  margin: 0 0 12px;
  border-color: var(--line);
  border-top: 0;
  border-top-right-radius: 0;
  border-top-left-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

.layout-story .audio-card.is-story-first.is-playing {
  background: #fbfffd;
}

.layout-story .audio-card.is-story-first .audio-button {
  align-self: center;
}

.layout-story .actions {
  margin-top: 10px;
}

@media (min-width: 720px) {
  body {
    padding: 28px 0;
  }

  .app-shell {
    min-height: 860px;
    border-radius: 18px;
    box-shadow: var(--shadow);
  }
}
