/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: #000;
    color: #fff;
    cursor: crosshair;
}

#container {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    cursor: grab;
}

#container:active {
    cursor: grabbing;
}

/* 星球悬停效果 */
canvas {
    display: block;
}

/* 加载界面 */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a40 25%, #2d1b69 50%, #6b21a8 75%, #a855f7 100%);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.loading-content {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.heart {
    font-size: 60px;
    animation: pulse 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(236, 72, 153, 0.8));
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.progress-bar {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 20px auto;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.3);
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #a78bfa, #ec4899, #f472b6, #a78bfa);
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
    width: 0%;
    transition: width 0.3s ease;
}

@keyframes shimmer {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 200% 0%;
    }
}

/* 欢迎界面 */
#welcome {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1e1b4b 0%, #0f172a 50%, #000000 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

#welcome::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(167, 139, 250, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(236, 72, 153, 0.15) 0%, transparent 50%);
    animation: floatBg 10s ease-in-out infinite;
}

@keyframes floatBg {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(20px, 20px);
    }
}

#welcome.active {
    opacity: 1;
    pointer-events: auto;
}

.welcome-content {
    text-align: center;
    animation: fadeInUp 1s ease;
    position: relative;
    z-index: 1;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-content h1 {
    font-size: 56px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #a78bfa 0%, #ec4899 50%, #f472b6 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShimmer 3s linear infinite;
    font-weight: bold;
    text-shadow: 0 0 80px rgba(167, 139, 250, 0.5);
}

@keyframes textShimmer {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

.welcome-content p {
    font-size: 22px;
    margin: 15px 0;
    opacity: 0.9;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.welcome-content .subtitle {
    font-size: 14px;
    opacity: 0.6;
    margin-top: 30px;
}

#startBtn {
    margin-top: 40px;
    padding: 18px 60px;
    font-size: 20px;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

#startBtn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

#startBtn:hover::before {
    left: 100%;
}

#startBtn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 50px rgba(102, 126, 234, 0.6),
                0 0 30px rgba(167, 139, 250, 0.5);
}

#startBtn:active {
    transform: translateY(-1px) scale(1.02);
}

/* 距离显示面板 */
#distance-panel {
    position: fixed;
    top: 30px;
    left: 30px;
    z-index: 100;
    display: none;
}

#distance-panel.active {
    display: block;
    animation: fadeIn 1s ease;
}

.distance-content {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    padding: 20px 30px;
    border-radius: 20px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
    min-width: 200px;
}

.distance-title {
    font-size: 16px;
    font-weight: 600;
    color: #ffd700;
    margin-bottom: 10px;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.distance-value {
    font-size: 32px;
    font-weight: bold;
    color: #fff;
    text-align: center;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    letter-spacing: 2px;
}

.distance-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    margin-top: 8px;
    font-style: italic;
}

/* 控制提示 */
#controls-hint {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 20px 30px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
    display: none;
    animation: fadeIn 1s ease;
}

#controls-hint.active {
    display: block;
}

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

.hint-item {
    margin: 8px 0;
    font-size: 14px;
    opacity: 0.9;
    text-align: center;
}

/* 照片弹窗 */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#modal-img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(167, 139, 250, 0.4),
                0 0 100px rgba(236, 72, 153, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
}

#modal-img:hover {
    transform: scale(1.02);
}

.close-btn {
    position: absolute;
    top: -40px;
    right: 0;
    font-size: 40px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    transform: rotate(90deg);
    color: #ec4899;
}

.modal-caption {
    text-align: center;
    margin-top: 20px;
    font-size: 18px;
    color: #a78bfa;
}

/* 音乐控制 */
#music-control {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 100;
}

.music-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.music-btn:hover {
    background: rgba(167, 139, 250, 0.3);
    transform: scale(1.1);
}

.music-btn.playing {
    animation: rotate 3s linear infinite;
}

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

/* 回到初始位置按钮 */
#reset-position {
    position: fixed;
    top: 90px;
    right: 30px;
    z-index: 100;
    display: none;
}

#reset-position.active {
    display: block;
}

.reset-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.reset-btn:hover {
    background: rgba(236, 72, 153, 0.3);
    transform: scale(1.1);
}

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

/* 隐藏类 */
.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* 语言选择界面 */
#language-selection {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1e1b4b 0%, #0f172a 50%, #000000 100%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#language-selection.active {
    display: flex;
    opacity: 1;
}

