:root {
    color-scheme: dark;
    /* Apple-inspired dark */
    --bg-primary: #000000;
    --bg-card: #1d1d1f;
    --bg-header: #1d1d1f;
    --bg-item: #2c2c2e;
    --border-color: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
    --card-highlight: rgba(255, 255, 255, 0.06);
    --control-bg: rgba(255, 255, 255, 0.08);
    --control-bg-hover: rgba(255, 255, 255, 0.14);
    --warning-bg: rgba(180, 38, 38, 0.16);
    --warning-border: rgba(255, 120, 120, 0.34);
    --warning-text: #ffdede;
    --warning-muted: #ffbdbd;
    --text-primary: #f5f5f7;
    --text-secondary: #86868b;
    --text-tertiary: #6e6e73;
    --text-label: #a1a1a6;
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-active: #0077ed;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --eta-actual: rgba(245, 245, 247, 0.78);
    --eta-kmb-actual: rgba(255, 220, 220, 0.92);
    --eta-gmb-actual: rgba(200, 235, 210, 0.92);
    --eta-mtr-actual: rgba(91, 155, 213, 0.95);
    --eta-ctb-actual: rgba(255, 232, 180, 0.95);
    --eta-nlb-actual: rgba(183, 232, 255, 0.95);
    --color-kmb: #ff5252;
    --color-gmb: #1f5f3a;
    --color-mtr: #11254A;
    --color-mtr-light: #5B9BD5;
    --color-ctb: #f0a000;
    --color-nlb: #0a7ea4;
    --color-land-boundary: #2a5f8f;
    --color-sushiro: #c8102e;
    --color-error: #ff6b6b;
    --color-temp-min: #7ec8e3;
    --color-temp-max: #ffb347;
    /* Spacing rhythm: 4 / 8 / 16 / 24（資訊密度保留 md=12） */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 24px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --ease-apple: cubic-bezier(0.25, 0.1, 0.25, 1);
    /* iPhone 靈動島／瀏海／底部 Home 指示條（需 viewport-fit=cover） */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --ui-font-scale: 1;
    --tab-bar-height: 49px;
    --app-header-compact-height: 44px;
    --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
    --sheet-bg: #1c1c1e;
    --inset-group-bg: #2c2c2e;
}

:root[data-theme="day"] {
    color-scheme: light;
    /* Apple-inspired light */
    --bg-primary: #f5f5f7;
    --bg-card: #ffffff;
    --bg-header: #f5f5f7;
    --bg-item: #f5f5f7;
    --border-color: rgba(0, 0, 0, 0.06);
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --card-highlight: rgba(0, 0, 0, 0.04);
    --control-bg: rgba(0, 0, 0, 0.04);
    --control-bg-hover: rgba(0, 0, 0, 0.08);
    --warning-bg: rgba(255, 235, 235, 0.86);
    --warning-border: rgba(190, 18, 60, 0.24);
    --warning-text: #7f1d1d;
    --warning-muted: #9f1239;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --text-tertiary: #6e6e73;
    --text-label: #6e6e73;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-active: #006edb;
    --accent-soft: rgba(0, 113, 227, 0.12);
    --eta-actual: rgba(29, 29, 31, 0.78);
    --eta-kmb-actual: rgba(127, 29, 29, 0.9);
    --eta-gmb-actual: rgba(22, 101, 52, 0.88);
    --eta-mtr-actual: rgba(30, 94, 154, 0.92);
    --eta-ctb-actual: rgba(146, 64, 14, 0.92);
    --eta-nlb-actual: rgba(14, 116, 144, 0.92);
    --color-land-boundary: #1e4d78;
    --color-sushiro: #a50d24;
    --color-error: #b42318;
    --color-temp-min: #1477a8;
    --color-temp-max: #b85f00;
    --sheet-bg: #f2f2f7;
    --inset-group-bg: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background: var(--bg-primary);
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    min-height: 100dvh;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "Helvetica Neue", sans-serif;
    font-size: 17px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    width: 100%;
    max-width: 100%;
    min-height: 100dvh;
    min-height: 100svh;
    box-sizing: border-box;
    padding-top: max(var(--spacing-md), var(--safe-top));
    padding-right: max(var(--spacing-md), var(--safe-right));
    padding-bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 16px);
    padding-left: max(var(--spacing-md), var(--safe-left));
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.main-container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    min-height: 0;
    zoom: var(--ui-font-scale, 1);
}

html[data-app-boot="pending"] #mainModuleStack,
html[data-app-boot="pending"] .coffee-support,
html[data-app-boot="pending"] #openSettingsBtn,
html[data-app-boot="pending"] #appTabBar,
html[data-app-boot="pending"] #navEmptyState {
    display: none !important;
}

.app-boot-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: min(52vh, 360px);
    padding: 32px 16px;
    color: var(--text-secondary);
    font-size: 15px;
    animation: fadeUp 0.45s var(--ease-apple) both;
}

.app-boot-shell[hidden] {
    display: none !important;
}

.app-boot-shell .spinner {
    width: 28px;
    height: 28px;
    border-width: 3px;
    margin-bottom: var(--spacing-md);
}

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

.routes-stack {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

.routes-stack > .weather-card,
.routes-stack > .hospital-card,
.routes-stack > .route-section {
    animation: fadeUp 0.4s var(--ease-apple) both;
}

.routes-stack > .weather-card { animation-delay: 0.02s; }
.routes-stack > .hospital-card { animation-delay: 0.04s; }
.routes-stack > .route-section:nth-of-type(1) { animation-delay: 0.06s; }
.routes-stack > .route-section:nth-of-type(2) { animation-delay: 0.08s; }
.routes-stack > .route-section:nth-of-type(3) { animation-delay: 0.1s; }
.routes-stack > .route-section:nth-of-type(n + 4) { animation-delay: 0.12s; }

@media (prefers-reduced-motion: reduce) {
    .routes-stack > .weather-card,
    .routes-stack > .hospital-card,
    .routes-stack > .route-section {
        animation: none;
    }
}

.routes-stack > .weather-card,
.routes-stack > .hospital-card {
    margin-bottom: 0;
}

.route-section {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: var(--card-shadow);
}

:root[data-theme="day"] .route-section,
:root[data-theme="day"] .weather-card,
:root[data-theme="day"] .hospital-card {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

:root[data-theme="day"] .route-section .route-card {
    background: #ffffff;
}

:root[data-theme="day"] .route-section {
    background: #ffffff;
}

:root[data-theme="day"] .route-section-body {
    background: #f5f5f7;
}

.route-section--bus-source {
    display: none !important;
}

.route-section-head-row {
    display: flex;
    align-items: stretch;
    gap: 4px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s var(--ease-apple);
}

.route-section-head-row .route-section-head {
    flex: 1;
    min-width: 0;
    width: auto;
    border-bottom: none;
    background: transparent;
}

/* 路線區標題：可點、防選字、整列 :active 手感 */
.route-section-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 12px 16px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.2s var(--ease-apple);
}

.route-section-head-row:has(.route-section-head:active),
.route-section-head-row--pressed {
    background: color-mix(in srgb, var(--text-primary) 8%, var(--bg-card));
}

.route-section-head:active {
    opacity: 0.92;
}

:root[data-theme="day"] .route-section-head-row:has(.route-section-head:active),
:root[data-theme="day"] .route-section-head-row--pressed {
    background: color-mix(in srgb, var(--text-primary) 5%, #ffffff);
}

.route-section-head-titles {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.section-eta-toggle {
    flex-shrink: 0;
    align-self: center;
    margin: 4px 8px 4px 0;
}

.section-eta-toggle .display-btn {
    font-size: 11px;
    font-weight: 500;
    padding: 8px 12px;
    min-width: 3.2em;
    min-height: 32px;
    background: var(--accent);
    color: #fff;
    border-radius: 980px;
    transition: transform 0.2s var(--ease-apple), filter 0.2s var(--ease-apple), background 0.2s var(--ease-apple);
}

.section-eta-toggle .display-btn:hover {
    background: var(--accent-hover);
    filter: brightness(1.08);
}

.section-eta-toggle .display-btn:active {
    background: var(--accent-active);
    transform: scale(0.98);
}

/* 區塊標題列用的緊湊 select（設定面板內由下方共用規則覆寫） */
.route-section-head .lrt-station-select {
    width: 132px;
    min-height: 34px;
    height: 34px;
    font-size: 12px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
}

.settings-panel {
    padding: 12px 16px 48px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 680px;
    margin: 0 auto;
    box-sizing: border-box;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    margin-bottom: 0;
}

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

.settings-field__label {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.settings-field .lrt-station-select {
    width: 100%;
}

.settings-field--span2 {
    grid-column: 1 / -1;
}

.settings-inset-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    margin: 10px 0 0;
    padding: 10px 14px;
    border-radius: var(--radius-md, 12px);
    background: var(--control-bg);
    border: 1px solid var(--border-color);
    box-sizing: border-box;
}

.settings-inset-field--stack {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 14px;
}

.settings-inset-field__label {
    flex-shrink: 0;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.settings-inset-field__control {
    flex: 1;
    min-width: 0;
    max-width: 62%;
    min-height: 36px;
    margin: 0;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font: inherit;
    font-size: 15px;
    text-align: right;
    appearance: none;
    -webkit-appearance: none;
}

.settings-inset-field__control:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.settings-font-scale {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 10px 14px;
    border-radius: var(--radius-md, 12px);
    background: var(--control-bg);
    border: 1px solid var(--border-color);
    box-sizing: border-box;
}

.settings-font-scale__sample {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1;
}

.settings-font-scale__sample--sm {
    font-size: 13px;
}

.settings-font-scale__sample--lg {
    font-size: 22px;
}

.settings-font-scale__range {
    flex: 1;
    min-width: 0;
    height: 44px;
    accent-color: var(--accent);
}

.settings-font-scale__value {
    flex: 0 0 auto;
    min-width: 3.25em;
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    text-align: right;
    letter-spacing: -0.02em;
}

.settings-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 52px;
    padding: 12px 14px;
    margin: 0;
    border-radius: var(--radius-md, 12px);
    background: var(--control-bg);
    border: 1px solid var(--border-color);
    cursor: pointer;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s var(--ease-apple, ease);
}

.settings-switch-row:active {
    background: color-mix(in srgb, var(--control-bg) 88%, var(--text-primary));
}

.settings-switch-row__text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.settings-switch-row__label {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.settings-switch-row__desc {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.settings-switch {
    position: relative;
    flex-shrink: 0;
    width: 51px;
    height: 31px;
}

.settings-switch__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.settings-switch__ui {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 980px;
    background: color-mix(in srgb, var(--text-secondary) 28%, var(--control-bg));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border-color) 70%, transparent);
    transition: background 0.22s var(--ease-apple, ease);
    pointer-events: none;
}

.settings-switch__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    border-radius: 980px;
    background: #fff;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.18),
        0 1px 4px rgba(0, 0, 0, 0.12);
    transition: transform 0.22s var(--ease-apple, ease);
    pointer-events: none;
}

.settings-switch__input:checked + .settings-switch__ui {
    background: var(--accent, #0071e3);
    box-shadow: none;
}

.settings-switch__input:checked + .settings-switch__ui .settings-switch__thumb {
    transform: translateX(20px);
}

.settings-switch__input:focus-visible + .settings-switch__ui {
    outline: 2px solid var(--accent, #0071e3);
    outline-offset: 2px;
}

:root[data-theme="night"] .settings-switch__thumb,
:root:not([data-theme="day"]) .settings-switch__thumb {
    background: #f5f5f7;
}

.ui-font-scale-control {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 44px;
    padding: 4px 0;
}

.ui-font-scale-control__range {
    flex: 1;
    min-width: 0;
    height: 44px;
    accent-color: var(--accent);
}

.ui-font-scale-control__value {
    flex: 0 0 auto;
    min-width: 3.5em;
    font-size: 17px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    text-align: right;
    letter-spacing: -0.02em;
}

.settings-backup {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-backup__cloud {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-elevated, var(--bg-card));
}

.settings-backup__cloud-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 12px;
}

.settings-backup__cloud-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-backup__cloud-status {
    font-size: 13px;
    line-height: 1.35;
    color: var(--text-secondary);
    text-align: right;
}

.settings-backup__cloud-status[data-tone="error"] {
    color: var(--warning-border);
}

.settings-backup__cloud-status[data-tone="ok"] {
    color: var(--text-secondary);
}

.settings-backup__cloud-hint {
    margin: 0;
}

.settings-backup__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.settings-backup__hint {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
    margin: 0;
}

.settings-backup__cipher {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font: inherit;
    resize: vertical;
    min-height: 96px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
    word-break: break-all;
    transition: border-color 0.3s var(--ease-apple), box-shadow 0.3s var(--ease-apple);
}

.settings-backup__cipher:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.settings-legal-links {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-card);
}

.settings-legal-links__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.settings-legal-links__row:last-child {
    border-bottom: 0;
}

.settings-legal-links__row:hover {
    background: var(--control-bg-hover);
}

.settings-legal-links__label {
    font-size: 15px;
    font-weight: 500;
}

.settings-legal-links__path {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.settings-route-group {
    border: 1px solid color-mix(in srgb, var(--border-color) 85%, transparent);
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    padding: 16px;
    margin: 0;
}

.settings-route-group:first-of-type {
    border-top: 1px solid color-mix(in srgb, var(--border-color) 85%, transparent);
    padding-top: 16px;
    margin-top: 0;
}

.settings-route-group__title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0 0 8px;
}

.settings-mode-hint {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
    margin: 0 0 12px;
}

.settings-grid--compact {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    border-top: 0;
}

.settings-display-mode {
    display: grid;
    gap: 8px;
}

.settings-display-mode__option {
    display: block;
    cursor: pointer;
}

.settings-display-mode__option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.settings-display-mode__card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-height: 64px;
    padding: 14px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--control-bg);
    transition: border-color 0.3s var(--ease-apple), background 0.3s var(--ease-apple), transform 0.2s var(--ease-apple), box-shadow 0.3s var(--ease-apple);
}

