:root {
    --page-bg: #f5efe2;
    --paper-bg: #fffcf6e0;
    --paper-strong: #fffdf8;
    --ink: #162033;
    --ink-soft: #5f6c80;
    --line: #1620331f;
    --accent: #b24a2f;
    --accent-deep: #7f2412;
    --shadow-lg: 0 24px 70px #251c1029;
    --shadow-md: 0 12px 28px #251c101a;
    /* 动态变量：线路颜色（由JS动态设置，此处提供默认值）*/
    --route-color: #1a1a1a;
    /* 动态变量：线路标题文字色（由JS根据线路色亮度自动计算）*/
    --route-text-color: #ffffff;
    --route-text-shadow: rgba(0,0,0,0.5);
    /* 线路标题渐变：左侧纯色区间的终点位置（占容器宽度的百分比） */
    --gradient-solid-distance: 20%;
    /* 线路标题渐变：渐变过渡到完全无色的终点位置（占容器宽度的百分比），之后保持无色 */
    --gradient-fade-end: 80%;
}

/* route页面特定的body样式，覆盖base.css的全局body */
body {
    color: var(--ink);
    background: #fffcf7f5; /* 与展示容器背景色一致，消除左侧分界颜色 */
    min-height: 100vh;
    padding: 0; /* 移除内边距，使内容全宽显示 */
    /* 如果没有navigate.js，需要手动设置padding-top防止被导航遮挡 */
    /* padding-top: 64px;  假设导航只有1行，高度64px */
}
@media (max-width: 768px) {
    h1 { font-size: 24px;}
    body { padding: 0;}
}

.container {
    max-width: 1240px;
    margin: 0 auto;
}

/* ========== 新的两栏布局 ========= */
.route-layout {
    display: flex;
    gap: 0;
    min-height: calc(100vh - var(--header-height));
    background: #fffcf7f5;
}

/* ========== 左侧导航栏 ========= */
.left-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
    /* 隐藏滚动条 */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.left-sidebar::-webkit-scrollbar {
    display: none;
}

/* 二级导航区域 */
.secondary-nav-section {
    padding: 0;
    border-bottom: 1px solid #e0e0e0;
}

.secondary-nav-section .secondary-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.secondary-nav-section .secondary-nav-item {
    width: 100%;
    padding: 16px 20px;
    border: none;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-decoration: none;
    white-space: normal;
    word-break: keep-all;
}

.secondary-nav-section .secondary-nav-item:hover {
    transform: translateX(4px) scale(1.06);
}

.secondary-nav-section .secondary-nav-item.active {
    background: #e60012 !important;
    color: #ffffff !important;
}

.secondary-nav-section .secondary-nav-item.info-style {
    background: #003366;
    color: #ffffff;
}

.secondary-nav-section .secondary-nav-item.info-style:hover {
    background: #004080;
    color: #ffffff;
}

/* 外部链接样式（乘车导航） */
.secondary-nav-section .secondary-nav-item.external-link {
    background: transparent;
    color: #0066cc;
}

.secondary-nav-section .secondary-nav-item.external-link:hover {
    background: #f0f8ff;
    color: #0052a3;
}

.secondary-nav-section .secondary-nav-item.external-link a {
    color: inherit;
}

.secondary-nav-section .secondary-nav-item a {
    color: inherit;
    text-decoration: none;
    display: block;
    width: 100%;
    height: 100%;
}

/* 二级导航中英文双行 */
.secondary-nav-section .secondary-nav-item .nav-label-en {
    font-size: 11px;
    line-height: 1.2;
    margin-top: 2px;
    opacity: 0.75;
}

/* 子选项区域 */
.sub-nav-section {
    flex: 1;
    padding: 35px 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fffcf7; /* 作业本纸的温暖米黄色 */
    /* 隐藏滚动条 */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sub-nav-section::-webkit-scrollbar {
    display: none;
}

.sub-nav-content {
    display: none;
}

.sub-nav-content.active {
    display: block;
}

/* 子选项容器布局 */
.sub-nav-content .category-tabs,
.sub-nav-content .map-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* 子选项按钮基础样式 */
.sub-nav-content .category-tab,
.sub-nav-content .map-nav-item {
    flex: none;
    min-width: auto;
    max-width: none;
    padding: 14px 20px;
    background: transparent;
    color: #333;
    text-align: left;
    justify-content: flex-start;
    border-left: 4px solid transparent;
    font-weight: 500;
}

.sub-nav-content .category-tab:hover,
.sub-nav-content .map-nav-item:hover {
    background: #ebebeb;
    color: #c00000;
    transform: translateX(4px) scale(1.03);
}

.sub-nav-content .category-tab.active,
.sub-nav-content .map-nav-item.active {
    background: #ffffff;
    color: #c00000 !important;
    border-left-color: #c00000;
    font-weight: 600 !important;
}

/* 地图说明按钮保持蓝色样式 */
.sub-nav-content .map-nav-item.info-style {
    background: #003366;
    color: #ffffff;
    font-weight: 600;
    border-left: 4px solid transparent;
}

.sub-nav-content .map-nav-item.info-style:hover {
    background: #004080;
    color: #ffffff;
    padding-left: 24px;
}

.sub-nav-content .map-nav-item.info-style.active {
    background: #003366;
    color: #ffffff;
}



/* ========== 右侧内容区域 ========= */
.right-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #fffcf7f5;
    overflow-y: auto;
}

