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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
    max-width: 800px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #667eea;
    font-size: 2.5em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.level-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 1.2em;
    color: #555;
    font-weight: 600;
}

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

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1em;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

button:active {
    transform: translateY(0);
}

.game-wrapper {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    background: #f5f5f5;
    border-radius: 15px;
    padding: 20px;
}

#game-canvas {
    border: 3px solid #667eea;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.instructions {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin-top: 20px;
}

.instructions h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
}

.instructions p {
    margin: 8px 0;
    font-size: 1em;
    line-height: 1.6;
}

.leaderboard {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin-top: 20px;
}

.leaderboard h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
    text-align: center;
}

.leaderboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    box-shadow: none;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: none;
}

.tab-btn.active {
    background: white;
    color: #4facfe;
    border-color: white;
}

.leaderboard-content {
    background: rgba(255, 255, 255, 0.15);
    padding: 15px;
    border-radius: 10px;
    min-height: 100px;
    backdrop-filter: blur(10px);
}

.no-records {
    text-align: center;
    opacity: 0.7;
    margin: 20px 0;
}

.record-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(5px);
}

.record-rank {
    font-weight: bold;
    font-size: 1.2em;
    min-width: 30px;
}

.record-info {
    flex: 1;
    margin-left: 15px;
}

.record-level {
    font-weight: 600;
    margin-bottom: 3px;
}

.record-stats {
    font-size: 0.9em;
    opacity: 0.9;
}

.new-record {
    color: #ffd700;
    font-weight: bold;
    font-size: 1.1em;
    text-align: center;
    animation: pulse 1s infinite;
}

.new-record.hidden {
    display: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2em;
}

.modal-content p {
    font-size: 1.3em;
    margin-bottom: 30px;
    color: #555;
}

.modal-content button {
    margin: 0 10px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 2em;
    }
    
    .level-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .buttons {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
}