/**
 * 单词射击游戏 - 样式表
 */

/* ========== 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #1a1a1a;
    color: white;
    overflow: hidden;
    height: 100vh;
    height: 100dvh; /* iOS Safari动态视口高度 */
}

.hidden { display: none !important; }

/* ========== 屏幕容器 ========== */
.screen {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ========== 主菜单 ========== */
#menuScreen {
    background: rgba(0, 0, 0, 0.8);
}

#menuScreen h1 {
    font-size: 3rem;
    margin-bottom: 2rem;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.menu-btn {
    padding: 15px 30px;
    font-size: 1.2rem;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.menu-btn:hover {
    background: #1976D2;
    transform: translateY(-2px);
}

/* ========== 主题选择 ========== */
#themeScreen {
    padding: 50px;
    overflow-y: auto;
}

#themeScreen h2 {
    margin-bottom: 30px;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1000px;
}

.theme-card {
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.theme-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

/* ========== 游戏说明 ========== */
.intro-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 20px;
    max-width: 90%;
    text-align: center;
}

.intro-content h2 {
    font-size: 2.5rem;
    margin-bottom: 30px;
}

.intro-steps {
    display: grid;
    gap: 20px;
    margin-bottom: 40px;
}

.intro-step {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 1.3rem;
}

.intro-step span:first-child {
    font-size: 2rem;
}

.intro-controls {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.intro-controls p {
    margin: 5px 0;
    font-size: 1.1rem;
}

.start-btn {
    padding: 20px 50px;
    font-size: 1.5rem;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

.skip-intro {
    display: block;
    margin-top: 20px;
    font-size: 1rem;
    cursor: pointer;
}

/* ========== 游戏画面 ========== */
#gameScreen {
    position: relative;
    display: block;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
}

/* 游戏UI */
.game-ui {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

.ui-box {
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 1.2rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.3);
}

.progress-info {
    font-size: 0.9rem;
    margin-top: 5px;
    opacity: 0.8;
    display: none;
}

.progress-info span {
    margin-right: 10px;
}

/* 控制按钮 */
.game-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.control-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 准星 */
#crosshair {
    position: fixed;
    width: 40px;
    height: 40px;
    pointer-events: none;
    z-index: 1000;
}

#crosshair::before,
#crosshair::after {
    content: '';
    position: absolute;
    background: rgba(255, 0, 0, 0.8);
}

#crosshair::before {
    width: 100%;
    height: 2px;
    top: 50%;
    transform: translateY(-50%);
}

#crosshair::after {
    width: 2px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
}

#crosshair .center {
    position: absolute;
    width: 6px;
    height: 6px;
    background: red;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* 枪 */
#gunSprite {
    position: fixed;
    bottom: 20px;
    right: 50px;
    width: 200px;
    height: 100px;
    pointer-events: none;
    z-index: 999;
    opacity: 0.7;
}

/* 重听按钮 */
.replay-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(76, 175, 80, 0.9);
    color: white;
    border: 2px solid white;
    font-size: 24px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 100;
}

/* 射击提示 */
.shoot-hint {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    pointer-events: none;
    z-index: 100;
    text-align: center;
    transition: opacity 0.5s;
}

.shoot-hint span {
    font-size: 14px;
    color: #87CEEB;
}

/* ========== 弹窗 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

/* 加载动画 */
.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 暂停菜单 */
#pauseMenu h2 {
    margin-bottom: 30px;
    font-size: 2rem;
}

#pauseMenuItems {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pause-menu-btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid white;
    border-radius: 10px;
    cursor: pointer;
    min-width: 280px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s;
}

.pause-menu-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.pause-menu-btn .status {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9rem;
}

/* ========== 游戏结束 ========== */
#gameOverScreen {
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    padding-bottom: 100px;
    justify-content: flex-start;
    padding-top: env(safe-area-inset-top, 20px);
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

#gameOverScreen h2 {
    font-size: 3rem;
    margin-bottom: 20px;
}

.final-score {
    font-size: 2rem;
    margin-bottom: 30px;
}

.learning-report {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    max-width: 800px;
    width: 100%;
}

