:root {
    color-scheme: light dark;
    --bg-color: #ffffff;
    --map-bg: #ffffff;
    --text-main: #001d31;
    --text-sub: #78848b;
    --border-color: #eeeeee;
    --header-bg: #ffffff;
    --header-title: #001d31;
    --header-btn-bg-default: #001d31;
    --header-btn-icon: #ffffff;
    --station-stroke: #001d31;
    --not-open-color: #bdcbd2;
    --panel-bg: #ffffff;
    --panel-header-bg: #001d31;
    --panel-header-text: #ffffff;
    --close-btn-color: rgba(255,255,255,0.6);
    --footer-bg: #f9f9f9;
    --btn-primary-bg: #001d31;
    --btn-secondary-bg: #ffffff;
    --btn-secondary-text: #001d31;
    --capsule-bg: #ffffff;
    --capsule-text: #333333;
    --stops-tag-bg: #f0f2f5;
    --opt-label-bg: #f9f9f9;
    --opt-text: #555555;
    --opt-hover: #eeeeee;
    --breakdown-bg: #f7f9fa;
    --breakdown-text: #555555;
    --action-btn-bg: #001d31;
    --input-bg: #f9f9f9;
    --list-hover: #f0f2f5;
    --close-btn-bg: #f0f2f5;
    --control-bg: #ffffff;
    --ctrl-btn-bg: #f0f2f5;
    --ctrl-icon: #333333;
    --ctrl-hover: #e1e4e8;
    --divider: #e0e0e0;
}
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --map-bg: #1a1a1a;
    --text-main: #e5e8ea;
    --text-sub: #78848b;
    --border-color: #333333;
    --header-bg: #1f2020;
    --header-title: #e5e8ea;
    --station-stroke: #bdcbd2;
    --not-open-color: #383838;
    --panel-bg: #1f2020;
    --panel-header-bg: #373838;
    --panel-header-text: #e5e8ea;
    --close-btn-color: #78848b;
    --footer-bg: #373838;
    --btn-primary-bg: #006098;
    --btn-secondary-bg: #191919;
    --btn-secondary-text: #e5e8ea;
    --capsule-bg: #1f2020;
    --capsule-text: #78848b;
    --stops-tag-bg: #78848b;
    --opt-label-bg: #78848b;
    --opt-text: #e5e8ea;
    --opt-hover: #78848b;
    --breakdown-bg: #383838;
    --breakdown-text: #78848b;
    --action-btn-bg: #383838;
    --input-bg: #1f2020;
    --list-hover: #373838;
    --close-btn-bg: #373838;
    --control-bg: #1f2020;
    --ctrl-btn-bg: #373838;
    --ctrl-icon: #78848b;
    --ctrl-hover: #3f3f3f;
    --divider: #333333;
}
html, body {
    background-color: #fff !important;
    font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-weight: 400;
    overscroll-behavior: none;
    overflow: hidden;
    background-color: var(--bg-color) !important;
    color: var(--text-main);
    transition: background-color 0.3s, color 0.3s;
}
.tool-header {
    background-color: var(--bg-color) !important;
    color: var(--text-main) !important;
    border-bottom: 1px solid var(--border-color);
}
.app-title { color: var(--header-title) !important; }
[data-theme="dark"] .header-left .btn-info,
[data-theme="dark"] .header-right .btn-info {
    background-color: #373838 !important;
    color: #fff !important;
}
[data-theme="dark"] .header-left .btn-dark {
    background-color: #006098 !important;
    color: #fff !important;
}
#map-container {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
    border: none;
    background-color: #fff;
    overflow: hidden;
    user-select: none;
    cursor: grab;
    touch-action: none;
    transform-origin: 0 0;
    background-color: var(--map-bg) !important;
}
#map-content {
    position: relative;
    width: 1850px;
    height: 1300px;
    transform-origin: 0 0;
    background-color: #fff;
    background-color: var(--map-bg) !important;
}
.animate-zoom { transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
#map-container::-webkit-scrollbar { display: none; }
#map-container.active { cursor: grabbing; }
#lines-layer,
#stations-layer,
#labels-layer,
#not-open-layer,
#scattered-layer,
#highlight-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
#lines-layer {
    z-index: 10;
    pointer-events: none;
}
.line-visual-overlay {
    fill: none;
    pointer-events: none;
    transition: all 0.2s;
}
.line-visual-outer,
.line-visual-inner {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.2s;
    pointer-events: none;
}
.line-visual-group.active .line-visual-outer {
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.5));
}
.line-visual-group.active .line-visual-inner {
    stroke-width: 9px !important;
}
.line-interaction {
    fill: none;
    stroke: transparent;
    stroke-width: 15px;
    cursor: pointer;
    pointer-events: stroke;
}
#line-tooltip {
    position: fixed;
    z-index: 9999;
    display: none;
    pointer-events: none;
    transform: translate(-50%, -100%);
    margin-top: -15px;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.3));
    transition: opacity 0.2s;
}
#line-tooltip img {
    height: 24px;
    display: block;
    background-color: #fff;
    border-radius: 2px;
    padding: 1px;
}
#stations-layer {
    z-index: 20;
    pointer-events: none;
}
.station {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.station svg {
    width: 100%;
    height: 100%;
    display: block;
}
.station.active {
    transform: translate(-50%, -50%) scale(1.5);
    z-index: 100 !important;
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.5));
}
.dot,
.rdot,
.diy { width: 10px; height: 10px; z-index: 15; }
.tsf,
.tsfo { width: 17.5px; height: 17.5px; z-index: 20; }
.no { width: 10px; height: 10px; z-index: 5; }
.diy {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}
#labels-layer {
    z-index: 30;
    pointer-events: none;
}
.label-group {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s;
}
.stacn {
    font-size: 11.5px;
    color: #001d31;
    display: block;
    line-height: 13.8px;
    font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-weight: 500;
    color: var(--text-main) !important;
}
.staen {
    font-size: 6.65px;
    color: #001d31;
    display: block;
    margin-top: 0;
    line-height: 6.35px;
    white-space: normal;
    font-family: 'Arimo', 'Arial', sans-serif;
    font-weight: 500;
    color: var(--text-main) !important;
}
.label-group.type-no .stacn,
.label-group.type-no .staen {
    color: #bdcbd2;
    color: var(--not-open-color) !important;
}
.label-group.active { z-index: 35; }
.label-group.active .stacn {
    color: #D0021B !important;
    transform: scale(1.1);
    transform-origin: inherit;
    font-size: 15px;
    line-height: 15px;
    font-weight: 700
}
.label-group.active .staen { color: #D0021B !important; font-size: 9px; line-height: 8px; font-weight: 700}
#not-open-layer { z-index: 12; pointer-events: none; }
#highlight-layer { z-index: 13; pointer-events: none; }
.line-visual-group.active .line-visual-outer {
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.8)) !important;
}
#scattered-layer { pointer-events: none; z-index: 5; }
.scattered-item {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
#modern-zoom-control {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 800;
    background: white;
    padding: 8px 6px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    user-select: none;
    touch-action: none;
    background-color: var(--control-bg) !important;
}
#modern-zoom-control button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f0f2f5;
    color: #333;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    background-color: var(--ctrl-btn-bg) !important;
    color: var(--ctrl-icon) !important;
}
#modern-zoom-control button:hover {
    background: #e1e4e8;
    color: #001d31;
    background-color: var(--ctrl-hover) !important;
}
#modern-zoom-control button:active { background: #d0d7de; }
.mz-slider-track {
    height: 100px;
    width: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}
