body {
    font-family: 'Rubik', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ecf0f1;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: relative;
    min-height: 100vh;
    box-sizing: border-box;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

#main-title {
    font-size: 2.5em;
    font-weight: bold;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 5px;
    letter-spacing: 1px;
    line-height: 1;
}

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

#new-highscore-banner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    color: #2c1810;
    padding: 20px 40px;
    border-radius: 20px;
    font-size: 2.2em;
    font-weight: 900;
    z-index: 1000;
    box-shadow: 
        0 0 30px rgba(255, 215, 0, 0.8),
        0 10px 40px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.3),
        0 0 10px rgba(255, 215, 0, 0.8);
    border: 3px solid rgba(255, 255, 255, 0.4);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    backdrop-filter: blur(2px);
    letter-spacing: 2px;
    text-align: center;
    min-width: 300px;
}

@keyframes highscore-celebration {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 
            0 0 30px rgba(255, 215, 0, 0.8),
            0 10px 40px rgba(0, 0, 0, 0.4),
            inset 0 2px 4px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 
            0 0 50px rgba(255, 215, 0, 1),
            0 15px 60px rgba(0, 0, 0, 0.6),
            inset 0 2px 8px rgba(255, 255, 255, 0.5);
    }
}

#new-highscore-banner.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: 
        highscore-celebration 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55),
        pulse-glow 2s ease-in-out infinite 0.8s;
}

#top-player-display {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 165, 0, 0.1));
    padding: 8px 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    font-size: 1em;
    text-align: center;
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.1);
    backdrop-filter: blur(5px);
    font-weight: 600;
    line-height: 1.3;
    max-width: 350px;
    width: 85%;
}

#top-player-display .trophy {
    display: none; /* Verberg het beker icoon */
}

canvas {
    border-bottom: 25px solid #8B4513;
    box-sizing: border-box;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    background: linear-gradient(to bottom, 
        rgba(135, 206, 235, 0.1) 0%,
        rgba(135, 206, 235, 0.3) 100%);
    
    /* Maak afbeeldingen scherp en smooth voor SVG */
    image-rendering: auto;
    image-rendering: smooth;
}

/* Game Over scherm styling */
#name-entry-screen h1 {
    font-size: 3em;
    font-weight: bold;
    background: linear-gradient(45deg, #ff6b6b, #ee5a52, #ff6b6b);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin: 0;
    letter-spacing: 2px;
}

#name-entry-screen p {
    font-size: 1.5em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin: 10px 0;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

#final-score {
    color: #ffd700;
    font-weight: 900;
    font-size: 1.2em;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    animation: scoreGlow 2s ease-in-out infinite alternate;
}

@keyframes scoreGlow {
    0% {
        text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    }
    100% {
        text-shadow: 0 0 25px rgba(255, 215, 0, 1), 0 0 35px rgba(255, 215, 0, 0.6);
    }
}
#menu-screen, #name-entry-screen, #leaderboard-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 10px 280px 10px; /* Extra padding-bottom voor karakterafbeeldingen */
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 0;
    border: none;
    box-shadow: none;
    animation: fadeInUp 0.8s ease-out;
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    justify-content: center;
    gap: 15px; /* Verkleind van 20px naar 15px */
    position: relative; /* Voor absolute positioning van karakters */
    overflow-y: auto; /* Voor scroll als nodig */
}

/* Achtergrond karakters op startpagina - naast elkaar, in beeld */
#menu-screen::before {
    content: '';
    position: absolute;
    bottom: 20px;
    left: calc(50% - 200px); /* Niek verder naar links */
    width: 250px;
    height: 250px;
    background-image: url('niek.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 1;
    z-index: -1;
    pointer-events: none;
}

#menu-screen::after {
    content: '';
    position: absolute;
    bottom: 20px;
    left: calc(50% - 50px); /* Jamie dichter bij center */
    width: 250px;
    height: 250px;
    background-image: url('jamie.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 1;
    z-index: -1;
    pointer-events: none;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

#game-screen {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Center canvas for cases where it doesn't fill screen */
}

/* Use high-specificity selectors to hide screens. This is the most robust way. */
#menu-screen.hidden,
#game-screen.hidden,
#name-entry-screen.hidden,
#leaderboard-screen.hidden {
    display: none;
}

/* Knoppen & Formulieren */
button, .char-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 16px;
    font-size: 1em;
    margin: 0;
    border-radius: 10px;
    cursor: pointer;
    width: 90%;
    min-height: 44px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
    touch-action: manipulation;
}

button::before, .char-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

button:hover::before, .char-button:hover::before {
    left: 100%;
}

button:hover, .char-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

button:active, .char-button:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Name form styling */
#name-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
}

#player-name {
    padding: 15px 20px;
    font-size: 1.2em;
    width: 280px;
    max-width: 90%;
    margin: 0;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#player-name::placeholder {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
}

#player-name:focus {
    outline: none;
    border-color: rgba(255, 215, 0, 0.8);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3), 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

#restart-button {
    background: linear-gradient(135deg, #7f8c8d 0%, #95a5a6 100%);
    transition: all 0.3s ease;
}

#restart-button:hover {
    background: linear-gradient(135deg, #95a5a6 0%, #bdc3c7 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

/* HUD (Heads-Up Display) */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 8px 15px;
    box-sizing: border-box;
    font-size: 1.0em;
    font-weight: bold;
    color: #fff;
    background-image: linear-gradient(to bottom, rgba(58, 80, 107, 0.9), rgba(44, 62, 80, 0));
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
    flex-wrap: wrap;
    gap: 15px;
}

