:root {
    --sidebar-width: 360px;
    --detail-width: 320px;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f7fa;
    --text-primary: #1a1a2e;
    --text-secondary: #5a5a7a;
    --accent: #4a6cf7;
    --border: #e0e4ea;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --radius: 12px;
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
    font-family: 'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif;
    height:100vh; width:100vw; overflow:hidden; background:#f0f2f5;
}
#map { position:absolute; top:0; left:0; width:100%; height:100%; z-index:1; background:#fff; }

/* 状态提示条 */
.status-bar {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 18px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.2s;
}
.status-bar.empty {
    color: var(--text-secondary);
}

/* 左侧侧边栏 */
#sidebar {
    position:absolute; top:12px; left:12px; width:var(--sidebar-width);
    max-height:calc(100vh - 24px); background:var(--bg-primary);
    border-radius:var(--radius); box-shadow:var(--shadow); z-index:1000;
    display:flex; flex-direction:column; border:1px solid var(--border);
    transition: transform 0.3s ease, opacity 0.3s ease;
}
#sidebar.collapsed { transform:translateX(-110%); opacity:0; pointer-events:none; }
.sidebar-header { padding:16px 18px 12px; border-bottom:1px solid var(--border); flex-shrink:0; }
.sidebar-header h2 { font-size:1.2rem; font-weight:700; color:var(--text-primary); display:flex; align-items:center; gap:8px; }
.sidebar-header .subtitle { font-size:0.72rem; color:var(--text-secondary); margin-top:4px; }

/* 分类选择器 */
.category-bar {
    display:flex; flex-wrap:wrap; gap:6px; padding:8px 12px;
    border-bottom:1px solid var(--border); flex-shrink:0;
}
.category-btn {
    padding:5px 14px; border-radius:16px; border:1px solid var(--border);
    background:var(--bg-secondary); color:var(--text-primary); font-size:0.78rem;
    cursor:pointer; transition:0.2s; white-space:nowrap; user-select:none;
}
.category-btn:hover { background:#eef1f7; }
.category-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); }

