body { 
    margin: 0; 
    padding: 0; 
    font-family: 'SimSun', 'Songti SC', 'Noto Serif SC', 'Microsoft YaHei', serif;
    color: #e6e6e6;
    background-color: #111;
}

#map { 
    position: absolute; 
    top: 0; 
    bottom: 0; 
    width: 100%; 
}

/* ====================================
    == 左上角: 控制面板样式 (原始)
    ====================================
*/
.controls {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(32, 32, 32, 0.88);
    padding: 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 1;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    max-width: 320px;
}

.control-group {
    margin-bottom: 15px;
}
.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #f2f2f2;
    text-shadow: none;
}
.control-group select {
    width: 100%;
    padding: 9px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background-color: rgba(24, 24, 24, 0.9);
    color: #f5f5f5;
    appearance: none;
}
.controls h3 {
    margin: 0 0 12px 0;
    color: #f0f0f0;
}
.controls button {
    display: inline-block;
    margin-right: 10px;
    padding: 8px 14px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: #595959;
    color: #fafafa;
    border-radius: 6px;
    transition: background 0.2s ease, transform 0.2s ease;
}
.controls button:disabled {
    background-color: #2d2d2d;
    color: #8d8d8d;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.08);
}
.controls button:not(:disabled):hover {
    background: #6d6d6d;
    transform: translateY(-1px);
}

/* ====================================
    == 右下角时间线面板样式 (已更新)
    ====================================
*/
.timeline-controls {
    position: absolute;
    bottom: 20px; /* 在版权信息上方 */
    right: 20px;
    background: rgba(32, 32, 32, 0.88);
    padding: 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 1;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    width: 450px; /* [修改] 已加宽 */
    max-width: 450px;
}

/* "输入框 + 按钮" 布局 */
.timeline-input-group {
    display: flex;
    margin: 10px 0;
}

.timeline-input-group input[type="number"] {
    flex-grow: 1; /* 占据剩余空间 */
    padding: 9px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 6px 0 0 6px; /* 左侧圆角 */
    background-color: rgba(24, 24, 24, 0.9);
    color: #f5f5f5;
    -moz-appearance: textfield; /* 隐藏 +/- 按钮 (Firefox) */
}

/* 隐藏 +/- 按钮 (Chrome, Safari, Edge) */
.timeline-input-group input[type=number]::-webkit-inner-spin-button,
.timeline-input-group input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.timeline-input-group button {
    padding: 9px 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background-color: #595959;
    color: #fafafa;
    cursor: pointer;
    border-radius: 0 6px 6px 0; /* 右侧圆角 */
    transition: background 0.2s ease, transform 0.2s ease;
}
.timeline-input-group button:hover {
    background: #6d6d6d;
    transform: translateY(-1px);
}

/* 时间线控制区域容器 */
.timeline-control-section {
    margin: 12px 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* 播放控制行 */
.playback-control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

/* 步进控制行 */
.step-control-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 统一按钮样式 */
.playback-btn,
.step-btn {
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background-color: #595959;
    color: #fafafa;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

.playback-btn:hover,
.step-btn:hover {
    background: #6d6d6d;
    transform: translateY(-1px);
}

.playback-btn:active,
.step-btn:active {
    transform: translateY(0);
}

.playback-btn.playing {
    background-color: #d46a6a;
}

.playback-btn.playing:hover {
    background-color: #e07a7a;
}

/* 统一标签样式 */
.control-label,
.control-unit {
    color: #d9d9d9;
    font-size: 13px;
    white-space: nowrap;
}

/* 统一输入框样式 */
#playback-speed-input,
#step-years-input {
    width: 55px;
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 6px;
    background-color: rgba(24, 24, 24, 0.9);
    color: #f5f5f5;
    text-align: center;
    -moz-appearance: textfield;
}

#playback-speed-input::-webkit-inner-spin-button,
#playback-speed-input::-webkit-outer-spin-button,
#step-years-input::-webkit-inner-spin-button,
#step-years-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#playback-speed-input:focus,
#step-years-input:focus {
    border-color: rgba(255, 255, 255, 0.28);
    outline: none;
}


.range-settings {
    margin-top: 12px;
}

.range-settings-label {
    display: block;
    margin-bottom: 6px;
    color: #d9d9d9;
    font-size: 13px;
}

.range-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.range-input-group input[type="number"] {
    width: 110px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 6px;
    background-color: rgba(24, 24, 24, 0.9);
    color: #f5f5f5;
}

.range-input-group button {
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background-color: #595959;
    color: #fafafa;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.range-input-group button:hover {
    background: #6d6d6d;
    transform: translateY(-1px);
}

.range-separator {
    color: #d9d9d9;
    font-size: 13px;
    padding: 0 4px;
}

/* 滑块样式 */
#timeline-slider {
    width: 100%;
    margin-top: 5px;
    cursor: pointer;
    accent-color: #8c8c8c;
}

/* [新增] 滑块标签样式 */
.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #c9c9c9;
    margin-top: 5px;
    padding: 0 5px; /* 轻微内缩 */
}

