:root {
  color-scheme: light;
  --ink: #17251f;
  --muted: #66726c;
  --paper: #fffdf8;
  --surface: #f4f1e9;
  --line: rgba(23, 37, 31, 0.1);
  --green: #1f6a4a;
  --green-dark: #145039;
  --green-soft: #dcecdf;
  --shadow: 0 20px 52px rgba(27, 48, 38, 0.12);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(31, 106, 74, 0.12), transparent 26rem),
    linear-gradient(180deg, #faf7f0 0%, #f1ede5 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid rgba(31, 106, 74, 0.28); outline-offset: 3px; }

.app-shell { width: min(100%, 680px); min-height: 100svh; margin: 0 auto; }
.app-shell > [hidden] { display: none !important; }

.home-view { padding: max(30px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom)); }

.hero {
  position: relative;
  overflow: hidden;
  padding: 28px 24px 24px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 30px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.brand-mark {
  position: absolute;
  right: -42px;
  top: -42px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: var(--green-soft);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  content: "";
  position: absolute;
  border: 2px solid rgba(31, 106, 74, 0.24);
  border-radius: 50%;
}

.brand-mark::before { inset: 20px; }
.brand-mark::after { inset: 42px; }
.brand-mark span { inset: 64px; background: var(--green); border: 0; }

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.hero h1 {
  max-width: 82%;
  margin: 9px 0 0;
  font-size: clamp(31px, 9vw, 43px);
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.hero-copy { max-width: 470px; margin: 14px 0 0; color: var(--muted); font-size: 15px; line-height: 1.75; }

.guide-tip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
  padding: 10px 13px;
  border-radius: 14px;
  background: var(--surface);
  color: #53615a;
  font-size: 13px;
}

.guide-tip-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-weight: 800;
}

.route-groups { display: grid; gap: 28px; margin-top: 30px; }
.group-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 0 4px 12px; }
.group-heading h2 { margin: 0; font-size: 19px; letter-spacing: -0.02em; }
.group-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.route-list { display: grid; gap: 11px; }

.route-card {
  width: 100%;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 15px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 21px;
  background: rgba(255, 253, 248, 0.96);
  color: inherit;
  text-align: left;
  box-shadow: 0 10px 28px rgba(27, 48, 38, 0.08);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.route-card:active { transform: scale(0.985); }
.route-card:hover { box-shadow: 0 15px 34px rgba(27, 48, 38, 0.13); }

.route-cover {
  width: 116px;
  height: 88px;
  overflow: hidden;
  border-radius: 14px;
  background: #e4e7e2;
}

.route-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.route-copy { min-width: 0; }
.route-copy strong { display: block; font-size: 16px; line-height: 1.35; }
.route-copy span { display: block; margin-top: 7px; color: var(--muted); font-size: 13px; }
.route-arrow {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 20px;
  font-weight: 700;
}

.home-footer { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 28px; color: #7d8983; font-size: 12px; }
.signal-dot { width: 7px; height: 7px; border-radius: 50%; background: #54a574; box-shadow: 0 0 0 4px rgba(84, 165, 116, 0.12); }

body.navigation-active { overflow: hidden; background: #111915; }

.route-view {
  min-height: 100svh;
  height: 100svh;
  display: grid;
  grid-template-rows: auto 3px minmax(0, 1fr) auto;
  background: #111915;
  color: white;
}

.route-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  background: rgba(17, 25, 21, 0.96);
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  cursor: pointer;
}

.icon-button span { margin-top: -3px; font-size: 34px; line-height: 1; }
.route-heading { min-width: 0; }
.route-heading strong { display: block; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.route-heading span { display: block; overflow: hidden; margin-top: 3px; color: rgba(255, 255, 255, 0.58); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.step-counter { color: rgba(255, 255, 255, 0.82); font-size: 13px; font-variant-numeric: tabular-nums; }

.progress-track { overflow: hidden; background: rgba(255, 255, 255, 0.1); }
.progress-track span { display: block; width: 0; height: 100%; background: #72c18f; transition: width 220ms ease; }

.step-stage { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; padding: 13px 13px 8px; touch-action: pan-y; }
.image-shell {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 21px;
  background: #090d0b;
}

.image-shell img { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; opacity: 1; transition: opacity 130ms ease; }
.image-shell.is-loading img { opacity: 0; }
.image-loader { display: none; width: 34px; height: 34px; border: 3px solid rgba(255, 255, 255, 0.18); border-top-color: white; border-radius: 50%; animation: spin 800ms linear infinite; }
.image-shell.is-loading .image-loader { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.image-error { color: rgba(255, 255, 255, 0.72); text-align: center; }
.image-error strong { display: block; margin-bottom: 12px; }
.image-error button { min-height: 42px; padding: 0 18px; border: 0; border-radius: 999px; background: white; color: var(--ink); }

.step-instruction { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 8px 0 0; color: rgba(255, 255, 255, 0.72); font-size: 13px; }
.step-instruction span { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; background: rgba(114, 193, 143, 0.16); color: #8bd1a5; }

.step-controls {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  gap: 10px;
  padding: 11px 13px max(13px, env(safe-area-inset-bottom));
  background: rgba(17, 25, 21, 0.98);
}

.control-button {
  min-height: 54px;
  padding: 0 18px;
  border: 0;
  border-radius: 17px;
  font-weight: 750;
  cursor: pointer;
}

.control-button.primary { background: #f3f7f3; color: #153d2b; box-shadow: 0 9px 22px rgba(0, 0, 0, 0.16); }
.control-button.secondary { border: 1px solid rgba(255, 255, 255, 0.13); background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.88); }
.control-button.ghost { border: 1px solid var(--line); background: transparent; color: var(--green-dark); }
.control-button:disabled { opacity: 0.32; cursor: default; }

.arrival-view {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: max(28px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}

.arrival-card {
  width: min(100%, 430px);
  padding: 38px 28px 28px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 30px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow);
  text-align: center;
}

.arrival-check { width: 78px; height: 78px; display: grid; margin: 0 auto 22px; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 38px; font-weight: 800; }
.arrival-card h2 { margin: 8px 0 0; font-size: 42px; letter-spacing: -0.04em; }
.arrival-card > p:not(.eyebrow) { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.arrival-actions { display: grid; gap: 10px; margin-top: 30px; }
.arrival-actions .primary { background: var(--green); color: white; }

.noscript { margin: 32px auto; padding: 18px; max-width: 520px; text-align: center; }

@media (max-width: 380px) {
  .home-view { padding-inline: 12px; }
  .hero { padding-inline: 20px; }
  .route-card { grid-template-columns: 100px minmax(0, 1fr) 30px; gap: 11px; }
  .route-cover { width: 100px; height: 80px; }
  .route-copy strong { font-size: 15px; }
  .route-heading span { display: none; }
  .step-stage { padding-inline: 8px; }
  .step-controls { padding-inline: 8px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .route-header { padding-top: 7px; padding-bottom: 7px; }
  .icon-button { width: 36px; height: 36px; }
  .step-stage { grid-template-columns: minmax(0, 1fr) 180px; grid-template-rows: minmax(0, 1fr); align-items: center; gap: 12px; padding-block: 7px; }
  .step-instruction { padding: 16px; text-align: center; }
  .step-controls { padding-block: 7px; }
  .control-button { min-height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
