@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;600;800&family=Secular+One&display=swap');

:root {
    --pink: #FF9EB5;
    --pink-dark: #E57A95;
    --blue: #7EC8E8;
    --blue-dark: #5BA8C8;
    --grass: #7EC850;
    --grass-dark: #5a9e3a;
    --sun: #FFE066;
    --text: #2D3436;
    --text-light: #636e72;
    --candy-pink: #FF6B9D;
    --candy-blue: #4ECDC4;
    --candy-yellow: #FFE66D;
    --candy-purple: #C56CF0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: 'Rubik', 'Secular One', sans-serif;
    background: linear-gradient(180deg, #87CEEB 0%, #B8E4F9 50%, #E8F4FF 100%);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ==================== SCREENS ==================== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 20px;
    text-align: center;
    color: var(--text);
    overflow-y: auto;
}

.screen.active {
    display: flex;
}

/* ==================== FLOATING DECORATIONS ==================== */
.floating-decorations {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.floating-bubble {
    position: absolute;
    width: var(--size, 50px);
    height: var(--size, 50px);
    left: var(--x, 50%);
    bottom: -100px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, 
        rgba(255,255,255,0.9) 0%, 
        rgba(255,255,255,0.4) 30%,
        rgba(135,206,250,0.3) 60%,
        rgba(135,206,250,0.1) 100%
    );
    box-shadow: 
        inset 0 -5px 15px rgba(135,206,250,0.3),
        0 0 20px rgba(255,255,255,0.5);
    animation: floatUp 8s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes floatUp {
    0% { 
        transform: translateY(0) scale(1);
        opacity: 0;
    }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { 
        transform: translateY(-120vh) scale(0.8);
        opacity: 0;
    }
}

.floating-star {
    position: absolute;
    left: var(--x, 50%);
    top: var(--y, 50%);
    font-size: 24px;
    animation: twinkle 2s ease-in-out infinite, sway 4s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

.floating-star::before {
    content: '✨';
}

@keyframes twinkle {
    0%, 100% { opacity: 0.4; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

@keyframes sway {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(10px); }
}

/* ==================== START SCREEN ==================== */
#start-screen {
    background: linear-gradient(180deg, 
        #7BC8F6 0%,
        #A8DAFF 40%,
        #D4EDFF 70%,
        #FFF5E6 100%
    );
    gap: 15px;
    justify-content: center;
    padding: 15px;
}

/* ==================== GAME TITLE ==================== */
.game-title {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
    z-index: 1;
}

.title-text {
    font-family: 'Secular One', sans-serif;
    font-size: clamp(56px, 14vw, 120px);
    font-weight: 800;
    background: linear-gradient(180deg, #FFF 0%, #FFE066 40%, #FFD700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 6px 0 rgba(200, 150, 0, 0.4)) 
            drop-shadow(0 0 40px rgba(255,224,102,0.6));
    animation: titleWobble 3s ease-in-out infinite;
}

@keyframes titleWobble {
    0%, 100% { transform: rotate(-2deg) scale(1); }
    50% { transform: rotate(2deg) scale(1.05); }
}

.title-bubble {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, 
        rgba(255,255,255,0.95) 0%, 
        rgba(255,182,193,0.6) 50%,
        rgba(255,105,180,0.3) 100%
    );
    box-shadow: 
        inset -3px -3px 8px rgba(255,105,180,0.3),
        0 0 15px rgba(255,182,193,0.5);
    animation: bubbleBounce 2s ease-in-out infinite;
}

.title-bubble-1 { animation-delay: 0s; }
.title-bubble-2 { animation-delay: 0.3s; }

@keyframes bubbleBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-15px) scale(1.1); }
}

/* ==================== PLAYERS AREA ==================== */
.players-area {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    z-index: 1;
    width: 100%;
    max-width: 700px;
}

.player-bubble {
    flex: 1;
    min-width: 280px;
    max-width: 320px;
    padding: 20px 15px 15px;
    background: radial-gradient(ellipse at 50% 0%, 
        rgba(255,255,255,0.98) 0%,
        rgba(255,255,255,0.9) 50%,
        rgba(240,248,255,0.85) 100%
    );
    border-radius: 40px 40px 60px 60px;
    box-shadow: 
        0 15px 35px rgba(100,150,200,0.25),
        0 5px 15px rgba(0,0,0,0.08),
        inset 0 -8px 20px rgba(200,230,255,0.5),
        inset 0 3px 0 rgba(255,255,255,1);
    position: relative;
    animation: cloudFloat 4s ease-in-out infinite;
    --player-color: #FF9EB5;
}

