:root {
    --bg: #f2f4f6;
    --card-bg: oklch(99% 0.004 250);
    --border: #e5e8eb;
    --text: #191f28;
    --text-muted: #8b95a1;
    --accent: #3182f6;
    --accent-hover: #1b64da;
    --accent-soft: #eaf2ff;
    --error: #f04452;
    --error-bg: #fff0f1;
    --safe: #17953a;
    --safe-bg: #eafbee;
    --shadow-color: 25, 31, 40;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --font-body: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Segoe UI Mono", "Roboto Mono", monospace;
    --font-display: "Do Hyeon", var(--font-body);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--bg);
    background-image: url('/img/map-bg-f0a0d2ce6b3a04b9ab3870881639c6cf.svg');
    background-size: cover;
    background-position: center top;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.6;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.page {
    max-width: 480px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.main-panel,
.alert,
.candidates,
.result {
    animation: fadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.alert,
.candidates,
.result {
    animation-delay: 0.06s;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/*
  검색 패널을 결과 영역보다 위 레이어에 둔다. 시/분 드롭다운이 패널 밖으로 펼쳐지는데,
  등장 애니메이션(fadeInUp)의 transform 때문에 .main-panel과 .result가 각각 별도의 스택
  컨텍스트가 되어 드롭다운의 z-index가 패널 안에 갇힌다 - 그래서 드롭다운 아래쪽이 뒤따르는
  택시/경로 카드에 가려졌다. 두 형제의 순서를 여기서 정해줘야 드롭다운이 온전히 보인다.
*/
.main-panel {
    position: relative;
    z-index: 2;
    background: var(--card-bg);
    border-radius: 24px;
    padding: 28px 24px 24px;
    margin-bottom: 16px;
    box-shadow: 0 8px 28px rgba(var(--shadow-color), 0.1);
}

.app-header {
    margin-bottom: 28px;
}

.logo-badge {
    display: block;
    height: 56px;
    width: auto;
    object-fit: contain;
    margin: 0 auto 16px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
    margin: 0;
    line-height: 1.5;
}

.disclaimer {
    text-shadow: 0 1px 14px rgba(255, 255, 255, 0.95), 0 1px 3px rgba(255, 255, 255, 0.9);
}

.tabs {
    display: flex;
    gap: 4px;
    background: var(--border);
    border-radius: 9999px;
    padding: 4px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    display: block;
    text-align: center;
    padding: 10px 8px;
    border-radius: 9999px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    color: var(--text-muted);
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.1s var(--ease-out);
}

.tab:active {
    transform: scale(0.97);
}

.tab-active {
    background: var(--card-bg);
    color: var(--accent);
    box-shadow: 0 1px 3px rgba(var(--shadow-color), 0.1);
}

.tab-disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.schedule-note {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0 0 20px;
}

.schedule-note b {
    color: var(--text);
    font-weight: 700;
}

.schedule-note-warn {
    color: var(--error);
    margin-top: -14px;
}

.calendar {
    display: none;
    background: var(--bg);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 16px;
}

.calendar.is-open {
    display: block;
}

.calendar-title {
    margin: 0 0 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-weekdays {
    margin-bottom: 6px;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
}

.calendar-sat {
    color: var(--accent) !important;
}

.calendar-sun {
    color: var(--error) !important;
}

.calendar-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    font-variant-numeric: tabular-nums;
    transition: background 0.15s var(--ease-out);
}

.calendar-cell:hover {
    background: var(--accent-soft);
}

.calendar-cell-blank {
    visibility: hidden;
}

/* 지난 날짜는 막차를 계산할 의미가 없어 고를 수 없게 둔다. */
.calendar-cell-disabled {
    color: var(--border);
    cursor: not-allowed;
}

.calendar-cell-saturday {
    color: var(--accent);
}

.calendar-cell-holiday {
    color: var(--error);
}

.calendar-cell-selected {
    background: var(--accent);
    color: #ffffff !important;
}

.calendar-cell-selected:hover {
    background: var(--accent-hover);
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 출발지/도착지를 placeholder만으로 한 줄에 나란히 두고, 그 사이에 스왑 버튼을 끼운다.
   align-items는 center가 아니라 start를 써야 한다 - 출발지 쪽에만 있는 GPS 안내문구
   (#gpsStatus, 평소엔 비어있지만 자리는 차지함) 때문에 center로 두면 두 입력창의
   세로 위치가 어긋나 버린다(입력창 자체 높이는 이미 같다). */
.origin-dest-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.origin-dest-row .field {
    flex: 1 1 0;
    min-width: 0;
}

.swap-button {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    /* 행 전체(부모)는 align-items:flex-start라, 입력창 높이(51px) 한가운데에 오도록
       버튼 자신의 높이(34px)만큼 여백을 계산해서 직접 내려준다. */
    margin-top: 9px;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 9999px;
    background: var(--card-bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out), transform 0.15s var(--ease-out);
}

.swap-button:hover {
    background: var(--accent-soft);
    color: var(--accent-hover);
    transform: rotate(180deg);
}

.field-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    color: var(--text-muted);
    pointer-events: none;
}

/* .field 클래스 하나만 있는 기본 input 규칙(.field input)과 명시도가 같아서, 파일 안에서
   더 뒤에 나오는 쪽이 그냥 이겨버린다 - 아이콘 자리를 비우는 왼쪽 패딩이 이 때문에
   먹히지 않고 아이콘과 placeholder 글자가 겹쳤었다. 클래스를 두 개 걸어 명시도를 올려
   순서에 안 흔들리게 고정한다. */
.field.field-origin input {
    padding-left: 38px;
    padding-right: 40px;
}

.field.field-dest input {
    padding-left: 38px;
}

.gps-button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out);
}

.gps-button:hover {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.gps-button.is-loading {
    color: var(--accent);
    animation: gps-pulse 1s ease-in-out infinite;
}

@keyframes gps-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.field-hint {
    margin: 0;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    min-height: 14px;
}

.time-picker-icon {
    display: flex;
    align-items: center;
    padding-left: 10px;
    color: var(--text-muted);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
}

.field input {
    background: var(--bg);
    border: 1.5px solid transparent;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    width: 100%;
    font-family: inherit;
    transition: border-color 0.15s var(--ease-out), background 0.15s var(--ease-out);
}

.field input::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

.field input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--card-bg);
}

.field input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.autocomplete {
    position: relative;
}

.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(var(--shadow-color), 0.16);
    /* 폼이 조밀해서 후보가 5개씩 다 펼쳐지면 바로 아래 시간 선택/검색 버튼까지 덮어버린다 -
       한 번에 3~4개만 보이게 줄여서 가리는 범위를 최대한 줄인다(나머지는 스크롤). */
    max-height: 176px;
    overflow-y: auto;
    z-index: 20;
    padding: 6px;
    margin-top: 6px;
}