.learning-report h3 {
    text-align: center;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.stat-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.report-section {
    margin: 15px 0;
    display: none;
}

.report-section h4 {
    margin-bottom: 10px;
}

.word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.word-item {
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
}

.word-item.mastered {
    background: rgba(76, 175, 80, 0.3);
    border: 1px solid #4CAF50;
}

.word-item.learning {
    background: rgba(255, 193, 7, 0.3);
    border: 1px solid #FFC107;
}

.word-item.difficult {
    background: rgba(244, 67, 54, 0.3);
    border: 1px solid #F44336;
}

.game-over-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    margin-bottom: 50px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 20px));
}

/* ========== 设置界面 ========== */
.settings-modal {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
}

.settings-modal h2 {
    margin-bottom: 20px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 15px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

/* 音量控制滑块 */
.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-control input[type="range"] {
    -webkit-appearance: none;
    width: 120px;
    height: 6px;
    background: #555;
    border-radius: 3px;
    outline: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #2196F3;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.volume-control input[type="range"]::-webkit-slider-thumb:hover {
    background: #1976D2;
}

.volume-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #2196F3;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.volume-control span {
    min-width: 40px;
    text-align: right;
    font-size: 14px;
    color: #aaa;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #4CAF50;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

/* ========== 动画效果 ========== */
@keyframes scoreFloat {
    0% { 
        transform: translateX(-50%) translateY(0) scale(0.5);
        opacity: 1;
    }
    100% { 
        transform: translateX(-50%) translateY(-50px) scale(1.5);
        opacity: 0;
    }
}

@keyframes wrongMark {
    0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); }
    50% { transform: translate(-50%, -50%) scale(1.5) rotate(180deg); }
    100% { transform: translate(-50%, -50%) scale(1) rotate(360deg); }
}

@keyframes missEffect {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

@keyframes lifeBonusAnim {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.5); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ========== 怪物状态显示 ========== */
.monster-box {
    position: fixed;
    top: 70px;
    left: 20px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 8px;
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

.monster-title {
    font-size: 0.9rem;
    margin-bottom: 3px;
    color: #ffcc00;
    font-weight: bold;
}

.monster-counts {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
}

.monster-counts .killed {
    color: #4CAF50;
}

.monster-counts .alive {
    color: #ff6666;
    font-weight: bold;
}

.monster-counts span span {
    font-weight: bold;
    font-size: 1rem;
}

/* ========== 胜利界面 ========== */
#gameWinScreen {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    padding-top: env(safe-area-inset-top, 20px);
    padding-bottom: 100px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.victory-content {
    text-align: center;
    padding: 40px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
}

.victory-content h2 {
    font-size: 3rem;
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    margin-bottom: 40px;
    animation: victoryPulse 2s ease-in-out infinite;
}

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

.victory-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.victory-stat {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px 40px;
    border-radius: 15px;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.victory-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.victory-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #FFD700;
    margin-bottom: 5px;
}

.victory-label {
    font-size: 1rem;
    opacity: 0.8;
}

/* ========== 战斗统计（失败界面） ========== */
.battle-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0 30px;
    flex-wrap: wrap;
}

.battle-stat {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 1.1rem;
}

.battle-stat span:last-child {
    color: #FFD700;
    font-weight: bold;
    margin-left: 10px;
}

/* ========== 关卡选择界面 ========== */
#levelScreen {
    padding: 40px 20px;
}

#levelScreen h2 {
    margin-bottom: 10px;
}

.level-info {
    margin-bottom: 30px;
    font-size: 1.1rem;
    opacity: 0.8;
}

.level-info span {
    margin: 0 10px;
}

#levelThemeName {
    color: #4CAF50;
    font-weight: bold;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.level-card {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.3) 0%, rgba(76, 175, 80, 0.1) 100%);
    border: 2px solid #4CAF50;
    border-radius: 15px;
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.level-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(76, 175, 80, 0.3);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.5) 0%, rgba(76, 175, 80, 0.2) 100%);
}

.level-card.locked {
    background: rgba(100, 100, 100, 0.2);
    border-color: #666;
    cursor: not-allowed;
    opacity: 0.6;
}

