* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    color: #fff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

#ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#score {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 24px;
    font-weight: bold;
    color: #4CAF50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.7);
    z-index: 10;
}

#sound-toggle {
    position: absolute;
    top: 20px;
    right: 60px;
    width: 30px;
    height: 30px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%234CAF50"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    cursor: pointer;
    pointer-events: auto;
    z-index: 10;
    transition: transform 0.2s ease;
}

#sound-toggle:hover {
    transform: scale(1.1);
}

#leaderboard-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 30px;
    height: 30px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%234CAF50"><path d="M7.5 15.5l3.5-3.5 3.5 3.5L16 14l-5-5-5 5z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    cursor: pointer;
    pointer-events: auto;
    z-index: 10;
    transition: transform 0.2s ease;
}

#leaderboard-toggle:hover {
    transform: scale(1.1);
}

#sound-toggle.sound-off {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23f44336"><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/></svg>');
}

#bottom-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
}

#game-over, #start-screen, #level-complete {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(10, 15, 30, 0.9);
    padding: 40px;
    border-radius: 15px;
    pointer-events: auto;
    max-width: 90%;
    z-index: 20;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.5);
    border: 1px solid rgba(76, 175, 80, 0.3);
    backdrop-filter: blur(10px);
}

#game-over.hidden, #start-screen.hidden, #level-complete.hidden {
    display: none;
}

#game-over h2, #start-screen h1 {
    margin-bottom: 20px;
    font-size: 36px;
    color: #4CAF50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.7);
}

#game-over p {
    font-size: 24px;
    margin-bottom: 20px;
    color: #fff;
}

button {
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 18px;
    margin: 10px 5px;
    cursor: pointer;
    border-radius: 30px;
    pointer-events: auto;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.6);
}

#leaderboard {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 15, 30, 0.95);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    z-index: 100;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.5);
    border: 1px solid rgba(76, 175, 80, 0.3);
    backdrop-filter: blur(10px);
    min-width: 300px;
}

#leaderboard.hidden {
    display: none;
}

#leaderboard h2 {
    margin-top: 0;
    color: #4CAF50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.7);
}

#leaderboard-list {
    text-align: left;
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-entry {
    padding: 12px;
    border-bottom: 1px solid rgba(76, 175, 80, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.leaderboard-entry:first-child {
    font-weight: bold;
    color: gold;
    font-size: 1.2em;
}

.leaderboard-entry .rank {
    width: 30px;
    font-weight: bold;
}

.leaderboard-entry .score {
    flex-grow: 1;
    text-align: center;
    font-size: 1.1em;
}

.leaderboard-entry .date {
    width: 80px;
    text-align: right;
    font-size: 12px;
    color: #aaa;
}

/* 关卡选择界面样式 */
#mode-select {
    margin: 30px 0;
}

#mode-select button {
    display: block;
    width: 250px;
    margin: 15px auto;
    padding: 18px;
    font-size: 20px;
    background: linear-gradient(45deg, #2196F3, #21CBF3);
    border-radius: 30px;
}

#mode-select button:hover {
    background: linear-gradient(45deg, #1976D2, #0ea5e9);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(33, 150, 243, 0.6);
}

#level-select {
    margin: 30px 0;
    max-height: 70vh;
    overflow-y: auto;
}

#level-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
    padding: 10px;
}

.level-btn {
    padding: 15px;
    font-size: 18px;
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    border: none;
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.level-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.6);
}

.level-btn.locked {
    background: linear-gradient(45deg, #9e9e9e, #bdbdbd);
    cursor: not-allowed;
}

.level-btn.locked:hover {
    transform: none;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

#current-level {
    margin: 20px 0;
    font-size: 20px;
    color: #4CAF50;
    font-weight: bold;
}

/* 响应式设计 */
@media (max-width: 768px) {
    #game-over, #start-screen, #level-complete {
        padding: 20px;
        width: 90%;
    }
    
    #game-over h2, #start-screen h1 {
        font-size: 28px;
    }
    
    #game-over p {
        font-size: 20px;
    }
    
    button {
        padding: 12px 25px;
        font-size: 16px;
        margin: 8px 3px;
    }
    
    #score {
        font-size: 20px;
        top: 15px;
        left: 15px;
    }
    
    #sound-toggle, #leaderboard-toggle {
        top: 15px;
        width: 25px;
        height: 25px;
    }
    
    #bottom-hint {
        font-size: 16px;
        bottom: 15px;
        padding: 8px 15px;
    }
    
    #level-buttons {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
        max-width: 400px;
    }
    
    .level-btn {
        padding: 12px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    #game-over h2, #start-screen h1 {
        font-size: 24px;
    }
    
    #game-over p {
        font-size: 18px;
    }
    
    button {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    #score {
        font-size: 18px;
    }
    
    #bottom-hint {
        font-size: 14px;
    }
    
    #level-buttons {
        grid-template-columns: repeat(3, 1fr);
        max-width: 300px;
    }
    
    .level-btn {
        padding: 10px;
        font-size: 14px;
    }
}