.autocomplete-dropdown.is-open {
    display: block;
}

/* 브라우저 기본 "이 입력란을 작성하세요" 말풍선은 배경색 등을 CSS로 바꿀 수 없어서(브라우저가
   직접 그리는 UI라 페이지 스타일이 안 먹는다), 같은 자리에 직접 그린 커스텀 툴팁으로 대체한다. */
.field-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 4px;
    margin-top: 10px;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(var(--shadow-color), 0.2);
    padding: 9px 12px;
    max-width: 260px;
    z-index: 25;
}

.field-tooltip.is-open {
    display: flex;
}

.field-tooltip::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 16px;
    width: 10px;
    height: 10px;
    background: var(--card-bg);
    transform: rotate(45deg);
}

.field-tooltip-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    background: #FFC021;
    color: #4A3300;
    font-size: 13px;
    font-weight: 800;
}

.field-tooltip-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.autocomplete-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s var(--ease-out);
}

.autocomplete-option:hover,
.autocomplete-option.is-active {
    background: var(--accent-soft);
}

.autocomplete-option-name {
    width: 100%;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-option-line {
    width: 100%;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: normal;
    word-break: keep-all;
}

/* overflow:hidden을 쓰면 안 된다 - 시/분 드롭다운이 이 박스 밖으로 펼쳐지는데 통째로 잘려서 안 보인다. */
.time-picker {
    display: flex;
    align-items: stretch;
    background: var(--bg);
    border-radius: 12px;
}

.time-picker-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    position: relative;
    border-right: 1px solid var(--border);
}

