:root {
    color-scheme: light dark;
    --bg: #f6f7f5;
    --surface: #ffffff;
    --text: #1b1f1d;
    --muted: #5b6460;
    --line: #dfe3e0;
    --accent: #0f7a4f;
    --accent-text: #ffffff;
    --accent-soft: #e3f2ea;
    --warn: #9a5b00;
    --radius: 12px;
    font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121514;
        --surface: #1b1f1d;
        --text: #e8ece9;
        --muted: #9aa49f;
        --line: #2e3532;
        --accent: #3fbf87;
        --accent-text: #0b1f16;
        --accent-soft: #183327;
        --warn: #e0a64a;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
}

.page {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.intro h1 { margin: 0 0 4px; font-size: 1.6rem; line-height: 1.2; }
.intro p { margin: 0 0 20px; color: var(--muted); }

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    display: grid;
    gap: 16px;
}

.where { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.place { display: grid; gap: 4px; flex: 1 1 200px; }
.place label, .field span, legend { font-size: 0.85rem; color: var(--muted); }

.combo { position: relative; }
.combo input {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    font: inherit;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
}
.combo input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.combo-list {
    position: absolute;
    z-index: 10;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 264px;
    overflow-y: auto;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
}
.combo-list li { padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.combo-list li[aria-selected="true"], .combo-list li[role="option"]:hover { background: var(--accent-soft); }
.combo-list .combo-empty { color: var(--muted); cursor: default; }

button, select {
    font: inherit;
    color: inherit;
    min-height: 44px;
    border-radius: 10px;
}

select {
    width: 100%;
    padding: 0 12px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.primary {
    flex: 1 1 220px;
    padding: 0 18px;
    border: 0;
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 600;
    cursor: pointer;
}
.primary:disabled { opacity: 0.6; cursor: progress; }

.hint { margin: -8px 0 0; min-height: 1.2em; font-size: 0.9rem; color: var(--muted); }
.hint:empty { display: none; }
.hint a { color: var(--accent); }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }

.chips, .segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .segmented label { position: relative; }

.chip input, .segmented input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chip span, .segmented span {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
}

.chip input:checked + span, .segmented input:checked + span {
    background: var(--accent-soft);
    border-color: var(--accent);
    font-weight: 600;
}

.chip input:focus-visible + span, .segmented input:focus-visible + span,
button:focus-visible, select:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.row { display: grid; gap: 16px; grid-template-columns: 1fr; }
.field { display: grid; gap: 4px; }

@media (min-width: 640px) {
    .row { grid-template-columns: 2fr 1fr 1fr; align-items: end; }
}

.summary { margin: 20px 0 12px; color: var(--muted); }

.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.results[aria-busy="true"] { opacity: 0.5; }

.station {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: grid;
    gap: 6px;
}

.station-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.station-title { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* Logos are drawn for light backgrounds, so they sit on a white tile in dark mode too. */
.brand-logo {
    flex: none;
    width: 32px;
    height: 32px;
    padding: 3px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--line);
    object-fit: contain;
}
.brand-initials {
    display: inline-grid;
    place-items: center;
    padding: 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-soft);
}
.station h3 { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.distance { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }

.facts { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.9rem; color: var(--muted); }
.status-operational { color: var(--accent); }
.status-under_repair, .status-coming_soon { color: var(--warn); }

.address { margin: 0; overflow-wrap: anywhere; }
.price { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.price.missing { font-weight: 400; color: var(--muted); }

.connectors { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.connectors li {
    font-size: 0.85rem;
    padding: 2px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

.route { justify-self: start; color: var(--accent); font-weight: 600; }

.footer { margin-top: 32px; font-size: 0.85rem; color: var(--muted); }
.footer p { margin: 0 0 6px; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
