/* Flappy Klaus - Christmas Edition Styles */

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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(to bottom, #0f2027, #203a43, #2c5364);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    overflow: hidden;
}

/* Snow Animation */
.snow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.snowflake {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
    animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.3; }
}

/* Game Container */
.game-container {
    position: relative;
    z-index: 10;
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    border: 3px solid #FFD700;
    max-width: 900px;
}

.title {
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    color: #FFD700;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px #FFD700; }
    50% { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 20px #FFD700, 0 0 30px #DC143C; }
}

/* Screens */
.screen {
    transition: opacity 0.3s ease;
}

.screen.hidden {
    display: none;
}

/* Intro Section */
.intro {
    margin-bottom: 30px;
}

.intro p {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.controls {
    color: #FFD700;
    font-size: 1em;
}

/* Name Input */
.name-input-container {
    margin: 30px 0;
}

.name-input-container label {
    display: block;
    font-size: 1.3em;
    margin-bottom: 10px;
    color: #FFD700;
}

#playerName {
    width: 300px;
    max-width: 100%;
    padding: 12px 20px;
    font-size: 1.1em;
    border: 3px solid #FFD700;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
}

#playerName:focus {
    background: white;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    transform: scale(1.05);
}

/* Buttons */
.game-button {
    background: linear-gradient(to bottom, #DC143C, #8B0000);
    color: white;
    border: 3px solid #FFD700;
    padding: 15px 40px;
    font-size: 1.5em;
    font-weight: bold;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    margin: 20px 0;
}

.game-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.5);
    background: linear-gradient(to bottom, #FF1744, #DC143C);
}

.game-button:active {
    transform: translateY(0);
}

/* Canvas */
#gameCanvas {
    border: 5px solid #FFD700;
    border-radius: 10px;
    background: #87CEEB;
    display: block;
    margin: 0 auto;
    cursor: pointer;
}

/* Score Display */
.score-display {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 0 20px;
    font-size: 1.3em;
    gap: 15px;
}

.current-score, .speed-display, .player-name-display {
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px solid #FFD700;
}

.current-score span, .speed-display span, .player-name-display span {
    color: #FFD700;
    font-weight: bold;
}

.speed-display {
    border-color: #FF6B6B;
}

.speed-display span {
    color: #FF6B6B;
}

/* Leaderboard */
.leaderboard {
    margin-top: 30px;
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #228B22;
}

.leaderboard h2 {
    color: #FFD700;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.scores-list {
    max-height: 400px;
    overflow-y: auto;
}

.score-entry {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.score-entry:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.score-entry.highlight {
    background: rgba(255, 215, 0, 0.3);
    border: 2px solid #FFD700;
    font-weight: bold;
}

.score-entry .rank {
    color: #FFD700;
    font-weight: bold;
    min-width: 40px;
}

.score-entry .name {
    flex: 1;
    text-align: left;
    padding: 0 15px;
}

.score-entry .score {
    color: #90EE90;
    font-weight: bold;
    min-width: 60px;
    text-align: right;
}

.loading, .error, .no-scores {
    padding: 20px;
    color: #ccc;
    font-style: italic;
}

.error {
    color: #FF6B6B;
}

/* Game Over Screen */
#gameOverScreen h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #FF6B6B;
}

.final-score {
    margin: 20px 0;
    font-size: 1.5em;
}

.final-score strong {
    color: #FFD700;
    font-size: 1.5em;
}

.rank-message {
    margin-top: 15px;
    font-size: 1.3em;
    font-weight: bold;
}

/* Scrollbar Styling */
.scores-list::-webkit-scrollbar {
    width: 10px;
}

.scores-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

.scores-list::-webkit-scrollbar-thumb {
    background: #FFD700;
    border-radius: 5px;
}

.scores-list::-webkit-scrollbar-thumb:hover {
    background: #FFA500;
}

/* Music Toggle Button */
.music-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    border: 3px solid #FFD700;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.music-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(255, 215, 0, 0.5);
}

.music-toggle.muted {
    opacity: 0.5;
}

/* Flying Klaus Animations */
.flying-klaus-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.flying-klaus-container.hidden {
    display: none;
}

.flying-klaus {
    position: absolute;
    width: 120px;
    height: 120px;
    object-fit: contain;
}