.settings-display-mode__option:hover .settings-display-mode__card {
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border-color));
}

.settings-display-mode__option input:checked + .settings-display-mode__card {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, var(--control-bg));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.settings-display-mode__option input:focus-visible + .settings-display-mode__card {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.settings-display-mode__label {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.settings-display-mode__desc {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.settings-bus-routes__heading {
    margin-bottom: 4px;
}

.settings-bus-routes--separate .settings-bus-routes__hint {
    display: none;
}

.settings-bus-routes--merged .settings-bus-routes__intro {
    display: none;
}

.settings-bus-routes--merged .settings-bus-merged-order {
    margin-bottom: 4px;
}

.settings-bus-routes--merged .settings-bus-merged-order + .settings-bus-routes__body {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 16px;
}

.settings-bus-routes--merged .settings-route-subgroup__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.settings-bus-routes--merged .settings-route-subgroup {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 16px;
}

.settings-bus-routes--merged .settings-route-subgroup:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.settings-bus-routes--separate .settings-route-subgroup {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--control-bg);
}

.settings-bus-routes--separate .settings-route-subgroup:first-child {
    margin-top: 0;
}

.settings-bus-routes--separate .settings-route-subgroup__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.settings-route-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 16px 0 8px;
    letter-spacing: -0.01em;
}

.settings-route-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;
}

.settings-route-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s var(--ease-apple);
}

.settings-route-item:hover {
    background: var(--control-bg);
}

.settings-route-item input[type="checkbox"] {
    margin: 0;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    accent-color: var(--accent);
}

.settings-route-item--hint {
    grid-column: 1 / -1;
    color: var(--text-secondary);
    cursor: default;
}

.settings-route-item--hint:hover {
    background: transparent;
}

.settings-check-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.settings-check-section:first-of-type {
    margin-top: 4px;
}

.settings-check-section__header {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    padding: 0 4px;
}

.settings-check-group {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md, 12px);
    background: var(--control-bg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.settings-check-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    margin: 0;
    padding: 10px 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s var(--ease-apple, ease);
}

.settings-check-row + .settings-check-row {
    border-top: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
}

.settings-check-row:active {
    background: color-mix(in srgb, var(--control-bg) 88%, var(--text-primary));
}

.settings-check-row__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.settings-check-row__label {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.settings-check-row__input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.settings-check-row__mark {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 980px;
    border: 1.5px solid color-mix(in srgb, var(--text-secondary) 45%, transparent);
    background: transparent;
    box-sizing: border-box;
    position: relative;
    transition: background 0.2s var(--ease-apple, ease), border-color 0.2s var(--ease-apple, ease);
}

.settings-check-row__mark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 3px;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.18s var(--ease-apple, ease);
}

