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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    display: block;
    background: linear-gradient(180deg, #2d3a4a 0%, #1e2d3d 100%);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(30, 40, 60, 0.92);
    z-index: 10;
    transition: opacity 0.3s ease;
}

.screen.hidden {
    display: none;
}

.game-title {
    font-size: clamp(24px, 8vw, 48px);
    color: #fff;
    text-shadow: 4px 4px 0 #ff6b6b, -2px -2px 0 #4ecdc4;
    margin-bottom: 20px;
    animation: titlePulse 2s ease-in-out infinite;
    text-align: center;
    padding: 0 20px;
}

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

.pixel-art-hero {
    width: 64px;
    height: 64px;
    background: linear-gradient(45deg, #ff6b6b 25%, transparent 25%),
                linear-gradient(-45deg, #ff6b6b 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #ff6b6b 75%),
                linear-gradient(-45deg, transparent 75%, #ff6b6b 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    margin: 20px 0;
    animation: heroFloat 3s ease-in-out infinite;
    image-rendering: pixelated;
}

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

.menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px;
}

.btn {
    padding: 18px 45px;
    font-size: clamp(16px, 5vw, 20px);
    font-family: 'Courier New', monospace;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    min-width: 220px;
    -webkit-tap-highlight-color: transparent;
}

.btn:hover, .btn:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.primary-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

.secondary-btn {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white;
}

.difficulty-select {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
}

.difficulty-select p {
    color: #fff;
    font-size: clamp(14px, 4vw, 18px);
    margin-bottom: 5px;
}

.difficulty-btn {
    background: #3d4a5c;
    color: #b8c5d6;
    border: 2px solid #4a5a6c;
    min-width: 100px;
    padding: 12px 22px;
    -webkit-tap-highlight-color: transparent;
}

.difficulty-btn.active {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    color: #2d3436;
    border-color: #fdcb6e;
}

.high-score-display {
    color: #ffeaa7;
    font-size: clamp(16px, 5vw, 24px);
    margin: 10px 0;
}

.instructions {
    color: #c8d5e6;
    font-size: clamp(12px, 3.5vw, 16px);
    text-align: center;
    margin-top: 20px;
    padding: 0 20px;
    line-height: 1.5;
}

.game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, transparent 100%);
    pointer-events: none;
}

.score-info, .lives-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-info span, .lives-info span {
    color: #fff;
    font-size: clamp(14px, 4vw, 18px);
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.game-over-title {
    font-size: clamp(28px, 8vw, 42px);
    color: #ff6b6b;
    text-shadow: 3px 3px 0 #fff;
    margin-bottom: 30px;
    animation: gameOverShake 0.5s ease-in-out;
}

@keyframes gameOverShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.final-score {
    text-align: center;
    margin: 20px 0;
}

.final-score p:first-child {
    color: #c8d5e6;
    font-size: clamp(14px, 4vw, 18px);
    margin-bottom: 10px;
}

.score-value {
    font-size: clamp(36px, 10vw, 56px);
    color: #ffeaa7;
    font-weight: bold;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
}

.new-record {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    padding: 15px 30px;
    border-radius: 10px;
    margin: 20px 0;
    animation: recordBounce 0.6s ease-in-out infinite;
}

.new-record p {
    color: #fff;
    font-size: clamp(18px, 5vw, 24px);
    font-weight: bold;
}

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

/* 移动端适配 */
@media (max-width: 768px) {
    .menu {
        padding: 15px;
        gap: 12px;
    }

    .btn {
        padding: 16px 35px;
        min-width: 200px;
    }

    .difficulty-select {
        gap: 8px;
    }

    .difficulty-btn {
        padding: 10px 18px;
        font-size: 15px;
    }
}

/* 触摸区域指示器 */
.touch-zone {
    position: absolute;
    bottom: 20px;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    pointer-events: none;
}

.touch-zone.left {
    left: 20px;
}

.touch-zone.right {
    right: 20px;
}