.selection-content {
    text-align: center;
    animation: fadeInUp 1s ease;
    max-width: 800px;
    padding: 40px;
}

.language-buttons {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

.lang-btn {
    padding: 20px 40px;
    font-size: 20px;
    background: rgba(167, 139, 250, 0.1);
    color: white;
    border: 2px solid rgba(167, 139, 250, 0.3);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.lang-btn .flag {
    font-size: 48px;
}

.lang-btn:hover {
    background: rgba(167, 139, 250, 0.3);
    border-color: rgba(167, 139, 250, 0.8);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(167, 139, 250, 0.4);
}

/* 角色选择界面 */
#character-selection {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1e1b4b 0%, #0f172a 50%, #000000 100%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#character-selection.active {
    display: flex;
    opacity: 1;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    margin: 40px 0;
}

.character-card {
    background: rgba(167, 139, 250, 0.1);
    border: 2px solid rgba(167, 139, 250, 0.3);
    border-radius: 20px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.character-card:hover {
    background: rgba(167, 139, 250, 0.2);
    border-color: rgba(167, 139, 250, 0.6);
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(167, 139, 250, 0.4);
}

.character-card.selected {
    background: rgba(167, 139, 250, 0.3);
    border-color: #a78bfa;
    box-shadow: 0 0 30px rgba(167, 139, 250, 0.8);
}

.character-preview {
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.3), transparent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-model {
    font-size: 80px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.character-card h3 {
    font-size: 24px;
    margin: 15px 0;
    color: #a78bfa;
}

.character-card p {
    font-size: 14px;
    opacity: 0.8;
}

.start-btn {
    margin-top: 40px;
    padding: 18px 60px;
    font-size: 20px;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.start-btn:hover:not(.disabled) {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 50px rgba(102, 126, 234, 0.6);
}

.start-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 任务面板 */
#mission-panel {
    position: fixed;
    top: 30px;
    left: 30px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(167, 139, 250, 0.3);
    z-index: 100;
    min-width: 280px;
    display: none;
}

#mission-panel.active {
    display: block;
}

#mission-panel h3 {
    color: #a78bfa;
    margin-bottom: 15px;
    font-size: 20px;
}

.mission-item {
    margin: 15px 0;
    padding: 10px;
    background: rgba(167, 139, 250, 0.1);
    border-radius: 10px;
}

.mission-item p {
    margin: 5px 0;
    font-size: 14px;
}

.distance-indicator, .progress-indicator {
    margin-top: 8px;
    font-size: 12px;
    color: #ec4899;
}

.hint-text {
    margin-top: 15px;
    font-size: 12px;
    opacity: 0.7;
    font-style: italic;
}

/* 胜利界面 */
#victory-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1002;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#victory-screen.active {
    display: flex;
    opacity: 1;
}

.victory-content {
    text-align: center;
    animation: scaleIn 0.8s ease;
    max-width: 600px;
    padding: 40px;
}

.victory-title {
    font-size: 48px;
    background: linear-gradient(135deg, #a78bfa 0%, #ec4899 50%, #f472b6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 30px;
}

.hearts-animation {
    font-size: 40px;
    animation: heartPulse 2s ease-in-out infinite;
    margin: 20px 0;
}

@keyframes heartPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.victory-message {
    font-size: 24px;
    margin: 20px 0;
    color: #f472b6;
}

.stats {
    margin: 30px 0;
    padding: 20px;
    background: rgba(167, 139, 250, 0.1);
    border-radius: 15px;
}

.stats p {
    font-size: 18px;
    margin: 10px 0;
}

#playAgainBtn {
    margin-top: 30px;
    padding: 15px 50px;
    font-size: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

#playAgainBtn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 50px rgba(102, 126, 234, 0.6);
}

.memory-collected {
    color: #10b981;
    font-weight: bold;
    margin-top: 10px;
    font-size: 16px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .welcome-content h1 {
        font-size: 32px;
    }
    
    .welcome-content p {
        font-size: 16px;
    }
    
    #startBtn {
        padding: 12px 40px;
        font-size: 16px;
    }
    
    #controls-hint {
        font-size: 12px;
        padding: 15px 20px;
    }
    
    .language-buttons {
        flex-direction: column;
        gap: 20px;
    }
    
    .character-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    #mission-panel {
        left: 10px;
        right: 10px;
        top: 10px;
        min-width: auto;
    }
}