.settings-check-row__input:checked + .settings-check-row__mark {
    background: var(--accent, #0071e3);
    border-color: var(--accent, #0071e3);
}

.settings-check-row__input:checked + .settings-check-row__mark::after {
    transform: rotate(45deg) scale(1);
}

.settings-check-row__input:focus-visible + .settings-check-row__mark {
    outline: 2px solid var(--accent, #0071e3);
    outline-offset: 2px;
}

.settings-check-row--hint {
    cursor: default;
    color: var(--text-secondary);
    font-size: 14px;
}

.settings-check-row--hint:active {
    background: transparent;
}

.settings-chip-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.settings-chip-toggle__option {
    margin: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.settings-chip-toggle__option input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.settings-chip-toggle__card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 64px;
    padding: 12px 14px;
    border-radius: var(--radius-md, 12px);
    border: 1.5px solid var(--border-color);
    background: var(--control-bg);
    box-sizing: border-box;
    transition: border-color 0.2s var(--ease-apple, ease), background 0.2s var(--ease-apple, ease),
        box-shadow 0.2s var(--ease-apple, ease);
}

.settings-chip-toggle__option:active .settings-chip-toggle__card {
    transform: scale(0.98);
}

.settings-chip-toggle__label {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.settings-chip-toggle__desc {
    font-size: 12px;
    line-height: 1.35;
    color: var(--text-secondary);
}

.settings-chip-toggle__option input:checked + .settings-chip-toggle__card {
    border-color: var(--accent, #0071e3);
    background: color-mix(in srgb, var(--accent, #0071e3) 12%, var(--control-bg));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #0071e3) 35%, transparent);
}

.settings-chip-toggle__option input:focus-visible + .settings-chip-toggle__card {
    outline: 2px solid var(--accent, #0071e3);
    outline-offset: 2px;
}

.settings-sushiro-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: min(52vh, 420px);
    overflow: auto;
    margin-top: 4px;
    padding-right: 2px;
    -webkit-overflow-scrolling: touch;
}

.settings-sushiro-list .settings-check-section {
    margin-top: 10px;
}

.settings-sushiro-list .settings-check-section:first-child {
    margin-top: 0;
}

.kmb-builder {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.kmb-builder__input,
.kmb-builder__select,
.lrt-station-select {
    width: 100%;
    min-height: 44px;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.3;
    letter-spacing: -0.01em;
    padding: 10px 12px;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.3s var(--ease-apple), box-shadow 0.3s var(--ease-apple);
}

.settings-bus-routes--separate .kmb-builder__input,
.settings-bus-routes--separate .kmb-builder__select {
    background: var(--bg-card);
}

.kmb-builder__input:focus,
.kmb-builder__select:focus,
.lrt-station-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.kmb-builder__actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}

.kmb-builder__btn {
    border: 0;
    border-radius: 980px;
    padding: 11px 18px;
    min-height: 44px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.2s var(--ease-apple), filter 0.2s var(--ease-apple), background 0.2s var(--ease-apple);
}

.kmb-builder__btn:hover {
    background: var(--accent-hover);
    filter: brightness(1.08);
    transform: scale(1.02);
}

.kmb-builder__btn:active {
    background: var(--accent-active);
    transform: scale(0.98);
}

.kmb-builder__btn--secondary {
    background: color-mix(in srgb, var(--text-primary) 8%, var(--bg-card));
    color: var(--text-primary);
    box-shadow: none;
}

.kmb-builder__btn--secondary:hover {
    background: color-mix(in srgb, var(--text-primary) 12%, var(--bg-card));
    filter: none;
}

.kmb-builder__btn--secondary:active {
    background: color-mix(in srgb, var(--text-primary) 16%, var(--bg-card));
    filter: none;
}

.kmb-builder__hint {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
    margin-left: auto;
}

.kmb-selected-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--control-bg);
}

.kmb-selected-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    padding: 10px 14px;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.kmb-selected-item:last-child {
    border-bottom: none;
}

.kmb-selected-item__label {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.kmb-selected-item__actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.kmb-selected-item__remove {
    border: 0;
    border-radius: 980px;
    padding: 8px 12px;
    min-height: 32px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    background: color-mix(in srgb, var(--color-error) 14%, transparent);
    color: var(--color-error);
    transition: background 0.2s var(--ease-apple), transform 0.2s var(--ease-apple);
}

.kmb-selected-item__remove:hover {
    background: color-mix(in srgb, var(--color-error) 22%, transparent);
}

.kmb-selected-item__remove:active {
    transform: scale(0.96);
}

.tab-order-list--dragging {
    user-select: none;
}

.tab-order-item {
    cursor: grab;
}

.tab-order-item--dragging {
    opacity: 0.62;
    outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
    outline-offset: -2px;
    cursor: grabbing;
    pointer-events: none;
    background: color-mix(in srgb, var(--accent) 8%, var(--bg-card));
}

.tab-order-handle {
    width: 36px;
    height: 36px;
    border-radius: 980px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
    font-size: 16px;
    line-height: 1;
    cursor: grab;
    touch-action: none;
    transition: background 0.2s var(--ease-apple), transform 0.2s var(--ease-apple);
}

.tab-order-handle:hover {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.tab-order-handle:active {
    cursor: grabbing;
    transform: scale(0.96);
}

.settings-trigger-btn {
    display: none !important;
}

.settings-modal[hidden] {
    display: none;
}

.settings-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.settings-modal__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    margin: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.settings-modal__grabber,
.more-sheet__grabber {
    width: 36px;
    height: 5px;
    border-radius: 100px;
    background: color-mix(in srgb, var(--text-primary) 22%, transparent);
    margin: 8px auto 0;
    flex-shrink: 0;
}

.settings-modal__card {
    position: relative;
    width: min(680px, calc(100vw - 16px));
    max-height: min(86vh, 820px);
    margin: 8px;
    border-radius: 18px 18px var(--radius-lg) var(--radius-lg);
    overflow: auto;
    background: rgba(29, 29, 31, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
    animation: sheetRise 0.35s var(--ease-spring) both;
    touch-action: pan-y;
    transition: transform 0.2s var(--ease-spring);
}

:root[data-theme="day"] .settings-modal__card {
    background: var(--sheet-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}

:root[data-theme="day"] .settings-route-group {
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.settings-modal__head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    min-height: 52px;
    background: inherit;
    border-bottom: 1px solid var(--border-color);
}

.settings-modal__title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.settings-modal__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.settings-modal__theme-toggle,
.settings-modal__close {
    border: 0;
    background: var(--control-bg);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 980px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.3s var(--ease-apple), color 0.3s var(--ease-apple), transform 0.2s var(--ease-apple);
}

.settings-modal__theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.settings-modal__theme-toggle:hover {
    background: var(--control-bg-hover);
}

.settings-modal__theme-toggle:active {
    transform: scale(0.96);
}

.settings-modal__theme-toggle .theme-toggle__icon {
    display: none;
}

:root[data-theme="day"] .settings-modal__theme-toggle .theme-toggle__icon--moon {
    display: block;
}

:root[data-theme="night"] .settings-modal__theme-toggle .theme-toggle__icon--sun,
:root:not([data-theme="day"]) .settings-modal__theme-toggle .theme-toggle__icon--sun {
    display: block;
}

.first-login-notice {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: opacity 0.3s var(--ease-apple);
}

.first-login-notice--hide {
    opacity: 0;
}

.first-login-notice__card {
    width: min(420px, calc(100vw - 28px));
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: -0.02em;
    padding: 28px 24px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    animation: fadeUp 0.4s var(--ease-apple) both;
}

.route-section-head:focus-visible {
    outline: 2px solid var(--color-mtr-light);
    outline-offset: -2px;
}

.route-section-title {
    letter-spacing: -0.02em;
}

.route-section-chevron {
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.3s var(--ease-apple);
    flex-shrink: 0;
    margin-left: 8px;
}

.route-section.collapsed .route-section-chevron {
    transform: rotate(-90deg);
}

.route-section.collapsed .route-section-body {
    display: none;
}

.route-section-body {
    padding: 12px;
    background: var(--bg-card);
}

.route-section-body .routes-grid {
    margin-bottom: 0;
}

.routes-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 8px;
}

/* 奇數張可見卡時，最後一張跨兩欄全寬 */
.routes-grid > .route-card--span-full {
    grid-column: 1 / -1;
}

#panel-lrt .lrt-platforms-grid .route-header,
#panel-mtr-rail .lrt-platforms-grid .route-header {
    display: block;
}

#panel-lrt .lrt-platforms-grid .route-badge,
#panel-mtr-rail .lrt-platforms-grid .route-badge {
    display: inline-block;
    max-width: 100%;
    margin-bottom: 8px;
    white-space: normal;
    line-height: 1.1;
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* 輕鐵：月台號獨立放在站名 badge 旁 */
#panel-lrt .lrt-platforms-grid .lrt-station-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    max-width: 100%;
    min-width: 0;
}

#panel-lrt .lrt-platforms-grid .lrt-station-title-row .route-badge {
    margin-bottom: 0;
    max-width: calc(100% - 30px);
}

#panel-lrt .lrt-platforms-grid .lrt-platform-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #d32f2f;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
}

#panel-lrt .lrt-platforms-grid .route-info,
#panel-mtr-rail .lrt-platforms-grid .route-info {
    display: block;
    width: 100%;
    text-align: left;
}

#panel-lrt .lrt-platforms-grid .route-info .station-name,
#panel-mtr-rail .lrt-platforms-grid .route-info .station-name,
#panel-lrt .lrt-platforms-grid .route-info .destination,
#panel-mtr-rail .lrt-platforms-grid .route-info .destination {
    display: block;
    width: 100%;
    max-width: none;
    white-space: normal;
}

#panel-lrt .lrt-platforms-grid .route-info .station-name,
#panel-mtr-rail .lrt-platforms-grid .route-info .station-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

#panel-lrt .lrt-platforms-grid .destination,
#panel-mtr-rail .lrt-platforms-grid .destination {
    font-size: 13px;
    line-height: 1.4;
}

/* 巴士路線卡統一版面：路線號在上，站名／方向在下，ETA 在底 */
.bus-routes-grid .route-header {
    display: block;
}

.bus-routes-grid .route-badge {
    display: inline-block;
    max-width: 100%;
    margin-bottom: 6px;
    white-space: normal;
    line-height: 1.05;
}

.bus-routes-grid .route-info {
    display: block;
    width: 100%;
    text-align: left;
}

.bus-routes-grid .route-info .station-name,
.bus-routes-grid .route-info .destination {
    display: block;
    width: 100%;
}

.display-toggle {
    display: inline-flex;
    background: var(--control-bg);
    border: 1px solid var(--border-color);
    border-radius: 980px;
    overflow: hidden;
}

.display-btn {
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    padding: 8px 12px;
    min-height: 36px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s var(--ease-apple), color 0.2s var(--ease-apple);
}

.display-btn.active {
    background: var(--accent);
    color: #fff;
}

.route-card {
    background: var(--bg-item);
    border-radius: var(--radius-md);
    box-shadow: none;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.3s var(--ease-apple), border-color 0.3s var(--ease-apple), background 0.3s var(--ease-apple);
}

.route-card:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--accent) 28%, var(--border-color));
}

.route-card--interactive {
    cursor: pointer;
}

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

.route-header {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
}

.route-badge {
    background: var(--color-kmb);
    color: white;
    font-size: 28px;
    font-weight: 700;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    box-shadow: none;
    line-height: 1;
    letter-spacing: -0.03em;
}

.route-badge.mtr {
    background: var(--color-mtr);
    box-shadow: none;
}

.route-badge.gmb {
    background: var(--color-gmb);
    box-shadow: none;
}

.route-badge.ctb {
    background: var(--color-ctb);
    box-shadow: none;
    color: #1e1400;
}

.route-badge.nlb {
    background: var(--color-nlb);
    box-shadow: none;
}

.route-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.station-name {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 2px;
    display: block;
    max-width: none;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.3;
}

.destination {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
}

.route-content {
    padding: 4px 0 0;
    min-height: auto;
}

/* ETA 列表：Apple 風格分隔列 + 下一班強調 */
.eta-item {
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 12px 14px 12px 16px;
    min-height: 56px;
    border: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: background 0.3s var(--ease-apple);
}

.eta-item:last-child {
    border-bottom: none;
}

.eta-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 980px;
    background: var(--op-accent, var(--color-kmb));
    opacity: 0.85;
}

.eta-item.kmb { --op-accent: var(--color-kmb); }
.eta-item.gmb { --op-accent: var(--color-gmb); }
.eta-item.mtr { --op-accent: var(--color-mtr-light); }
.eta-item.ctb { --op-accent: var(--color-ctb); }
.eta-item.nlb { --op-accent: var(--color-nlb); }

.eta-item--next {
    min-height: 72px;
    padding-top: 14px;
    padding-bottom: 14px;
    background: color-mix(in srgb, var(--op-accent, var(--color-kmb)) 8%, transparent);
}