/* Tab内容区域默认隐藏 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========== 二级导航通用样式==========
适用于：线路分类标签(.category-tabs)、地图导航(.map-nav) */
.category-tabs,
.map-nav {
    display: flex;
    flex-wrap: wrap; /* 允许换行 */
    gap: 0;
    padding: 0;
    justify-content: flex-start; /* 左对齐，适应换行 */
    background: transparent;
    width: 100%;
}

.secondary-nav-item,
.category-tab,
.map-nav-item {
    flex: 1 1 0; /* 平均分配宽度，允许收缩和扩展 */
    min-width: max-content; /* 最小宽度为内容宽度，确保内容完整显示 */
    max-width: 100%; /* 不超过容器宽度 */
    padding: 14px 20px; /* 调整左右内边距 */
    border: none;
    border-radius: 0; /* 矩形 */
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: #ffffff; /* 白色字体 */
    white-space: normal; /* 允许文字换行 */
    text-align: center;
    position: relative;
    display: flex; /* 使用flex布局 */
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
    word-break: keep-all; /* 保持单词完整性 */
    overflow: visible; /* 显示溢出内容 */
}

.secondary-nav-item:hover,
.category-tab:hover,
.map-nav-item:hover {
    transform: translateX(4px) scale(1.06);
}

.secondary-nav-item.active {
    background: #e60012 !important; /* 二级导航选中时背景变红 */
    color: #ffffff !important;
    font-weight: 600 !important;
}

/* 选中的二级导航项悬停时仅文字放大+右移 */
.secondary-nav-item.active:hover {
    transform: translateX(4px) scale(1.06);
}

.secondary-nav-item a,
.category-tab a {
    color: inherit;
    text-decoration: none;
    display: block;
    width: 100%;
    height: 100%;
}

.secondary-nav-item a:hover,
.category-tab a:hover {
    color: inherit;
    text-decoration: none;
}

/* 深蓝色特殊按钮样式（用于地图说明、乘车导航等） */
.secondary-nav-item.info-style,
.map-nav-item.info-style {
    background: #003366; /* 深蓝色背景 */
    color: #ffffff;
    font-weight: 600;
}

.secondary-nav-item.info-style:hover,
.map-nav-item.info-style:hover {
    background: #004080; /* 悬停时稍浅的蓝色 */
    color: #ffffff;
}

