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

body {
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    background: #0a0a14;
    color: #c8d0e0;
    height: 100vh;
    overflow: hidden;
    display: flex;
}

/* ── 控制面板 ── */
#control-panel {
    width: var(--panel-width, 220px);
    min-width: 0;
    height: 100vh;
    background: #0e1020cc;
    backdrop-filter: blur(8px);
    border-right: 1px solid #2a3050;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.2s ease;
    flex-shrink: 0;
}

#control-panel.collapsed {
    width: 0 !important;
    border-right: none;
}

/* 分隔条（可拖拽） */
#panel-resizer {
    width: 4px;
    min-width: 4px;
    height: 100vh;
    background: transparent;
    cursor: col-resize;
    z-index: 101;
    flex-shrink: 0;
    transition: background 0.15s;
    position: relative;
}

#panel-resizer:hover,
#panel-resizer.dragging {
    background: #3a5080;
}

/* 收起/展开按钮 */
#panel-toggle {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    left: var(--panel-width, 220px);
    margin-left: 4px;          /* 紧贴分隔条右侧 */
    width: 18px;
    height: 48px;
    background: #0e1428;
    border: 1px solid #2a3555;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    z-index: 102;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a6090;
    font-size: 12px;
    transition: left 0.2s ease, color 0.15s, background 0.15s;
    user-select: none;
}

#panel-toggle:hover {
    background: #141e38;
    color: #a0c0ff;
}

#panel-toggle.collapsed {
    left: 0;
    margin-left: 4px;
}

#panel-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid #2a3050;
}

#panel-header h1 {
    font-size: 15px;
    font-weight: 600;
    color: #e8eaf0;
    letter-spacing: 0.5px;
}

#panel-header p {
    font-size: 11px;
    color: #6070a0;
    margin-top: 2px;
}

/* 搜索框 */
#search-container {
    position: relative;
    margin: 10px 16px 4px;
}

#search-input {
    width: 100%;
    box-sizing: border-box;
    background: #0e1428;
    color: #c8d8f0;
    border: 1px solid #2a3555;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 13px;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

#search-input:focus {
    border-color: #4a70b0;
}

#search-input::placeholder {
    color: #3a4870;
}

#search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #0c1020;
    border: 1px solid #2a3555;
    border-radius: 6px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 500;
    box-shadow: 0 6px 20px rgba(0,0,0,0.7);
}

.search-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    cursor: pointer;
    border-bottom: 1px solid #161c30;
    outline: none;
}

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

.search-item:hover,
.search-item:focus {
    background: #151e38;
}

.search-tag {
    font-size: 10px;
    min-width: 52px;
    text-align: center;
    border: 1px solid currentColor;
    border-radius: 3px;
    padding: 1px 4px;
    opacity: 0.85;
    flex-shrink: 0;
}

.search-name {
    font-size: 13px;
    color: #c8d8f0;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-sub {
    font-size: 11px;
    color: #4a5880;
    white-space: nowrap;
    flex-shrink: 0;
}

#search-results::-webkit-scrollbar {
    width: 4px;
}
#search-results::-webkit-scrollbar-thumb {
    background: #2a3555;
    border-radius: 2px;
}

/* 语言切换 */
#lang-toggle {
    display: flex;
    margin: 12px 16px 0;
    border: 1px solid #2a3050;
    border-radius: 6px;
    overflow: hidden;
}

/* 数据源下拉框 */
#survey-select {
    width: 100%;
    background: #0e1428;
    color: #a0b8d8;
    border: 1px solid #2a3555;
    border-radius: 5px;
    padding: 6px 8px;
    font-size: 12px;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    cursor: pointer;
    outline: none;
    margin-top: 2px;
}

#survey-select:hover {
    border-color: #3a5080;
}

#survey-select option,
#survey-select optgroup {
    background: #0e1428;
    color: #a0b8d8;
}

#survey-select optgroup {
    color: #4a6090;
    font-style: normal;
    font-size: 11px;
}

.lang-btn {
    flex: 1;
    padding: 6px 0;
    background: transparent;
    color: #6070a0;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    transition: all 0.2s;
}

.lang-btn.active {
    background: #1e2850;
    color: #a0c0ff;
}

.lang-btn:hover:not(.active) {
    background: #161a30;
}

/* 分区 */
.section {
    padding: 12px 16px;
    border-bottom: 1px solid #1a2040;
}

.section-title {
    font-size: 11px;
    color: #4a5880;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    font-weight: 600;
}

/* 复选框开关 */
.toggle-row {
    display: flex;
    align-items: center;
    padding: 5px 0;
    cursor: pointer;
    user-select: none;
}

.toggle-row input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    width: 32px;
    height: 18px;
    border-radius: 9px;
    background: #1e2440;
    border: 1px solid #2a3555;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4a5880;
    top: 2px;
    left: 2px;
    transition: transform 0.2s, background 0.2s;
}

.toggle-row input:checked + .toggle-switch {
    background: #1a3a6a;
    border-color: #3060a0;
}

.toggle-row input:checked + .toggle-switch::after {
    transform: translateX(14px);
    background: #60a0ff;
}

.toggle-label {
    margin-left: 10px;
    font-size: 13px;
    color: #9aa8c8;
    flex: 1;
}

.toggle-row:hover .toggle-label {
    color: #c0cce0;
}

/* 星等滑块 */
#mag-section {
    padding: 12px 16px 16px;
    border-bottom: 1px solid #1a2040;
}

#mag-display {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

#mag-display .mag-label {
    font-size: 13px;
    color: #9aa8c8;
}

#mag-value-badge {
    font-size: 13px;
    color: #60a0ff;
    font-weight: 600;
    min-width: 28px;
    text-align: right;
}

.slider-track {
    position: relative;
    padding: 4px 0;
}

#mag-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, #60a0ff 0%, #60a0ff var(--fill), #2a3555 var(--fill), #2a3555 100%);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

#mag-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #60a0ff;
    border: 2px solid #0e1020;
    box-shadow: 0 0 6px #60a0ff88;
    cursor: grab;
}

#mag-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
}

.slider-labels span {
    font-size: 10px;
    color: #3a4870;
}

/* ── 地图容器 ── */
#aladin-lite-div {
    flex: 1;
    height: 100vh;
}

/* 加载遮罩 */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: #0a0a14ee;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s;
}

#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #1e2850;
    border-top-color: #60a0ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 14px;
}

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

#loading-text {
    font-size: 13px;
    color: #6070a0;
}

/* 滚动条 */
#control-panel::-webkit-scrollbar {
    width: 4px;
}
#control-panel::-webkit-scrollbar-track {
    background: transparent;
}
#control-panel::-webkit-scrollbar-thumb {
    background: #2a3050;
    border-radius: 2px;
}
