* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Arial', sans-serif;
    overflow: hidden;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    width: 100%;
    max-width: 400px;
}

.header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 100%;
    margin-bottom: 15px;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

h1 {
    color: #fff;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.score-display {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    position: absolute;
    right: 15px;
}

.high-score-display {
    display: flex;
    align-items: center;
    gap: 4px;
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.high-score-icon {
    font-size: 14px;
}

.high-score-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
}

.high-score-value {
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.back-btn {
    position: absolute;
    left: 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.score-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
}

.score-value {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-area {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    max-height: 70vh;
    background: #2a2a4a;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* 开始界面 */
.start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.start-overlay.show {
    display: flex;
}

.start-content {
    text-align: center;
    color: #fff;
}

.start-content h2 {
    font-size: 36px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
}

.start-content .start-best {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 30px;
}

.start-content .start-best span {
    color: #ffd700;
    font-weight: bold;
}

.start-btn {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: #fff;
    border: none;
    padding: 15px 50px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

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

.start-btn:active {
    transform: translateY(0);
}

.start-content .start-hint {
    margin-top: 20px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
}

/* 游戏结束 */
.game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.game-over-overlay.show {
    display: flex;
}

.game-over-content {
    text-align: center;
    color: #fff;
}

.game-over-content h2 {
    font-size: 36px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.final-score {
    font-size: 24px;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.9);
}

.final-score span {
    color: #ffd700;
    font-weight: bold;
}

.final-high-score {
    font-size: 16px;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.6);
}

.final-high-score span {
    color: #ffd700;
    font-weight: bold;
}

.new-record {
    display: none;
    font-size: 20px;
    color: #ff6b6b;
    font-weight: bold;
    margin-bottom: 15px;
    animation: recordPulse 0.5s ease-in-out infinite alternate;
}

@keyframes recordPulse {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

.restart-btn {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

.restart-btn:active {
    transform: translateY(0);
}

.instructions {
    margin-top: 15px;
    text-align: center;
}

.instructions p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.instructions kbd {
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}

.perfect-text {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    animation: perfectFloat 0.8s ease-out forwards;
    z-index: 50;
}

@keyframes perfectFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) translateY(-20px) scale(1.3);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-50px) scale(1.5);
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 10px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .score-value {
        font-size: 18px;
    }
    
    .game-area {
        border-width: 2px;
    }
    
    .high-score-display {
        display: none;
    }
}
