/* 字母射击游戏 - 样式文件 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f8ff 25%, #f5f5dc 50%, #e6f3ff 75%, #f0fff0 100%);
    color: #2c3e50;
    overflow-x: hidden;
    overflow-y: auto;
    user-select: none;
    min-height: 100vh;
    padding-bottom: 20px;
}

.game-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.language-selector {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
}

.language-btn {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #3498db;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-width: 80px;
}

.language-btn:hover {
    background: #3498db;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.game-header {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    background: linear-gradient(135deg, rgba(240, 248, 255, 0.9), rgba(245, 255, 250, 0.9));
    backdrop-filter: blur(10px);
    border-radius: 0 0 20px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.score, .timer, .miss-counter {
    font-size: 24px;
    font-weight: bold;
    color: #34495e;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.game-area {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    border: 3px solid #87ceeb;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(135, 206, 235, 0.3);
    background: linear-gradient(135deg, rgba(248, 255, 248, 0.95), rgba(240, 248, 255, 0.95));
    max-width: 100%;
    height: auto;
}

/* 响应式设计 */
/* 大屏幕优化 */
@media (min-width: 1200px) {
    .game-container {
        max-width: 1400px;
        margin: 0 auto;
    }
    
    #gameCanvas {
        max-width: 1000px;
        max-height: 600px;
    }
}

/* 平板设备 */
@media (max-width: 1024px) {
    .game-title {
        font-size: 42px;
    }
    
    .difficulty-buttons {
        gap: 12px;
    }
    
    .difficulty-btn {
        padding: 10px 18px;
        font-size: 15px;
    }
    
    .language-selector {
        top: 15px;
        right: 15px;
    }
}

/* 1440x900 分辨率优化 - 缩小键盘 */
@media (max-width: 1440px) and (max-height: 900px) {
    .keyboard-container {
        min-height: 180px;
        padding: 15px;
    }
    
    .keyboard {
        gap: 4px;
        transform: scale(0.85);
        transform-origin: center bottom;
    }
    
    .keyboard-row {
        gap: 3px;
    }
    
    .key {
        padding: 10px 12px;
        min-width: 40px;
        font-size: 16px;
    }
    
    #gameCanvas {
        max-height: 450px;
    }
}