.level-card.locked:hover {
    transform: none;
    box-shadow: none;
}

.level-number {
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: #fff;
}

.level-words {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 8px;
}

.level-stars {
    font-size: 1.2rem;
    letter-spacing: 2px;
}

/* 主要按钮样式 */
.menu-btn.primary {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-color: #4CAF50;
    font-size: 1.3rem;
    padding: 15px 40px;
}

.menu-btn.primary:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: scale(1.05);
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    
    /* 顶部状态栏紧凑 */
    .game-ui {
        top: 10px !important;
        left: 10px !important;
        right: 10px !important;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .ui-box {
        padding: 8px 12px !important;
        font-size: 0.9rem !important;
    }
    
    .monster-box {
        padding: 6px 10px !important;
    }
    
    .monster-title {
        font-size: 0.8rem !important;
    }
    
    .monster-counts {
        font-size: 0.85rem !important;
    }
    
    /* 隐藏电脑端控制按钮 */
    .game-controls.desktop-only {
        display: none !important;
    }

    #gameCanvas {
        cursor: auto !important;
    }
}

/* 手机端设置按钮（右上角） */
.mobile-settings-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 手机端浮动按钮（重听和暂停） */
.mobile-float-btn {
    position: fixed;
    width: 56px;
    height: 56px;
    font-size: 28px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.mobile-float-btn:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

/* 重听按钮 - 左下角 */
.mobile-replay {
    left: 20px;
    bottom: 100px;
}

/* 暂停按钮 - 右下角 */
.mobile-pause {
    right: 20px;
    bottom: 100px;
}

/* 手机端设置菜单 */
.mobile-settings-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-settings-content {
    background: rgba(40, 40, 50, 0.98);
    padding: 20px;
    border-radius: 15px;
    width: 90%;
    max-width: 320px;
}

.mobile-settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-settings-row span {
    color: white;
    font-size: 16px;
}

.speed-buttons, .word-buttons {
    display: flex;
    gap: 5px;
}

.speed-btn, .word-btn {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    color: white;
    font-size: 14px;
    cursor: pointer;
}

.speed-btn.active, .word-btn.active {
    background: #2196F3;
    border-color: #2196F3;
}

.toggle-music-btn {
    padding: 8px 16px;
    background: rgba(76, 175, 80, 0.3);
    border: 1px solid #4CAF50;
    border-radius: 5px;
    color: white;
    font-size: 14px;
    cursor: pointer;
}

.toggle-music-btn.off {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.mobile-exit-btn {
    width: 100%;
    margin-top: 15px;
    padding: 12px;
    background: #F44336;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    cursor: pointer;
}

@media (min-width: 769px) {
    .mobile-only { display: none !important; }
    
    #gameCanvas {
        cursor: none;
    }
}

/* ========== 复习提醒弹窗 ========== */
.review-modal {
    background: rgba(30, 30, 40, 0.98);
    padding: 30px;
    border-radius: 15px;
    max-width: 400px;
    width: 90%;
    border: 2px solid #4CAF50;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.3);
}

.review-modal h2 {
    margin-bottom: 10px;
    color: #4CAF50;
    text-align: center;
}

.review-subtitle {
    color: #aaa;
    font-size: 14px;
    text-align: center;
    margin-bottom: 20px;
}

.review-section {
    margin-bottom: 20px;
}

.review-section h4 {
    color: #fff;
    margin-bottom: 10px;
    font-size: 16px;
}

.review-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.review-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
}

.review-item.need-review {
    background: rgba(244, 67, 54, 0.2);
    border-left: 3px solid #F44336;
}

.review-item.upcoming {
    background: rgba(33, 150, 243, 0.2);
    border-left: 3px solid #2196F3;
}

.review-name {
    font-weight: bold;
    color: #fff;
}

.review-days {
    color: #aaa;
    font-size: 13px;
}

.review-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.review-buttons .menu-btn {
    flex: 1;
}

.review-buttons .menu-btn.primary {
    background: #4CAF50;
}

.review-buttons .menu-btn.primary:hover {
    background: #45a049;
}