/* 响应式：小屏幕下调整导航样式 */
@media (max-width: 768px) {
    .category-tab,
    .map-nav-item {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* ========== 响应式：窄屏适配 ========= */
@media (max-width: 1024px) {
    .left-sidebar {
        width: 220px;
    }
    
    .secondary-nav-section .secondary-nav-item {
        padding: 14px 16px;
        font-size: 14px;
    }
    
    .sub-nav-content .category-tab,
    .sub-nav-content .map-nav-item {
        padding: 10px 16px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .route-layout {
        flex-direction: column;
    }
    
    .left-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .secondary-nav-section .secondary-nav {
        flex-direction: row;
        flex-wrap: nowrap;
    }
    
    .secondary-nav-section .secondary-nav-item {
        flex: 1 1 0;
        min-width: 0;
        text-align: center;
        justify-content: center;
        align-items: center;
        border-bottom: none;
        border-right: 1px solid #e0e0e0;
        padding: 12px 6px;
        font-size: 14px;
        /* 移动端显示英文小字 */
        flex-direction: column;
    }
    
    .secondary-nav-section .secondary-nav-item .nav-label-en {
        font-size: 10px;
        line-height: 1.2;
        margin-top: 2px;
    }
    
    .secondary-nav-section .secondary-nav-item:last-child {
        border-right: none;
    }
    
    /* 移动端二级导航 active 状态 */
    .secondary-nav-section .secondary-nav-item.active {
        background: #e60012 !important;
        color: #ffffff !important;
    }
    .secondary-nav-section .secondary-nav-item.active {
        color: #ffffff !important;
    }
    
    /* 移动端乘车导航改为蓝色（与地图说明一致） */
    .secondary-nav-section .secondary-nav-item.external-link {
        background: #003366;
        color: #ffffff;
        border-right: none;
    }
    .secondary-nav-section .secondary-nav-item.external-link {
        color: #ffffff !important;
    }
    .secondary-nav-section .secondary-nav-item.external-link:hover {
        background: #004080;
        color: #ffffff;
    }
    
    .sub-nav-section {
        max-height: none;
        padding: 0;
    }

    /* 移动端子导航：横向滚动 */
    .sub-nav-content .category-tabs,
    .sub-nav-content .map-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .sub-nav-content .category-tabs::-webkit-scrollbar,
    .sub-nav-content .map-nav::-webkit-scrollbar {
        display: none;
    }

    .sub-nav-content .category-tab,
    .sub-nav-content .map-nav-item {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: auto;
        min-width: auto;
        flex-shrink: 0;
        padding: 8px 14px;
        background: #f0f0f0;
        color: #333;
        text-align: center;
        border: 1px solid #e0e0e0;
        border-radius: 0;
        font-size: 13px;
        font-weight: 500;
        line-height: 1.4;
        word-break: keep-all;
        white-space: nowrap;
    }

    .sub-nav-content .category-tab:hover,
    .sub-nav-content .map-nav-item:hover {
        background: #e8e8e8;
        color: #c00000;
        padding-left: 14px;
    }

    .sub-nav-content .category-tab.active,
    .sub-nav-content .map-nav-item.active {
        background: #c00000;
        color: #ffffff !important;
        border-color: #c00000;
        font-weight: 600 !important;
    }

    /* 地图说明：sticky 固定右侧，不参与滚动 */
    .sub-nav-content .map-nav-item.info-style {
        background: #003366;
        color: #ffffff;
        border-color: #003366;
        position: sticky;
        right: 0;
        z-index: 1;
        flex-shrink: 0;
        margin-left: 8px;
    }

    .sub-nav-content .map-nav-item.info-style:hover {
        background: #004080;
        color: #ffffff;
        border-color: #004080;
        padding-left: 14px;
    }

    .sub-nav-content .map-nav-item.info-style.active {
        background: #003366;
        color: #ffffff;
        border-color: #003366;
    }
    
    .right-content {
        min-height: calc(100vh - var(--header-height) - 200px);
        overflow: visible;
    }
}
/*线路色块容器样式*/

.line-blocks-container {
    width: 100%; /* 与右侧内容区域同宽 */
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    max-height: calc(5 * (52px + 12px)); /* 5行色块高度 */
    overflow-y: auto;
    /* 增加上下内边距，减少黑色背景影响 为滚动条留出空间 */
    padding: 32px 48px 32px 40px;
    /* 修改背景色与展示容器一致，增加渐变 */
    background: linear-gradient(180deg, #fffcf7 0%, #fff9f0 100%);
    /* 移除边框，使视觉上连起来 */
    border-radius: 0; /* 矩形，无圆角 */
    margin-bottom: 22px; /* 恢复底部边距，与黑色标题区域增加间距 */
    box-shadow: none; /* 移除阴影 */
    backdrop-filter: blur(14px);
    /* 移除顶部边框，与分类标签无缝连接 */
    border-style: none;
    border-bottom: 1px solid #0000000f;
}

/* 自定义滚动条样式 */
.line-blocks-container::-webkit-scrollbar {
    width: 8px;
}

.line-blocks-container::-webkit-scrollbar-track {
    background: #0000000d;
    border-radius: 4px;
}

.line-blocks-container::-webkit-scrollbar-thumb {
    background: #00000033;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.line-blocks-container::-webkit-scrollbar-thumb:hover {
    background: #0000004d;
}


/* 线路/站点色块公共样式 */
.line-block,
.station-block {
    height: 52px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid transparent;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 14px;
    width: auto;
}
.line-block { min-width: 52px; }
.station-block { min-width: 64px; }

.line-block-label,
.station-block-label {
    color: var(--route-text-color, #ffffff);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 1px 3px var(--route-text-shadow, #00000066);
    z-index: 1;
    letter-spacing: 0.3px;
}

.line-block:hover,
.station-block:hover {
    transform: translateY(-4px) scale(1.08);
    box-shadow: 0 18px 40px #251c1040;
    border-color: #ffffffdd;
}

.line-block.active,
.station-block.active {
    transform: scale(1.12);
    border-color: #ffffff;
    box-shadow: 0 22px 44px #251c1055, 0 0 0 3px #ffffff4d;
    z-index: 5;
}
.station-block.active {
    animation: stationPulse 2.5s ease-in-out infinite;
}

/* 选中态脉冲动画 */
@keyframes stationPulse {
    0%, 100% { 
        box-shadow: 0 22px 44px #251c1055, 0 0 0 3px #ffffff4d;
    }
    50% { 
        box-shadow: 0 24px 50px #251c1070, 0 0 0 6px #ffffff33;
    }
}

/* 选中的色块增加对勾标识 */
.line-block.active::after,
.station-block.active::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background: #ffffff;
    color: #162033;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px #00000040;
    border: 2px solid #ffffffe6;
    z-index: 10;
}

/* 色块tooltip - 已禁用悬停显示 */
.line-block-tooltip,
.station-block-tooltip {
    display: none !important;
}

@media (max-width: 768px) {
    .line-block {
        min-width: 40px;
        height: 40px;
        padding: 4px 10px;
    }

    .line-block-label {
        font-size: 11px;
    }

    .line-blocks-container {
        gap: 8px;
        max-height: calc(5 * (40px + 8px)); /* 5行色块高度（移动端） */
        padding: 18px; /* 移动端内边距 */
        border-radius: 0; /* 移动端也保持矩形 */
    }

    #routesContainer {
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        padding: 0 20px 22px;
    }
}

/*.direction-label-forward, .direction-label-reverse已移动到unuse.css中*/

#routesContainer {
    width: 100%; /* 与右侧内容区域同宽 */
    /* 添加背景色与色块容器一致 */
    background: #fffcf7f5;
    border: none; /* 移除边框 */
    box-shadow: none; /* 移除阴影 */
    padding: 0 40px 22px;
}

#routesContainer .route-card {
    box-shadow: none;
    border-left: none;
    border-right: none;
    border-radius: 0;
    max-width: none; /* 取消最大宽度限制，与次级导航一样宽 */
    margin: 0 0 22px; /* 移除自动居中 */
    background: transparent; /* 卡片背景透明，与容器融合 */
    border-bottom: 1px solid #00000014; /* 只保留底部细线分隔 */
}

.route-card {
    background: #fffcf7eb;
    border: 1px solid #ffffffa3;
    border-radius: 0;
    padding: 0;
    margin-bottom: 22px;
    overflow: hidden;
    box-shadow: 0 4px 12px #251c1014;
    backdrop-filter: blur(14px);
}
.route-card.hidden {
    display: none;
}

@media (max-width: 768px) {
    .route-header { padding: 14px 16px; }
}

.route-header {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 18px 22px;
    background: linear-gradient(to right, var(--route-color) 0%, var(--route-color) var(--gradient-solid-distance), transparent var(--gradient-fade-end));
    color: #ffffff;
    flex-wrap: wrap;
    gap: 12px;
}
.unified-header {
    justify-content: flex-start;
    text-align: left;
}
.route-color {
    display: none;
}
.route-title h2 {
    color: var(--route-text-color, #ffffff);
    font-size: 18px;
    margin-bottom: 2px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 3px var(--route-text-shadow, rgba(0,0,0,0.5));
}
.route-title p {
    color: var(--route-text-color, #ffffff);
    opacity: 0.7;
    font-size: 12px;
    font-weight: 500;
    text-shadow: 0 1px 2px var(--route-text-shadow, rgba(0,0,0,0.5));
}
/*方向选择*/
.direction-selector {
    display: flex;
    gap: 0;
    margin: 0;
    background: #f5f5f5;
    padding: 0;
    border-bottom: 1px solid #e0e0e0;
}
.direction-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: #f5f5f5;
    color: #666;
    border-right: 1px solid #e0e0e0;
}
.direction-btn:last-child {
    border-right: none;
}
.direction-btn:hover {
    background: #e8e8e8;
}
.direction-btn.active {
    background: #ffffff;
    color: #1a1a1a;
    border-bottom: 3px solid;
    border-color: inherit;
}
/*站点列表*/
.station-list {
    display: flex;
    flex-direction: row;
    position: relative;
    padding: 220px 20px 210px 20px;
    overflow-x: auto;
    overflow-y: auto;
    align-items: flex-start;
    min-height: 160px;
}

/* Canvas 主线：绝对定位覆盖容器，z-index 低于站点圆点 */
.station-main-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 0;
}

/* 垂直滚动条：与线路色块容器保持一致 */
.station-list::-webkit-scrollbar {
    width: 8px;
}

.station-list::-webkit-scrollbar-track {
    background: #0000000d;
    border-radius: 4px;
}

.station-list::-webkit-scrollbar-thumb {
    background: #00000033;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.station-list::-webkit-scrollbar-thumb:hover {
    background: #0000004d;
}
.station-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: 100px;
    flex: 1 0 auto;
    margin: 0;
}

