/* ==========================================================================
   Solar - 太阳系 3D 互动探索平台
   ========================================================================== */

:root {
    --theme-color: #ffdd00;
    --theme-color-rgb: 255, 221, 0;
    --theme-bg: rgba(10, 15, 25, 0.9);
    --theme-border: rgba(var(--theme-color-rgb), 0.6);
    --theme-glow: rgba(var(--theme-color-rgb), 0.2);
    --theme-glow-inset: rgba(var(--theme-color-rgb), 0.05);
    --theme-text: rgb(var(--theme-color-rgb));
    --accent-color: #ffaa00;
    --theme-bg-light: rgba(var(--theme-color-rgb), 0.05);
    --theme-bg-lighter: rgba(var(--theme-color-rgb), 0.1);
    --theme-label: #aaa;
}

/* ==========================================================================
   全局重置
   ========================================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    color: white;
}

/* ==========================================================================
   Three.js 场景容器
   ========================================================================== */
#scene-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ==========================================================================
   语言切换按钮
   ========================================================================== */
#lang-switch {
    position: fixed;
    bottom: 30px;
    right: 20px;
    z-index: 500;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--theme-border);
    background: var(--theme-bg);
    color: var(--theme-text);
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 15px var(--theme-glow);
    transition: all 0.2s;
}

#lang-switch:hover {
    box-shadow: 0 0 25px var(--theme-glow);
    transform: scale(1.1);
}

/* ==========================================================================
   顶部搜索框 + 对话面板
   ========================================================================== */
#search-container {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
}

#search-box {
    display: flex;
    align-items: center;
    background: var(--theme-bg);
    border: 1px solid var(--theme-border);
    border-radius: 25px;
    padding: 8px 15px;
    width: 280px;
    box-shadow: 0 0 20px var(--theme-glow);
    transition: all 0.3s;
}

#search-box:focus-within {
    border-color: var(--theme-text);
    box-shadow: 0 0 25px var(--theme-glow);
    width: 320px;
}

#search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--theme-text);
    font-size: 13px;
    padding: 5px 10px;
}

#search-input::placeholder {
    color: #666;
}

#search-icon {
    width: 24px;
    height: 24px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
}

#search-icon:hover {
    opacity: 1;
}

#search-icon svg {
    width: 100%;
    height: 100%;
    fill: var(--theme-text);
}

/* 对话面板 */
#chat-panel {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    max-height: 400px;
    background: rgba(10, 15, 25, 0.95);
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    z-index: 200;
    display: none;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#chat-panel.show {
    display: flex;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--theme-border);
}

.chat-header h4 {
    color: var(--theme-text);
    font-size: 13px;
    margin: 0;
}

.chat-close {
    width: 24px;
    height: 24px;
    cursor: pointer;
    opacity: 0.7;
}

.chat-close:hover {
    opacity: 1;
}

.chat-close svg {
    width: 100%;
    height: 100%;
    fill: #888;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    max-height: 300px;
}

.chat-message {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
}

.chat-message.user {
    background: var(--theme-bg-lighter);
    border-left: 3px solid var(--theme-text);
    color: #fff;
    margin-left: 20px;
}

.chat-message.ai {
    background: var(--theme-bg-light);
    border-left: 3px solid var(--theme-text-secondary);
    color: var(--theme-text);
    margin-right: 20px;
}

.chat-input-area {
    display: flex;
    padding: 12px 15px;
    border-top: 1px solid var(--theme-border);
    gap: 10px;
}

#chat-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--theme-text);
    font-size: 12px;
    outline: none;
}

#chat-input:focus {
    border-color: var(--theme-text);
}

#chat-send {
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(var(--theme-color-rgb), 0.5), rgba(255, 170, 0, 0.5));
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    color: white;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

#chat-send:hover {
    background: linear-gradient(135deg, rgba(var(--theme-color-rgb), 0.7), rgba(255, 170, 0, 0.7));
    box-shadow: 0 0 10px var(--theme-glow);
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--theme-border);
    border-radius: 3px;
}

/* ==========================================================================
   左侧信息面板
   ========================================================================== */
#info-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 260px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: var(--theme-bg);
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    padding: 15px;
    z-index: 100;
    box-shadow: 0 0 20px var(--theme-glow), inset 0 0 30px var(--theme-glow-inset);
}

