/* ============================================
   太阳系 3D 模拟 - 样式文件
   现代毛玻璃风格 UI
   ============================================ */

/* ---------- 全局重置与基础样式 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue',
                 Helvetica, Arial, sans-serif;
    color: #e0e6ed;
    user-select: none;
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}

/* 行星标签样式 */
.planet-label {
    color: #f4f7fb;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    background: rgba(26, 38, 64, 0.82);
    border: 1px solid rgba(148, 178, 214, 0.32);
    border-radius: 12px;
    white-space: nowrap;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.25s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.18);
}

.planet-label:hover {
    background: rgba(37, 70, 160, 0.9);
    border-color: rgba(125, 186, 255, 0.6);
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.35);
}

.moon-label {
    font-size: 10px;
    padding: 2px 7px;
    opacity: 0.85;
}

.moon-label:hover {
    background: rgba(60, 40, 20, 0.85);
    border-color: rgba(200, 180, 140, 0.5);
}

/* ---------- HUD 面板通用样式（供信息面板使用） ---------- */
.hud-panel {
    position: fixed;
    z-index: 100;
    background: rgba(22, 33, 58, 0.82);
    backdrop-filter: blur(18px) saturate(1.5);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    border: 1px solid rgba(150, 178, 214, 0.26);
    border-radius: 16px;
    padding: 20px;
    color: #eef2f8;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.35),
        0 0 28px rgba(59, 130, 246, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.09);
    animation: panelFadeIn 0.5s ease-out both;
}

@keyframes panelFadeIn {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 标题样式（保留兼容） ---------- */
.title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---------- 控件组（保留兼容） ---------- */
.control-group {
    margin-bottom: 14px;
}

.control-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #94a3b8;
    margin-bottom: 8px;
    font-weight: 600;
}

/* ---------- 按钮行 ---------- */
.button-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

/* 按钮通用样式 */
.btn {
    flex: 1;
    padding: 9px 14px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.22s ease;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.45);
}

.btn-secondary {
    background: rgba(58, 74, 102, 0.7);
    color: #dde6f2;
    border: 1px solid rgba(150, 178, 214, 0.28);
}

.btn-secondary:hover {
    background: rgba(80, 98, 130, 0.82);
    border-color: rgba(150, 178, 214, 0.42);
}

.btn-small {
    width: 100%;
    margin-top: 12px;
    padding: 7px 14px;
    background: rgba(58, 74, 102, 0.5);
    color: #aeb9cc;
    border: 1px solid rgba(150, 178, 214, 0.18);
    font-size: 12px;
    border-radius: 8px;
}

.btn-small:hover {
    background: rgba(80, 98, 130, 0.6);
    color: #f1f5fb;
}

.btn:active {
    transform: scale(0.97);
}

/* ---------- 滑块行 ---------- */
.slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.slider-label {
    font-size: 11px;
    color: #8593a8;
    min-width: 30px;
    text-align: center;
}

.speed-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(51, 65, 85, 0.8);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 17px;
    height: 17px;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.45);
    transition: transform 0.15s ease;
}

.speed-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.speed-slider::-moz-range-thumb {
    width: 17px;
    height: 17px;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.45);
}

.speed-display {
    font-size: 13px;
    color: #dde6f2;
    text-align: center;
    margin-top: 4px;
}

#speed-value {
    color: #60a5fa;
    font-weight: 700;
}

/* ---------- 时间信息 ---------- */
.time-info {
    padding-top: 12px;
    border-top: 1px solid rgba(150, 178, 214, 0.14);
    font-size: 13px;
    line-height: 1.7;
    color: #aeb9cc;
}

.time-info span {
    color: #f3f6fb;
    font-weight: 600;
}

/* ============================================
   右上角齿轮设置按钮
   ============================================ */
/* 右上角控制按钮组（齿轮 + 全屏），flex 并排 */
.top-right-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 102;
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
}

/* 右上角圆形玻璃图标按钮（齿轮 / 全屏 共用视觉） */
.settings-btn,
.fullscreen-btn {
    position: relative;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(150, 178, 214, 0.26);
    border-radius: 13px;
    background: rgba(22, 33, 58, 0.82);
    backdrop-filter: blur(18px) saturate(1.5);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    color: #eef2f8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.35),
        0 0 28px rgba(59, 130, 246, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.09);
    transition: background 0.28s ease, border-color 0.28s ease,
                box-shadow 0.28s ease;
    animation: panelFadeIn 0.5s ease-out both;
}