#hud span {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    border-radius: 6px;
    min-width: fit-content;
    font-size: 0.9em;
}

#controls-info {
    position: absolute;
    bottom: 20px; /* Match the canvas border-bottom */
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    font-size: 0.9em;
    color: #fff;
    background-color: rgba(0,0,0,0.4);
    padding: 5px 15px;
    border-radius: 5px;
}

/* Leaderboard Container */
.leaderboard-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    height: 60vh;
    display: flex;
    flex-direction: column;
}

/* Champion (Nummer 1) Header - Always Visible */
.champion-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border: 3px solid #FF8C00;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.champion-entry {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    position: relative;
}

.champion-entry::before {
    content: "👑";
    font-size: 24px;
    position: absolute;
    left: -5px;
    top: -5px;
}

.champion-entry .rank {
    font-weight: bold;
    font-size: 24px;
    color: #8B0000;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    width: 40px;
}

.champion-entry .character-icon {
    width: 40px;
    height: 40px;
    border: 2px solid #8B0000;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px;
}

.champion-entry .player-name {
    flex-grow: 1;
    font-weight: bold;
    font-size: 18px;
    color: #8B0000;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
}

.champion-entry .player-score {
    font-weight: bold;
    font-size: 20px;
    color: #8B0000;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
}

/* Scrollable Leaderboard List */
.leaderboard-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

.leaderboard-scroll::-webkit-scrollbar {
    width: 8px;
}

.leaderboard-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.leaderboard-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.leaderboard-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

#leaderboard-list {
    list-style-type: none;
    padding-left: 0;
    width: 100%;
    counter-reset: leaderboard 1; /* Start bij 2 omdat nummer 1 sticky is */
    margin: 0;
}

#leaderboard-list li {
    margin-bottom: 8px;
    font-size: 1.1em;
    border-bottom: 1px solid #4a6078;
    padding-bottom: 8px;
    counter-increment: leaderboard;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: background 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-entry:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.leaderboard-entry .rank {
    font-weight: bold;
    width: 30px;
    text-align: center;
    font-size: 1.2em;
    color: #4ecdc4;
}

.leaderboard-entry .rank::before {
    content: counter(leaderboard);
}

.leaderboard-entry .character-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px;
    object-fit: contain;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.leaderboard-entry .player-name {
    flex-grow: 1;
    font-weight: 500;
    color: #ecf0f1;
}

.leaderboard-entry .player-score {
    font-weight: bold;
    color: #4ecdc4;
    font-size: 1.1em;
}

#leaderboard-list li::before {
    display: none; /* Verberg oude counter */
}

#main-title {
    font-size: 2.5em;
    font-weight: bold;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin: 20px 0 10px 0;
    letter-spacing: 1px;
    line-height: 1;
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.floating-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.floating-fish {
    position: absolute;
    font-size: 1.5em;
    color: rgba(78, 205, 196, 0.3);
    animation: float var(--duration, 4s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

.floating-fish:nth-child(1) {
    top: 20%;
    left: 10%;
}

.floating-fish:nth-child(2) {
    top: 60%;
    right: 15%;
}

.floating-fish:nth-child(3) {
    top: 80%;
    left: 20%;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.3;
    }
    25% {
        transform: translateY(-20px) rotate(5deg);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-10px) rotate(-3deg);
        opacity: 0.4;
    }
    75% {
        transform: translateY(-30px) rotate(7deg);
        opacity: 0.7;
    }
}

.title-decoration {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 10px 0 20px 0;
}

.main-fish {
    font-size: 2.5em;
    color: #4ecdc4;
    animation: fishSwim 2s ease-in-out infinite;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
    z-index: 2;
    position: relative;
}

.ripple {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 2px solid rgba(78, 205, 196, 0.3);
    border-radius: 50%;
    animation: rippleEffect 3s ease-out infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes rippleEffect {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 120px;
        height: 120px;
        opacity: 0;
    }
}

.subtitle {
    font-size: 1.3em;
    font-weight: 600;
    margin: 5px 0;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
}

.char-buttons-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 10px 0;
    padding: 0;
    background: none;
    border-radius: 0;
    border: none;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    justify-items: center;
}

.leaderboard-button {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 90%;
    padding: 10px 20px;
    margin-top: 15px;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.leaderboard-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.leaderboard-button .fa-trophy {
    margin-right: 10px;
    color: #ffd700;
    animation: trophyGlow 2s ease-in-out infinite alternate;
}

@keyframes trophyGlow {
    0% {
        text-shadow: 0 0 5px #ffd700;
    }
    100% {
        text-shadow: 0 0 15px #ffd700, 0 0 25px #ffd700;
    }
}

#top-player-display {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 165, 0, 0.1));
    padding: 15px 25px;
    border-radius: 15px;
    margin-bottom: 25px;
    font-size: 1.2em;
    text-align: center;
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.1);
    backdrop-filter: blur(5px);
    font-weight: 600;
}

#top-player-display .trophy {
    color: #ffd700;
    margin-right: 10px;
    text-shadow: 0 0 10px #ffd700;
    animation: trophyGlow 2s ease-in-out infinite alternate;
}
