/* ===== 基础样式重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #050510;
    font-family: 'Press Start 2P', monospace;
}

/* ===== 游戏容器 ===== */
#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ===== 星云背景 ===== */
#nebula-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 30%, rgba(138, 43, 226, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(0, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 0, 255, 0.08) 0%, transparent 60%),
        linear-gradient(180deg, #0a0a1a 0%, #050510 50%, #0a0a1a 100%);
    animation: nebula-drift 20s ease-in-out infinite;
    z-index: 0;
}

@keyframes nebula-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(2%, -1%) scale(1.02); }
    66% { transform: translate(-1%, 2%) scale(0.98); }
}

/* ===== HUD 界面 ===== */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 100;
    background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
    pointer-events: none;
}

.hud-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hud-section.center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.hud-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hud-label {
    font-size: 8px;
    color: #888;
    text-shadow: 0 0 5px rgba(136, 136, 136, 0.5);
    letter-spacing: 2px;
}

.hud-value {
    font-size: 14px;
    font-weight: bold;
}

.game-title {
    font-size: 18px;
    letter-spacing: 4px;
    margin-top: 5px;
}

/* ===== 霓虹文字效果 ===== */
.neon-text {
    color: #0ff;
    text-shadow: 
        0 0 5px #0ff,
        0 0 10px #0ff,
        0 0 20px #0ff,
        0 0 40px #00ffff;
    animation: neon-flicker 2s infinite alternate;
}

.neon-text-pink {
    color: #ff00ff;
    text-shadow: 
        0 0 5px #ff00ff,
        0 0 10px #ff00ff,
        0 0 20px #ff00ff,
        0 0 40px #ff00ff;
    animation: neon-flicker 2s infinite alternate;
}

.neon-title {
    color: #fff;
    text-shadow: 
        0 0 5px #fff,
        0 0 10px #fff,
        0 0 20px #0ff,
        0 0 40px #0ff,
        0 0 80px #0ff;
}

.neon-title-glow {
    font-size: 48px;
    color: #fff;
    text-shadow: 
        0 0 10px #fff,
        0 0 20px #fff,
        0 0 40px #0ff,
        0 0 80px #0ff,
        0 0 120px #00ffff;
    animation: title-glow 1.5s ease-in-out infinite alternate;
}

.neon-title-red {
    font-size: 36px;
    color: #ff0040;
    text-shadow: 
        0 0 10px #ff0040,
        0 0 20px #ff0040,
        0 0 40px #ff0040,
        0 0 80px #ff0000;
    animation: neon-flicker 0.5s infinite alternate;
}

.neon-title-green {
    font-size: 24px;
    color: #00ff80;
    text-shadow: 
        0 0 10px #00ff80,
        0 0 20px #00ff80,
        0 0 40px #00ff00;
}

@keyframes neon-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

@keyframes title-glow {
    0% { text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 40px #0ff, 0 0 80px #0ff; }
    100% { text-shadow: 0 0 20px #fff, 0 0 40px #fff, 0 0 80px #0ff, 0 0 120px #0ff, 0 0 160px #00ffff; }
}

/* ===== 屏幕覆盖层 ===== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(5, 5, 16, 0.9);
    z-index: 200;
    backdrop-filter: blur(5px);
}

.screen-content {
    text-align: center;
    padding: 40px;
    max-width: 600px;
}

.main-title {
    margin-bottom: 10px;
}

.subtitle {
    font-size: 14px;
    margin-bottom: 40px;
    letter-spacing: 3px;
}

.instructions {
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 40px;
}

.instructions h3 {
    font-size: 12px;
    margin-bottom: 20px;
    color: #0ff;
}

.control-row {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
    text-align: left;
    font-size: 10px;
    line-height: 1.6;
}

.control-label {
    color: #ff00ff;
    min-width: 70px;
    font-weight: bold;
}

.control-desc {
    color: #ccc;
}

.final-score {
    font-size: 20px;
    margin: 30px 0;
}

#new-record-msg {
    font-size: 16px;
    margin-bottom: 30px;
    animation: pulse 0.5s infinite;
}

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

/* ===== 按钮样式 ===== */
.neon-button {
    background: transparent;
    border: 2px solid #0ff;
    color: #0ff;
    padding: 12px 30px;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    cursor: pointer;
    margin: 10px;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 
        0 0 5px rgba(0, 255, 255, 0.5),
        inset 0 0 5px rgba(0, 255, 255, 0.1);
}

.neon-button:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.8),
        inset 0 0 10px rgba(0, 255, 255, 0.3);
    transform: scale(1.05);
}