.time-picker-segment:last-child {
    border-right: none;
}

.time-picker-day {
    flex: 0 0 auto;
    padding: 8px 16px;
    color: var(--text);
    font-weight: 700;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out);
}

.time-picker-day:hover {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.time-picker-unit {
    flex: 1;
}

.time-picker-step {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    font-family: inherit;
    transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out);
}

.time-picker-step:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.time-picker-value {
    border: none;
    background: transparent;
    color: var(--text);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    transition: background 0.15s var(--ease-out);
}

.time-picker-value:hover {
    background: var(--accent-soft);
}

.time-picker-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(var(--shadow-color), 0.16);
    max-height: 220px;
    overflow-y: auto;
    z-index: 20;
    padding: 6px;
    margin-top: 6px;
    width: 84px;
}

.time-picker-dropdown.is-open {
    display: block;
}

.time-picker-option {
    display: block;
    width: 100%;
    text-align: center;
    padding: 8px 0;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
}

.time-picker-option:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.time-picker-option.is-selected {
    background: var(--accent);
    color: #ffffff;
}

.btn-search {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
    border: none;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: background 0.15s var(--ease-out), transform 0.1s var(--ease-out);
}

.btn-search:hover {
    background: var(--accent-hover);
}

.btn-search:active {
    transform: scale(0.98);
}

.btn-search[disabled] {
    cursor: default;
    opacity: 0.85;
}

.spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn-search.is-loading .spinner {
    display: inline-block;
}

.alert {
    border-radius: 16px;
    padding: 16px 18px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    background: var(--error-bg);
}

.alert-error {
    color: var(--error);
}

.candidates {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(var(--shadow-color), 0.06);
}

.candidates-title {
    margin: 0 0 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.candidate-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.candidate-group {
    border: none;
    margin: 0 0 14px;
    padding: 0;
}

.candidate-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out), transform 0.1s var(--ease-out);
}

.candidate-chip:has(input:checked) {
    background: var(--accent-soft);
    color: var(--accent-hover);
    box-shadow: inset 0 0 0 1.5px var(--accent);
}

.candidate-chip input {
    accent-color: var(--accent);
    margin: 0;
}

.candidate-chip:active {
    transform: scale(0.98);
}

.candidate-chip:hover {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.result {
    margin-top: 24px;
}

.route-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.route-station {
    color: var(--text);
    font-weight: 700;
}

.route-arrow {
    color: var(--accent);
}

.result-heading {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    text-shadow: 0 1px 14px rgba(255, 255, 255, 0.95), 0 1px 3px rgba(255, 255, 255, 0.9);
}

.route-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(var(--shadow-color), 0.06);
}

.route-card-best {
    border: 2px solid var(--accent);
}

.route-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.route-mode-badge {
    display: inline-block;
    background: var(--text);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 9999px;
}

.route-flag {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 9999px;
}

.route-flag-fast {
    background: var(--accent);
    color: #ffffff;
}

.route-flag-late {
    background: #FFF1CC;
    color: #8A6100;
}

.route-flag-estimated {
    background: var(--border);
    color: var(--text-muted);
}

.route-result {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.route-result .result-time {
    font-size: 40px;
}

.route-total {
    margin-bottom: 10px;
}

.route-total-badge {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent-hover);
    font-size: 13px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 9999px;
}

.route-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.route-leg-chip {
    display: inline-block;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 12px;
    border-radius: 14px;
    white-space: nowrap;
}