#mz-slider {
    width: 100px;
    height: 32px;
    transform: rotate(-90deg);
    transform-origin: center;
    margin: 0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}
#mz-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: #eee;
    border-radius: 2px;
}
#mz-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: #eee;
    border-radius: 2px;
}
#mz-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #001d31;
    margin-top: -6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.1s;
}
#mz-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
#modern-zoom-control div[style*="height: 1px"] {
    background-color: var(--divider) !important;
}
[data-theme="dark"] #mz-slider::-webkit-slider-runnable-track {
    background: #373838 !important;
}
[data-theme="dark"] #mz-slider::-webkit-slider-thumb {
    background: #78848b !important;
}
#info-panel {
    width: 320px;
    padding: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    overflow: hidden;
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-weight: 400;
    overscroll-behavior: contain;
    touch-action: pan-y;
}
[data-theme="dark"] #info-panel {
    background-color: #1f2020 !important;
    color: #e5e8ea !important;
}
.panel-header {
    position: relative;
    background-color: #001d31;
    color: white;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 50px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background-color: var(--panel-header-bg) !important;
}
[data-theme="dark"] .panel-header {
    background-color: #373838;
    color: #e5e8ea;
}
.header-name-group {
    flex: 0 0 auto;
    min-width: 0;
}
.panel-cn-name {
    font-size: 18.5px;
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: 1px;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--panel-header-text) !important;
}
.panel-en-name {
    font-family: 'Arimo', 'Arial', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #a0b0b9;
    margin-bottom: 0;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--panel-header-text) !important;
}
[data-theme="dark"] .panel-cn-name,
[data-theme="dark"] .panel-en-name {
    color: inherit !important;
}
.panel-badges {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 15px;
}
.line-badge {
    height: 20px;
    width: auto;
    display: block;
    border-radius: 2px;
}
.text-badge {
    font-size: 12px;
    background: rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 4px;
}
.panel-close-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    padding: 0;
    color: var(--close-btn-color) !important;
}
.panel-close-btn:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}
[data-theme="dark"] .panel-close-btn {
    color: inherit !important;
    opacity: 0.7;
}
.panel-body {
    background-color: white;
    padding: 15px 20px;
}
[data-theme="dark"] .panel-body {
    background-color: var(--panel-bg) !important;
    color: var(--text-main) !important;
}
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    margin-bottom: 10px;
    line-height: 1.5;
}
.info-label {
    color: #78848b;
    flex-shrink: 0;
    margin-right: 15px;
    color: var(--text-sub) !important;
}
.info-value {
    color: #001d31;
    text-align: right;
    font-weight: bold;
    word-break: break-word;
    color: var(--text-main) !important;
}
.line-block {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #eee;
}
[data-theme="dark"] .line-block {
    border-top-color: var(--border-color) !important;
}
.line-block-header {
    margin-bottom: 8px;
    text-align: left;
}
.line-block-header .line-badge {
    background-color: transparent;
    padding: 0;
    height: 18px;
}
.accordion-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 5px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
    overflow: hidden;
}
.accordion-header:hover {
    background-color: #f9f9f9;
    border-radius: 4px;
}
[data-theme="dark"] .accordion-header:hover {
    background-color: var(--list-hover) !important;
}
.collapse-arrow {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    fill: #bdcbd2;
    transition: transform 0.3s ease;
    transform: rotate(0deg);
}
[data-theme="dark"] .collapse-arrow {
    fill: var(--text-sub) !important;
}
.collapse-arrow.collapsed { transform: rotate(-90deg); }
.accordion-body {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 500px;
    opacity: 1;
    padding-left: 28px;
    border-bottom: 1px dashed #eee;
    margin-bottom: 5px;
    overscroll-behavior: contain;
}
[data-theme="dark"] .accordion-body {
    border-bottom-color: var(--border-color) !important;
    color: var(--text-main) !important;
}
.accordion-body.hidden {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    border-bottom: none;
}
.accordion-hint {
    font-size: 11px;
    color: #bdcbd2;
    margin-left: 8px;
    font-weight: normal;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.2s ease;
    flex-shrink: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
[data-theme="dark"] .accordion-hint {
    color: var(--text-sub) !important;
}
.accordion-header.expanded .accordion-hint {
    opacity: 0;
    display: none;
}
.reserved-box {
    background: #f0f2f5;
    color: #bdcbd2;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    margin: 5px 0;
    text-align: center;
    border: 1px dashed #e0e0e0;
}
[data-theme="dark"] .reserved-box {
    background-color: var(--ctrl-btn-bg) !important;
    border-color: var(--border-color) !important;
    color: var(--text-sub) !important;
}
.station-svg-container {
    width: 100%;
    height: auto;
    padding: 0;
    overflow: hidden;
}
.station-svg-container svg { display: block; width: 100%; height: auto; }
.panel-footer {
    padding: 8px 15px;
    background-color: #f9f9f9;
    color: #ccc;
    text-align: center;
    font-size: 11px;
    border-top: 1px solid #eee;
    border-top: 1px solid var(--border-color) !important;
}
[data-theme="dark"] .panel-footer {
    background-color: #373838 !important;
}
.mini-schedule-btn {
    font-size: 11px;
    padding: 2px 8px;
    background-color: #001d31;
    color: white !important;
    border-radius: 12px;
    text-decoration: none;
    line-height: 18px;
    height: 20px;
    display: inline-block;
    transition: background 0.2s;
    font-weight: normal;
    font-family: "Microsoft YaHei", sans-serif;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    flex-shrink: 0;
    white-space: nowrap;
    position: relative;
    z-index: 5;
    margin-left: 10px !important;
}
.mini-schedule-btn:hover { background-color: #006098; }
[data-theme="dark"] .mini-schedule-btn {
    background-color: #006098 !important;
    color: #ffffff !important;
}
.header-station-logo {
    height: 50px;
    width: auto;
    margin-right: -5px;
    margin-left: -5px;
    display: block;
    flex-shrink: 0;
}
.special-br {
    display: block;
    height: 0;
    content: "";
}
.force-white-text .panel-cn-name,
.force-white-text .panel-en-name,
.force-white-text .panel-close-btn {
    color: #ffffff !important;
}
#route-ui-container {
    position: absolute;
    top: 20px;
    left: 70px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
#route-capsule {
    background: white;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    padding: 8px 15px;
    pointer-events: auto;
    animation: slideInLeft 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background-color: var(--capsule-bg) !important;
}
.capsule-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #333;
    margin-right: 10px;
    font-family: "Microsoft YaHei", sans-serif;
}
.capsule-dot.end {
    width: 8px;
    height: 8px;
    background: #D0021B;
    border-radius: 50%;
}
.capsule-text b {
    color: #001d31;
    color: var(--capsule-text) !important;
}
.capsule-arrow { color: #ccc; }
.capsule-hint { color: #999; font-size: 12px; }
.capsule-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0 0 0 10px;
    line-height: 1;
    border-left: 1px solid #eee;
    transition: color 0.2s;
}
.capsule-close:hover { color: #D0021B; }
#route-result-panel {
    background: white;
    width: 240px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    padding: 15px;
    pointer-events: auto;
    position: relative;
    animation: slideInLeft 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-family: "Microsoft YaHei", sans-serif;
}
[data-theme="dark"] #route-result-panel {
    background-color: #1f2020 !important;
    color: #e5e8ea !important;
}
.result-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    color: #ccc;
    cursor: pointer;
}
.result-close:hover { color: #333; }
.result-header {
    margin-bottom: 12px;
    font-size: 13px;
    color: #666;
    border-bottom: 1px dashed #eee;
    padding-bottom: 8px;
}
.station-flow {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: bold;
    color: #001d31;
    color: var(--text-main) !important;
}
.flow-arrow {
    color: #ccc;
    font-weight: normal;
    font-size: 12px;
}
.result-main {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 15px;
}
.time-big {
    font-size: 32px;
    font-weight: 800;
    color: #001d31;
    line-height: 1;
    letter-spacing: -1px;
    color: var(--text-main) !important;
}
.time-big small {
    font-size: 12px;
    font-weight: normal;
    margin-left: 2px;
    color: #666;
    color: var(--text-sub) !important;
}
.stops-small {
    font-size: 13px;
    color: #78848b;
    background: #f0f2f5;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: var(--stops-tag-bg) !important;
}
[data-theme="dark"] .stops-small {
    color: #ffffff !important;
}
.result-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}
.result-options label {
    font-size: 11px;
    background: #f9f9f9;
    padding: 5px 8px;
    border-radius: 4px;
    color: #555;
    cursor: pointer;
    border: 1px solid #eee;
    transition: all 0.2s;
    background-color: var(--opt-label-bg) !important;
    color: var(--opt-text) !important;
    border-color: var(--border-color) !important;
}
.result-options label:hover { border-color: #ccc; }
.result-options input {
    margin-right: 3px;
    vertical-align: middle;
}
#copy-result-btn {
    width: 100%;
    background: #001d31;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    background-color: var(--action-btn-bg) !important;
}
#copy-result-btn:hover { background: #002d4a; }
#copy-result-btn:active { transform: translateY(1px); }
#route-calc-error {
    color: #D0021B;
    font-size: 11px;
    margin-top: 8px;
    text-align: center;
}
#fare-breakdown {
    margin-bottom: 12px;
    padding: 8px 10px;
    background: #f7f9fa;
    border-radius: 6px;
    border: 1px dashed #e0e0e0;
    font-size: 12px;
    color: #555;
    display: none;
    background-color: var(--breakdown-bg) !important;
    color: var(--breakdown-text) !important;
    border-color: var(--border-color) !important;
}
.fare-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}
#route-path-debug {
    display: none !important;
    margin: 10px 0;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 12px;
    color: #333;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.6;
    border: 1px solid #eee;
}
#route-path-debug::-webkit-scrollbar { width: 4px; }
#route-path-debug::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}
.path-step { display: block; }
.path-transfer {
    color: #D0021B;
    font-weight: bold;
    margin: 0 4px;
}
.path-arrow { color: #999; margin: 0 2px; }
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
#legend-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    backdrop-filter: blur(3px);
    animation: overlayFadeIn 0.2s ease-out;
}
@keyframes overlayFadeIn {
    from { background: rgba(0,0,0,0); backdrop-filter: blur(0); }
    to { background: rgba(0,0,0,0.5); backdrop-filter: blur(3px); }
}
.legend-modal {
    position: absolute;
    background: white;
    width: 400px;
    max-width: 85%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform-origin: 0 0;
    animation: expandMenu 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    touch-action: none;
}
[data-theme="dark"] .legend-modal {
    background-color: #1f2020 !important;
    color: #e5e8ea !important;
}
@keyframes expandMenu {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.legend-close-btn {
    position: absolute;
    top: 15px;
    left: 20px;
    background: #f0f2f5;
    border: none;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px 6px 8px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
    z-index: 20;
    background-color: var(--close-btn-bg) !important;
}
.legend-close-btn:hover {
    background-color: #e4e6e9;
    color: #001d31;
}
.legend-close-btn:active { background-color: #d0d3d6; }
[data-theme="dark"] .legend-close-btn:hover {
    background-color: #4a4b4c !important;
    color: #ffffff !important;
}
#legend-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px 20px;
    touch-action: pan-y;
}
.legend-section-title {
    margin-bottom: 15px;
    text-align: left;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}
.legend-section-title img {
    height: 24px;
    display: block;
    max-width: 100%;
}
.legend-grid {
    display: grid;
    gap: 0px 12px;
    margin-bottom: 25px;
}
.legend-item {
    cursor: pointer;
    border-radius: 6px;
    transition: transform 0.1s, background 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: white;
    border: 1px solid transparent;
    background-color: var(--panel-bg) !important;
    color: var(--text-main) !important;
    border-color: transparent !important;
}
.legend-item:hover {
    background-color: #eef2f5;
    border-color: #dee2e6;
    transform: translateY(-1px);
    background-color: var(--list-hover) !important;
}
.legend-item:active {
    transform: translateY(1px);
    background-color: #e0e4e8;
}
.legend-item img {
    width: 100%;
    height: auto;
    max-height: 50px;
    object-fit: contain;
    display: block;
}
.search-container {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    border-bottom: none;
    padding-bottom: 10px;
    margin-bottom: 10px;
    padding-top: 55px;
    background-color: var(--panel-bg) !important;
}
.search-input-wrapper { position: relative; width: 100%; }
#station-search-input {
    width: 100%;
    padding: 10px 32px 10px 12px;
    font-size: 14px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    outline: none;
    color: #001d31;
    background-color: #f9f9f9;
    transition: border-color 0.2s;
    font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: var(--input-bg) !important;
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
}
#station-search-input:focus {
    border-color: #001d31;
    background-color: #fff;
}
#station-search-input::placeholder { color: #bdcbd2; }
#search-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #bdcbd2;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    display: none;
    transition: color 0.2s;
}
#search-clear-btn:hover { color: #001d31; }
#search-results-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    display: none;
    touch-action: pan-y;
}
.search-item {
    display: flex;
    align-items: center;
    padding: 10px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.1s;
    color: #001d31;
    font-size: 14px;
    color: var(--text-main) !important;
}
.search-item:hover {
    background-color: #f0f2f5;
    background-color: var(--list-hover) !important;
}
.search-item.pending { color: #bdcbd2; }
.search-line-icon {
    height: 20px;
    width: auto;
    margin-right: 4px;
    display: block;
}
.search-item-text {
    margin-left: 4px;
    font-weight: 500;
}
#controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 900;
    background: transparent;
    display: none;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
}
#controls.visible { display: flex; }
.control-box {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    min-width: 220px;
    margin-bottom: 15px;
    pointer-events: auto;
}
[data-theme="dark"] .control-box {
    background-color: #1f2020 !important;
    color: #e5e8ea !important;
}
.mode-switch {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-bottom: 10px;
}
.mode-switch label {
    cursor: pointer;
    font-size: 14px;
}
.control-item {
    margin-bottom: 8px;
    font-size: 14px;
}
.text-dialog {
    background: var(--panel-bg) !important;
    color: var(--text-main) !important;
}
.dialog-content strong { color: var(--text-main) !important; }
.dialog-content p { color: var(--text-main) !important; }
.dialog-content { color: var(--text-main) !important; }
.text-dialog h3 { color: var(--text-main) !important; }
[data-theme="dark"] .dialog-content a[style*="background:#001d31"] {
    background-color: #006098 !important;
    color: #ffffff !important;
}
.bottom-bar {
    background-color: var(--bg-color) !important;
    color: var(--text-sub) !important;
    border-top: 1px solid var(--border-color);
}
@media (min-width: 769px) {
    #info-panel {
        max-height: 80vh;
        display: flex;
        flex-direction: column;
    }
    #info-panel.panel-adjust-anim {
        transition: top 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    .panel-header,
    .panel-footer { flex-shrink: 0; }
    .panel-body {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        scrollbar-width: thin;
        scrollbar-color: #bdcbd2 #f0f2f5;
    }
    .panel-body::-webkit-scrollbar { width: 6px; }
    .panel-body::-webkit-scrollbar-track { background: #f0f2f5; }
    .panel-body::-webkit-scrollbar-thumb {
        background-color: #bdcbd2;
        border-radius: 3px;
    }
}
@media (max-width: 768px) {
    body.mobile-split-active #modern-zoom-control .mz-slider-track {
        display: none;
    }
    body.mobile-split-active #info-panel {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 50% !important;
        left: 0 !important;
        width: 100% !important;
        height: 50% !important;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.15);
        z-index: 2000;
        overflow: hidden;
    }
    body.mobile-split-active .panel-header {
        min-height: 70px;
        padding: 15px 45px 15px 20px;
        align-items: center;
        justify-content: flex-start;
    }
    body.mobile-split-active .header-name-group {
        flex: 0 1 auto;
        margin-right: 10px;
        min-width: 0;
    }
    body.mobile-split-active .panel-cn-name { font-size: 20px; }
    body.mobile-split-active .panel-en-name {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    body.mobile-split-active .panel-badges {
        flex-shrink: 0;
        justify-content: flex-start;
        min-height: auto;
        display: flex;
        align-items: center;
    }
    body.mobile-split-active .line-badge {
        height: 22px;
        width: auto;
    }
    body.mobile-split-active .panel-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 24px;
        color: rgba(255, 255, 255, 0.9);
        background: rgba(255, 255, 255, 0.15);
        border-radius: 50%;
        width: 32px;
        height: 32px;
        padding: 0;
        cursor: pointer;
    }
    body.mobile-split-active #info-panel .panel-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 20px;
        overscroll-behavior: contain;
    }
    body.mobile-split-active #info-panel .panel-footer {
        flex-shrink: 0;
        border-top: 1px solid #eee;
    }
    body.mobile-split-active .special-br {
        display: inline;
    }
    body.mobile-split-active .special-br::before {
        content: " ";
    }
    body.mobile-split-active .header-station-logo {
        height: 60px;
        margin-right: 0px;
    }
}
#theme-tooltip {
    position: absolute;
    top: 50px;
    right: 50px;
    background-color: var(--action-btn-bg);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    pointer-events: none;
    z-index: 3000;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s ease;
}
#theme-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}
#theme-tooltip::after {
    display: none;
}
#theme-btn {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
body, .station, .label-group, #map-container {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}
#custom-context-menu {
    position: fixed;
    z-index: 10000;
    background: #fff;
    color: #001d31;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    padding: 6px;
    min-width: 160px;
    display: none;
    flex-direction: column;
    gap: 4px;
    border: 1px solid #eee;
    animation: menuFadeIn 0.15s ease-out;
    font-family: 'Noto Sans SC', sans-serif;
}
[data-theme="dark"] #custom-context-menu {
    background: #1f2020;
    color: #e5e8ea;
    border-color: #333;
}
@keyframes menuFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.ctx-header {
    padding: 8px 12px 6px 12px;
    font-size: 12px;
    color: #78848b;
    border-bottom: 1px solid #eee;
    margin-bottom: 4px;
    font-weight: bold;
    text-align: center;
}
[data-theme="dark"] .ctx-header {
    border-bottom-color: #333;
    color: #78848b;
}
.ctx-menu-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: #001d31;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.1s;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}
[data-theme="dark"] .ctx-menu-btn { color: #e5e8ea; }
.ctx-menu-btn:hover { background-color: #f0f2f5; }
[data-theme="dark"] .ctx-menu-btn:hover { background-color: #373838; }
.ctx-menu-btn:active { background-color: #e0e0e0; }
.ctx-btn-danger { color: #d93932 !important; }
.ctx-divider {
    font-size: 10px;
    color: #999;
    background: #f7f9fa;
    padding: 4px 12px;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    margin-top: 2px;
    margin-bottom: 2px;
    font-weight: bold;
}
[data-theme="dark"] .ctx-divider {
    background: #2a2a2a;
    border-color: #333;
    color: #666;
}
#theme-btn, .btn, button {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}
* {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
}
input, textarea {
    -webkit-user-select: auto !important;
    user-select: auto !important;
}
img {
    pointer-events: none;
}
.header-logo, .line-badge, .search-line-icon, #line-tooltip-img {
    pointer-events: auto;
}