.neon-button-large {
    background: linear-gradient(45deg, #ff00ff, #00ffff);
    border: none;
    color: #000;
    padding: 20px 50px;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    cursor: pointer;
    margin: 20px;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 3px;
    box-shadow: 
        0 0 20px rgba(255, 0, 255, 0.5),
        0 0 40px rgba(0, 255, 255, 0.3);
    display: block;
    width: 100%;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.neon-button-large:hover {
    transform: scale(1.1);
    box-shadow: 
        0 0 30px rgba(255, 0, 255, 0.8),
        0 0 60px rgba(0, 255, 255, 0.5);
}

/* ===== 高分榜面板 ===== */
.panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(5, 5, 16, 0.95);
    border: 2px solid #0ff;
    border-radius: 15px;
    padding: 30px;
    z-index: 300;
    min-width: 350px;
    box-shadow: 
        0 0 30px rgba(0, 255, 255, 0.3),
        inset 0 0 30px rgba(0, 255, 255, 0.05);
}

.panel h2 {
    font-size: 18px;
    margin-bottom: 25px;
    text-align: center;
}

#high-score-list {
    list-style: none;
    margin-bottom: 25px;
}

#high-score-list li {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    font-size: 11px;
}

#high-score-list li:last-child {
    border-bottom: none;
}

#high-score-list .rank {
    color: #ff00ff;
    width: 40px;
}

#high-score-list .name {
    color: #0ff;
    flex: 1;
    text-align: center;
}

#high-score-list .score {
    color: #fff;
    width: 80px;
    text-align: right;
}

/* ===== 游戏画布 ===== */
#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

/* ===== 道具通知 ===== */
#powerup-notify {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #ff0;
    border-radius: 10px;
    padding: 15px 30px;
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 15px;
    animation: powerup-slide 2s ease-out forwards;
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.5);
}

#powerup-icon {
    font-size: 30px;
}

#powerup-text {
    font-size: 14px;
    color: #ff0;
    text-shadow: 0 0 10px #ff0;
}

@keyframes powerup-slide {
    0% { transform: translateX(-50%) translateY(-50px); opacity: 0; }
    20% { transform: translateX(-50%) translateY(0); opacity: 1; }
    80% { transform: translateX(-50%) translateY(0); opacity: 1; }
    100% { transform: translateX(-50%) translateY(-30px); opacity: 0; }
}

/* ===== 音效控制 ===== */
#audio-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 100;
}

.audio-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #0ff;
    background: rgba(0, 0, 0, 0.5);
    color: #0ff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.audio-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.6);
}

.audio-btn.muted {
    border-color: #666;
    color: #666;
    box-shadow: none;
}

/* ===== 暂停按钮 ===== */
#pause-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #ff0;
    background: rgba(0, 0, 0, 0.5);
    color: #ff0;
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s;
}

#pause-btn:hover {
    background: rgba(255, 255, 0, 0.2);
    transform: scale(1.1);
}

/* ===== 实用类 ===== */
.hidden {
    display: none !important;
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
    #hud {
        padding: 10px 15px;
    }
    
    .hud-label {
        font-size: 6px;
    }
    
    .hud-value {
        font-size: 10px;
    }
    
    .game-title {
        font-size: 12px;
        letter-spacing: 2px;
    }
    
    .neon-title-glow {
        font-size: 32px;
    }
    
    .subtitle {
        font-size: 10px;
    }
    
    .instructions {
        padding: 15px;
        margin-bottom: 25px;
    }
    
    .instructions h3 {
        font-size: 10px;
    }
    
    .control-row {
        font-size: 8px;
        flex-direction: column;
        gap: 5px;
    }
    
    .control-label {
        min-width: auto;
    }
    
    .neon-button-large {
        padding: 15px 30px;
        font-size: 12px;
    }
    
    .neon-button {
        padding: 10px 20px;
        font-size: 8px;
    }
    
    .panel {
        min-width: 280px;
        padding: 20px;
    }
    
    .panel h2 {
        font-size: 14px;
    }
    
    #high-score-list li {
        font-size: 9px;
        padding: 8px 0;
    }
    
    .final-score {
        font-size: 14px;
    }
    
    .neon-title-red {
        font-size: 24px;
    }
    
    .neon-title-green {
        font-size: 16px;
    }
    
    #audio-controls {
        bottom: 15px;
        right: 15px;
    }
    
    .audio-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    #pause-btn {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    #powerup-notify {
        padding: 10px 20px;
    }
    
    #powerup-icon {
        font-size: 24px;
    }
    
    #powerup-text {
        font-size: 11px;
    }
}

/* ===== 横屏模式 ===== */
@media (max-width: 768px) and (orientation: landscape) {
    #hud {
        padding: 8px 15px;
    }
    
    .hud-section {
        flex-direction: row;
        gap: 20px;
    }
    
    .hud-item {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    
    .game-title {
        display: none;
    }
    
    .screen-content {
        padding: 20px;
    }
    
    .main-title {
        font-size: 28px;
    }
    
    .subtitle {
        margin-bottom: 20px;
    }
    
    .instructions {
        margin-bottom: 20px;
    }
    
    .neon-button-large {
        margin: 10px auto;
    }
}