.timeline-controls input,
.timeline-controls select,
.controls select {
    outline: none;
}

.timeline-controls input:focus,
.timeline-controls select:focus,
.controls select:focus {
    border-color: rgba(255, 255, 255, 0.28);
}

.timeline-controls button:active,
.controls button:active {
    transform: translateY(0);
}

.timeline-controls {
    width: 460px;
    max-width: 460px;
}

.maplibregl-popup-content {
    color: #111111;
    font-family: "SimSun", "Songti SC", "Noto Serif CJK SC", "Microsoft YaHei", serif;
}

/* ====================================
    == 星座过滤器样式
    ====================================
*/
#zodiac-filter {
    margin: 15px 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#zodiac-filter h4 {
    margin: 0 0 10px 0;
    color: #f0f0f0;
    font-size: 14px;
}

.zodiac-checkboxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.zodiac-checkboxes label {
    display: flex;
    align-items: center;
    color: #d9d9d9;
    font-size: 13px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.zodiac-checkboxes label:hover {
    background: rgba(255, 255, 255, 0.05);
}

.zodiac-checkboxes input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #8c8c8c;
}

.zodiac-controls {
    display: flex;
    gap: 8px;
}

.zodiac-controls button {
    flex: 1;
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background-color: #595959;
    color: #fafafa;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.zodiac-controls button:hover {
    background: #6d6d6d;
    transform: translateY(-1px);
}

.zodiac-controls button:active {
    transform: translateY(0);
}