:root[data-theme="day"] .eta-item--next {
    background: color-mix(in srgb, var(--op-accent, var(--color-kmb)) 7%, #ffffff);
}

.eta-item--soon {
    background: color-mix(in srgb, var(--op-accent, var(--color-kmb)) 14%, transparent);
}

.eta-item--soon::before {
    opacity: 1;
    box-shadow: 0 0 8px color-mix(in srgb, var(--op-accent, var(--color-kmb)) 45%, transparent);
}

.eta-item__meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.eta-label {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
}

.eta-item--next .eta-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--op-accent, var(--text-secondary));
}

.eta-remark {
    font-size: 12px;
    line-height: 1.35;
    color: var(--text-tertiary);
    letter-spacing: -0.01em;
}

.eta-time {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    line-height: 1;
    color: var(--op-accent, var(--color-kmb));
    font-variant-numeric: tabular-nums;
}

.eta-time.kmb { --op-accent: var(--color-kmb); color: var(--color-kmb); }
.eta-time.gmb { --op-accent: var(--color-gmb); color: var(--color-gmb); }
.eta-time.mtr { --op-accent: var(--color-mtr-light); color: var(--color-mtr-light); }
.eta-time.ctb { --op-accent: var(--color-ctb); color: var(--color-ctb); }
.eta-time.nlb { --op-accent: var(--color-nlb); color: var(--color-nlb); }

.eta-remaining {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    max-width: 100%;
}

.eta-remaining__value {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1;
}

.eta-item--next .eta-remaining__value {
    font-size: 40px;
    letter-spacing: -0.05em;
}

.eta-remaining__unit {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    opacity: 0.88;
    line-height: 1.2;
}

.eta-item--next .eta-remaining__unit {
    font-size: 15px;
}

.eta-remaining__text {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.eta-item--next .eta-remaining__text {
    font-size: 28px;
}

.eta-item--soon .eta-remaining__text,
.eta-item--soon .eta-remaining__value {
    animation: eta-soon-pulse 1.6s var(--ease-apple) infinite;
}

@keyframes eta-soon-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.72;
    }
}

@media (prefers-reduced-motion: reduce) {
    .eta-item--soon .eta-remaining__text,
    .eta-item--soon .eta-remaining__value {
        animation: none;
    }
}

.eta-actual-time {
    font-size: 12px;
    font-weight: 500;
    color: var(--eta-actual);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.eta-time.kmb .eta-actual-time {
    color: var(--eta-kmb-actual);
}

.eta-time.gmb .eta-actual-time {
    color: var(--eta-gmb-actual);
}

.eta-time.mtr .eta-actual-time {
    color: var(--eta-mtr-actual);
}

.eta-time.ctb .eta-actual-time {
    color: var(--eta-ctb-actual);
}

.eta-time.nlb .eta-actual-time {
    color: var(--eta-nlb-actual);
}

/* 輕鐵：月台內多班列車（與 eta-item 同層次） */
.lrt-train-row {
    position: relative;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    padding: 12px 14px 12px 16px;
    margin: 0;
    min-height: 56px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.lrt-train-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 980px;
    background: var(--color-mtr-light);
    opacity: 0.85;
}

.lrt-train-row:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.lrt-train-row--next {
    min-height: 72px;
    background: color-mix(in srgb, var(--color-mtr-light) 8%, transparent);
}

:root[data-theme="day"] .lrt-train-row--next {
    background: color-mix(in srgb, var(--color-mtr-light) 7%, #ffffff);
}

.lrt-train-row--soon {
    background: color-mix(in srgb, var(--color-mtr-light) 14%, transparent);
}

.lrt-train-left {
    flex: 1;
    min-width: 0;
}

.lrt-train-line {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 2px;
}

.lrt-train-route {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--color-mtr-light);
    flex-shrink: 0;
}

.lrt-train-cars {
    font-size: 13px;
    opacity: 0.85;
    color: var(--text-secondary);
}

.lrt-train-row .eta-time {
    flex-shrink: 0;
}

.lrt-train-row .eta-time.mtr .eta-actual-time {
    text-align: right;
    color: var(--eta-mtr-actual);
}

.lrt-station-group {
    margin-bottom: 10px;
}

.lrt-station-group:last-child {
    margin-bottom: 0;
}

.loading {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-secondary);
    font-size: 15px;
    letter-spacing: -0.01em;
}

.spinner {
    border: 2.5px solid var(--control-bg);
    border-top-color: var(--accent);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: var(--warning-bg);
    color: var(--color-error);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 13px;
    line-height: 1.4;
    border: 1px solid var(--warning-border);
}

.no-eta {
    text-align: center;
    padding: 20px 12px;
    color: var(--text-tertiary);
    font-size: 15px;
    letter-spacing: -0.01em;
}

.kmb-route-modal[hidden] {
    display: none;
}

.kmb-route-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.kmb-route-modal__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.kmb-route-modal__card {
    position: relative;
    width: min(680px, calc(100vw - 16px));
    max-height: min(84vh, 780px);
    margin: 0 8px;
    background: rgba(29, 29, 31, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
    color: var(--text-primary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: fadeUp 0.35s var(--ease-apple) both;
}

:root[data-theme="day"] .kmb-route-modal__card {
    background: #f5f5f7;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}

.kmb-route-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    min-height: 56px;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
}

.kmb-route-modal__title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.kmb-route-modal__meta {
    margin-top: 4px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.kmb-route-modal__close {
    border: 0;
    background: var(--control-bg);
    color: var(--text-primary);
    border-radius: 980px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.3s var(--ease-apple), transform 0.2s var(--ease-apple);
}

.kmb-route-modal__close:hover {
    background: var(--control-bg-hover);
}

.kmb-route-modal__close:active {
    transform: scale(0.96);
}

.kmb-route-modal__body {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    padding: 12px 16px 16px;
    overflow: hidden;
    min-height: 0;
}

.kmb-route-modal__pane {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    padding: 12px;
}

:root[data-theme="day"] .kmb-route-modal__pane {
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.kmb-route-modal__pane-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.kmb-stop-list,
.kmb-stop-eta-list {
    display: grid;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-item);
}

:root[data-theme="day"] .kmb-stop-list,
:root[data-theme="day"] .kmb-stop-eta-list {
    background: #f5f5f7;
}

.kmb-stop-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s var(--ease-apple);
}

.kmb-stop-btn:last-child {
    border-bottom: none;
}

.kmb-stop-btn:hover {
    background: var(--control-bg);
}

.kmb-stop-btn.active {
    background: color-mix(in srgb, var(--op-accent, var(--color-kmb)) 14%, transparent);
    box-shadow: inset 3px 0 0 var(--op-accent, var(--color-kmb));
}

.kmb-stop-btn:focus-visible {
    outline: 2px solid var(--op-accent, var(--color-kmb));
    outline-offset: -2px;
}

.kmb-stop-btn__seq {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border-radius: 980px;
    background: var(--control-bg);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.kmb-stop-btn.active .kmb-stop-btn__seq {
    background: color-mix(in srgb, var(--op-accent, var(--color-kmb)) 22%, transparent);
    color: var(--op-accent, var(--color-kmb));
}

.kmb-stop-btn__name {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.kmb-stop-eta-list {
    gap: 0;
    border: none;
    background: transparent;
    overflow: visible;
}

:root[data-theme="day"] .kmb-stop-eta-list {
    background: transparent;
}

.kmb-stop-eta-list .eta-item {
    margin-bottom: 0;
    padding-left: 16px;
}

.kmb-stop-eta-list .eta-item:last-child {
    border-bottom: none;
}

.kmb-stop-eta-list .no-eta,
.kmb-stop-eta-list .loading,
.kmb-stop-eta-list .error {
    border-radius: var(--radius-md);
}

/* 各營運商品牌色 token（主畫面區塊／詳情 Modal 共用） */
#section-kmb,
.kmb-route-modal[data-operator="kmb"],
.settings-route-subgroup[data-bus-operator="kmb"] {
    --op-accent: var(--color-kmb);
}

#section-gmb,
.kmb-route-modal[data-operator="gmb"],
.settings-route-subgroup[data-bus-operator="gmb"] {
    --op-accent: var(--color-gmb);
}

#section-mtr-bus,
.kmb-route-modal[data-operator="mtr"],
.settings-route-subgroup[data-bus-operator="mtr"] {
    --op-accent: var(--color-mtr-light);
}

#section-citybus,
.kmb-route-modal[data-operator="ctb"],
.settings-route-subgroup[data-bus-operator="ctb"] {
    --op-accent: var(--color-ctb);
}

#section-nlb,
.kmb-route-modal[data-operator="nlb"],
.settings-route-subgroup[data-bus-operator="nlb"] {
    --op-accent: var(--color-nlb);
}

#section-mtr-rail,
.kmb-route-modal[data-operator="mtrRail"] {
    --op-accent: var(--color-mtr-light);
}

#section-lrt,
.kmb-route-modal[data-operator="lrt"] {
    --op-accent: var(--color-mtr-light);
}

#section-bus {
    --op-accent: var(--accent);
}

#section-land-boundary {
    --op-accent: var(--color-land-boundary);
}

#section-sushiro {
    --op-accent: var(--color-sushiro);
}

/* 主畫面：班次切換／focus 用營運商色 */
#section-kmb .section-eta-toggle .display-btn,
#section-gmb .section-eta-toggle .display-btn,
#section-mtr-bus .section-eta-toggle .display-btn,
#section-citybus .section-eta-toggle .display-btn,
#section-nlb .section-eta-toggle .display-btn,
#section-bus .section-eta-toggle .display-btn,
#section-mtr-rail .section-eta-toggle .display-btn,
#section-lrt .section-eta-toggle .display-btn {
    background: var(--op-accent);
}

#section-kmb .section-eta-toggle .display-btn:hover,
#section-gmb .section-eta-toggle .display-btn:hover,
#section-mtr-bus .section-eta-toggle .display-btn:hover,
#section-citybus .section-eta-toggle .display-btn:hover,
#section-nlb .section-eta-toggle .display-btn:hover,
#section-bus .section-eta-toggle .display-btn:hover,
#section-mtr-rail .section-eta-toggle .display-btn:hover,
#section-lrt .section-eta-toggle .display-btn:hover {
    background: color-mix(in srgb, var(--op-accent) 88%, #fff);
    filter: none;
}