@media (max-width: 768px) {
    /* 移动端站点列表：竖向布局
       左侧：线+站点圆点  中间：站名  右侧：换乘徽章
       --line-x: 竖线中心点的 x 坐标，靠左放置 */
    .station-list {
        flex-direction: column !important;
        padding: 0 !important;
        overflow-x: visible;
        overflow-y: visible;
        min-height: auto;
        align-items: stretch;
        --line-x: 24px;
    }

    .station-item {
        display: grid !important;
        grid-template-columns: calc(var(--line-x) + 20px) 1fr;
        align-items: start;
        min-width: 0 !important;
        width: 100%;
        padding: 10px 16px 10px calc(var(--line-x) + 20px) !important;
        border-bottom: 1px solid #f0f0f0;
        box-sizing: border-box;
        position: relative;
    }

    /* 隐藏桌面端水平连接线 */
    .station-item::before {
        display: none !important;
    }

    /* 竖向连接线：以 --line-x 为中心 */
    .station-item::after {
        content: '';
        position: absolute;
        left: calc(var(--line-x) - 2px);
        top: 0;
        bottom: 0;
        width: 4px;
        background: var(--route-color, #1a1a1a);
        z-index: 0;
    }
    .station-item:first-child::after {
        top: 50%;
    }
    .station-item:last-child::after {
        bottom: 50%;
    }
    .station-item:only-child::after {
        display: none;
    }

    /* 站点圆点 & 换乘圆点：统一以 --line-x 为中心 */
    .station-dot {
        position: absolute !important;
        left: var(--line-x) !important;
        top: 50%;
        transform: translate(-50%, -50%) !important;
        z-index: 2;
        flex-shrink: 0;
        margin-top: 0 !important;
        transition: transform 0.15s;
    }
    .station-item:hover .station-dot,
    .station-item:active .station-dot {
        transform: translate(-50%, -50%) scale(1.2) !important;
    }
    .station-dot.transfer {
        margin-top: 0;
    }

    /* 换乘徽章：站名下方，与站名左对齐 */
    .transfer-badges-container {
        position: static !important;
        transform: none !important;
        width: auto !important;
        max-width: none;
        margin: 4px 0 0 0 !important;
        grid-column: 2;
    }
    .transfer-badges {
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 4px 8px;
        align-items: center;
    }
    .transfer-link-item {
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center;
        white-space: nowrap;
        margin-top: 0;
    }
    .transfer-link-text {
        font-size: 12px;
        max-width: 110px;
    }
    .transfer-link-item.nearby-item .transfer-link-text {
        font-size: 11px;
    }

    /* 站点信息：中间列 */
    .station-info {
        position: static !important;
        transform: none !important;
        width: auto !important;
        text-align: left !important;
        white-space: normal !important;
        margin: 0;
        padding: 0;
        display: flex !important;
        flex-direction: row !important;
        align-items: baseline;
        gap: 8px;
        grid-column: 2;
    }
    .station-name {
        font-size: 15px;
        flex-shrink: 0;
    }
    .station-name-en {
        font-size: 12px;
        flex: 1;
        min-width: 0;
    }

    /* Canvas 主线在竖向模式隐藏（移动端用 ::after 伪元素竖向连线） */
    .station-main-canvas {
        display: none !important;
    }
    /* 移动端手风琴适配 */
    .branch-label {
        padding: 10px 12px;
        font-size: 14px;
        background: #f5f5f5;
        border-radius: 4px;
        margin: 4px 8px;
    }
}

/* ========== 手风琴：多分支折叠 ========== */
.branch-container {
    border-bottom: 1px solid #16203314;
}
.branch-container:last-child {
    border-bottom: none;
}

/* 手风琴头部 */
.branch-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    user-select: none;
    background: var(--paper-bg);
    transition: background 0.2s ease;
    position: relative;
}
.branch-label:hover {
    background: #1620330a;
}
.branch-label::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--ink-soft);
    border-bottom: 2px solid var(--ink-soft);
    transform: rotate(45deg);
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