.player-bubble[data-player="2"] {
    --player-color: #7EC8E8;
}

.player-bubble[data-player="1"] { animation-delay: 0s; }
.player-bubble[data-player="2"] { animation-delay: 0.5s; }

@keyframes cloudFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Name input as speech bubble */
.player-name-bubble {
    position: relative;
    margin-bottom: 15px;
}

.player-name-bubble input {
    width: 100%;
    padding: 12px 20px;
    border: 4px solid var(--player-color, #FFB6C1);
    border-radius: 25px;
    font-size: 22px;
    font-family: 'Rubik', sans-serif;
    font-weight: 700;
    text-align: center;
    background: linear-gradient(180deg, #fff 0%, #FFF5F7 100%);
    color: var(--text);
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 0 rgba(0,0,0,0.1),
        inset 0 2px 5px rgba(255,200,210,0.3);
}

.player-name-bubble input:focus {
    outline: none;
    transform: scale(1.02);
    box-shadow: 
        0 6px 0 rgba(0,0,0,0.1),
        0 0 0 5px rgba(255,182,193,0.3),
        inset 0 2px 5px rgba(255,200,210,0.3);
}

.name-bubble-tail {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 14px solid var(--player-color, #FFB6C1);
}

.name-bubble-tail::before {
    content: '';
    position: absolute;
    top: -18px;
    left: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid #fff;
}

/* Player avatar area */
.player-avatar-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

/* Figure picker */
.figure-picker {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.figure-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 4px solid #E8E8E8;
    background: linear-gradient(180deg, #fff 0%, #F5F5F5 100%);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 0 #D0D0D0, 0 6px 15px rgba(0,0,0,0.1);
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.figure-btn:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 8px 0 #D0D0D0, 0 12px 25px rgba(0,0,0,0.15);
}

.figure-btn:active {
    transform: translateY(2px) scale(0.95);
    box-shadow: 0 2px 0 #D0D0D0;
}

.figure-btn.is-selected {
    border-color: var(--player-color, var(--candy-pink));
    background: linear-gradient(180deg, #FFF 0%, #FFF0F5 100%);
    box-shadow: 
        0 4px 0 color-mix(in srgb, var(--player-color, var(--candy-pink)) 70%, black),
        0 0 20px color-mix(in srgb, var(--player-color, var(--candy-pink)) 50%, transparent);
    transform: scale(1.1);
    animation: selectedPulse 1.5s ease-in-out infinite;
}

@keyframes selectedPulse {
    0%, 100% { box-shadow: 0 4px 0 color-mix(in srgb, var(--player-color) 70%, black), 0 0 15px color-mix(in srgb, var(--player-color) 40%, transparent); }
    50% { box-shadow: 0 4px 0 color-mix(in srgb, var(--player-color) 70%, black), 0 0 25px color-mix(in srgb, var(--player-color) 60%, transparent); }
}

.figure-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Blob figure */
.figure-blob {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--player-color, #FF9EB5), color-mix(in srgb, var(--player-color, #FF9EB5) 70%, black));
    position: relative;
    box-shadow: 
        inset -4px -4px 10px rgba(0,0,0,0.2),
        inset 4px 4px 10px rgba(255,255,255,0.5);
}

.figure-blob::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 9px;
    width: 6px;
    height: 8px;
    background: white;
    border-radius: 50%;
    box-shadow: 10px 0 0 white;
}

.figure-blob::after {
    content: '';
    position: absolute;
    bottom: 9px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 5px;
    border-bottom: 2px solid rgba(0,0,0,0.3);
    border-radius: 0 0 10px 10px;
}

/* Color petals */
.color-petals {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 5px;
}

.color-petal {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.8);
    background: var(--petal-color);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 
        0 3px 0 color-mix(in srgb, var(--petal-color) 60%, black),
        inset 0 3px 6px rgba(255,255,255,0.5);
}

.color-petal:hover {
    transform: scale(1.2) translateY(-3px);
}

.color-petal:active {
    transform: scale(0.9);
}

.color-petal.is-selected {
    border-color: white;
    transform: scale(1.15);
    box-shadow: 
        0 3px 0 color-mix(in srgb, var(--petal-color) 60%, black),
        0 0 0 4px white,
        0 0 20px var(--petal-color);
    animation: colorPulse 1s ease-in-out infinite;
}

@keyframes colorPulse {
    0%, 100% { box-shadow: 0 3px 0 color-mix(in srgb, var(--petal-color) 60%, black), 0 0 0 4px white, 0 0 15px var(--petal-color); }
    50% { box-shadow: 0 3px 0 color-mix(in srgb, var(--petal-color) 60%, black), 0 0 0 4px white, 0 0 30px var(--petal-color); }
}

/* Player keys hint */
.player-keys {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

.player-keys kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 4px 10px;
    font-family: 'Rubik', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: #555;
    background: linear-gradient(180deg, #FAFAFA 0%, #E0E0E0 100%);
    border: none;
    border-radius: 10px;
    box-shadow: 
        0 4px 0 #BDBDBD,
        inset 0 2px 0 #FFF;
}

/* ==================== FUN SETTINGS ==================== */
.fun-settings {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    justify-content: center;
    flex-wrap: wrap;
    z-index: 1;
    padding: 10px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.setting-label {
    font-family: 'Rubik', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(180deg, #FF9EB5 0%, #E57A95 100%);
    padding: 4px 14px;
    border-radius: 20px;
    box-shadow: 
        0 3px 0 rgba(180, 80, 100, 0.5),
        0 4px 10px rgba(255, 158, 181, 0.3);
    white-space: nowrap;
}

/* World picker */
.world-picker {
    display: flex;
    gap: 8px;
    background: rgba(255,255,255,0.7);
    padding: 8px 12px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.world-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(180deg, #FFF 0%, #F0F0F0 100%);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 3px 0 #D0D0D0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.world-btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 6px 0 #D0D0D0, 0 10px 20px rgba(0,0,0,0.15);
}

.world-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #D0D0D0;
}

.world-btn.active {
    background: linear-gradient(180deg, var(--candy-yellow) 0%, #FFD700 100%);
    box-shadow: 
        0 3px 0 #D4A800,
        0 0 20px rgba(255,215,0,0.5);
    transform: scale(1.1);
}

/* Timer candy buttons */
.timer-candy {
    display: flex;
    gap: 8px;
    background: rgba(255,255,255,0.7);
    padding: 8px 12px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.candy-btn {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(180deg, #FFF 0%, #F5F5F5 100%);
    font-family: 'Secular One', sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 0 #D0D0D0;
}

.candy-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 0 #D0D0D0, 0 10px 20px rgba(0,0,0,0.15);
}

.candy-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #D0D0D0;
}

.candy-btn.active {
    background: linear-gradient(180deg, var(--candy-yellow) 0%, #FFD700 100%);
    color: #6B5A00;
    box-shadow: 
        0 4px 0 #D4A800,
        0 0 15px rgba(255,215,0,0.4);
}

/* Trophy button */
.trophy-btn {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(180deg, #FFD700 0%, #FFA500 100%);
    font-size: 28px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 
        0 4px 0 #CC8400,
        0 0 20px rgba(255,165,0,0.4);
    animation: trophyGlow 2s ease-in-out infinite;
}

@keyframes trophyGlow {
    0%, 100% { box-shadow: 0 4px 0 #CC8400, 0 0 15px rgba(255,165,0,0.3); }
    50% { box-shadow: 0 4px 0 #CC8400, 0 0 30px rgba(255,165,0,0.6); }
}

.trophy-btn:hover {
    transform: translateY(-4px) rotate(10deg) scale(1.1);
    box-shadow: 0 8px 0 #CC8400, 0 0 40px rgba(255,165,0,0.5);
}

.trophy-btn:active {
    transform: translateY(2px) scale(0.95);
}

/* ==================== PLAY BUTTON ==================== */
.play-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 50px;
    border: none;
    border-radius: 60px;
    background: linear-gradient(180deg, #5BE87F 0%, #32CD32 50%, #28A828 100%);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 
        0 8px 0 #1E8F1E,
        0 12px 40px rgba(50,205,50,0.5),
        inset 0 3px 0 rgba(255,255,255,0.4);
    z-index: 1;
    animation: playPulse 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

@keyframes playPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.play-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: buttonShine 3s ease-in-out infinite;
}

@keyframes buttonShine {
    0%, 100% { left: -100%; }
    50% { left: 100%; }
}

.play-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 
        0 13px 0 #1E8F1E,
        0 18px 50px rgba(50,205,50,0.6),
        inset 0 3px 0 rgba(255,255,255,0.4);
}

.play-button:active {
    transform: translateY(4px);
    box-shadow: 
        0 4px 0 #1E8F1E,
        0 6px 20px rgba(50,205,50,0.4);
}

.play-icon {
    font-size: 28px;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.play-text {
    font-family: 'Secular One', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: white;
    text-shadow: 0 3px 0 rgba(0,0,0,0.2);
}

/* ==================== SCORES POPUP ==================== */
.scores-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

.scores-popup.hidden {
    display: none;
}

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

.popup-cloud {
    background: radial-gradient(ellipse at 50% 30%, 
        #FFF 0%,
        #FFF8F0 50%,
        #FFF0E0 100%
    );
    padding: 30px 40px;
    border-radius: 50px;
    box-shadow: 
        0 20px 60px rgba(0,0,0,0.3),
        inset 0 -10px 30px rgba(255,200,150,0.3),
        inset 0 5px 0 rgba(255,255,255,1);
    position: relative;
    min-width: 280px;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.popup-cloud h3 {
    font-family: 'Secular One', sans-serif;
    font-size: 28px;
    color: var(--text);
    margin-bottom: 20px;
    text-align: center;
}

.popup-cloud ol {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: score-counter;
}

.popup-cloud li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin: 8px 0;
    background: rgba(255,255,255,0.8);
    border-radius: 15px;
    font-size: 16px;
    font-weight: 600;
    counter-increment: score-counter;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.popup-cloud li::before {
    content: counter(score-counter) ".";
    font-weight: 800;
    color: var(--candy-pink);
    margin-left: 10px;
}

.close-popup {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(180deg, #FF6B6B 0%, #EE5A5A 100%);
    color: white;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 0 #CC4444;
    transition: all 0.2s;
}

.close-popup:hover {
    transform: scale(1.1);
}

/* ==================== GAME HUD ==================== */
#game-hud {
    justify-content: flex-start;
    pointer-events: none;
    background: transparent;
}

.hud-item {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 800;
    font-family: 'Secular One', sans-serif;
}

.score-container {
    top: 25px;
    left: 25px;
    background: linear-gradient(180deg, #FF9EB5 0%, #E57A95 100%);
    box-shadow: 
        0 6px 0 rgba(180,80,100,0.6),
        0 10px 30px rgba(255,158,181,0.4),
        inset 0 3px 0 rgba(255,255,255,0.4);
    font-size: 28px;
    color: white;
    text-shadow: 0 2px 0 rgba(0,0,0,0.15);
    animation: hudPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.score-container .label {
    font-size: 18px;
    opacity: 0.9;
}

.timer-container {
    top: 25px;
    right: 25px;
    background: linear-gradient(180deg, #7EC8E8 0%, #5BA8C8 100%);
    box-shadow: 
        0 6px 0 rgba(60,130,160,0.6),
        0 10px 30px rgba(126,200,232,0.4),
        inset 0 3px 0 rgba(255,255,255,0.4);
    font-size: 36px;
    color: white;
    text-shadow: 0 2px 0 rgba(0,0,0,0.15);
    min-width: 100px;
    justify-content: center;
    animation: hudPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.1s both;
}

@keyframes hudPop {
    0% { transform: scale(0) rotate(-15deg); opacity: 0; }
    70% { transform: scale(1.15) rotate(5deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* HUD Control hints */
.hud-controls {
    position: absolute;
    bottom: 25px;
    display: flex;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    animation: hudPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.2s both;
}

.hud-controls kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 4px 10px;
    font-family: 'Rubik', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: #555;
    background: linear-gradient(180deg, #FFF 0%, #E8E8E8 100%);
    border: none;
    border-radius: 10px;
    box-shadow: 
        0 4px 0 #BBB,
        inset 0 2px 0 #FFF;
}

.hud-controls-p1 {
    left: 25px;
}

.hud-controls-p2 {
    right: 25px;
}

/* ==================== END SCREEN ==================== */
#end-screen {
    background: linear-gradient(180deg, 
        #7BC8F6 0%,
        #A8DAFF 40%,
        #D4EDFF 70%,
        #FFF5E6 100%
    );
}

.end-title {
    font-family: 'Secular One', sans-serif;
    font-size: clamp(48px, 12vw, 90px);
    background: linear-gradient(180deg, #FFF 0%, #FFE066 40%, #FFD700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 5px 0 rgba(200, 150, 0, 0.4));
    margin-bottom: 20px;
    animation: celebrateBounce 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes celebrateBounce {
    0% { transform: scale(0) rotate(-20deg); }
    50% { transform: scale(1.2) rotate(10deg); }
    70% { transform: scale(0.9) rotate(-5deg); }
    100% { transform: scale(1) rotate(0); }
}

.final-score {
    font-size: 24px;
    margin-bottom: 25px;
    background: radial-gradient(ellipse at 50% 30%, #FFF 0%, #FFF8F0 100%);
    padding: 25px 50px;
    border-radius: 40px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    box-shadow: 
        0 15px 40px rgba(0,0,0,0.15),
        inset 0 -8px 20px rgba(255,200,150,0.2),
        inset 0 3px 0 rgba(255,255,255,1);
    animation: scoreReveal 0.6s ease-out 0.3s both;
}

@keyframes scoreReveal {
    0% { transform: translateY(40px) scale(0.8); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

#final-score-val {
    font-family: 'Secular One', sans-serif;
    font-size: 72px;
    font-weight: 800;
    background: linear-gradient(180deg, var(--grass) 0%, var(--grass-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.high-scores-full {
    width: 100%;
    max-width: 380px;
    background: radial-gradient(ellipse at 50% 30%, #FFF 0%, #FFF8F0 100%);
    padding: 25px;
    border-radius: 35px;
    margin-bottom: 25px;
    box-shadow: 
        0 12px 35px rgba(0,0,0,0.12),
        inset 0 -5px 15px rgba(255,200,150,0.2),
        inset 0 3px 0 rgba(255,255,255,1);
    animation: scoreReveal 0.6s ease-out 0.5s both;
}

.high-scores-full h3 {
    font-family: 'Secular One', sans-serif;
    font-size: 24px;
    color: var(--text);
    margin-bottom: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px 12px;
    text-align: center;
    font-size: 16px;
}

th {
    color: var(--text-light);
    font-weight: 600;
    border-bottom: 3px solid rgba(0,0,0,0.1);
}

td {
    border-bottom: 2px solid rgba(0,0,0,0.05);
}

.medal-gold td,
.medal-silver td,
.medal-bronze td {
    font-weight: 700;
}

.medal-gold td {
    background: linear-gradient(90deg, #FFEB99, #FFF5CC);
    color: #6B5200;
}

.medal-gold td:first-child { border-radius: 0 15px 15px 0; }
.medal-gold td:last-child { border-radius: 15px 0 0 15px; }

.medal-silver td {
    background: linear-gradient(90deg, #E8E8F0, #F5F5FF);
    color: #5B6470;
}

.medal-silver td:first-child { border-radius: 0 15px 15px 0; }
.medal-silver td:last-child { border-radius: 15px 0 0 15px; }

.medal-bronze td {
    background: linear-gradient(90deg, #E8C9A0, #F5DFC0);
    color: #6B3D17;
}

.medal-bronze td:first-child { border-radius: 0 15px 15px 0; }
.medal-bronze td:last-child { border-radius: 15px 0 0 15px; }

#restart-btn {
    animation: scoreReveal 0.6s ease-out 0.7s both;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 650px) {
    .players-area {
        flex-direction: column;
        align-items: center;
    }
    
    .player-bubble {
        min-width: 260px;
        max-width: 320px;
    }
    
    .fun-settings {
        gap: 10px;
    }
    
    .setting-label {
        font-size: 12px;
        padding: 3px 10px;
    }
    
    .world-btn, .candy-btn {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }
    
    .trophy-btn {
        width: 46px;
        height: 46px;
        font-size: 22px;
    }
    
    .play-button {
        padding: 14px 40px;
    }
    
    .play-text {
        font-size: 24px;
    }
}

@media (max-width: 400px) {
    .player-bubble {
        padding: 15px 12px 12px;
        min-width: 240px;
    }
    
    .figure-btn {
        width: 44px;
        height: 44px;
    }
    
    .color-petal {
        width: 28px;
        height: 28px;
    }
    
    .world-picker, .timer-candy {
        padding: 6px 10px;
    }
}

@media (max-height: 700px) {
    #start-screen {
        gap: 10px;
        padding: 10px;
    }
    
    .game-title {
        margin-bottom: 5px;
    }
    
    .title-text {
        font-size: clamp(40px, 10vw, 80px);
    }
    
    .title-bubble {
        width: 30px;
        height: 30px;
    }
    
    .player-bubble {
        padding: 12px 10px 10px;
    }
    
    .player-name-bubble input {
        padding: 8px 15px;
        font-size: 18px;
    }
    
    .figure-btn {
        width: 42px;
        height: 42px;
    }
    
    .color-petal {
        width: 26px;
        height: 26px;
    }
    
    .fun-settings {
        gap: 8px;
        padding: 5px;
    }
    
    .setting-label {
        font-size: 11px;
        padding: 2px 8px;
    }
    
    .setting-group {
        gap: 4px;
    }
    
    .play-button {
        padding: 12px 35px;
    }
    
    .play-text {
        font-size: 22px;
    }
}

/* Very small height */
@media (max-height: 550px) {
    .floating-decorations {
        display: none;
    }
    
    .title-bubble {
        display: none;
    }
    
    .player-keys {
        display: none;
    }
    
    .setting-label {
        display: none;
    }
}