/* 星座颜色指示器 */
.zodiac-color {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.zodiac-color[data-zodiac="aries"] { background-color: #E74C3C; }
.zodiac-color[data-zodiac="taurus"] { background-color: #27AE60; }
.zodiac-color[data-zodiac="gemini"] { background-color: #F39C12; }
.zodiac-color[data-zodiac="cancer"] { background-color: #95A5A6; }
.zodiac-color[data-zodiac="leo"] { background-color: #F1C40F; }
.zodiac-color[data-zodiac="virgo"] { background-color: #A0826D; }
.zodiac-color[data-zodiac="libra"] { background-color: #E91E63; }
.zodiac-color[data-zodiac="scorpio"] { background-color: #8E44AD; }
.zodiac-color[data-zodiac="sagittarius"] { background-color: #9B59B6; }
.zodiac-color[data-zodiac="capricorn"] { background-color: #795548; }
.zodiac-color[data-zodiac="aquarius"] { background-color: #3498DB; }
.zodiac-color[data-zodiac="pisces"] { background-color: #1ABC9C; }

/* 星座数量显示 */
.zodiac-count {
    color: #999;
    font-size: 11px;
    margin-left: 2px;
}

/* 版权信息样式 */
.attribution-info {
    margin-top: 20px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.attribution-info p {
    margin: 4px 0;
    color: #999;
    font-size: 10px;
    line-height: 1.4;
}

.attribution-info p:first-child {
    color: #b0b0b0;
    font-size: 11px;
    font-weight: bold;
}

/* 隐藏MapLibre地图默认的版权控件 */
.maplibregl-ctrl-attrib,
.maplibregl-ctrl-bottom-right {
    display: none !important;
}

/* ====================================
    == 移动端新增组件样式
    ====================================
*/

/* 汉堡菜单按钮 */
.mobile-menu-btn {
    display: none; /* 默认隐藏，移动端显示 */
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    width: 50px;
    height: 50px;
    background: rgba(32, 32, 32, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: background 0.3s ease, transform 0.2s ease;
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 3px;
    background: #f5f5f5;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* 汉堡按钮激活状态（X形状） */
.mobile-menu-btn.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* 遮罩层 */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* 移动端浮动操作按钮容器 */
.mobile-fab-container {
    display: none; /* 默认隐藏，移动端显示 */
    position: fixed;
    bottom: 90px; /* 在底部工具栏上方 */
    left: 0;
    right: 0;
    z-index: 10;
    pointer-events: none; /* 容器不拦截点击 */
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* 未选择主题时隐藏浮动按钮 */
.mobile-fab-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.mobile-fab {
    pointer-events: auto; /* 按钮可点击 */
    position: absolute;
    bottom: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(32, 32, 32, 0.92);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fafafa;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.mobile-fab:active {
    transform: scale(0.9);
}

.mobile-fab:disabled {
    background: rgba(32, 32, 32, 0.5);
    color: #666;
    cursor: not-allowed;
    opacity: 0.5;
}

.mobile-fab-left {
    left: 20px;
}

.mobile-fab-right {
    right: 20px;
}

.fab-icon {
    font-size: 24px;
    line-height: 1;
}

/* 移动端时间线工具栏 */
.mobile-timeline-toolbar {
    display: none; /* 默认隐藏，移动端显示 */
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
}

.mobile-play-btn {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #595959;
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #fafafa;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-play-btn:active {
    transform: scale(0.95);
}

.mobile-play-btn.playing {
    background: #d46a6a;
}

.mobile-timeline-slider-container {
    flex: 1;
    min-width: 0;
}

#mobile-timeline-slider {
    width: 100%;
    height: 36px;
    cursor: pointer;
    accent-color: #8c8c8c;
}

.mobile-year-btn {
    flex-shrink: 0;
    min-width: 80px;
    height: 48px;
    padding: 0 12px;
    background: rgba(24, 24, 24, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 6px;
    color: #f5f5f5;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-year-btn:active {
    background: rgba(40, 40, 40, 0.9);
}

/* 桌面端控制显示/隐藏 */
.desktop-timeline-controls {
    display: block; /* 默认显示 */
}

.desktop-slider-container {
    display: block; /* 默认显示 */
}

/* ====================================
    == 移动端响应式适配
    ====================================
*/

/* 平板及以下 (768px) */
@media screen and (max-width: 768px) {
    /* ===== 移动端布局控制 ===== */

    /* 显示汉堡菜单按钮 */
    .mobile-menu-btn {
        display: flex;
    }

    /* 控制面板改为抽屉式 */
    .controls {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 85%;
        max-width: 320px;
        height: 100%;
        margin: 0;
        padding: 80px 20px 20px 20px;
        border-radius: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.5);
    }

    .controls.active {
        transform: translateX(0);
    }

    /* 隐藏桌面端导航按钮 */
    #person-controls #prev-btn,
    #person-controls #next-btn {
        display: none !important;
    }

    /* 显示移动端浮动按钮 */
    .mobile-fab-container {
        display: block;
    }

    /* 时间线面板改为底部工具栏 */
    .timeline-controls {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        border-radius: 0;
        background: rgba(32, 32, 32, 0.95);
        border: none;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
    }

    /* 隐藏桌面端时间线控制 */
    .desktop-timeline-controls {
        display: none;
    }

    .desktop-slider-container {
        display: none;
    }

    /* 显示移动端时间线工具栏 */
    .mobile-timeline-toolbar {
        display: flex;
    }

    /* 调整控制面板内按钮尺寸 */
    .controls button {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 44px;
    }

    /* 星座过滤器改为单列 */
    .zodiac-checkboxes {
        grid-template-columns: 1fr;
    }

    /* 调整输入框尺寸 */
    .control-group select {
        font-size: 16px; /* 防止iOS自动缩放 */
        min-height: 44px;
    }

    /* 控制组间距 */
    .control-group {
        margin-bottom: 15px;
    }

    /* 星座控制按钮 */
    .zodiac-controls button {
        min-height: 44px;
        font-size: 14px;
    }
}

/* 手机端 (480px以下) */
@media screen and (max-width: 480px) {
    /* 缩小汉堡按钮 */
    .mobile-menu-btn {
        width: 45px;
        height: 45px;
        top: 12px;
        left: 12px;
    }

    .mobile-menu-btn span {
        width: 20px;
        height: 2.5px;
    }

    /* 抽屉面板宽度调整 */
    .controls {
        width: 90%;
        max-width: 280px;
        padding: 70px 15px 15px 15px;
        font-size: 13px;
    }

    /* 减小控制组间距 */
    .control-group {
        margin-bottom: 12px;
    }

    /* 调整标题和文本大小 */
    .controls h3,
    #zodiac-filter h4 {
        font-size: 15px;
        margin-bottom: 8px;
    }

    .control-group label {
        font-size: 13px;
        margin-bottom: 5px;
    }

    #location-info,
    #location-title {
        font-size: 13px;
    }

    /* 星座过滤器标签 */
    .zodiac-checkboxes label {
        font-size: 12px;
        padding: 6px;
    }

    /* 缩小FAB按钮 */
    .mobile-fab {
        width: 50px;
        height: 50px;
    }

    .mobile-fab-left {
        left: 15px;
    }

    .mobile-fab-right {
        right: 15px;
    }

    /* 底部工具栏调整 */
    .mobile-timeline-toolbar {
        padding: 10px 12px;
        gap: 10px;
    }

    .mobile-play-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }

    .mobile-year-btn {
        min-width: 70px;
        height: 44px;
        font-size: 13px;
    }
}

/* 超小屏幕 (360px以下) */
@media screen and (max-width: 360px) {
    /* 汉堡按钮进一步缩小 */
    .mobile-menu-btn {
        width: 42px;
        height: 42px;
        top: 10px;
        left: 10px;
    }

    /* 抽屉面板 */
    .controls {
        width: 95%;
        max-width: 260px;
        padding: 60px 12px 12px 12px;
        font-size: 12px;
    }

    .controls h3 {
        font-size: 14px;
    }

    /* 星座过滤器更紧凑 */
    .zodiac-checkboxes label {
        font-size: 11px;
        padding: 4px;
    }

    .zodiac-color {
        width: 8px;
        height: 8px;
    }

    /* FAB按钮 */
    .mobile-fab {
        width: 46px;
        height: 46px;
    }

    .fab-icon {
        font-size: 20px;
    }

    /* 底部工具栏 */
    .mobile-timeline-toolbar {
        padding: 8px 10px;
        gap: 8px;
    }

    .mobile-play-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .mobile-year-btn {
        min-width: 65px;
        height: 40px;
        font-size: 12px;
    }
}