#section-kmb .section-eta-toggle .display-btn:active,
#section-gmb .section-eta-toggle .display-btn:active,
#section-mtr-bus .section-eta-toggle .display-btn:active,
#section-citybus .section-eta-toggle .display-btn:active,
#section-nlb .section-eta-toggle .display-btn:active,
#section-bus .section-eta-toggle .display-btn:active,
#section-mtr-rail .section-eta-toggle .display-btn:active,
#section-lrt .section-eta-toggle .display-btn:active {
    background: color-mix(in srgb, var(--op-accent) 82%, #000);
}

#section-kmb .route-section-head:focus-visible,
#section-gmb .route-section-head:focus-visible,
#section-mtr-bus .route-section-head:focus-visible,
#section-citybus .route-section-head:focus-visible,
#section-nlb .route-section-head:focus-visible,
#section-bus .route-section-head:focus-visible,
#section-mtr-rail .route-section-head:focus-visible,
#section-lrt .route-section-head:focus-visible {
    outline-color: var(--op-accent);
}

#section-kmb .route-card--interactive:focus-visible,
#section-gmb .route-card--interactive:focus-visible,
#section-mtr-bus .route-card--interactive:focus-visible,
#section-citybus .route-card--interactive:focus-visible,
#section-nlb .route-card--interactive:focus-visible,
#section-bus .route-card--interactive:focus-visible,
#section-mtr-rail .route-card--interactive:focus-visible,
#section-lrt .route-card--interactive:focus-visible {
    outline-color: var(--op-accent);
}

/* 路線 badge 統一圓角／字重 */
.route-badge.kmb,
.route-badge.gmb,
.route-badge.mtr,
.route-badge.ctb,
.route-badge.nlb {
    border-radius: 10px;
    padding: 6px 8px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.04em;
}

/* 設定 builder：營運商主按鈕 + focus */
.settings-route-subgroup[data-bus-operator] .kmb-builder__btn:not(.kmb-builder__btn--secondary) {
    background: var(--op-accent, var(--accent));
}

.settings-route-subgroup[data-bus-operator] .kmb-builder__btn:not(.kmb-builder__btn--secondary):hover {
    background: color-mix(in srgb, var(--op-accent, var(--accent)) 88%, #fff);
    filter: none;
}

.settings-route-subgroup[data-bus-operator] .kmb-builder__btn:not(.kmb-builder__btn--secondary):active {
    background: color-mix(in srgb, var(--op-accent, var(--accent)) 82%, #000);
}

.settings-route-subgroup[data-bus-operator] .kmb-builder__input:focus,
.settings-route-subgroup[data-bus-operator] .kmb-builder__select:focus {
    border-color: var(--op-accent, var(--accent));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--op-accent, var(--accent)) 22%, transparent);
}

.settings-route-subgroup[data-bus-operator] .kmb-selected-item__remove {
    background: color-mix(in srgb, var(--op-accent, var(--color-error)) 14%, transparent);
    color: var(--op-accent, var(--color-error));
}

/* 城巴主按鈕文字需深色對比 */
.settings-route-subgroup[data-bus-operator="ctb"] .kmb-builder__btn:not(.kmb-builder__btn--secondary) {
    color: #1e1400;
}

#section-citybus .section-eta-toggle .display-btn {
    color: #1e1400;
}

.last-update {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
    line-height: 1.4;
    letter-spacing: -0.01em;
    margin-top: 16px;
    margin-bottom: 0;
    padding-bottom: calc(16px + var(--safe-bottom));
}

.last-update-api-src {
    cursor: help;
}

.last-update-version-btn {
    border: 0;
    padding: 0;
    margin: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: baseline;
}

.last-update-version-btn:hover,
.last-update-version-btn:focus-visible {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.version-history-modal[hidden] {
    display: none;
}

.version-history-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.version-history-modal__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    margin: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.version-history-modal__card {
    position: relative;
    width: min(560px, calc(100vw - 16px));
    max-height: min(70vh, 640px);
    margin: 8px;
    border-radius: var(--radius-lg);
    overflow: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    animation: fadeUp 0.35s var(--ease-apple) both;
}

.version-history-modal__card--tall {
    max-height: min(88vh, 820px);
}

.version-history-modal__head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    min-height: 52px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.version-history-modal__title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.version-history-modal__close {
    border: 0;
    background: var(--control-bg);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 980px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.version-history-modal__body {
    padding: 12px 14px 16px;
}

.version-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.version-history-list__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.version-history-list__item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.version-history-list__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
}

.version-history-list__version {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.version-history-list__current {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
}

.version-history-list__date {
    margin-left: auto;
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

.version-history-list__summary {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.version-history-list__summaries {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.version-history-list__summaries .version-history-list__summary {
    position: relative;
    padding-left: 0.85em;
}

.version-history-list__summaries .version-history-list__summary::before {
    content: '·';
    position: absolute;
    left: 0;
    color: var(--text-secondary);
}

.version-history-list__empty {
    font-size: 12px;
    color: var(--text-secondary);
}

body.version-history-modal-open {
    overflow: hidden;
}

.help-guide-intro {
    margin: 0 0 12px;
    padding: 0 2px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.help-guide-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.help-guide-list__item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 12px;
    border-radius: var(--radius-md, 12px);
    background: var(--bg-item);
    border: 1px solid var(--border-color);
}

.help-guide-list__title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.help-guide-list__desc {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.coffee-support {
    display: flex;
    justify-content: center;
    margin: 16px 0 0;
}

.coffee-support[hidden] {
    display: none !important;
}

.coffee-support img {
    max-width: min(200px, 70vw);
    height: auto;
    display: block;
    border-radius: var(--radius-md);
    opacity: 0.92;
    transition: opacity 0.3s var(--ease-apple), transform 0.3s var(--ease-apple);
}

.coffee-support img:hover {
    opacity: 1;
    transform: scale(1.02);
}

/* 天氣卡片：與路線區同寬（全寬於 main-container，邊距由 body padding 負責） */
.weather-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 16px 16px 14px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s var(--ease-apple), box-shadow 0.3s var(--ease-apple);
}

.weather-card::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -25%;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, var(--card-highlight) 0%, transparent 68%);
    pointer-events: none;
}

.weather-top {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    position: relative;
    z-index: 1;
}

.weather-date {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.weather-place {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin-bottom: 2px;
    overflow-wrap: anywhere;
}

.weather-time {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    flex-shrink: 0;
}

.weather-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    position: relative;
    z-index: 1;
}

.weather-hero {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.weather-hero-text {
    min-width: 0;
    flex: 1;
}

.weather-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    line-height: 1;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.12));
    animation: weather-icon-float 4s var(--ease-apple) infinite;
}

.weather-icon--big {
    width: 56px;
    height: 56px;
}

.weather-icon .wx-icon,
.weather-icon .wx-svg {
    width: 100%;
    height: 100%;
}

@keyframes weather-icon-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
    .weather-icon {
        animation: none;
    }
}

/* 天文台天氣 SVG 色票 */
.wx-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
}

.wx-icon--sm {
    width: 28px;
    height: 28px;
}

.wx-icon--md {
    width: 40px;
    height: 40px;
}

.wx-icon--lg {
    width: 56px;
    height: 56px;
}

.wx-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.wx-sun {
    fill: #ff9f0a;
}

.wx-sun--dim {
    fill: #ffcc66;
    opacity: 0.7;
}

.wx-ray {
    stroke: #ff9f0a;
}

.wx-cloud {
    fill: #c7c7cc;
}

.wx-cloud--back {
    fill: #8e8e93;
    opacity: 0.85;
}

.wx-cloud--front {
    fill: #e5e5ea;
}

.wx-rain,
.wx-rain--heavy {
    stroke: #64d2ff;
}

.wx-bolt {
    fill: #ffd60a;
}

.wx-moon {
    fill: #e8e8ed;
}

.wx-star {
    fill: #ffd60a;
}

.wx-wind,
.wx-fog,
.wx-heat,
.wx-snow {
    stroke: #aeaeb2;
}

.wx-drop {
    fill: #64d2ff;
}

.wx-drop-shine {
    stroke: #e5f6ff;
}

.wx-thermo-body {
    fill: #aeaeb2;
}

.wx-thermo-bulb,
.wx-thermo-fill {
    fill: #ff453a;
}

:root[data-theme="day"] .wx-cloud {
    fill: #aeaeb2;
}

:root[data-theme="day"] .wx-cloud--back {
    fill: #8e8e93;
}

:root[data-theme="day"] .wx-cloud--front {
    fill: #d1d1d6;
}

:root[data-theme="day"] .wx-moon {
    fill: #636366;
}

:root[data-theme="day"] .wx-wind,
:root[data-theme="day"] .wx-fog,
:root[data-theme="day"] .wx-heat,
:root[data-theme="day"] .wx-snow {
    stroke: #8e8e93;
}

.weather-temp-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 6px;
}

.weather-temp {
    display: inline-flex;
    align-items: baseline;
    white-space: nowrap;
    font-size: 44px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.04em;
}

.weather-temp .unit {
    font-size: 17px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 2px;
}

.weather-range {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
}

.temp-min {
    color: var(--color-temp-min);
}

.temp-max {
    color: var(--color-temp-max);
}

.weather-desc {
    font-size: 15px;
    line-height: 1.4;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.weather-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    width: 100%;
}

