:root {
  --ink: #17342e;
  --green: #0c4a3e;
  --lime: #d6f05d;
  --paper: #f7f5ef;
  --line: #d7d9d2;
  --muted: #6f7c77;
  --orange: #ee744d;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 86px;
  padding: 0 clamp(22px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  background: var(--green);
  border-bottom: 1px solid rgba(255,255,255,.18);
}
.topbar h1 { margin: 1px 0 0; font-size: 22px; letter-spacing: .08em; }
.eyebrow { margin: 0; font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.topbar .eyebrow { color: var(--lime); }
.install-app-button { padding: 9px 14px; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; color: white; background: transparent; font-size: 12px; font-weight: 800; }
.install-app-button span { color: var(--lime); font-size: 16px; vertical-align: -1px; }

main { max-width: 1440px; margin: 0 auto; padding-bottom: 80px; }
.hero {
  min-height: 250px;
  padding: 48px clamp(22px, 5vw, 72px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  background: var(--green);
  color: white;
}
.hero h2 { margin: 12px 0 16px; max-width: 600px; font-size: clamp(38px, 5vw, 70px); line-height: 1.02; letter-spacing: -.04em; }
.hero > div > p:last-child { max-width: 510px; color: #c6d6d1; line-height: 1.8; }
.hero .eyebrow { color: var(--lime); }
.date-card { width: 96px; height: 112px; flex: 0 0 auto; display: grid; place-content: center; text-align: center; background: var(--lime); color: var(--green); transform: rotate(2deg); }
.date-card strong { font-size: 50px; line-height: 1; }
.date-card span { margin-top: 4px; font-size: 12px; font-weight: 800; }

.workspace { margin: 0 clamp(16px, 4vw, 58px); display: grid; grid-template-columns: minmax(280px, 390px) 1fr; background: white; box-shadow: 0 22px 60px rgba(22,52,46,.12); }
.planner { padding: 34px; border-right: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.section-heading > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: white; font-size: 12px; }
h3 { margin: 3px 0 0; font-size: 23px; }
.field { display: grid; gap: 8px; margin-bottom: 20px; }
.field > span, legend { font-size: 12px; font-weight: 800; }
select, input[type="time"] { width: 100%; padding: 13px 14px; color: var(--ink); background: #f4f3ee; border: 1px solid transparent; border-radius: 2px; outline: none; }
select:focus, input:focus { border-color: var(--green); }
.time-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { padding: 0; margin: 0 0 22px; border: 0; }
legend { margin-bottom: 9px; }
.legend-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.legend-row > span:last-child { display: flex; gap: 5px; }
.legend-row button { padding: 3px 7px; border: 1px solid var(--line); background: white; color: var(--green); font-size: 9px; font-weight: 800; }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span { display: block; padding: 10px 12px; text-align: center; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; font-weight: 700; }
.chips input:checked + span { border-color: var(--green); background: var(--green); color: white; }
.density-options { display: grid; gap: 7px; }
.density-options input { position: absolute; opacity: 0; pointer-events: none; }
.density-options span { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); background: white; }
.density-options strong { font-size: 12px; }
.density-options small { color: var(--muted); font-size: 10px; }
.density-options input:checked + span { border-color: var(--green); background: #edf4d2; box-shadow: inset 4px 0 0 var(--green); }
.toggle-row { margin: 4px 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.toggle-row span { display: grid; gap: 3px; font-size: 12px; }
.toggle-row small { color: var(--muted); }
.toggle-row input { appearance: none; width: 44px; height: 24px; flex: 0 0 auto; padding: 3px; border-radius: 20px; background: #c8cdc9; transition: .2s; }
.toggle-row input::before { content: ""; display: block; width: 18px; height: 18px; border-radius: 50%; background: white; transition: .2s; }
.toggle-row input:checked { background: var(--green); }
.toggle-row input:checked::before { transform: translateX(20px); }
.range-field output { float: right; color: var(--green); }
input[type="range"] { accent-color: var(--green); }
.primary-button { width: 100%; padding: 16px 18px; display: flex; justify-content: space-between; border: 0; background: var(--lime); color: var(--green); font-weight: 900; box-shadow: 5px 5px 0 var(--green); transition: .15s; }
.primary-button:hover { transform: translate(-2px,-2px); box-shadow: 7px 7px 0 var(--green); }
.primary-button:active { transform: translate(2px,2px); box-shadow: 3px 3px 0 var(--green); }
.note { margin: 18px 0 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.data-status { margin: 18px 0 0; color: var(--muted); font-size: 11px; font-weight: 800; }
.data-status span { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #d2a53a; }
.data-status.ready { color: var(--green); }
.data-status.ready span { background: #75a91c; }
.data-status.error { color: #a33c27; }
.data-status.error span { background: var(--orange); }

.map-panel { position: relative; min-width: 0; background: #f0f1eb; overflow: hidden; }
.map-toolbar { height: 80px; padding: 20px 26px; position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; background: rgba(247,245,239,.9); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.map-toolbar h3 { font-size: 16px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--green); background: white; font-weight: 900; }
.map-wrap { min-height: 640px; position: relative; }
#routeMap { display: block; width: 100%; height: 640px; background: #eef0e9; }
.legend { position: absolute; bottom: 18px; left: 18px; display: flex; gap: 16px; padding: 10px 14px; background: rgba(255,255,255,.92); font-size: 10px; font-weight: 700; }
.legend i { display: inline-block; margin-right: 6px; vertical-align: middle; }
.route-key { width: 22px; height: 4px; background: var(--green); }
.road-key { width: 22px; height: 2px; background: #b8c0b9; }
.map-attribution { position: absolute; right: 8px; bottom: 7px; padding: 3px 5px; color: #33453f; background: rgba(255,255,255,.84); font-size: 8px; text-decoration: none; }
.empty-state { position: absolute; inset: 80px 0 0; display: grid; place-content: center; text-align: center; background: rgba(240,241,235,.72); backdrop-filter: blur(2px); transition: .25s; }
.empty-state span { font-size: 46px; color: var(--green); }
.empty-state p { line-height: 1.7; }
.empty-state.hidden { opacity: 0; pointer-events: none; }

.result-panel { margin: 28px clamp(16px, 4vw, 58px) 0; padding: 32px; background: white; box-shadow: 0 16px 40px rgba(22,52,46,.08); }
.summary { display: grid; grid-template-columns: repeat(5, 1fr) auto; align-items: center; gap: 18px; padding: 20px 24px; background: var(--green); color: white; }
.summary div { display: grid; gap: 5px; }
.summary span { color: #b9cbc5; font-size: 10px; }
.summary strong { font-size: 23px; }
.secondary-button { padding: 14px 20px; border: 0; background: var(--lime); color: var(--green); font-weight: 900; }
.itinerary-heading { margin: 32px 0 18px; display: flex; align-items: flex-end; justify-content: space-between; }
.itinerary-heading button { padding: 8px 12px; border: 1px solid var(--line); background: white; color: var(--green); font-size: 12px; font-weight: 800; }
.course-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 18px; }
.course-tabs button { min-width: 108px; padding: 11px 13px; display: grid; gap: 3px; border: 1px solid var(--line); background: white; color: var(--ink); text-align: left; }
.course-tabs button strong { font-size: 12px; }
.course-tabs button small { color: var(--muted); font-size: 9px; }
.course-tabs button.active { border-color: var(--green); background: #edf4d2; box-shadow: inset 0 -3px 0 var(--green); }
#itinerary { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
#itinerary li { display: grid; grid-template-columns: 70px 44px 1fr auto; align-items: center; gap: 16px; padding: 16px 8px; border-bottom: 1px solid var(--line); }
.stop-time { font-variant-numeric: tabular-nums; font-weight: 900; }
.stop-index { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: white; font-size: 11px; }
.stop-copy { display: grid; gap: 4px; }
.stop-copy small, .stop-meta { color: var(--muted); font-size: 11px; }
.quiet-badge { color: var(--orange); font-weight: 800; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 28px; padding: 12px 18px; border-radius: 999px; background: var(--ink); color: white; font-size: 12px; transform: translate(-50%, 120px); transition: .3s; box-shadow: 0 10px 30px rgba(0,0,0,.22); }
.toast.show { transform: translate(-50%, 0); }

.navigation-overlay { position: fixed; z-index: 50; inset: 0; overflow-y: auto; color: white; background: #092f28; }
.nav-header { min-height: 72px; padding: 14px max(18px, env(safe-area-inset-right)) 14px max(18px, env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.15); }
.nav-header .eyebrow { color: var(--lime); }
.nav-header strong { display: block; margin-top: 3px; font-size: 18px; }
.nav-header button { width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; color: white; background: transparent; font-size: 25px; }
.nav-preflight { min-height: calc(100dvh - 72px); padding: 24px; display: grid; place-items: center; }
.nav-preflight-card { width: min(480px, 100%); padding: 30px; color: var(--ink); background: var(--paper); text-align: center; }
.nav-pin { width: 62px; height: 62px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--lime); font-size: 30px; font-weight: 900; }
.nav-preflight h2 { margin: 0 0 12px; font-size: 28px; }
.nav-preflight p { color: var(--muted); font-size: 13px; line-height: 1.8; }
.nav-warning { margin: 20px 0; padding: 14px; color: #8b361f; background: #fff0e8; border-left: 4px solid var(--orange); font-size: 12px; line-height: 1.7; text-align: left; }
.nav-start-button, .nav-demo-button { width: 100%; padding: 16px; border: 0; font-weight: 900; }
.nav-start-button { color: var(--green); background: var(--lime); }
.nav-demo-button { margin-top: 10px; color: var(--green); background: white; border: 1px solid var(--line); }
.nav-dashboard { width: min(760px, 100%); min-height: calc(100dvh - 72px); margin: 0 auto; padding: 18px max(18px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
.nav-status-row { display: flex; justify-content: space-between; color: #bed0ca; font-size: 11px; }
.nav-gps-status i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #d6a647; }
.nav-gps-status.active i { background: var(--lime); box-shadow: 0 0 0 4px rgba(214,240,93,.12); }
.off-route-alert { margin: 16px 0 0; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: white; background: #b54c32; font-size: 12px; font-weight: 800; }
.off-route-alert button { flex: 0 0 auto; padding: 7px 10px; border: 1px solid rgba(255,255,255,.5); color: white; background: transparent; font-size: 10px; font-weight: 900; }
.nav-instruction { min-height: 200px; padding: 28px 0 20px; display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 20px; }
.nav-arrow { width: 104px; height: 104px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--lime); font-size: 66px; line-height: 1; }
.nav-instruction span { color: var(--lime); font-size: 16px; font-weight: 900; }
.nav-instruction h2 { margin: 7px 0; font-size: clamp(26px, 6vw, 44px); line-height: 1.18; }
.nav-instruction p { margin: 0; color: #c5d4d0; }
.nav-progress-track { height: 8px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.14); }
.nav-progress-track span { display: block; width: 0; height: 100%; background: var(--lime); transition: width .35s; }
.nav-metrics { padding: 22px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; }
.nav-metrics div { padding: 14px; display: grid; gap: 4px; background: rgba(255,255,255,.07); text-align: center; }
.nav-metrics span { color: #b5c8c2; font-size: 10px; }
.nav-metrics strong { font-size: 20px; }
.nav-map-toolbar { width: min(100%, 520px); margin: 0 auto 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nav-map-toolbar > span { color: #bed0ca; font-size: 10px; font-weight: 800; }
.nav-map-toolbar > div { display: flex; gap: 4px; }
.nav-map-toolbar button { padding: 7px 9px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; color: white; background: transparent; font-size: 10px; font-weight: 800; }
.nav-map-toolbar button.active { color: var(--green); background: var(--lime); border-color: var(--lime); }
.nav-map-wrap { width: min(100%, 520px); margin: 0 auto; position: relative; }
#navigationMap { width: 100%; height: auto; aspect-ratio: 1; display: block; background: #e9ede7; border: 1px solid rgba(255,255,255,.12); }
.nav-heading-label { position: absolute; top: 8px; left: 50%; z-index: 2; padding: 4px 9px; color: white; background: rgba(12,74,62,.88); border-radius: 999px; font-size: 9px; font-weight: 900; transform: translateX(-50%); }
.nav-attribution { position: absolute; right: 5px; bottom: 4px; z-index: 2; padding: 2px 4px; color: #34463f; background: rgba(255,255,255,.78); font-size: 8px; text-decoration: none; }
.nav-controls { padding-top: 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.nav-controls button { min-height: 48px; border: 1px solid rgba(255,255,255,.25); color: white; background: transparent; font-size: 12px; font-weight: 800; }
.nav-controls button:last-child { color: #ffb9a8; border-color: rgba(255,185,168,.4); }
.nav-legal { margin: 16px 0 0; color: #9fb5ae; font-size: 10px; line-height: 1.6; text-align: center; }
body.navigation-open { overflow: hidden; }
.install-overlay { position: fixed; z-index: 70; inset: 0; padding: 24px; display: grid; place-items: center; background: rgba(5,31,26,.82); backdrop-filter: blur(8px); }
.install-card { width: min(460px, 100%); padding: 30px; position: relative; color: var(--ink); background: var(--paper); box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.install-card > img { display: block; margin: 0 auto 14px; border-radius: 18px; }
.install-card > .eyebrow { color: var(--green); text-align: center; }
.install-card h2 { margin: 8px 0 18px; font-size: 25px; text-align: center; }
.install-card p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.install-close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--green); background: white; font-size: 22px; }
.install-card ol { padding-left: 22px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.ios-steps { padding: 0 !important; display: grid; gap: 8px; list-style: none; }
.ios-steps li { padding: 12px; display: flex; align-items: center; gap: 10px; background: white; border: 1px solid var(--line); }
.ios-steps strong { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green); }
.install-note { padding: 10px; color: #8b361f !important; background: #fff0e8; }

@media (max-width: 850px) {
  .hero { min-height: 230px; align-items: center; }
  .hero h2 { font-size: 44px; }
  .workspace { grid-template-columns: 1fr; }
  .planner { border-right: 0; border-bottom: 1px solid var(--line); }
  .map-wrap, #routeMap { min-height: 520px; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .secondary-button { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .topbar { height: 72px; }
  .hero { min-height: 210px; padding-top: 28px; padding-bottom: 34px; }
  .hero h2 { font-size: 38px; }
  .hero > div > p:last-child { font-size: 12px; }
  .date-card { width: 70px; height: 85px; }
  .date-card strong { font-size: 38px; }
  .workspace { margin: 0; }
  .planner { padding: 27px 22px; }
  .map-toolbar { height: 70px; }
  .map-wrap, #routeMap { min-height: 470px; }
  .result-panel { margin: 20px 0 0; padding: 22px 16px; }
  .summary { gap: 14px; padding: 18px; }
  .summary strong { font-size: 17px; }
  #itinerary li { grid-template-columns: 56px 34px 1fr; gap: 10px; }
  .stop-meta { grid-column: 3; }
  .nav-instruction { grid-template-columns: 82px 1fr; gap: 14px; min-height: 170px; }
  .nav-arrow { width: 76px; height: 76px; font-size: 48px; }
  .nav-instruction h2 { font-size: 27px; }
  .nav-metrics strong { font-size: 16px; }
  .nav-map-toolbar { align-items: flex-start; flex-direction: column; }
  .nav-controls { grid-template-columns: 1fr 1fr; }
  .nav-controls button:last-child { grid-column: 1 / -1; }
}
