:root {
    color-scheme: light;
    --bg: #f3f6fa;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #071323;
    --muted: #536273;
    --teal: #047c7f;
    --teal-dark: #0f4f50;
    --teal-soft: #e5f7f6;
    --blue: #1f5f99;
    --amber: #a15c00;
    --line: #cfe1e7;
    --line-strong: #8fb8c2;
    --warning-bg: #fff7e8;
    --warning-line: #f0c87d;
    --shadow: 0 14px 36px rgba(13, 39, 58, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}

.shell {
    width: min(1160px, calc(100% - 32px));
    margin: 20px auto 40px;
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.crumb,
.crumb-current {
    min-height: 38px;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--teal-dark);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    text-align: center;
}

.crumb-current {
    color: var(--muted);
    border-style: dashed;
    background: var(--surface-soft);
}

.crumb-separator {
    color: var(--teal);
    font-weight: 800;
}

.panel {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 18px;
}

.list-header,
.line-header,
.trip-title-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
}

.list-header,
.line-header,
.trip-header {
    margin-bottom: 16px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--teal);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    max-width: 920px;
    font-size: 24px;
    line-height: 1.25;
}

h2 {
    font-size: 18px;
    line-height: 1.3;
}

.result-count,
.section-title span {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.search-panel {
    margin: 16px 0 18px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.search-label {
    display: block;
    margin-bottom: 8px;
    color: var(--ink);
    font-weight: 800;
}

.search {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
}

.search:focus {
    border-color: var(--teal);
    outline: none;
    box-shadow: 0 0 0 3px var(--teal-soft);
}

.line-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.line-card {
    position: relative;
    display: grid;
    gap: 8px;
    min-height: 126px;
    padding: 16px 46px 16px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
}

.line-card:hover,
.line-card:focus-visible,
.time-button:hover,
.time-button:focus-visible,
.period-tab:hover,
.period-tab:focus-visible,
.map-button:hover,
.map-button:focus-visible {
    border-color: var(--teal);
    outline: none;
    box-shadow: 0 0 0 3px var(--teal-soft);
}

.line-card-main {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.line-code {
    color: var(--ink);
    font-size: 20px;
    font-weight: 900;
}

.line-led {
    border-radius: 999px;
    background: var(--teal-soft);
    color: var(--teal-dark);
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
}

.line-name {
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.35;
}

.line-route {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
}

.line-card-arrow {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    color: var(--teal);
    font-size: 30px;
    font-weight: 400;
}

.line-summary {
    display: grid;
    gap: 7px;
    min-width: 260px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.35;
    text-align: right;
}

.schedule-section {
    margin-top: 16px;
}

.section-title {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.period-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.period-tab {
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--teal-dark);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.period-tab.active {
    background: var(--surface);
    color: var(--teal-dark);
    border-color: var(--teal);
    box-shadow: inset 0 0 0 1px var(--teal);
}

.time-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 10px;
}

.time-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--ink);
    font-size: 20px;
    font-weight: 900;
    text-decoration: none;
}

.time-map-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--blue);
}

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

.alert {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--warning-line);
    border-radius: 10px;
    background: var(--warning-bg);
    color: #593600;
    font-size: 14px;
    line-height: 1.45;
}

.trip-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 10px;
}

.trip-meta span {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    padding: 7px 11px;
    font-size: 14px;
}

.trip-type {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.map-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--teal);
    border-radius: 10px;
    background: var(--teal-dark);
    color: #fff;
    padding: 9px 13px;
    font-size: 14px;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
}

.map-button-icon {
    position: relative;
    width: 17px;
    height: 17px;
    border: 2px solid currentColor;
    border-radius: 4px;
}

.map-button-icon::before,
.map-button-icon::after {
    content: "";
    position: absolute;
    top: 2px;
    bottom: 2px;
    width: 2px;
    background: currentColor;
}

.map-button-icon::before {
    left: 5px;
}

.map-button-icon::after {
    right: 5px;
}

.route-box {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
    padding: 16px;
}

.timeline {
    position: relative;
    display: grid;
    gap: 0;
    margin: 14px 0 0;
    padding-left: 32px;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 10px;
    width: 3px;
    border-radius: 999px;
    background: #14956d;
}

.stop {
    position: relative;
    min-height: 50px;
    padding: 0 0 16px;
}

.stop:last-child {
    padding-bottom: 0;
}

.stop::before {
    content: "";
    position: absolute;
    top: 1px;
    left: -31px;
    width: 19px;
    height: 19px;
    border: 3px solid var(--surface-soft);
    border-radius: 50%;
    background: var(--teal-dark);
}

.stop-main {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: baseline;
    color: var(--ink);
    font-weight: 900;
    line-height: 1.35;
}

.stop-time {
    color: var(--teal-dark);
}

.stop-label {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
}

.empty,
.loading,
.error {
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

.footer-note {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

@media (max-width: 720px) {
    .shell {
        width: min(100% - 20px, 1160px);
        margin-top: 12px;
    }

    .panel {
        padding: 14px;
    }

    .list-header,
    .line-header,
    .trip-title-row,
    .section-title {
        align-items: stretch;
        flex-direction: column;
    }

    .line-summary {
        min-width: 0;
        text-align: left;
    }

    .crumb,
    .crumb-current {
        min-height: 36px;
        padding: 8px 12px;
    }

    h1 {
        font-size: 21px;
    }

    .line-list {
        grid-template-columns: 1fr;
    }

    .period-tabs,
    .time-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .map-button {
        justify-content: center;
        width: 100%;
    }
}

@media (max-width: 420px) {
    .period-tabs,
    .time-grid {
        grid-template-columns: 1fr;
    }
}