/* 中等屏幕 */
@media (max-width: 768px) {
    #gameCanvas {
        max-width: 95%;
        max-height: none; /* 移除高度限制，允许滚动 */
        height: auto;
    }
    
    .game-header {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .score, .timer {
        font-size: 20px;
    }
    
    .keyboard-container {
        padding: 20px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 50;
        background: linear-gradient(135deg, rgba(240, 248, 255, 0.95), rgba(245, 255, 250, 0.95));
        backdrop-filter: blur(15px);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        min-height: 200px;
    }
    
    .keyboard {
         gap: 6px;
         max-width: 100%;
         padding: 0 10px;
         margin-top: 5px;
     }
     
     .keyboard-row {
         gap: 4px;
         justify-content: center;
         margin-bottom: 6px;
     }
    
    .key {
        font-size: 18px;
        padding: 12px 14px;
        min-width: 45px;
        flex: 0 0 auto;
    }
    
    .game-title {
        font-size: 36px;
        margin-bottom: 15px;
    }
    
    .game-instructions {
        font-size: 16px;
        padding: 0 20px;
        margin-bottom: 25px;
    }
    
    .difficulty-selection {
        margin: 20px 0;
    }
    
    .difficulty-selection h3 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .difficulty-buttons {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .difficulty-btn {
        padding: 10px 16px;
        font-size: 14px;
        min-width: 80px;
    }
    
    .final-stats {
        font-size: 18px;
        margin: 20px 0;
    }
    
    .game-over-title {
        font-size: 36px;
        margin-bottom: 15px;
    }
    
    .language-selector {
        top: 10px;
        right: 10px;
    }
    
    .language-selector select {
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* 小屏幕设备 */
@media (max-width: 480px) {
    #gameCanvas {
        max-width: 98%;
        max-height: none; /* 移除高度限制，允许滚动 */
        height: auto;
        border-width: 2px;
    }
    
    .game-header {
        padding: 8px;
        border-radius: 0 0 15px 15px;
    }
    
    .score, .timer {
        font-size: 16px;
    }
    
    .keyboard {
         gap: 3px;
         margin-top: 15px;
         padding: 0 3px;
     }
     
     .keyboard-row {
         gap: 2px;
         justify-content: center;
         margin-bottom: 4px;
     }
    
    .key {
        font-size: 14px;
        padding: 8px 10px;
        min-width: 35px;
        flex: 0 0 auto;
        border-radius: 8px;
    }
    
    .game-title {
        font-size: 24px;
        margin-bottom: 10px;
    }
    
    .game-instructions {
        margin: 10px 0;
    }
    
    .game-instructions p {
        font-size: 16px;
        padding: 10px 15px;
        margin: 5px 0;
    }
    
    .difficulty-selection {
        margin: 10px 0;
    }
    
    .difficulty-selection h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .difficulty-buttons {
        gap: 6px;
        flex-direction: column;
        align-items: center;
    }
    
    .difficulty-btn {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 70px;
        border-radius: 12px;
    }
    
    .start-btn, .restart-btn {
        padding: 10px 20px;
        font-size: 18px;
        border-radius: 20px;
        margin-top: 10px;
    }
    
    .final-stats {
        font-size: 16px;
        margin: 15px 0;
    }
    
    .final-stats p {
        margin: 8px 0;
    }
    
    .game-over-title {
        font-size: 28px;
        margin-bottom: 10px;
    }
    
    .language-selector {
        top: 8px;
        right: 8px;
    }
    
    .language-selector select {
        padding: 4px 8px;
        font-size: 12px;
        border-radius: 15px;
    }
    
    .finger-guide {
        display: none; /* 在小屏幕上隐藏手指指导 */
    }
    
    .keyboard-container {
        padding: 15px;
        border-radius: 15px 15px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 50;
        background: linear-gradient(135deg, rgba(240, 248, 255, 0.95), rgba(245, 255, 250, 0.95));
        backdrop-filter: blur(15px);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        min-height: 180px;
    }
}

/* iPhone SE 和类似尺寸设备 (375px) */
@media (max-width: 375px) {
    body {
        overflow: auto;
    }
    
    .game-container {
        padding: 5px;
        margin: 0;
        min-height: 100vh;
        height: auto;
    }
    
    #gameCanvas {
        max-width: 95%;
        max-height: 50vh;
        border-width: 1px;
        margin: 5px auto;
    }
    
    .game-header {
        padding: 8px 15px;
        border-radius: 0 0 12px 12px;
    }
    
    .score, .timer {
        font-size: 18px;
    }
    
    .game-title {
        font-size: 22px;
        margin-bottom: 8px;
    }
    
    .game-instructions {
        font-size: 13px;
        padding: 0 8px;
        margin: 8px 0;
    }
    
    .game-instructions p {
        font-size: 13px;
        padding: 8px 12px;
        margin: 3px 0;
    }
    
    .difficulty-selection {
        display: none; /* 在iPhone SE上隐藏难度选择 */
    }
    
    .start-btn, .restart-btn {
        padding: 10px 18px;
        font-size: 16px;
        margin-top: 8px;
    }
    
    .keyboard {
        gap: 2px;
        margin-top: 10px;
        padding: 0 2px;
    }
    
    .keyboard-row {
        gap: 1px;
        margin-bottom: 3px;
    }
    
    .key {
        font-size: 13px;
        padding: 8px 6px;
        min-width: 32px;
        min-height: 40px;
        border-radius: 6px;
    }
    
    .keyboard-container {
        padding: 10px 5px;
        border-radius: 12px 12px 0 0;
    }
    
    .final-stats {
        font-size: 14px;
        margin: 10px 0;
    }
    
    .game-over-title {
        font-size: 24px;
        margin-bottom: 8px;
    }
    
    .finger-guide {
        display: none;
    }
    
    .language-selector {
        top: 5px;
        right: 5px;
    }
    
    .language-selector select {
        padding: 3px 6px;
        font-size: 11px;
    }
}

/* 超小屏幕设备 */
@media (max-width: 360px) {
    .game-title {
        font-size: 20px;
    }
    
    .game-instructions {
        font-size: 12px;
        padding: 0 10px;
    }
    
    .difficulty-selection {
        display: none; /* 在超小屏幕上隐藏难度选择，使用默认难度 */
    }
    
    .difficulty-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 100px;
    }
    
    .start-btn, .restart-btn {
        padding: 8px 16px;
        font-size: 16px;
    }
    
    .key {
        font-size: 12px;
        padding: 6px 8px;
        min-width: 30px;
    }
    
    .final-stats {
        font-size: 14px;
    }
    
    .game-over-title {
        font-size: 24px;
    }
    
    .finger-guide {
        display: none; /* 在超小屏幕上也隐藏手指指导 */
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .key {
        min-height: 44px;
        min-width: 44px;
    }
    
    .difficulty-btn {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .start-btn, .restart-btn {
        min-height: 48px;
        touch-action: manipulation;
    }
    
    .language-selector select {
        min-height: 40px;
        touch-action: manipulation;
    }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 600px) {
    .game-container {
        flex-direction: row;
    }
    
    .game-area {
        flex: 2;
    }
    
    .keyboard-container {
        flex: 1;
        max-width: 400px;
        border-radius: 0;
    }
    
    .start-screen, .end-screen {
        padding: 10px;
    }
    
    .game-title {
        font-size: 24px;
        margin-bottom: 10px;
    }
    
    .game-instructions {
        font-size: 12px;
        margin-bottom: 15px;
    }
    
    .difficulty-selection {
        margin: 10px 0;
    }
    
    .difficulty-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .difficulty-btn {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 60px;
    }
}

.keyboard-container {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 200px;
}

.keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 1000px;
    margin: 0 auto;
    align-items: center;
    width: 100%;
}

.keyboard-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: nowrap;
}