/* ── 접힌 요약 ───────────────────────────────────────────── */

.route-headline {
    margin-bottom: 4px;
}

.route-headline-label {
    margin: 0 0 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.route-headline-time {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 34px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
    color: var(--accent);
}

.route-headline-safe {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 6px 0 0;
    padding: 6px 10px;
    border-radius: 10px;
    background: var(--safe-bg);
    width: fit-content;
}

.route-headline-safe-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--safe);
}

.route-headline-safe-time {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--safe);
}

/* 네이버지도 경로 카드처럼 "총 소요시간"을 크게, 도착/요금은 옆에 작게 */
.route-meta {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.route-meta-total {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
    margin-right: 2px;
}

.route-meta-sep {
    opacity: 0.5;
}

.route-meta-wait {
    font-size: 12px;
    opacity: 0.75;
}

/* 구간별 소요시간 비율 막대 */
.route-bar {
    display: flex;
    gap: 2px;
    height: 20px;
    margin-bottom: 12px;
}

.route-bar-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 10px;
    border-radius: 4px;
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 700;
    overflow: hidden;
    white-space: nowrap;
}

.route-bar-walk {
    background: var(--border);
    color: var(--text-muted);
}

/* 어느 노선을 어디서 타는지만 간단히 */
.route-brief {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.route-brief li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.route-brief-line {
    display: inline-block;
    min-width: 46px;
    text-align: center;
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.route-brief-off {
    display: inline-block;
    min-width: 46px;
    text-align: center;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
}

.route-brief-station {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

/* 지하철 구간에 실제로 타는 차편의 방면(종착역)을 "OO행"으로 안내한다 - 어느 방향 열차를
   타야 하는지 헷갈리지 않게(사용자 요청). 노선 색 배지 바로 옆, 역명보다는 작게. */
.route-brief-direction {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── 상세보기 타임라인 ───────────────────────────────────── */

.route-detail {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.route-detail-toggle {
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    list-style: none;
}

.route-detail-toggle::-webkit-details-marker {
    display: none;
}

.route-detail-toggle::after {
    content: ' ▾';
}

.route-detail[open] .route-detail-toggle::after {
    content: ' ▴';
}

.route-timeline {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.route-timeline-row {
    display: grid;
    grid-template-columns: 44px 14px 1fr;
    align-items: stretch;
    gap: 10px;
}

.route-timeline-time {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    padding-top: 2px;
}

/* 가운데 세로선 - 승차 구간은 노선 색, 도보는 점선 */
.route-timeline-rail {
    position: relative;
    justify-self: center;
    width: 3px;
    background: var(--rail-color, transparent);
    border-radius: 2px;
}

.route-timeline-walk-row .route-timeline-rail,
.route-timeline-row.route-timeline-walk .route-timeline-rail {
    width: 0;
    border-left: 2px dotted var(--text-muted);
    background: none;
}

.route-timeline-dot {
    justify-self: center;
    align-self: start;
    width: 11px;
    height: 11px;
    margin-top: 4px;
    border-radius: 50%;
}

.route-timeline-dot.is-origin {
    background: var(--accent);
}

.route-timeline-dot.is-dest {
    background: var(--error);
}

.route-timeline-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 14px;
}

.route-timeline-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
}

.route-timeline-kind {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.route-timeline-walk {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
}

.route-timeline-row.route-timeline-wait .route-timeline-rail {
    width: 0;
    border-left: 2px dotted var(--accent);
    background: none;
}

.route-timeline-wait {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--accent);
}

.route-timeline-interval {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 2px 0;
}

/* 상세 타임라인의 방면 표시 - route-brief-direction과 같은 정보, 노선 배지 바로 옆에 둔다. */
.route-timeline-direction {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
}

/* 지하철 승차 행의 "HH:mm 출발 예정" - 역명 옆에 작고 옅게 덧붙인다(시간표 기준임을 알려주는 참고용). */
.route-timeline-departure-note {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 4px;
}

.route-timeline-alight {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
}

.route-timeline-alight b {
    font-variant-numeric: tabular-nums;
}

/* 출발지/도착지 - 경로의 양 끝 */
.route-place {
    display: inline-block;
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    padding: 7px 12px;
    border-radius: 14px;
}

.route-place-origin {
    box-shadow: inset 3px 0 0 var(--accent);
}

.route-place-dest {
    box-shadow: inset 3px 0 0 var(--error);
}

/* 승차~하차 한 구간을 하나의 묶음으로 보여준다 (노선 색 테두리 + 승차역/하차역/소요시간).
   좁은 화면에서는 묶음 안에서 줄바꿈되지만, 테두리 덕분에 어디까지가 한 번 타는 구간인지 보인다. */
.route-ride {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 6px 10px;
    background: var(--bg);
}

.route-ride-line {
    display: inline-block;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 9999px;
    white-space: nowrap;
}

.route-ride-stops {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
}

.route-ride-sep {
    color: var(--text-muted);
}

.route-ride-time {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.route-leg-final {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 7px 12px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.route-walk {
    background: var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 9999px;
    white-space: nowrap;
}

.result-card {
    border-radius: 20px;
    padding: 32px 24px;
    text-align: center;
    margin-bottom: 14px;
    background: var(--card-bg);
    box-shadow: 0 2px 10px rgba(var(--shadow-color), 0.06);
}

.result-label {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
}

.result-time {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 52px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
    color: var(--accent);
}

.badge-nextday {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    vertical-align: middle;
    margin-left: 8px;
}

.result-note {
    margin: 10px 0 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.result-note b {
    color: var(--text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.result-walk-only {
    background: var(--accent-soft);
    color: var(--accent-hover);
    font-size: 15px;
    font-weight: 500;
}

.result-infeasible {
    background: var(--error-bg);
    color: var(--error);
    font-size: 15px;
    font-weight: 500;
}

.taxi-info-card {
    border-radius: 16px;
    padding: 14px 18px;
    margin-bottom: 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
}

.taxi-info-label {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.taxi-info-main {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.taxi-info-sep {
    margin: 0 4px;
    color: var(--text-muted);
}

.taxi-info-surcharge {
    margin: 4px 0 0;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
}

.disclaimer {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    margin-top: 18px;
}

/* ── 반응형 ──────────────────────────────────────────────
   기본값(.page max-width: 480px)은 모바일 폭에 맞춘 카드 하나짜리 디자인이라,
   그보다 넓은 화면에서는 카드가 화면 정중앙에 작게 떠 있는 것만으로도 안 깨지고
   잘 보인다(실측: 375/768/1440px 모두 가로 스크롤·겹침 없음). 아래 두 구간은
   "안 깨짐"을 넘어 화면 크기에 맞는 여유를 주기 위한 것이다:
   - 태블릿 이상: 카드를 조금 넓혀 결과 카드 내부가 덜 빽빽해 보이게 한다.
   - 아주 좁은 구형 폰(360px 이하): 출발지/도착지 한 줄 배치가 타이트해질 수
     있어 다시 위아래로 쌓는 안전장치를 둔다.
*/
@media (min-width: 640px) {
    .page {
        max-width: 560px;
        padding-top: 56px;
    }
}

@media (min-width: 1024px) {
    .page {
        max-width: 640px;
        padding-top: 72px;
    }

    .main-panel {
        padding: 34px 30px 28px;
    }
}

@media (max-width: 360px) {
    .page {
        padding-left: 14px;
        padding-right: 14px;
    }

    .main-panel {
        padding: 22px 16px 18px;
    }

    .origin-dest-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    /* 위아래로 쌓이면 "바꾸기" 의미가 좌우 화살표보다 위아래 화살표에 더 맞는다 */
    .swap-button {
        align-self: center;
        margin: -4px 0;
        transform: rotate(90deg);
    }

    .swap-button:hover {
        transform: rotate(270deg);
    }

    .time-picker {
        flex-wrap: wrap;
    }
}