.settings-btn:hover,
.fullscreen-btn:hover {
    background: rgba(34, 48, 82, 0.92);
    border-color: rgba(125, 186, 255, 0.55);
    box-shadow:
        0 4px 20px rgba(59, 130, 246, 0.3),
        0 0 28px rgba(59, 130, 246, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.settings-btn:active,
.fullscreen-btn:active {
    transform: scale(0.94);
}

/* 全屏图标：默认显示「进入」，全屏态显示「退出」 */
.fullscreen-btn .fs-icon {
    position: absolute;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.fullscreen-btn .fs-icon-exit {
    opacity: 0;
    transform: scale(0.7);
}
.fullscreen-btn.is-fullscreen .fs-icon-enter {
    opacity: 0;
    transform: scale(0.7);
}
.fullscreen-btn.is-fullscreen .fs-icon-exit {
    opacity: 1;
    transform: scale(1);
}

/* 全屏激活态：轻微高亮，提示当前已进入全屏 */
.fullscreen-btn.is-fullscreen {
    border-color: rgba(125, 186, 255, 0.55);
    background: rgba(34, 48, 82, 0.92);
    box-shadow:
        0 4px 20px rgba(59, 130, 246, 0.28),
        0 0 28px rgba(59, 130, 246, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* 齿轮图标旋转动画 */
.settings-btn .gear-icon {
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(0deg);
}

.settings-btn:hover .gear-icon {
    transform: rotate(90deg);
}

/* 弹窗打开时齿轮旋转 90° */
.settings-btn.active .gear-icon {
    transform: rotate(90deg);
}

/* ============================================
   设置弹窗面板
   ============================================ */
.settings-panel {
    position: fixed;
    top: 76px;
    right: 20px;
    z-index: 101;
    width: 300px;
    background: rgba(22, 33, 58, 0.82);
    backdrop-filter: blur(18px) saturate(1.5);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    border: 1px solid rgba(150, 178, 214, 0.26);
    border-radius: 16px;
    padding: 20px;
    color: #eef2f8;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.35),
        0 0 28px rgba(59, 130, 246, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.09);

    /* 展开/收起动画初始状态 */
    opacity: 0;
    transform: translateY(-12px) scale(0.95);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 弹窗展开状态 */
.settings-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ---------- 弹窗区块 ---------- */
.settings-section {
    margin-bottom: 0;
}

/* 区块之间的分隔线 */
.settings-section + .settings-section {
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

/* 区块小标题 */
.section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #b3c0d4;
    margin-bottom: 12px;
}

/* ---------- 视角按钮网格 ---------- */
.view-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* 视角按钮（通用样式） */
.btn-view {
    padding: 10px 8px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: rgba(51, 65, 85, 0.4);
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.22s ease;
    white-space: nowrap;
    text-align: center;
}

.btn-view:hover {
    background: rgba(71, 85, 105, 0.6);
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.2);
}

.btn-view.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(139, 92, 246, 0.25));
    color: #fff;
    border-color: rgba(96, 165, 250, 0.4);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

.btn-view:active {
    transform: scale(0.97);
}

/* ---------- 行星信息面板 ---------- */
/* 移至左上角（原 HUD 位置已释放） */
.info-panel {
    top: 20px;
    left: 20px;
    width: 280px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.planet-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.info-item {
    background: rgba(30, 41, 59, 0.5);
    padding: 8px 10px;
    border-radius: 8px;
}

.info-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #8593a8;
    margin-bottom: 3px;
}

.info-value {
    font-size: 13px;
    font-weight: 600;
    color: #f3f6fb;
}

.info-description {
    font-size: 12px;
    line-height: 1.7;
    color: #b3c0d4;
}

.hidden {
    display: none !important;
}

/* 视觉隐藏：对屏幕阅读器与搜索引擎可见，但不在屏幕上渲染 */
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 行星名称隐藏：用 body class + !important，避免被 CSS2DRenderer 每帧重置 style.display 覆盖 */
body.labels-hidden .planet-label {
    display: none !important;
}

/* 设置面板中的开关行 */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #dde6f2;
    cursor: pointer;
    padding: 6px 0;
}
.toggle-row input {
    width: 16px;
    height: 16px;
    accent-color: #60a5fa;
    cursor: pointer;
}

/* ---------- 加载屏幕 ---------- */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(ellipse at center, #111a33 0%, #02040c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 18px;
    border: 3px solid rgba(96, 165, 250, 0.15);
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content p {
    font-size: 15px;
    color: #b3c0d4;
    letter-spacing: 0.5px;
}

/* 空间暗角：边缘微压暗以强化「深空」纵深，中心保持通透「明朗」 */
.space-vignette {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 46%,
                rgba(0, 0, 0, 0) 52%,
                rgba(0, 0, 0, 0.38) 100%);
    mix-blend-mode: multiply;
}

/* ---------- 滚动条美化 ---------- */
.info-panel::-webkit-scrollbar {
    width: 5px;
}

.info-panel::-webkit-scrollbar-track {
    background: transparent;
}

.info-panel::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.35);
    border-radius: 3px;
}

/* ---------- 响应式适配 ---------- */
@media (max-width: 768px) {
    .top-right-controls {
        top: 12px;
        right: 12px;
        gap: 8px;
    }

    .settings-btn,
    .fullscreen-btn {
        width: 42px;
        height: 42px;
    }

    .settings-panel {
        top: 64px;
        right: 12px;
        width: calc(100vw - 24px);
        max-width: 300px;
        padding: 14px;
    }

    .info-panel {
        top: auto;
        bottom: 12px;
        left: 12px;
        width: calc(100vw - 24px);
        max-width: 280px;
        max-height: 38vh;
    }

    .btn-view {
        padding: 8px 6px;
        font-size: 12px;
    }
}