.search-box { margin:10px 12px; flex-shrink:0; }
.search-box input {
    width:100%; padding:9px 12px; border-radius:8px; border:1px solid var(--border);
    background:var(--bg-secondary); color:var(--text-primary); font-size:0.85rem; outline:none;
}
.search-box input::placeholder { color:#aaa; }
.lines-list { flex:1; overflow-y:auto; padding:4px 8px; scrollbar-width:thin; scrollbar-color:#ccd #f5f7fa; }
.lines-list::-webkit-scrollbar { width:4px; }
.lines-list::-webkit-scrollbar-thumb { background:#ccd; border-radius:4px; }
.line-item {
    display:flex; align-items:center; gap:10px; padding:12px 12px; border-radius:8px; cursor:pointer;
    margin-bottom:3px; background:var(--bg-secondary); border:1px solid transparent;
    transition:all 0.2s; user-select:none;
}
.line-item:hover { background:#eef1f7; border-color:#c0c8d8; }
.line-item.active { border-color:var(--line-color); background:#eef3ff; box-shadow:0 0 8px rgba(74,108,247,0.15); }
.line-dot { width:14px; height:14px; border-radius:50%; flex-shrink:0; border:2px solid rgba(0,0,0,0.15); }
.line-info { flex:1; min-width:0; }
.line-name { font-size:0.9rem; font-weight:600; color:var(--text-primary); }
.line-meta { font-size:0.7rem; color:var(--text-secondary); display:flex; gap:8px; margin-top:3px; }
.line-badge { font-size:0.68rem; background:rgba(0,0,0,0.05); padding:2px 8px; border-radius:12px; white-space:nowrap; color:var(--text-secondary); }

/* 取消选中按钮组 */
.deselect-actions {
    display:flex; gap:8px; margin:10px 12px 12px; flex-shrink:0;
}
.deselect-btn {
    flex:1; padding:10px 12px; border-radius:8px; border:none; cursor:pointer;
    font-weight:600; font-size:0.85rem; transition:0.2s; text-align:center;
}
.deselect-btn:disabled {
    opacity:0.45; cursor:not-allowed; filter:grayscale(0.6);
}
.deselect-all {
    background:#e74c3c; color:#fff;
}
.deselect-all:not(:disabled):hover { background:#c0392b; }
.deselect-last {
    background:#f39c12; color:#fff;
}
.deselect-last:not(:disabled):hover { background:#d68910; }

/* 右侧固定详情面板 */
#detail-panel {
    position:absolute; top:12px; right:12px; width:var(--detail-width);
    max-height:calc(100vh - 24px); background:var(--bg-primary); border-radius:var(--radius);
    box-shadow:var(--shadow); z-index:1000; display:flex; flex-direction:column;
    border:1px solid var(--border); transition: transform 0.3s ease, opacity 0.3s ease;
}
#detail-panel.hidden {
    transform:translateX(110%); opacity:0; pointer-events:none;
}
.detail-header { padding:14px 16px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; }
.detail-header h2 { font-size:1.05rem; font-weight:700; color:var(--text-primary); }
.detail-close-btn { background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--text-secondary); line-height:1; }
.detail-content { flex:1; overflow-y:auto; padding:14px 16px; }
.detail-content .section { margin-bottom:18px; }
.detail-content .section h3 { font-size:0.9rem; font-weight:600; color:var(--text-primary); margin-bottom:8px; border-bottom:1px solid #eee; padding-bottom:5px; }
.detail-content .line-tags { display:flex; flex-wrap:wrap; gap:6px; }
.detail-content .line-tag {
    display:inline-flex; align-items:center; gap:4px; padding:4px 12px; border-radius:14px;
    font-size:0.8rem; font-weight:600; color:#fff; cursor:pointer; transition:0.2s;
}
.detail-content .line-tag:hover { filter: brightness(1.15); }
.detail-content .exits-list { display:flex; flex-direction:column; gap:5px; font-size:0.82rem; color:var(--text-secondary); }
.detail-content .exit-item { display:flex; gap:8px; align-items:baseline; }
.detail-content .exit-name { font-weight:600; color:var(--text-primary); min-width:40px; }
.detail-content .exit-dest { color:var(--text-secondary); }

/* 切换按钮 */
#toggle-sidebar {
    position:absolute; top:16px; left:16px; z-index:1001; width:40px; height:40px;
    border-radius:50%; background:var(--bg-primary); border:1px solid var(--border);
    color:var(--text-primary); font-size:1.2rem; cursor:pointer; display:flex;
    align-items:center; justify-content:center; box-shadow:var(--shadow); transition: left 0.3s;
}
#toggle-sidebar.shifted { left:calc(var(--sidebar-width) + 24px); }

/* 弹窗 */
.leaflet-popup-content-wrapper { border-radius:12px !important; background:#ffffff !important; color:#1a1a2e !important; border:1px solid #e0e4ea !important; box-shadow:0 8px 24px rgba(0,0,0,0.1) !important; }
.leaflet-popup-tip { background:#ffffff !important; border:1px solid #e0e4ea !important; }

/* 站点标签 */
.station-label {
    background:rgba(255,255,255,0.92); border:1px solid #c0c8d8; border-radius:4px;
    padding:2px 6px; font-size:0.7rem; font-weight:600; color:#1a1a2e; white-space:nowrap;
    box-shadow:0 2px 6px rgba(0,0,0,0.08);
}

/* 放大缩小按钮（隐藏 Leaflet 默认，使用自定义控件） */
.leaflet-control-zoom { display:none !important; }

/* 选中线路高亮效果 */
.leaflet-pane path.line-highlighted {
    filter: drop-shadow(0 0 4px rgba(255,255,255,0.8)) drop-shadow(0 0 6px currentColor);
}

/* 自定义控件组（1.2倍放大，上移避免遮挡文字） */
.custom-controls {
    position:absolute; bottom:30px; right:12px; z-index:1000;
    display:flex; flex-direction:column; gap:0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 16px; overflow:hidden;
}
.ctrl-btn {
    width:62px; height:62px; border:none; background:#ffffff; color:#1a1a2e;
    font-size:32px; line-height:62px; cursor:pointer; display:flex;
    align-items:center; justify-content:center; user-select:none;
    transition: background 0.2s;
}
.ctrl-btn:hover { background:#f5f7fa; }
.ctrl-btn:active { background:#e8ecf2; }
.ctrl-zoom-in {
    border-bottom: 1px solid #e0e4ea; border-radius: 16px 16px 0 0;
}
.ctrl-reset {
    border-bottom: 1px solid #e0e4ea; font-size:28px;
    font-weight:600;
}
.ctrl-zoom-out {
    border-radius: 0 0 16px 16px; font-size:36px;
}

/* 右下角访问主站提示（审图号样式） */
.site-credit {
    position:absolute; bottom:6px; right:6px; z-index:1001;
    font-size:0.7rem; color:#999; text-decoration:none;
    padding:2px 8px; border-radius:4px; cursor:pointer;
    transition: background 0.2s, color 0.2s;
}
.site-credit:hover {
    background:#ffffff; color:#1a1a2e;
}

@media (max-width:768px) {
    :root { --sidebar-width:290px; --detail-width:280px; }
    #sidebar { top:8px; left:8px; }
    #detail-panel { top:8px; right:8px; }
    #toggle-sidebar { top:12px; left:12px; }
    #toggle-sidebar.shifted { left:calc(var(--sidebar-width) + 16px); }
    .status-bar { font-size:0.7rem; padding:5px 12px; }
}