.weather-raincast,
.weather-psr {
    font-size: 13px;
    line-height: 1.35;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.weather-raincast[hidden],
.weather-psr[hidden] {
    display: none !important;
}

.weather-humidity {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.weather-meta-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    flex: 1 1 100%;
}

.weather-update {
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.3;
    overflow-wrap: anywhere;
    min-width: 0;
}

.weather-warning {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    color: var(--warning-text);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.weather-warning-title {
    color: var(--warning-text);
}

.weather-warning-list {
    margin-top: 2px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}

.weather-warning-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    padding: 1px 6px;
    border-radius: 999px;
    border: 1px solid transparent;
}

.weather-warning-item--yellow {
    background: rgba(234, 179, 8, 0.22);
    border-color: rgba(234, 179, 8, 0.55);
    color: #fde68a;
}

.weather-warning-item--red {
    background: rgba(220, 38, 38, 0.22);
    border-color: rgba(248, 113, 113, 0.55);
    color: #fecaca;
}

.weather-warning-item--black {
    background: rgba(15, 15, 15, 0.72);
    border-color: rgba(255, 255, 255, 0.35);
    color: #f5f5f5;
}

:root[data-theme="day"] .weather-warning-item--yellow {
    background: rgba(250, 204, 21, 0.28);
    border-color: rgba(202, 138, 4, 0.45);
    color: #854d0e;
}

:root[data-theme="day"] .weather-warning-item--red {
    background: rgba(254, 202, 202, 0.9);
    border-color: rgba(185, 28, 28, 0.4);
    color: #7f1d1d;
}

:root[data-theme="day"] .weather-warning-item--black {
    background: rgba(24, 24, 27, 0.92);
    border-color: rgba(24, 24, 27, 0.85);
    color: #fafafa;
}

.weather-warning-text {
    min-width: 0;
    white-space: nowrap;
}

.weather-warning[hidden] {
    display: none !important;
}

.weather-card[hidden] {
    display: none !important;
}

.weather-loading {
    text-align: center;
    padding: 10px 6px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
}

.weather-loading .spinner {
    border-top-color: var(--text-secondary);
}

.weather-error {
    background: var(--warning-bg);
    color: var(--warning-text);
    padding: 10px 10px;
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid var(--warning-border);
    width: 100%;
}

.weather-card--interactive {
    cursor: pointer;
    transition: border-color 0.3s var(--ease-apple), box-shadow 0.3s var(--ease-apple), transform 0.3s var(--ease-apple);
}

.weather-card--interactive:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border-color));
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

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

.weather-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    flex-shrink: 0;
    text-align: right;
}

.weather-forecast-modal[hidden] {
    display: none;
}

.weather-forecast-modal {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.weather-forecast-modal__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.weather-forecast-modal__card {
    position: relative;
    width: min(680px, calc(100vw - 16px));
    max-height: min(86vh, 760px);
    margin: 0 8px;
    background: rgba(29, 29, 31, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
    color: var(--text-primary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: fadeUp 0.35s var(--ease-apple) both;
}

:root[data-theme="day"] .weather-forecast-modal__card {
    background: #f5f5f7;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}

.weather-forecast-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    min-height: 56px;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    flex-shrink: 0;
}

.weather-forecast-modal__head-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.weather-forecast-modal__back {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 980px;
    background: var(--control-bg);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.3s var(--ease-apple), transform 0.2s var(--ease-apple);
}

.weather-forecast-modal__back[hidden] {
    display: none;
}

.weather-forecast-modal__back:hover {
    background: var(--control-bg-hover);
}

.weather-forecast-modal__back:active {
    transform: scale(0.96);
}

.weather-forecast-modal__title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.weather-forecast-modal__meta {
    margin-top: 4px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.weather-forecast-modal__close {
    border: 0;
    background: var(--control-bg);
    color: var(--text-primary);
    border-radius: 980px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.3s var(--ease-apple), transform 0.2s var(--ease-apple);
}

.weather-forecast-modal__close:hover {
    background: var(--control-bg-hover);
}

.weather-forecast-modal__close:active {
    transform: scale(0.96);
}

.weather-forecast-modal__situation {
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.45;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    flex-shrink: 0;
}

.weather-forecast-modal__situation[hidden] {
    display: none !important;
}

.weather-forecast-modal__picker {
    display: grid;
    gap: 10px;
    padding: 16px;
}

.weather-forecast-modal__picker[hidden] {
    display: none;
}

.weather-forecast-modal__pick-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 64px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.3s var(--ease-apple), background 0.3s var(--ease-apple), transform 0.2s var(--ease-apple);
}

.weather-forecast-modal__pick-btn[hidden] {
    display: none !important;
}

.weather-forecast-modal__pick-btn:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border-color));
    background: color-mix(in srgb, var(--accent) 8%, var(--bg-card));
}

.weather-forecast-modal__pick-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.weather-forecast-modal__pick-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    line-height: 0;
}

.weather-forecast-modal__pick-icon svg {
    display: block;
}

.weather-forecast-modal__pick-icon--warn {
    background: color-mix(in srgb, #ff9f0a 16%, transparent);
    color: #ff9f0a;
}

.weather-forecast-modal__pick-icon--tc {
    background: color-mix(in srgb, #bf5af2 16%, transparent);
    color: #bf5af2;
}

.weather-forecast-modal__pick-icon--sun {
    background: color-mix(in srgb, #ff9f0a 14%, transparent);
    color: #ff9f0a;
}

.weather-forecast-modal__pick-icon--rain {
    background: color-mix(in srgb, #64d2ff 18%, transparent);
    color: #64d2ff;
}

.weather-forecast-modal__pick-icon--pin {
    background: color-mix(in srgb, #ff453a 14%, transparent);
    color: #ff453a;
}

:root[data-theme="day"] .weather-forecast-modal__pick-icon--rain {
    color: #0071e3;
    background: color-mix(in srgb, #0071e3 12%, transparent);
}

.weather-forecast-modal__pick-text {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.weather-forecast-modal__pick-label {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.weather-forecast-modal__pick-desc {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.weather-forecast-modal__panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.weather-forecast-modal__panel[hidden] {
    display: none;
}

.weather-forecast-modal__list {
    flex: 1;
    overflow: auto;
    padding: 12px 16px 16px;
    display: grid;
    gap: 10px;
    min-height: 0;
}

.weather-forecast-modal__empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    letter-spacing: -0.01em;
}

.weather-forecast-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    padding: 14px 16px;
    transition: border-color 0.3s var(--ease-apple), background 0.3s var(--ease-apple);
}

.weather-forecast-item--today {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border-color));
    background: color-mix(in srgb, var(--accent) 8%, var(--bg-card));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}

.weather-forecast-item__head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.weather-forecast-item__day {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    min-width: 0;
    flex: 1;
}

.weather-forecast-item__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    line-height: 0;
}

.weather-forecast-item__icon .wx-icon {
    width: 28px;
    height: 28px;
}

.weather-forecast-item__temp {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.weather-forecast-item__desc {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.4;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
}

.weather-forecast-item__psr,
.weather-forecast-item__wind {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.35;
    color: var(--text-tertiary);
}

.weather-forecast-item__psr {
    color: var(--text-secondary);
    font-weight: 500;
}

.weather-forecast-modal__pick-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 999px;
    background: #c0392b;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
}

.weather-forecast-modal__pick-badge[hidden] {
    display: none;
}

.weather-forecast-modal__pick-btn--alert {
    border-color: rgba(192, 57, 43, 0.55);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(192, 57, 43, 0.08) 100%);
}

.weather-warning-detail {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    padding: 10px 12px;
}

.weather-warning-detail--yellow {
    border-color: rgba(234, 179, 8, 0.55);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(234, 179, 8, 0.12) 100%);
}

.weather-warning-detail--red {
    border-color: rgba(248, 113, 113, 0.55);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(220, 38, 38, 0.12) 100%);
}

.weather-warning-detail--black {
    border-color: rgba(255, 255, 255, 0.28);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(0, 0, 0, 0.28) 100%);
}

:root[data-theme="day"] .weather-warning-detail--yellow {
    border-color: rgba(202, 138, 4, 0.4);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(250, 204, 21, 0.18) 100%);
}

:root[data-theme="day"] .weather-warning-detail--red {
    border-color: rgba(185, 28, 28, 0.35);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(254, 202, 202, 0.55) 100%);
}

:root[data-theme="day"] .weather-warning-detail--black {
    border-color: rgba(24, 24, 27, 0.55);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(24, 24, 27, 0.08) 100%);
}

.weather-warning-detail__head {
    display: grid;
    gap: 4px;
}

.weather-warning-detail__title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.35;
}

.weather-warning-detail--yellow .weather-warning-detail__title {
    color: #fde68a;
}

.weather-warning-detail--red .weather-warning-detail__title {
    color: #fecaca;
}

.weather-warning-detail--black .weather-warning-detail__title {
    color: #f5f5f5;
}

:root[data-theme="day"] .weather-warning-detail--yellow .weather-warning-detail__title {
    color: #854d0e;
}

:root[data-theme="day"] .weather-warning-detail--red .weather-warning-detail__title {
    color: #7f1d1d;
}

:root[data-theme="day"] .weather-warning-detail--black .weather-warning-detail__title {
    color: #18181b;
}

.weather-warning-detail__meta {
    font-size: 10px;
    line-height: 1.4;
    color: var(--text-tertiary);
}

.weather-warning-detail__body {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.weather-warning-detail__body--empty {
    font-size: 13px;
    color: var(--text-secondary);
}

.weather-warning-detail__paragraph {
    margin: 0;
    font-size: 15px;
    line-height: 1.45;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
}

.weather-flw-block {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    padding: 14px 16px;
}

.weather-flw-block--alert {
    border-color: color-mix(in srgb, var(--color-error) 40%, var(--border-color));
    background: color-mix(in srgb, var(--color-error) 6%, var(--bg-card));
}

.weather-flw-block__title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.weather-flw-block__body {
    margin-top: 8px;
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.weather-flw-footer {
    margin-top: 8px;
    padding: 4px 2px 0;
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: right;
}

.weather-rainfall-table {
    display: grid;
    gap: 8px;
}

.weather-rainfall-table__head,
.weather-rainfall-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.weather-rainfall-table__head {
    padding: 0 4px 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: -0.01em;
}

.weather-rainfall-row {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    padding: 12px 14px;
    min-height: 44px;
}

.weather-rainfall-row--station {
    border-color: var(--color-mtr-light);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-item) 100%);
}

.weather-rainfall-row--heavy {
    border-color: rgba(192, 57, 43, 0.45);
}

.weather-rainfall-row--moderate {
    border-color: rgba(230, 126, 34, 0.4);
}

