* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 新增：主题变量（默认浅色海天蓝），自动适配暗黑模式 */
:root {
    --bg-gradient-start: #d8eaff;
    --bg-gradient-end:   #bcdcff;
    --text-primary:      #223b5f;
    --text-secondary:    #3a5a8f;
    --accent:            #4a6ee0;
    --accent-2:          #2ea9ff;

    /* 适度加深并带蓝灰色调 */
    --panel-bg:          rgba(220, 232, 250, 0.88);
    --panel-shadow:      rgba(0, 86, 179, 0.25);
    --map-bg:            rgba(210, 225, 245, 0.75);

    --btn-bg:            rgba(205, 225, 245, 0.90);
    --btn-text:          var(--text-primary);
    --btn-hover-bg:      rgba(74, 110, 224, 0.9);

    --border-color:      #4a6ee0;

    --legend-bg:         rgba(225, 235, 250, 0.90);
    --legend-text:       var(--text-secondary);

    --tooltip-bg:        rgba(225, 235, 250, 0.95);
    --tooltip-text:      var(--text-primary);
    --tooltip-border:    rgba(74, 110, 224, 0.5);

    /* 将省份标签背景改为透明 */
    --label-bg:          transparent;
    --label-text:        #133b6b;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-gradient-start: #1a1a2e;
        --bg-gradient-end:   #16213e;
        --text-primary:      #e6e6e6;
        --text-secondary:    #b0b0d0;

        --panel-bg:          rgba(30, 30, 46, 0.85);
        --panel-shadow:      rgba(0, 0, 0, 0.5);
        --map-bg:            rgba(25, 25, 35, 0.7);

        --btn-bg:            rgba(30, 30, 46, 0.85);
        --btn-text:          #e6e6e6;
        --btn-hover-bg:      rgba(74, 110, 224, 0.9);

        --border-color:      #4a6ee0;

        --legend-bg:         rgba(30, 30, 46, 0.85);
        --legend-text:       #b0b0d0;

        --tooltip-bg:        rgba(30, 30, 46, 0.95);
        --tooltip-text:      #ffffff;
        --tooltip-border:    rgba(74, 110, 224, 0.5);

        /* 暗黑模式同样设为透明 */
        --label-bg:          transparent;
        --label-text:        #ffffff;
    }

    /* 新增：暗色模式下联系人标题为白色 */
    .contact-item h3 {
        color: #ffffff;
    }
}

/* 修改：使用主题变量替换主要背景与文本颜色 */
body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    display: flex;
    flex-direction: row;
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
    gap: 30px;
    min-height: 100vh;
}

/* 地图容器样式 */
.map-section {
    flex: 3;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px var(--panel-shadow);
    background: var(--map-bg);
    min-height: 800px;
}

#china-map {
    /* 让画布绝对定位填满容器，便于进行视觉缩放 */
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
}