#info-panel h3 {
    color: var(--theme-text);
    font-size: 16px;
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 0 0 10px var(--theme-glow);
    border-bottom: 1px solid var(--theme-border);
    padding-bottom: 10px;
}

.info-section {
    margin-bottom: 15px;
}

.info-section-title {
    color: var(--accent-color);
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 8px;
    padding-left: 8px;
    border-left: 2px solid var(--accent-color);
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 11px;
    padding: 4px 8px;
    background: var(--theme-bg-light);
    border-radius: 4px;
}

.info-label {
    color: var(--theme-label);
    white-space: nowrap;
    flex-shrink: 0;
    margin-right: 8px;
}

.info-value {
    color: var(--theme-text);
    font-weight: bold;
    text-align: right;
}

.info-note {
    color: #666;
    font-size: 10px;
    margin-top: 4px;
    font-style: italic;
}

#info-panel::-webkit-scrollbar {
    width: 0;
    display: none;
}

/* ==========================================================================
   右侧答题面板
   ========================================================================== */
#quiz-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 300px;
    background: var(--theme-bg);
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    padding: 15px;
    z-index: 100;
    box-shadow: 0 0 20px var(--theme-glow), inset 0 0 30px var(--theme-glow-inset);
}

#quiz-panel h3 {
    color: var(--theme-text);
    font-size: 14px;
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 0 0 10px var(--theme-glow);
    border-bottom: 1px solid var(--theme-border);
    padding-bottom: 10px;
}

.quiz-mode-switch {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.quiz-mode-btn {
    flex: 1;
    padding: 10px 12px;
    background: var(--theme-bg-lighter);
    border: 2px solid rgba(var(--theme-color-rgb), 0.2);
    border-radius: 6px;
    color: var(--theme-label);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s;
    height: 38px;
}

.quiz-mode-btn:hover {
    background: var(--theme-bg-light);
    border-color: rgba(var(--theme-color-rgb), 0.4);
}

.quiz-mode-btn.active {
    background: rgba(var(--theme-color-rgb), 0.25);
    border-color: rgba(var(--theme-color-rgb), 0.8);
    color: var(--theme-text);
    font-weight: bold;
    box-shadow: 0 0 10px rgba(var(--theme-color-rgb), 0.3);
}

.question-text {
    color: var(--theme-text);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 15px;
    padding: 10px;
    background: var(--theme-bg-light);
    border-radius: 6px;
    border-left: 3px solid var(--theme-text-secondary);
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-btn {
    padding: 10px 12px;
    background: var(--theme-bg-lighter);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    color: #ccc;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-btn:hover:not(.disabled) {
    background: var(--theme-bg-light);
    border-color: var(--theme-border);
    transform: translateX(3px);
}

.option-btn.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.option-btn.correct {
    background: rgba(0, 255, 100, 0.2) !important;
    border-color: #00ff88 !important;
    color: #fff !important;
}

.option-btn.wrong {
    background: rgba(255, 50, 50, 0.2) !important;
    border-color: #ff4444 !important;
    color: #fff !important;
}

.option-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--theme-bg-lighter);
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    color: var(--theme-text);
    flex-shrink: 0;
}

.feedback {
    margin-top: 15px;
    padding: 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.5;
    display: none;
}

.feedback.show {
    display: block;
}

.feedback.correct {
    background: rgba(0, 255, 100, 0.15);
    border: 1px solid rgba(0, 255, 100, 0.4);
    color: #00ff88;
}

.feedback.wrong {
    background: rgba(255, 50, 50, 0.15);
    border: 1px solid rgba(255, 50, 50, 0.4);
    color: #ff6666;
}

.feedback-title {
    font-weight: bold;
    margin-bottom: 6px;
}

.feedback-explanation {
    color: #aaa;
    font-size: 11px;
}

.next-btn {
    padding: 10px;
    background: linear-gradient(135deg, rgba(var(--theme-color-rgb), 0.5), rgba(255, 170, 0, 0.5));
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: none;
}

.next-btn:hover {
    background: linear-gradient(135deg, rgba(var(--theme-color-rgb), 0.7), rgba(255, 170, 0, 0.7));
    box-shadow: 0 0 15px var(--theme-glow);
}