.weather-rainfall-row__place {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 0;
}

.weather-rainfall-row__tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 999px;
    background: var(--bg-item);
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 700;
    vertical-align: middle;
}

.weather-rainfall-row__amount {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.weather-forecast-modal__radar {
    flex-shrink: 0;
    padding: 10px 12px 12px;
    overflow: auto;
}

.weather-forecast-modal__radar-controls {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.weather-forecast-modal__radar-control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.weather-forecast-modal__radar-control-group[hidden] {
    display: none;
}

.weather-forecast-modal__radar-control-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    flex-shrink: 0;
    min-width: 2.2em;
    letter-spacing: -0.01em;
}

.weather-forecast-modal__radar-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.weather-forecast-modal__radar-tab {
    flex: 1 1 auto;
    min-width: 4.8em;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 980px;
    background: var(--control-bg);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.2;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.3s var(--ease-apple), background 0.3s var(--ease-apple), color 0.3s var(--ease-apple);
}

.weather-forecast-modal__radar-tab:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border-color));
    color: var(--text-primary);
}

.weather-forecast-modal__radar-tab.is-active {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
}

.weather-forecast-modal__radar-tab:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.weather-forecast-modal__radar-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.weather-forecast-modal__radar-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.weather-forecast-modal__radar-meta {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: right;
    line-height: 1.35;
}

.weather-forecast-modal__radar-body {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #0b1220;
    min-height: 120px;
}

.weather-forecast-modal__radar-img {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: top;
}

.weather-forecast-modal__radar-img[hidden],
.weather-forecast-modal__radar-loading[hidden],
.weather-forecast-modal__radar-error[hidden] {
    display: none;
}

.weather-forecast-modal__radar-loading,
.weather-forecast-modal__radar-error {
    padding: 28px 12px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.weather-forecast-modal__radar-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 11px;
    color: var(--color-mtr-light);
    text-decoration: none;
}

.weather-forecast-modal__radar-link:hover {
    text-decoration: underline;
}

.weather-forecast-modal__tc-track {
    flex-shrink: 0;
    padding: 10px 12px 12px;
    overflow: auto;
}

.weather-forecast-modal__tc-track-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.weather-forecast-modal__tc-track-selector[hidden] {
    display: none;
}

.weather-forecast-modal__tc-track-tab {
    flex: 1 1 auto;
    min-width: 5em;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 980px;
    background: var(--control-bg);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.2;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.3s var(--ease-apple), background 0.3s var(--ease-apple), color 0.3s var(--ease-apple);
}

.weather-forecast-modal__tc-track-tab.is-active {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
}

.weather-forecast-modal__tc-track-head {
    display: grid;
    gap: 4px;
    margin-bottom: 10px;
}

.weather-forecast-modal__tc-track-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.weather-forecast-modal__tc-track-meta {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.35;
}

.weather-forecast-modal__tc-track-details {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
}

.weather-tc-track-detail__line {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
}

.weather-forecast-modal__tc-track-body {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #0b1220;
    min-height: 120px;
}

.weather-forecast-modal__tc-track-img {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: top;
}

.weather-forecast-modal__tc-track-img[hidden],
.weather-forecast-modal__tc-track-loading[hidden],
.weather-forecast-modal__tc-track-error[hidden] {
    display: none;
}

.weather-forecast-modal__tc-track-loading,
.weather-forecast-modal__tc-track-error {
    padding: 28px 12px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.weather-forecast-modal__tc-track-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 11px;
    color: var(--color-mtr-light);
    text-decoration: none;
}

.weather-forecast-modal__tc-track-link:hover {
    text-decoration: underline;
}

.weather-forecast-modal__tc-prob-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.weather-forecast-modal__tc-prob-legend[hidden] {
    display: none;
}

.weather-forecast-modal__tc-prob-legend-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 700;
}

.weather-forecast-modal__tc-prob-legend-img {
    display: block;
    max-width: min(100%, 220px);
    height: auto;
}

.weather-forecast-modal__tc-prob-legend-img[hidden] {
    display: none;
}

.weather-forecast-modal__tc-prob-empty {
    text-align: left;
    line-height: 1.5;
}

.weather-forecast-modal__radar-playback {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.weather-forecast-modal__radar-playback[hidden] {
    display: none;
}

.weather-forecast-modal__radar-play-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 980px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.2s var(--ease-apple), filter 0.2s var(--ease-apple), background 0.2s var(--ease-apple);
}

.weather-forecast-modal__radar-play-btn:hover {
    background: var(--accent-hover);
    filter: brightness(1.08);
    transform: scale(1.02);
}

.weather-forecast-modal__radar-play-btn:active {
    transform: scale(0.96);
}

.weather-forecast-modal__radar-slider {
    flex: 1;
    min-width: 0;
    height: 44px;
    accent-color: var(--accent);
}

.weather-forecast-modal__radar-frame-time {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

/* 運輸署特別交通消息：使用統一卡片色調，左線保留警示語意 */
.traffic-alert-bar {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--color-error);
    box-shadow: none;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: -0.01em;
    text-align: left;
}

.traffic-alert-bar__head {
    font-size: 13px;
    letter-spacing: -0.01em;
    font-weight: 600;
    opacity: 0.95;
    margin-bottom: 8px;
    color: var(--warning-text);
}

.traffic-alert-bar__line {
    font-weight: 500;
    opacity: 0.98;
    line-height: 1.45;
}

.traffic-alert-bar__text {
    font-weight: 500;
}

/* 緊接正文之後；字級與正文一致，僅以顏色區分 */
.traffic-alert-bar__time {
    display: inline;
    font-weight: 500;
    margin-left: 0.4em;
    white-space: nowrap;
    color: var(--warning-muted);
}

.traffic-alert-bar__line + .traffic-alert-bar__line {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.land-boundary-grid {
    gap: 10px;
}

.land-boundary-card .route-header {
    display: block;
    padding: 12px 14px;
    text-align: center;
}

.land-boundary-card .route-content {
    padding: 8px 12px 12px;
}

.land-boundary-card .route-badge.land-boundary {
    display: inline-block;
    max-width: 100%;
    background: var(--color-land-boundary);
    color: #fff;
    border: none;
    box-shadow: none;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    line-height: 1.25;
    white-space: normal;
}

.land-boundary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.land-boundary-row:last-child {
    border-bottom: none;
    padding-bottom: 2px;
}

.land-boundary-label {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.land-boundary-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-height: 28px;
    padding: 6px 12px;
    border-radius: 980px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    white-space: nowrap;
    line-height: 1.2;
}

.land-boundary-status--normal {
    color: #0f5132;
    background: rgba(93, 214, 161, 0.95);
}

.land-boundary-status--busy {
    color: #5b3b00;
    background: rgba(255, 213, 128, 0.95);
}

.land-boundary-status--very-busy {
    color: #641220;
    background: rgba(255, 160, 160, 0.95);
}

.land-boundary-status--maintenance,
.land-boundary-status--closed,
.land-boundary-status--unknown {
    color: var(--text-label);
    background: var(--control-bg);
}

:root[data-theme="day"] .land-boundary-status--maintenance,
:root[data-theme="day"] .land-boundary-status--closed,
:root[data-theme="day"] .land-boundary-status--unknown {
    color: var(--text-secondary);
    background: rgba(125, 139, 160, 0.18);
}

.sushiro-grid {
    gap: 10px;
}

.sushiro-card .route-header {
    display: block;
    padding: 12px 14px 6px;
}

.sushiro-card .route-content {
    padding: 6px 14px 14px;
}

.sushiro-card .route-badge.sushiro {
    display: inline-block;
    max-width: 100%;
    background: var(--color-sushiro);
    color: #fff;
    border: none;
    box-shadow: none;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    line-height: 1.25;
    white-space: normal;
}

.sushiro-card__meta {
    color: var(--text-secondary);
    font-size: 13px;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.sushiro-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.sushiro-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 980px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.35;
}

.sushiro-badge--open {
    color: #fff;
    background: #1f8f4a;
}

.sushiro-badge--closed {
    color: #fff;
    background: #8b2f2f;
}

.sushiro-badge--ticketing {
    color: #fff;
    background: var(--color-sushiro);
}

.sushiro-badge--stopped {
    color: var(--text-primary);
    background: rgba(255, 193, 7, 0.22);
    border: 1px solid rgba(255, 193, 7, 0.45);
}

.sushiro-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.sushiro-row:last-child {
    border-bottom: none;
    padding-bottom: 2px;
}

.sushiro-label {
    color: var(--text-secondary);
    font-size: 13px;
    letter-spacing: -0.01em;
}

.sushiro-value {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-align: right;
    word-break: break-word;
    font-variant-numeric: tabular-nums;
}

.sushiro-card__map-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 4px;
    color: var(--color-sushiro);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.sushiro-card__map-link:hover {
    text-decoration: underline;
}

.hospital-card {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
    padding: 4px 16px 14px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.hospital-card[hidden] {
    display: none !important;
}

.hospital-card__title {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--text-primary);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    cursor: pointer;
    text-align: left;
    min-height: 48px;
    font-family: inherit;
}

.hospital-card__chevron {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.9;
    transition: transform 0.3s var(--ease-apple);
}

.hospital-card--expanded .hospital-card__chevron {
    transform: rotate(180deg);
}

.hospital-card__body {
    margin-top: 4px;
}

.hospital-card__body[hidden] {
    display: none !important;
}

.hospital-card__name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.hospital-card__picker {
    margin-bottom: 8px;
}

.hospital-card__select {
    width: 100%;
    min-height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-item);
    color: var(--text-primary);
    font-size: 15px;
    letter-spacing: -0.01em;
    padding: 10px 12px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.3s var(--ease-apple), box-shadow 0.3s var(--ease-apple);
}

.hospital-card__select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.hospital-card__row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.hospital-card__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}

.hospital-card__col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hospital-card__label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 12px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.hospital-card__value {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    white-space: nowrap;
}