.keyboard-row:nth-child(2) {
    margin-left: 20px; /* A行缩进 */
}

.keyboard-row:nth-child(3) {
    margin-left: 40px; /* Z行更多缩进 */
}

/* 确保键盘在小屏幕上不会溢出 */
@media (max-width: 600px) {
    .keyboard-row:nth-child(2) {
        margin-left: 15px;
    }
    
    .keyboard-row:nth-child(3) {
        margin-left: 30px;
    }
}

@media (max-width: 400px) {
    .keyboard-row:nth-child(2) {
        margin-left: 10px;
    }
    
    .keyboard-row:nth-child(3) {
        margin-left: 20px;
    }
}

.key {
    aspect-ratio: 1;
    background: linear-gradient(145deg, #f0f8ff, #e6f3ff);
    color: #2c3e50;
    border: 2px solid #b0c4de;
    border-radius: 10px;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 0 3px 8px rgba(176, 196, 222, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
    padding: 16px 20px;
    min-width: 60px;
}

.key:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(176, 196, 222, 0.4);
    background: linear-gradient(145deg, #e6f3ff, #ddeeff);
}

.key.active {
    background: linear-gradient(145deg, #98fb98, #90ee90);
    color: #2c3e50;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(152, 251, 152, 0.6);
}

.key.pressed {
    background: #ff6b6b;
    color: white;
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.4);
}

/* 触摸设备优化 */
.key:active {
    background: #ff6b6b;
    color: white;
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.4);
}

/* 触摸反馈动画 */
@keyframes touchFeedback {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); background: #ff6b6b; }
    100% { transform: scale(1); }
}

.key.touch-feedback {
    animation: touchFeedback 0.2s ease;
}

.start-screen, .game-over-screen, .end-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, rgba(248, 255, 248, 0.95), rgba(240, 248, 255, 0.95));
    backdrop-filter: blur(15px);
    z-index: 100;
}

.difficulty-selection {
    margin: 20px 0;
    text-align: center;
}

.difficulty-selection h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.difficulty-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.difficulty-btn {
    padding: 10px 16px;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
    min-width: 100px;
}

.difficulty-btn:hover {
    background: #3498db;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(52, 152, 219, 0.3);
}

.difficulty-btn.active {
    background: #2ecc71;
    border-color: #2ecc71;
    color: white;
    box-shadow: 0 3px 6px rgba(46, 204, 113, 0.3);
}

.final-stats {
    text-align: center;
    margin: 30px 0;
    font-size: 20px;
    color: #2c3e50;
}

.final-stats p {
    margin: 10px 0;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.game-over-title {
    font-size: 48px;
    margin-bottom: 20px;
    text-align: center;
    color: #2c3e50;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.start-btn, .restart-btn {
    padding: 12px 24px;
    font-size: 18px;
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 3px 6px rgba(76, 175, 80, 0.3);
    margin: 15px 10px;
    min-width: 120px;
}

.start-btn:hover, .restart-btn:hover {
    background: linear-gradient(145deg, #45a049, #3d8b40);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

.start-btn:active, .restart-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.game-title {
    font-size: 48px;
    margin-bottom: 20px;
    text-align: center;
    color: #2c3e50;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.game-instructions {
    margin: 15px 0;
    text-align: center;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.game-instructions p {
    margin: 8px 0;
    font-size: 18px;
    line-height: 1.4;
    color: #333;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    border: 2px solid #4CAF50;
    font-weight: 500;
}

.finger-guide {
    margin-top: 10px;
    font-size: 14px;
    text-align: center;
    color: #7f8c8d;
}

.effects {
    position: absolute;
    pointer-events: none;
    z-index: 50;
}