/* 控制面板 */
.controls {
    position: absolute;
    bottom: 30px;
    left: 30px;
    z-index: 100;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.control-btn {
    background: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px var(--panel-shadow);
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn:hover {
    background: var(--btn-hover-bg);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(74, 110, 224, 0.4);
    color: #ffffff;
}

.control-btn.active {
    background: var(--btn-hover-bg);
    color: #ffffff;
}

/* 信息面板 */
.info-section {
    flex: 1;
    background: var(--panel-bg);
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 20px 50px var(--panel-shadow);
    backdrop-filter: blur(10px);
    overflow-y: auto;
    max-height: 800px;
    min-width: 350px;
}

.contact-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 25px;
    margin-bottom: 35px;
}

.contact-header h1 {
    color: #ffffff;
    font-size: 2.5em;
    margin-bottom: 10px;
    background: linear-gradient(90deg, var(--accent), #8a2be2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.contact-header p {
    color: var(--text-secondary);
    font-size: 1.1em;
    line-height: 1.6;
}

/* 联系人卡片样式 */
.contact-item {
    background: rgba(40, 40, 60, 0.7); /* 原深色，下面一行用变量覆盖 */
    background: var(--panel-bg);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 25px;
    transition: all 0.4s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.contact-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(74, 110, 224, 0.1), rgba(138, 43, 226, 0.1));
    opacity: 0;
    transition: opacity 0.4s ease;
}

.contact-item:hover::before {
    opacity: 1;
}

.contact-item:hover {
    transform: translateY(-8px);
    border-color: var(--border-color);
    box-shadow: 0 15px 30px rgba(74, 110, 224, 0.3);
}

.contact-item.active {
    border-color: var(--border-color);
    background: var(--panel-bg);
    box-shadow: 0 15px 30px rgba(74, 110, 224, 0.3);
}

.region {
    display: inline-block;
    background: linear-gradient(90deg, var(--accent), #8a2be2);
    color: white;
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 0.95em;
    margin-bottom: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.contact-item h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.6em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.contact-item h3::before {
    content: '👤';
    font-size: 1.2em;
}

.contact-details p {
    margin: 12px 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.contact-details strong {
    color: var(--text-primary);
    min-width: 50px;
}

.email {
    color: var(--accent);
    word-break: break-all;
}

/* 加载指示器 */
#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.3em;
    color: #4a6ee0;
    background: rgba(30, 30, 46, 0.9);
    padding: 20px 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 15px;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(74, 110, 224, 0.3);
    border-top: 3px solid #4a6ee0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 提示框样式 */
#tooltip {
    position: absolute;
    background: var(--tooltip-bg);
    color: var(--tooltip-text);
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 1.1em;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
    box-shadow: 0 10px 30px var(--panel-shadow);
    border: 1px solid var(--tooltip-border);
    max-width: 300px;
    backdrop-filter: blur(10px);
}

#tooltip h3 {
    color: #4a6ee0;
    margin-bottom: 8px;
    font-size: 1.3em;
}

#tooltip p {
    color: #b0b0d0;
    margin: 5px 0;
    font-size: 0.95em;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .container {
        flex-direction: column;
    }
    
    .map-section, .info-section {
        min-height: 600px;
    }
    
    .info-section {
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
        gap: 20px;
    }
    
    .controls {
        bottom: 15px;
        left: 15px;
    }
    
    .control-btn {
        padding: 10px 18px;
        font-size: 14px;
    }
    
    .contact-header h1 {
        font-size: 2em;
    }
    
    .info-section {
        padding: 25px 20px;
    }

    /* 新增：移动端竖屏下提高地图可视高度占比 */
    .map-section {
        min-height: 70vh;
    }

    /* 新增：移动端画布视觉缩放，使“地图更大、容器不变” */
    #china-map {
        transform: scale(1.25);
        transform-origin: center center;
    }
}

/* 新增：更精细的竖屏适配（小屏竖屏时） */
@media (orientation: portrait) and (max-width: 900px) {
    .map-section {
        min-height: 70vh;
    }
    /* #china-map 高度跟随容器即可（height:100%） */
}

@media (orientation: portrait) and (max-width: 480px) {
    .map-section {
        min-height: 65vh;
    }
    /* 更小屏再提升缩放倍数，保持大地图视觉效果 */
    #china-map {
        transform: scale(1.35);
        transform-origin: center center;
    }
}

/* 省份高亮效果 */
.province-highlight {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* 地图图例 */
.legend {
    position: absolute;
    bottom: 60px;
    right: 20px;
    background: var(--legend-bg);
    border-radius: 12px;
    padding: 12px;
    z-index: 100;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px var(--panel-shadow);
    max-width: 200px;
}

.legend h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 1em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.color-box {
    /* 缩小色块尺寸 */
    width: 16px;
    height: 16px;
    border-radius: 4px;
    margin-right: 8px;
}

.legend-text {
    color: var(--legend-text);
    font-size: 0.85em;
}

/* 省份标签 */
.province-label {
    position: absolute;
    color: var(--label-text);
    font-size: 12px;
    pointer-events: none;
    z-index: 50;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    background: var(--label-bg);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}