/* Klaus 1 - Flying across top, spinning */
.klaus-1 {
    top: 10%;
    left: -150px;
    animation: flyAcross1 15s ease-in-out infinite, spin 3s linear infinite;
    animation-delay: 0s, 0s;
}

@keyframes flyAcross1 {
    0% {
        left: -150px;
        top: 10%;
    }
    50% {
        left: 110%;
        top: 15%;
    }
    100% {
        left: -150px;
        top: 10%;
    }
}

/* Klaus 2 - Flying diagonally, wobble */
.klaus-2 {
    top: -150px;
    left: 80%;
    animation: flyDiagonal 18s ease-in-out infinite, wobble 2s ease-in-out infinite;
    width: 100px;
    height: 100px;
}

@keyframes flyDiagonal {
    0% {
        left: 80%;
        top: -150px;
    }
    50% {
        left: 10%;
        top: 70%;
    }
    100% {
        left: 80%;
        top: -150px;
    }
}

/* Klaus 3 - Large, flying slowly across middle */
.klaus-3 {
    top: 40%;
    right: -200px;
    animation: flyAcross3 20s linear infinite, gentleSpin 4s ease-in-out infinite;
    width: 150px;
    height: 150px;
}

@keyframes flyAcross3 {
    0% {
        right: -200px;
    }
    100% {
        right: 110%;
    }
}

/* Spin animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Wobble animation */
@keyframes wobble {
    0%, 100% {
        transform: rotate(-15deg) scale(1);
    }
    50% {
        transform: rotate(15deg) scale(1.1);
    }
}

/* Gentle spin */
@keyframes gentleSpin {
    0%, 100% {
        transform: rotate(-10deg);
    }
    50% {
        transform: rotate(10deg);
    }
}

/* Klaus 4 - Small, bouncing across bottom */
.klaus-4 {
    bottom: 15%;
    left: -100px;
    animation: bounceAcross 12s ease-in-out infinite, spin 2s linear infinite;
    width: 80px;
    height: 80px;
}

@keyframes bounceAcross {
    0% {
        left: -100px;
        bottom: 15%;
    }
    50% {
        left: 110%;
        bottom: 25%;
    }
    100% {
        left: -100px;
        bottom: 15%;
    }
}

/* Klaus 5 - Medium, floating vertically on right */
.klaus-5 {
    right: 15%;
    top: -120px;
    animation: floatVertical 16s ease-in-out infinite, wobble 3s ease-in-out infinite;
    width: 110px;
    height: 110px;
}

@keyframes floatVertical {
    0% {
        top: -120px;
    }
    50% {
        top: 100%;
    }
    100% {
        top: -120px;
    }
}

/* Klaus 6 - Tiny, quick zip across middle */
.klaus-6 {
    top: 30%;
    left: -80px;
    animation: quickZip 8s linear infinite, spin 1.5s linear infinite;
    width: 60px;
    height: 60px;
}

@keyframes quickZip {
    0% {
        left: -80px;
    }
    100% {
        left: 110%;
    }
}

/* Klaus 7 - Large, slow diagonal */
.klaus-7 {
    bottom: -180px;
    right: -180px;
    animation: slowDiagonal 22s ease-in-out infinite, gentleSpin 5s ease-in-out infinite;
    width: 160px;
    height: 160px;
}

@keyframes slowDiagonal {
    0% {
        right: -180px;
        bottom: -180px;
    }
    50% {
        right: 100%;
        bottom: 100%;
    }
    100% {
        right: -180px;
        bottom: -180px;
    }
}

/* Responsive Design */
@media (max-width: 900px) {
    .game-container {
        padding: 20px;
        margin: 10px;
    }
    
    .title {
        font-size: 2em;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
    }
    
    .score-display {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    /* Smaller Klaus on mobile */
    .flying-klaus {
        width: 80px;
        height: 80px;
    }
    
    .klaus-2 {
        width: 60px;
        height: 60px;
    }
    
    .klaus-3 {
        width: 100px;
        height: 100px;
    }
    
    .klaus-4 {
        width: 50px;
        height: 50px;
    }
    
    .klaus-5 {
        width: 70px;
        height: 70px;
    }
    
    .klaus-6 {
        width: 40px;
        height: 40px;
    }
    
    .klaus-7 {
        width: 110px;
        height: 110px;
    }
}