.hospital-card__meta {
    margin-top: 8px;
    color: var(--text-tertiary);
    font-size: 12px;
    letter-spacing: -0.01em;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

/* iFrame 響應式優化 */
@media (max-width: 768px) {
    body {
        padding-top: max(var(--spacing-md), var(--safe-top));
        padding-right: max(var(--spacing-md), var(--safe-right));
        /* 預留底部 Tab Bar，避免最後幾個區塊被遮蓋 */
        padding-bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 24px);
        padding-left: max(var(--spacing-md), var(--safe-left));
    }
    
    .routes-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .route-card {
        border-radius: var(--radius-md);
    }

    .route-header {
        padding: 10px 12px;
    }

    .station-name {
        font-size: 15px;
    }

    .route-badge {
        font-size: 28px;
    }

    .kmb-route-modal__body {
        grid-template-columns: 1fr;
        overflow: auto;
    }

    .kmb-route-modal__pane {
        max-height: none;
    }

    .kmb-route-modal__card {
        width: min(680px, calc(100vw - 8px));
        margin: 0 4px;
        max-height: min(88vh, 820px);
    }

    .weather-card {
        width: 100%;
        padding: 14px 16px 12px;
        margin-bottom: 0;
    }

    .weather-top .weather-date {
        font-size: 13px;
    }

    .weather-place {
        font-size: 15px;
    }

    .weather-time {
        font-size: 13px;
    }

    .weather-icon--big {
        font-size: 44px;
    }

    .weather-temp {
        font-size: 40px;
    }

    .weather-desc {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .route-badge {
        font-size: 26px;
        padding: 4px 6px;
    }
    
    .station-name {
        font-size: 15px;
    }
    
    .weather-temp {
        font-size: 36px;
    }

    .weather-time {
        font-size: 13px;
    }

    .weather-top .weather-date {
        font-size: 13px;
    }

    .hospital-card__grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}

/* 防止 iFrame 滾動條 */
html,
body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

/* iOS／Android 主畫面 Web App：body 需為固定高度捲動容器（min-height 在部分 WebKit 無法捲動） */
html.mobile-adaptive {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
}

html.mobile-adaptive body {
    height: 100%;
    height: 100dvh;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding-bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 24px);
}

/* 行動裝置：在窄螢幕 @media 單欄時仍用兩欄（與原 mobile-adaptive 一致） */
html.mobile-adaptive .routes-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

html.mobile-adaptive .routes-grid > .route-card--span-full {
    grid-column: 1 / -1;
}

/* ========== Apple iOS Web Polish chrome ========== */

@keyframes sheetRise {
    from {
        opacity: 0.6;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-banner {
    position: sticky;
    top: 0;
    z-index: 45;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 calc(-1 * max(var(--spacing-md), var(--safe-right))) 0 calc(-1 * max(var(--spacing-md), var(--safe-left)));
    padding: 10px max(16px, var(--safe-right)) 10px max(16px, var(--safe-left));
    font-size: 13px;
    font-weight: 500;
}

.app-banner[hidden] {
    display: none !important;
}

.app-banner--offline {
    background: color-mix(in srgb, var(--color-error) 16%, var(--bg-card));
    color: var(--color-error);
    border-bottom: 1px solid color-mix(in srgb, var(--color-error) 28%, transparent);
}

.app-banner--install {
    background: var(--accent-soft);
    color: var(--accent);
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.app-banner__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.app-banner__btn {
    border: 0;
    border-radius: 980px;
    min-height: 32px;
    padding: 6px 14px;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.app-banner__dismiss {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    min-width: 32px;
    min-height: 32px;
    cursor: pointer;
    opacity: 0.7;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    margin: 0 calc(-1 * max(var(--spacing-md), var(--safe-right))) 8px calc(-1 * max(var(--spacing-md), var(--safe-left)));
    padding: var(--safe-top) max(16px, var(--safe-right)) 0 max(16px, var(--safe-left));
    background: color-mix(in srgb, var(--bg-primary) 82%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    transition: box-shadow 0.2s var(--ease-apple);
}

.app-header[data-compact="true"] {
    box-shadow: 0 1px 0 var(--border-color);
}

.app-header__compact {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: var(--app-header-compact-height);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.2s var(--ease-apple), transform 0.2s var(--ease-apple);
}

.app-header[data-compact="true"] .app-header__compact,
.app-header--no-title .app-header__compact {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}

.app-header--no-title {
    box-shadow: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.app-header--no-title .app-header__compact {
    min-height: 40px;
}

.app-header__compact-title {
    display: none;
}

.app-header__compact-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-header__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 980px;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.app-header__icon-btn:active {
    background: var(--control-bg);
    transform: scale(0.94);
}

.app-header__large {
    padding: 4px 0 12px;
    transition: opacity 0.2s var(--ease-apple), transform 0.25s var(--ease-spring), max-height 0.25s var(--ease-spring);
    max-height: 96px;
    overflow: hidden;
}

.app-header[data-compact="true"] .app-header__large {
    opacity: 0;
    transform: translateY(-8px);
    max-height: 0;
    padding-bottom: 0;
    pointer-events: none;
}

.app-header__large-title {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.1;
    color: var(--text-primary);
}

.app-header__subtitle {
    margin-top: 4px;
    font-size: 15px;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.ptr-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 0;
    overflow: hidden;
    opacity: 0;
    color: var(--text-secondary);
    font-size: 13px;
    pointer-events: none;
    transition: height 0.15s var(--ease-apple), opacity 0.15s var(--ease-apple);
}

.ptr-indicator.is-visible {
    height: 56px;
    opacity: 1;
}

.ptr-indicator.is-refreshing .ptr-indicator__spinner {
    animation: spin 0.8s linear infinite;
}

.ptr-indicator__spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
}

.ptr-indicator__label {
    font-weight: 500;
}

.app-boot-shell__hint {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.nav-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: min(42vh, 280px);
    padding: 32px 20px;
    text-align: center;
    animation: fadeUp 0.35s var(--ease-spring) both;
}

.nav-empty[hidden] {
    display: none !important;
}

.nav-empty__icon {
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.nav-empty__title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.nav-empty__hint {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 260px;
}

.nav-empty__btn {
    margin-top: 10px;
    border: 0;
    border-radius: 980px;
    min-height: 44px;
    padding: 10px 22px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.nav-empty__btn:active {
    transform: scale(0.98);
    filter: brightness(0.95);
}

.main-container.is-tab-sliding {
    animation: tabSlideIn 0.35s var(--ease-spring) both;
}

@keyframes tabSlideIn {
    from {
        opacity: 0.55;
        transform: translateX(18px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.main-container.is-tab-sliding-left {
    animation-name: tabSlideInLeft;
}

@keyframes tabSlideInLeft {
    from {
        opacity: 0.55;
        transform: translateX(-18px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

html.is-suppressing-selection,
html.is-suppressing-selection * {
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
}

.app-tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    min-height: calc(var(--tab-bar-height) + var(--safe-bottom));
    padding: 4px 4px calc(4px + var(--safe-bottom));
    background: color-mix(in srgb, var(--bg-card) 78%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--border-color);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.app-tab-bar__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--text-tertiary);
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    transition: color 0.2s var(--ease-apple), transform 0.15s var(--ease-apple);
}

.app-tab-bar__item:active {
    transform: scale(0.94);
}

.app-tab-bar__item.is-long-press-armed {
    color: var(--accent);
    transform: scale(1.08);
}

.app-tab-bar__item.is-long-press-armed .app-tab-bar__label {
    font-weight: 700;
}

.app-tab-bar__item.is-active {
    color: var(--accent);
}

.app-tab-bar__label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: -0.01em;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    pointer-events: none;
}

.app-tab-bar__icon {
    display: inline-flex;
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.more-sheet[hidden] {
    display: none;
}

.more-sheet {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.more-sheet__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    margin: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.more-sheet__card {
    position: relative;
    width: min(680px, 100%);
    max-height: min(72vh, 560px);
    border-radius: 18px 18px 0 0;
    overflow: auto;
    background: var(--sheet-bg);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
    animation: sheetRise 0.35s var(--ease-spring) both;
    touch-action: pan-y;
    transition: transform 0.2s var(--ease-spring);
    padding-bottom: max(16px, var(--safe-bottom));
}

.more-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 12px;
}

.more-sheet__title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.more-sheet__close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 980px;
    background: var(--control-bg);
    color: var(--text-secondary);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.more-sheet__body {
    padding: 0 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.more-sheet__group {
    background: var(--inset-group-bg);
    border-radius: 12px;
    overflow: hidden;
}

.more-sheet__group-header {
    padding: 8px 16px 4px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.more-sheet__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border: 0;
    border-top: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    font-size: 17px;
    font-family: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.more-sheet__group .more-sheet__row:first-of-type {
    border-top: 0;
}

.more-sheet__row:active {
    background: var(--control-bg);
}

.more-sheet__row-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.more-sheet__row-label {
    font-weight: 400;
}

.more-sheet__row-sub {
    font-size: 13px;
    color: var(--text-secondary);
}

.more-sheet__chevron {
    color: var(--text-tertiary);
    font-size: 22px;
    line-height: 1;
}

.more-sheet__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 10px;
    padding: 4px 4px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

.more-sheet__api-source {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.more-sheet__api-source-svg {
    display: block;
    width: 16px;
    height: 16px;
}

.more-sheet__version {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--text-secondary) 45%, transparent);
    text-underline-offset: 3px;
    cursor: pointer;
}

.more-sheet__version:hover,
.more-sheet__version:focus-visible {
    color: var(--text-primary);
    text-decoration-color: var(--text-primary);
    outline: none;
}

.more-sheet__version:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.routes-stack > [data-nav-hidden="true"] {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .app-header__compact,
    .app-header__large,
    .main-container.is-tab-sliding,
    .main-container.is-tab-sliding-left,
    .settings-modal__card,
    .more-sheet__card,
    .nav-empty,
    .ptr-indicator {
        animation: none !important;
        transition: none !important;
    }

    .ptr-indicator.is-refreshing .ptr-indicator__spinner {
        animation: none;
    }
}