/* Quiz Toast */
.quiz-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--theme-bg);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    padding: 10px 20px;
    color: var(--theme-text);
    font-size: 13px;
    z-index: 2000;
    box-shadow: 0 0 20px var(--theme-glow);
    animation: toastFadeIn 0.3s ease;
}

.quiz-toast-success { border-color: #00ff88; color: #00ff88; }
.quiz-toast-error { border-color: #ff4444; color: #ff6666; }

@keyframes toastFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Quiz Confirm Dialog */
.quiz-dialog-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(3px);
}

.quiz-dialog {
    background: var(--theme-bg);
    border: 2px solid var(--theme-border);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 0 30px var(--theme-glow);
}

.quiz-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--theme-border);
}

.quiz-dialog-title {
    color: var(--theme-text);
    font-size: 14px;
    font-weight: bold;
}

.quiz-dialog-close {
    background: none;
    border: none;
    color: var(--theme-label);
    font-size: 20px;
    cursor: pointer;
}

.quiz-dialog-body {
    padding: 20px;
}

.quiz-dialog-message {
    color: var(--theme-label);
    font-size: 12px;
    margin-bottom: 10px;
}

.quiz-dialog-question {
    color: var(--theme-text);
    font-size: 13px;
    padding: 10px;
    background: var(--theme-bg-light);
    border-radius: 6px;
    line-height: 1.5;
}

.quiz-dialog-footer {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--theme-border);
    justify-content: flex-end;
}

.quiz-dialog-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid var(--theme-border);
}

.quiz-dialog-cancel {
    background: transparent;
    color: var(--theme-label);
}

.quiz-dialog-confirm {
    background: rgba(var(--theme-color-rgb), 0.3);
    color: var(--theme-text);
    font-weight: bold;
}

/* ==========================================================================
   底部行星选择器
   ========================================================================== */
#planet-selector {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
}

.planet-orbit {
    display: flex;
    align-items: center;
    gap: 12px;
}

.planet-icon {
    position: relative;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.planet-sphere {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(var(--theme-color-rgb), 0.3),
                inset 0 0 10px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.planet-icon:hover {
    transform: scale(1.2);
}

.planet-icon:hover .planet-sphere {
    box-shadow: 0 0 25px rgba(var(--theme-color-rgb), 0.6),
                inset 0 0 15px rgba(0, 0, 0, 0.3);
}

.planet-icon.active .planet-sphere {
    box-shadow: 0 0 20px rgba(var(--theme-color-rgb), 0.5),
                inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.planet-name-label {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--theme-bg);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    color: var(--theme-text);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px var(--theme-glow);
    pointer-events: none;
}

.planet-icon:hover .planet-name-label {
    opacity: 1;
    visibility: visible;
    top: -40px;
}

/* ==========================================================================
   卫星弹出列表
   ========================================================================== */
#moons-list-btn {
    position: relative;
}

#moons-list-btn:hover .moons-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.moons-popup {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--theme-bg);
    border: 2px solid var(--theme-border);
    border-radius: 12px;
    width: 200px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px var(--theme-glow);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.moons-popup-header {
    color: var(--theme-text);
    font-size: 12px;
    font-weight: bold;
    padding: 10px 12px;
    border-bottom: 1px solid var(--theme-border);
    background: var(--theme-bg-light);
    text-align: center;
}

.moons-popup-content {
    padding: 8px;
}

.moon-item {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--theme-bg-lighter);
    border: 1px solid transparent;
}

.moon-item:hover {
    background: var(--theme-bg-light);
    border-color: var(--theme-border);
    transform: translateX(5px);
}

.moon-sphere {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
}

.moon-name {
    color: var(--theme-text);
    font-size: 11px;
    line-height: 1.3;
}

.moons-popup::-webkit-scrollbar {
    width: 6px;
}

.moons-popup::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.moons-popup::-webkit-scrollbar-thumb {
    background: var(--theme-border);
    border-radius: 3px;
}

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 768px) {
    #info-panel {
        width: 220px;
        font-size: 10px;
        padding: 10px;
    }

    #planet-selector {
        bottom: 10px;
    }

    .planet-orbit {
        gap: 8px;
    }

    .planet-icon {
        width: 35px;
        height: 35px;
    }

    .planet-sphere {
        width: 25px;
        height: 25px;
    }

    .planet-name-label {
        font-size: 10px;
    }

    #lang-switch {
        bottom: 20px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 11px;
    }
}
