:root {
    color-scheme: light;
    --ink: #17231c;
    --muted: #68746d;
    --line: #dce3de;
    --page: #f6f8f6;
    --surface: #ffffff;
    --soft: #edf5f0;
    --green: #287a56;
    --green-dark: #1f6144;
    --green-light: #dff0e6;
    --amber: #9a6321;
    --amber-soft: #fff4de;
    --red: #a33d39;
    --red-soft: #fdeceb;
    --shadow: 0 18px 45px rgba(29, 59, 42, .08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--page);
    color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--page); color: var(--ink); }
button, input, select { font: inherit; }
button, select, input[type="checkbox"], input[type="radio"] { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 72px;
    padding: 12px clamp(18px, 4vw, 64px);
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto minmax(150px, 1fr);
    align-items: center;
    gap: 24px;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; width: fit-content; }
.brand-logo { width: 44px; height: 44px; flex: 0 0 auto; object-fit: contain; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; font-weight: 750; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.main-nav { display: flex; gap: 4px; padding: 4px; background: var(--page); border-radius: 12px; }
.nav-button { min-height: 38px; padding: 0 15px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; }
.nav-button.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 3px 12px rgba(30, 55, 40, .09); }
.header-actions { justify-self: end; display: flex; align-items: center; gap: 9px; }
.install-button { min-height: 34px; padding: 0 12px; border: 1px solid var(--green); border-radius: 9px; background: var(--surface); color: var(--green-dark); font-size: 11px; font-weight: 750; }
.install-button:hover { background: var(--soft); }
.install-button:focus-visible { outline: 3px solid rgba(40, 122, 86, .2); outline-offset: 2px; }
.environment-badge { justify-self: end; padding: 8px 10px; border-radius: 8px; background: var(--amber-soft); color: var(--amber); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.pwa-network-status { position: sticky; top: 72px; z-index: 45; padding: 10px 18px; border-bottom: 1px solid #e7bd6e; background: var(--amber-soft); color: #724713; text-align: center; font-size: 12px; font-weight: 650; }

main { min-height: calc(100vh - 130px); }
.tab-panel { width: min(1380px, calc(100% - 36px)); margin: 0 auto; padding: 46px 0 72px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(330px, .6fr); gap: 40px; align-items: end; margin-bottom: 34px; }
.eyebrow { display: inline-block; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.hero h1, .page-heading h1 { margin: 10px 0 12px; font-size: clamp(34px, 5vw, 62px); line-height: 1.04; letter-spacing: -.045em; font-weight: 780; }
.hero p, .page-heading p { margin: 0; max-width: 740px; color: var(--muted); font-size: 16px; line-height: 1.65; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--line); }
.hero-stats div { padding: 18px 15px; background: var(--surface); }
.hero-stats strong, .hero-stats span { display: block; }
.hero-stats strong { font-size: 22px; font-weight: 760; }
.hero-stats span { color: var(--muted); font-size: 11px; margin-top: 4px; }

.planner-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
.planner-main { display: grid; gap: 16px; }
.form-section, .aside-card, .result-card, .data-card, .method-notes article {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.form-section { padding: clamp(20px, 3vw, 30px); }
.section-heading { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 22px; }
.section-heading > span { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; background: var(--soft); color: var(--green); font-size: 13px; font-weight: 800; }
.section-heading h2, .section-heading p, .aside-card h2 { margin: 0; }
.section-heading h2, .aside-card h2 { font-size: 18px; font-weight: 760; }
.section-heading p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.field-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.field { display: grid; gap: 7px; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 650; }
.field input, .field select, .currency-input { width: 100%; min-height: 45px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--page); color: var(--ink); outline: none; font-size: 13px; }
.field input:focus, .field select:focus, .currency-input:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(40, 122, 86, .12); }
.currency-input { display: flex; align-items: center; gap: 8px; }
.currency-input span { color: var(--muted); }
.currency-input input { min-height: 42px; padding: 0; border: 0; background: transparent; box-shadow: none !important; }
.check-row { display: flex; gap: 11px; align-items: flex-start; margin-top: 16px; padding: 13px; border-radius: 12px; background: var(--soft); }
.check-row input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--green); }
.check-row strong, .check-row small { display: block; }
.check-row strong { font-size: 13px; }
.check-row small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.destination-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.destination-card { position: relative; min-height: 96px; padding: 14px; display: flex; gap: 11px; align-items: flex-start; border: 1px solid var(--line); border-radius: 13px; background: var(--page); transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.destination-card:hover { transform: translateY(-1px); border-color: #a9b9ae; }
.destination-card input { position: absolute; opacity: 0; pointer-events: none; }
.destination-check { width: 24px; height: 24px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); color: transparent; background: var(--surface); font-size: 12px; }
.destination-card:has(input:checked) { border-color: #8fb8a1; background: #f1f8f4; }
.destination-card input:checked + .destination-check { color: white; border-color: var(--green); background: var(--green); }
.destination-copy { min-width: 0; }
.destination-copy strong, .destination-copy small, .destination-copy em { display: block; }
.destination-copy strong { font-size: 13px; line-height: 1.3; }
.destination-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.destination-copy em { width: fit-content; margin-top: 10px; padding: 4px 7px; border-radius: 7px; font-size: 9px; font-weight: 750; font-style: normal; }
.destination-copy em.verified { color: var(--green-dark); background: var(--green-light); }
.destination-copy em.pending { color: var(--amber); background: var(--amber-soft); }

.pace-fieldset { margin: 18px 0 0; padding: 0; border: 0; }
.pace-fieldset legend { margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.pace-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pace-grid label { position: relative; }
.pace-grid input { position: absolute; opacity: 0; }
.pace-grid span { min-height: 68px; padding: 13px; display: grid; align-content: center; border: 1px solid var(--line); border-radius: 12px; background: var(--page); }
.pace-grid strong, .pace-grid small { display: block; }
.pace-grid strong { font-size: 13px; }
.pace-grid small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.pace-grid input:checked + span { border-color: var(--green); background: #f1f8f4; box-shadow: inset 0 0 0 1px var(--green); }

.sticky-card { position: sticky; top: 92px; }
.aside-card { padding: 22px; }
.aside-card h2 { margin-top: 7px; }
.input-summary { margin: 18px 0; display: grid; gap: 12px; }
.input-summary div { display: flex; justify-content: space-between; gap: 14px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.input-summary span { color: var(--muted); font-size: 11px; }
.input-summary strong { font-size: 12px; text-align: right; }
.notice { display: flex; gap: 9px; padding: 12px; border-radius: 11px; background: var(--amber-soft); color: #6d4a1f; }
.notice > span { width: 20px; height: 20px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: 11px; font-weight: 800; }
.notice p { margin: 0; font-size: 11px; line-height: 1.45; }
.primary-button { width: 100%; min-height: 50px; margin-top: 16px; padding: 0 17px; display: flex; justify-content: space-between; align-items: center; border: 0; border-radius: 12px; background: var(--green); color: white; font-weight: 750; }
.primary-button:hover { background: var(--green-dark); }
.primary-button:disabled { opacity: .5; cursor: not-allowed; }
.privacy-note { margin: 11px 0 0; color: var(--muted); font-size: 10px; text-align: center; }

.result-section { scroll-margin-top: 88px; margin-top: 30px; }
.result-loading { min-height: 180px; display: flex; justify-content: center; align-items: center; gap: 15px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.result-loading strong, .result-loading small { display: block; }
.result-loading small { margin-top: 4px; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-heading { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 18px; }
.result-heading h2 { margin: 7px 0 4px; font-size: 28px; }
.result-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.status-pill { padding: 9px 12px; border-radius: 9px; font-size: 10px; font-weight: 850; letter-spacing: .05em; }
.status-pill.is-feasible { background: var(--green-light); color: var(--green-dark); }
.status-pill.is-infeasible { background: var(--red-soft); color: var(--red); }
.summary-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.summary-cards div { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.summary-cards span, .summary-cards strong { display: block; }
.summary-cards span { color: var(--muted); font-size: 11px; }
.summary-cards strong { margin-top: 5px; font-size: 18px; }
.result-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(380px, .88fr); gap: 14px; align-items: start; }
.result-map-card { grid-column: 1 / -1; }
.result-column { min-width: 0; display: grid; gap: 14px; }
.result-card { min-width: 0; max-width: 100%; padding: 20px; box-shadow: none; }
.card-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-heading h3, .card-heading p { margin: 0; }
.card-heading h3 { font-size: 16px; }
.card-heading p { margin-top: 4px; color: var(--muted); font-size: 11px; }
.day-tabs { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.day-tab { min-height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--page); color: var(--muted); font-size: 11px; font-weight: 700; }
.day-tab.is-active { border-color: var(--green); background: var(--green); color: white; }
.day-meta { display: flex; justify-content: space-between; gap: 14px; padding: 11px 13px; border-radius: 10px; background: var(--soft); font-size: 11px; }
.timeline { margin-top: 15px; }
.timeline-item { display: grid; grid-template-columns: 48px 16px 1fr; gap: 9px; min-height: 76px; }
.timeline-item time { padding-top: 1px; color: var(--green); font-size: 11px; font-weight: 750; }
.timeline-dot { position: relative; display: flex; justify-content: center; }
.timeline-dot::before { content: ""; position: absolute; top: 6px; bottom: -8px; width: 1px; background: var(--line); }
.timeline-dot::after { content: ""; position: relative; width: 9px; height: 9px; margin-top: 4px; border: 2px solid var(--surface); border-radius: 50%; background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.timeline-item:last-child .timeline-dot::before { bottom: 58px; }
.timeline-item strong, .timeline-item small { display: block; }
.timeline-item strong { font-size: 12px; }
.timeline-item small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.timeline-item p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.warning-list { display: grid; gap: 8px; }
.warning-list div { display: flex; gap: 9px; padding: 11px; border-radius: 10px; background: var(--amber-soft); color: #6d4a1f; }
.warning-list div.is-ok { color: var(--green-dark); background: var(--green-light); }
.warning-list span { font-weight: 850; }
.warning-list p { margin: 0; font-size: 11px; line-height: 1.45; }
details { margin-top: 14px; font-size: 11px; }
details summary { color: var(--green); font-weight: 750; }
details ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.6; }
#route-map { height: 420px; overflow: hidden; border-radius: 12px; background: var(--soft); }
.route-marker-wrapper, .route-arrow-wrapper { border: 0; background: transparent; }
.route-number-marker, .route-origin-marker, .route-arrow { display: grid; place-items: center; }
.route-number-marker { width: 34px; height: 34px; border: 3px solid #fff; border-radius: 50% 50% 50% 12px; background: var(--green); color: #fff; box-shadow: 0 5px 14px rgba(24, 61, 40, .28); font-size: 12px; font-weight: 850; transform: rotate(-45deg); }
.route-number-marker b { display: block; font: inherit; transform: rotate(45deg); }
.route-number-marker.is-last { background: #b47a22; }
.route-origin-marker { width: 38px; height: 38px; border: 3px solid #fff; border-radius: 12px; background: #155f78; color: #fff; box-shadow: 0 5px 14px rgba(20, 63, 77, .3); font-size: 12px; font-weight: 850; }
.route-arrow { width: 24px; height: 24px; border: 2px solid #fff; border-radius: 50%; background: var(--green); color: #fff; box-shadow: 0 3px 8px rgba(24, 61, 40, .2); font-size: 13px; font-weight: 900; transform-origin: center; }
.route-arrow.is-return { background: #b47a22; }
.route-map-legend { display: grid; gap: 6px; min-width: 118px; padding: 10px; border: 1px solid rgba(23, 35, 28, .1); border-radius: 10px; background: rgba(255, 255, 255, .94); box-shadow: 0 6px 18px rgba(23, 35, 28, .12); color: var(--ink); }
.route-map-legend strong { font-size: 10px; }
.route-map-legend span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.route-map-legend i { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 7px; color: #fff; font-size: 8px; font-style: normal; font-weight: 850; }
.route-map-legend .legend-origin { background: #155f78; }
.route-map-legend .legend-stop { border-radius: 50%; background: var(--green); }
.route-map-legend .legend-return { background: #b47a22; }
.route-list { width: 100%; min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.route-list li { min-width: 0; max-width: 100%; overflow: hidden; border-radius: 10px; background: var(--page); }
.route-stop-button { width: 100%; min-width: 0; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 9px; align-items: center; padding: 9px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: inherit; text-align: left; }
.route-stop-button:hover { border-color: #b7c9bd; background: var(--soft); }
.route-stop-button:focus-visible { outline: 3px solid rgba(40, 122, 86, .18); border-color: var(--green); }
.route-stop-button > div { min-width: 0; }
.route-list-marker, .map-index { width: 26px; height: 26px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; background: var(--green); color: white; font-size: 10px; font-weight: 800; }
.route-list-marker.is-origin { background: #155f78; }
.route-list-marker.is-last, .route-list-marker.is-return { background: #b47a22; }
.route-list strong, .route-list small { display: block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; word-break: normal; }
.route-list strong { font-size: 10px; }
.route-list small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.cost-list { display: grid; gap: 9px; }
.cost-list div, .cost-total { display: flex; justify-content: space-between; gap: 14px; font-size: 11px; }
.cost-list div { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.cost-list span { color: var(--muted); }
.cost-list strong { font-weight: 700; }
.cost-total { margin-top: 13px; font-size: 14px; font-weight: 800; }

.system-alert { width: min(1380px, calc(100% - 36px)); margin: 18px auto 0; padding: 13px 15px; border-radius: 11px; font-size: 12px; }
.system-alert-error { color: var(--red); background: var(--red-soft); border: 1px solid #f2c6c3; }
.page-heading { max-width: 900px; margin-bottom: 30px; }
.data-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.data-card { padding: 18px; box-shadow: none; }
.data-card-head { display: flex; gap: 11px; align-items: center; }
.data-card h2, .data-card p { margin: 0; }
.data-card h2 { font-size: 14px; }
.data-card p { margin-top: 3px; color: var(--muted); font-size: 10px; }
.data-card dl { margin: 17px 0; display: grid; gap: 10px; }
.data-card dl div { display: grid; gap: 3px; }
.data-card dt { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.data-card dd { margin: 0; font-size: 11px; line-height: 1.45; }
.source-links { display: flex; gap: 8px; flex-wrap: wrap; }
.source-links a { padding: 6px 8px; border-radius: 7px; background: var(--soft); color: var(--green-dark); font-size: 9px; font-weight: 700; text-decoration: none; }
.method-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; gap: 14px; align-items: center; }
.method-flow > div { min-height: 140px; padding: 18px; display: grid; align-content: center; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.method-flow > b { color: var(--green); }
.method-flow span, .method-flow strong, .method-flow small { display: block; }
.method-flow span { color: var(--green); font-size: 11px; font-weight: 800; }
.method-flow strong { margin-top: 12px; font-size: 15px; }
.method-flow small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.method-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.method-notes article { padding: 22px; box-shadow: none; }
.method-notes h2 { margin: 0; font-size: 16px; }
.method-notes ul { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.8; }

footer { min-height: 58px; padding: 16px clamp(18px, 4vw, 64px); display: flex; justify-content: space-between; gap: 18px; align-items: center; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 10px; }

@media (max-width: 1050px) {
    .site-header { grid-template-columns: 1fr auto; }
    .main-nav { order: 3; grid-column: 1 / -1; justify-content: center; }
    .header-actions { grid-column: 2; grid-row: 1; }
    .hero { grid-template-columns: 1fr; }
    .planner-layout { grid-template-columns: 1fr; }
    .sticky-card { position: static; }
    .result-grid { grid-template-columns: 1fr; }
    .route-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .site-header { position: static; padding: 12px 16px; gap: 12px; }
    .environment-badge { display: none; }
    .pwa-network-status { position: static; }
    .main-nav { overflow-x: auto; justify-content: flex-start; width: calc(100vw - 32px); }
    .nav-button { white-space: nowrap; }
    .tab-panel { width: min(100% - 24px, 1380px); padding: 30px 0 52px; }
    .hero h1, .page-heading h1 { font-size: 38px; }
    .hero-stats, .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .field-grid, .destination-grid, .data-grid { grid-template-columns: 1fr 1fr; }
    .result-heading { align-items: flex-start; flex-direction: column; }
    .method-flow { grid-template-columns: 1fr; }
    .method-flow > b { transform: rotate(90deg); justify-self: center; }
}

@media (max-width: 520px) {
    .brand small { display: none; }
    .install-button { padding: 0 9px; font-size: 10px; }
    .hero h1, .page-heading h1 { font-size: 32px; }
    .hero p, .page-heading p { font-size: 14px; }
    .hero-stats, .field-grid, .destination-grid, .pace-grid, .summary-cards, .route-list, .data-grid, .method-notes { grid-template-columns: 1fr; }
    .form-section, .aside-card, .result-card { border-radius: 14px; }
    .day-meta, footer { align-items: flex-start; flex-direction: column; }
    #route-map { height: 280px; }
}

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