/* 折叠状态：隐藏站点列表和方向选择器 */
.branch-container.collapsed .station-list,
.branch-container.collapsed .direction-selector {
    display: none !important;
}
.branch-container.collapsed .branch-label::after {
    transform: rotate(-45deg);
}

/* 折叠时的站点数量提示 */
.branch-label .branch-station-count {
    font-size: 12px;
    font-weight: 400;
    color: var(--ink-soft);
    margin-left: 6px;
}

.station-item::before {
    content: '';
    position: absolute;
    left: 50%;
    right: -50%;
    top: 11px;
    height: 6px;
    background: var(--route-color, #1a1a1a);
    z-index: 0;
}
.station-item:last-child::before {
    display: none;
}
.station-item:hover {
    background: transparent;
}
.station-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffffff;
    border: 6px solid var(--route-color, #1a1a1a);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all 0.15s;
    position: relative;
}
.station-dot.transfer {
    border-width: 7px;
    width: 32px;
    height: 32px;
    margin-top: -2px;
}
.station-dot.transfer::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--route-color, #1a1a1a);
    border-radius: 50%;
}
.station-item:hover .station-dot {
    transform: scale(1.2);
}
.station-info {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-8px) rotate(45deg);
    transform-origin: top left;
    white-space: nowrap;
    text-align: left;
    width: 220px;
}
.station-name {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}
.station-name-en {
    font-size: 11px;
    color: #777;
    font-weight: 600;
    letter-spacing: 0.4px;
    margin-top: 2px;
}
/*换乘信息*/
.transfer-badges-container {
    position: absolute;
    left: 50%;
    bottom: calc(100% - 14px);
    top: auto;
    transform-origin: bottom left;
    transform: rotate(-45deg);
    width: max-content;
    display: flex;
    justify-content: flex-start;
    margin-bottom: 8px;
    margin-left: 8px;
    z-index: 10;
}
.transfer-badges {
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
    align-items: flex-start;
}
.transfer-link-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
    cursor: pointer;
    flex-direction: row;
    transform: none;
    margin-top: 0;
}
.transfer-link-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid var(--tc, #607d8b);
    background: #ffffff;
    flex-shrink: 0;
    margin: 0;
}
.transfer-link-dot-end {
    background: var(--tc, #607d8b);
}
.transfer-link-line {
    width: 14px;
    height: 2px;
    background: var(--tc, #607d8b);
    flex-shrink: 0;
}
.transfer-link-text {
    font-size: 10px;
    font-weight: 700;
    color: var(--tc, #607d8b);
    white-space: nowrap;
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    transform: none;
}
.transfer-link-item.summary-item {
    --tc: #374151;
}
.transfer-link-item.hs-item {
    --tc: #3230a9;
}
.transfer-link-item.direct-item .transfer-link-text {
    font-weight: 800;
}
.transfer-link-item.nearby-item .transfer-link-line {
    background: repeating-linear-gradient(90deg, var(--tc, #607d8b) 0 4px, transparent 4px 6px);
}
.transfer-link-item.nearby-item .transfer-link-text {
    color: #455a64;
    font-size: 9px;
}

.hidden {
    display: none !important;
}

.empty-state {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #dee2e6;
    border-radius: 16px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
}

.empty-state::before {
    content: '🚇';
    display: block;
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state p {
    margin: 0;
    color: #6c757d;
    font-size: 16px;
    font-weight: 500;
}

/*站点信息*/
.tooltip-container {
    width: 100%; /* 与父容器同宽 */
    max-width: none; /* 不限制最大宽度 */
    margin: 0; /* 移除所有边距，与展示区和页脚无缝连接 */
    background: #fffcf7f5; /* 应用背景色，消除界限 */
    border: none; /* 移除边框 */
    border-radius: 0; /* 矩形边框 */
    padding: 32px 40px 80px; /* 增加上下内边距，文字距边界留间距，底部加大间距覆盖页脚 */
    min-height: 100px;
    box-shadow: none; /* 移除阴影 */
    backdrop-filter: blur(14px);
    display: block; /* 一直显示 */
    position: relative;
    z-index: 10;
}

/* Exit information styles */
.exit-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.exit-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.exit-section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: #c00000;
    border-radius: 2px;
}

.exits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.exit-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s ease;
}

.exit-name {
    font-size: 18px;
    font-weight: 700;
    color: #0b66a3;
    margin-bottom: 8px;
}

.exit-destinations {
    font-size: 14px;
    color: #333;
    line-height: 1.6;
}

.exit-destination-item {
    margin-bottom: 4px;
}

.exit-destination-item:last-child {
    margin-bottom: 0;
}

/* Tooltip 样式（从 JS 中提取）*/
.tooltip-header {
    background: linear-gradient(to right, var(--route-color) 0%, var(--route-color) var(--gradient-solid-distance), transparent var(--gradient-fade-end));
    padding: 20px 24px;
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
    border-radius: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

/* Tooltip头部装饰性背景图案 */
.tooltip-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, #ffffff0f 0%, transparent 70%);
    pointer-events: none;
}

.tooltip-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--route-text-color, #ffffff);
    letter-spacing: 0.5px;
    text-shadow: 0 1px 4px var(--route-text-shadow, rgba(0,0,0,0.55));
}

.tooltip-subtitle {
    color: var(--route-text-color, #ffffff);
    opacity: 0.7;
    font-size: 14px;
    margin-top: 0;
    text-shadow: 0 1px 2px var(--route-text-shadow, rgba(0,0,0,0.5));
}

.tooltip-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.tooltip-section-title {
    font-size: 20px;
    font-weight: bold;
}

.tooltip-section-empty {
    color: #999;
    font-size: 13px;
    margin-top: 5px;
}

.tooltip-lines-container {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 5px;
}

.tooltip-line-badge {
    background:var(--line-color);
    color: var(--route-text-color, #fff);
    text-shadow: 0 1px 2px var(--route-text-shadow, rgba(0,0,0,0.5));
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 2px 6px #00000033,
        inset 0 1px 0 #ffffff33;
    position: relative;
    letter-spacing: 0.2px;
}

.tooltip-line-badge:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 4px 12px #0000004d,
        inset 0 1px 0 #ffffff4d;
}

.tooltip-nearby-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.tooltip-nearby-link {
    text-decoration: none;
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
    color: #006064;
    border: 1px solid #00acc1;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px #0000001a;
    letter-spacing: 0.2px;
}

.tooltip-nearby-link:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 4px 12px #00000026;
    background: linear-gradient(135deg, #b2ebf2 0%, #80deea 100%);
}

.tooltip-nearby-link i {
    margin-right: 6px;
    font-size: 14px;
}

.tooltip-error {
    font-size: 14px;
    color: #ff5252;
    text-align: center;
    padding: 10px;
}

.tooltip-error i {
    margin-right: 5px;
}

.tooltip.show {
    display: block;
}
.tooltip.pinned {
    display: block;
    border: 3px solid #1a1a1a;
}

@keyframes tooltipFade {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tooltip 移动端适配 */
@media (max-width: 768px) {
    .tooltip-container {
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        padding: 24px 20px 80px;
        border-radius: 0;
    }
    .tooltip-header {
        padding: 16px 20px;
        border-radius: 0;
    }
    .tooltip-title {
        font-size: 20px;
    }
    .tooltip-subtitle {
        font-size: 13px;
    }
    .tooltip-section-title {
        font-size: 17px;
    }
    .tooltip-lines-container {
        gap: 6px;
    }
    .tooltip-line-badge {
        padding: 3px 8px;
        font-size: 13px;
    }
    .tooltip-nearby-container {
        gap: 8px;
    }
    .tooltip-nearby-link {
        padding: 6px 12px;
        font-size: 13px;
    }
    .exits-grid {
        grid-template-columns: 1fr;
    }
    .exit-name {
        font-size: 16px;
    }
}


.back-to-top {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: #1a1a1a;
    color: #ffffff;
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    font-size: 18px;
    box-shadow: 0 4px 8px #00000033;
    transition: all 0.3s;
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.back-to-top:hover {
    background-color: #333;
    transform: translateY(-3px);
}
/*线路信息页面样式结束*/
/* =====route.html-map页面专属样式开始=====*/
/*图片展示区域样式*/
.map-container {
    width: 100%;
    height: calc(100vh - var(--header-height) * 2); /*减去导航栏+下拉栏高度*/
    position: fixed;
    top: calc(var(--header-height) * 2); /*位于下拉栏下方*/
    left: 0;
    overflow: hidden; /*隐藏超出区域的图片*/
    background: #f5f5f5;
}

/*地铁线网图：初始居中，支持拖拽缩放*/
.subway-map {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: grab; /*抓手样式*/
    transition: transform 0.05s ease; /*拖拽平滑过渡*/
}

.subway-map:active {
    cursor: grabbing; /*按住时抓手样式*/
}

/*缩放控制按钮*/
.control-buttons {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 99;
}

.control-btn {
    width: 57px;
    height: 57px;
    border: none;
    border-radius: 10px;
    background: rgba(255,255,255,0.92);
    color: #333;
    font-size: 30px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, box-shadow 0.15s;
    line-height: 1;
    padding: 0;
}

.control-btn:hover {
    background: #e8f0fe;
    box-shadow: 0 3px 14px rgba(0,0,0,0.22);
}

.control-btn:active {
    background: #d2e3fc;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .control-btn {
        width: 44px;
        height: 44px;
        font-size: 24px;
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    .control-btn {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }
}

/*信息弹窗样式*/
.info-modal {
    display: none; /*默认隐藏*/
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #00000080;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

/*点击触发时显示模态框并居中内容*/
.info-modal.show {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 弹窗内容框：适配电脑端和移动端，移动端优先设计：width: 90% 确保在小屏幕上占据大部分宽度
max-width: 400px 限制在大屏幕上的最大宽度，避免过宽，min-width: 280px 保证在极小屏幕上仍有足够的可读空间*/
.modal-content {
    width: 90%; /* 移动端优先：占据屏幕90%宽度 */
    max-width: 400px; /* 电脑端最大宽度限制 */
    min-width: 280px; /* 最小宽度保证可读性 */
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    position: relative;
}

/* 关闭按钮样式 */
.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.close-btn:hover {
    color: #e60012;
}

.modal-content h3 {
    color: #003366;
    margin-bottom: 10px;
}

.modal-content p {
    color: #333;
    line-height: 1.6;
}

/* ========== 禁止页脚在线路图页面显示 ==========
/* 当body有route-map-active类时，隐藏页脚 */
body.route-map-active .main-footer {
    display: none !important;
}

/* 调整地图容器位置，使其位于右侧内容区域 */
#route-map-content .map-container {
    position: fixed; /* 固定定位 */
    top: var(--header-height); /* 紧贴顶部导航栏下方 */
    left: 260px; /* 紧贴左侧导航栏右侧 */
    right: 0;
    bottom: 0;
    width: auto; /* 由left和right决定 */
    height: auto; /* 由top和bottom决定 */
    overflow: hidden;
}

/* 响应式：窄屏下地图容器调整 */
@media (max-width: 768px) {
    #route-map-content .map-container {
        left: 0; /* 窄屏时左侧导航变为顶部，地图全宽 */
    }
}
/* 电脑端：弹窗改为正方形 */
@media (min-width: 769px) {
    #route-map-content .modal-content {
        width: min(600px, 90vw);
        height: min(600px, 90vw); /* 正方形 */
        max-height: 90vh;
    }
}
/* =====route.html-map页面专属样式结束=====*/

/* ========== 车站信息功能样式 ========= */

/* 站点选择容器 */
.station-selector-container {
    width: 100%;
    background: #fffcf7f5;
}

/* 站点色块容器 */
.station-blocks-container {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    max-height: calc(6 * (52px + 10px)); /* 6行色块高度 */
    overflow-y: auto;
    padding: 32px 48px 32px 40px;
    background: linear-gradient(180deg, #fffcf7 0%, #fff9f0 100%);
    border-radius: 0;
    margin-bottom: 0;
    box-shadow: none;
    backdrop-filter: blur(14px);
    border-bottom: 1px solid #0000000f;
}

/* 自定义滚动条样式 */
.station-blocks-container::-webkit-scrollbar {
    width: 8px;
}

.station-blocks-container::-webkit-scrollbar-track {
    background: #0000000d;
    border-radius: 4px;
}

.station-blocks-container::-webkit-scrollbar-thumb {
    background: #00000033;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.station-blocks-container::-webkit-scrollbar-thumb:hover {
    background: #0000004d;
}

/* 站点信息显示容器 */
.station-info-container {
    width: 100%;
    background: #fffcf7f5;
    border: none;
    box-shadow: none;
    padding: 0 40px 40px;
    min-height: 300px;
}

/* 站点详情容器 */
.station-detail-container {
    background: #fffcf7eb;
    border: 1px solid #ffffffa3;
    border-radius: 26px;
    padding: 0;
    margin-top: 22px;
    overflow: hidden;
    box-shadow: 0 4px 12px #251c1014;
    backdrop-filter: blur(14px);
}

/* 站点详情头部 */
.station-detail-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 24px 22px;
    background: linear-gradient(135deg, #0b1324f5 0%, #1e293bef 100%);
    color: #ffffff;
    text-align: center;
}

.station-detail-header h2 {
    color: #ffffff;
    font-size: 28px;
    margin: 0 0 8px 0;
    font-weight: 700;
    letter-spacing: 0.5px;
    /* 增强立体感：多层阴影 + 内发光效果 */
    text-shadow: 
        0 1px 0 #00000059,
        0 2px 5px #00000073,
        0 4px 12px #00000059,
        inset 0 1px 0 #ffffff2e;
}

.station-en-name {
    color: #ffffffb3;
    font-size: 12px;
    font-weight: 500;
    margin: 0 0 12px 0;
}

/* 站点统计信息 */
.station-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 8px;
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff26;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
}

.stat-item i {
    font-size: 14px;
}

/* 站点详情内容 */
.station-detail-content {
    padding: 24px;
}

/* 站点区块 */
.station-section {
    margin-bottom: 24px;
}

.station-section:last-child {
    margin-bottom: 0;
}

.station-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.station-section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: #c00000;
    border-radius: 2px;
}

/* 站点线路容器 */
.station-lines-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* 站点线路徽章 */
.station-line-badge {
    background: #999;
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px #00000033;
}

.station-line-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px #0000004d;
}

/* 站点出口区块 */
.station-exits-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid #e0e0e0;
}

/* 响应式：移动端适配 */
@media (max-width: 768px) {
    .station-block {
        min-width: 50px;
        height: 40px;
        padding: 4px 10px;
    }

    .station-block-label {
        font-size: 12px;
    }

    .station-blocks-container {
        gap: 8px;
        max-height: calc(6 * (40px + 8px)); /* 6行色块高度（移动端） */
        padding: 18px;
        border-radius: 0;
    }

    .station-detail-header h2 {
        font-size: 22px;
    }

    .station-en-name {
        font-size: 12px;
    }

    .stat-item {
        font-size: 12px;
        padding: 4px 10px;
    }

    .station-section-title {
        font-size: 16px;
    }

    .station-line-badge {
        font-size: 12px;
        padding: 4px 8px;
    }
}

