:root {

    --pink-main: #ff8fcf;
    --pink-hot: #ffe4ec;

    --dark-bg1: #1e1a24;
    --dark-bg2: #2a2433;

    /* 🌟 THEME GLOWS (ADD THESE) */
    --pink-glow: rgba(255, 79, 163, 0.45);
    --lavender-glow: rgba(170, 120, 255, 0.45);
    --blue-glow: rgba(60, 140, 255, 0.45);
}

/* ======================

   BASE

====================== */

body {

    margin: 0;

    min-height: 100vh;

    background: linear-gradient(to bottom, #ffe4ec, #ffb3d9);

    font-family: "Cherry Bomb One";

    transition: background 0.6s ease;

    overflow-x: hidden;

}

/* ======================

   GLOW BACKGROUND

====================== */

body::before,

body::after {

    content: "";

    position: fixed;

    width: 300px;

    height: 300px;

    border-radius: 50%;

    filter: blur(100px);

    z-index: -1;

    pointer-events: none;

}

body::before {

    background: #ffb3d9;

    left: -80px;

    top: 30%;

}

body::after {

    background: #ffd6f6;

    right: -80px;

    top: 20%;

}

body.dark::before,

body.dark::after {

    opacity: 0.08;

}

/* ======================
   THEMES
====================== */

body.pink { background: linear-gradient(135deg, #ffe4ec, #ffd6f6); }

body.lavender { background: linear-gradient(135deg, #e6ccff, #f3d1ff); }

body.blue { background: linear-gradient(135deg, #d6eaf9, #bde0ff); }


/* ======================
   THEME BUTTON GLOWS
====================== */

/* PINK */

body.pink .btn:hover,

body.pink .tile.selected {

    box-shadow: 0 0 15px var(--pink-glow);

}

/* LAVENDER */
body.lavender .btn:hover,
body.lavender .tile.selected {
    box-shadow: 0 0 15px var(--lavender-glow);
}

/* BLUE */
body.blue .btn:hover,
body.blue .tile.selected {
    box-shadow: 0 0 15px var(--blue-glow);
}

/* ======================
   🌙 DARK MODE (THEME-AWARE FIX)
====================== */

/* BLUE + DARK */
body.blue.dark {
    background: linear-gradient(135deg, #1b4fd6, #0b1a2e);
}

/* PINK + DARK */
body.pink.dark {
    background: linear-gradient(135deg, #a3386c, #3a1430);
}

/* LAVENDER + DARK */
body.lavender.dark {
    background: linear-gradient(135deg, #982286, #2e1f3d);
}

/* GAME UI STILL DARKENS PROPERLY */

body.dark .game-layout {

    background: rgba(20, 20, 30, 0.6);

    backdrop-filter: blur(12px);

}


body.dark .win-card {

    background: rgba(30, 30, 45, 0.95);

    color: white;

}

body.dark #puzzle-board {

    filter: brightness(0.9);

}

/* glow dim in dark mode */

body.dark::before,

body.dark::after {

    opacity: 0.08;

}

/* ======================
   START SCREEN
====================== */

.start-screen,

.game-screen {

    height: 100vh;

    display: flex;

    justify-content: center;

    align-items: center;

}

.game-screen {

    display: none;

}

.start-card {

    background: rgba(255,255,255,0.95);

    padding: 35px;

    border-radius: 25px;

    text-align: center;

    box-shadow: 0 20px 60px rgba(0,0,0,0.25);

}

/* ======================
   GAME LAYOUT
====================== */

.game-layout {
    display: flex;
    gap: 30px;
    padding: 30px;
    border-radius: 25px;

    background: rgba(255,255,255,0.4);

    align-items: flex-start;
    justify-content: center;
}

/* puzzle spacing FIX */

#puzzle-board {
    display: grid;
    width: 300px;
    aspect-ratio: 1/1;
    gap: 2px;
flex-shrink:0;

    margin-top: 25px; /* 👈 pushes board down */
}

.board-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* tiles */

.tile {

    aspect-ratio: 1/1;
    border-radius: 10px;
    background-repeat: no-repeat;
    cursor: pointer;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.15);

}

.tile.selected {
    outline: 2px solid rgba(255,255,255,0.7);
    transform: scale(1.05);
    transition: 0.2s ease;

}

body.pink .tile.selected {
    box-shadow: 0 0 18px var(--pink-glow);
}

body.lavender .tile.selected {
    box-shadow: 0 0 18px var(--lavender-glow);
}

body.blue .tile.selected {
    box-shadow: 0 0 18px var(--blue-glow);
}

/* ======================
   SIDE PANEL — GLASS CARD (FINAL UPGRADE)
====================== */

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;

    width: 170px;
    flex-shrink: 0;

    padding: 14px;
    border-radius: 20px;

    /* GLASS CORE */
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    border: 1px solid rgba(255, 255, 255, 0.35);

    /* FLOAT EFFECT */
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);

    position: relative;
    z-index: 5;

    transition: all 0.3s ease;
}

/* ======================
   SYSTEM BUTTON UPGRADE
====================== */

/* This wrapper makes the two buttons share one row */
.system-controls {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

/* Specific styling for the smaller, "pilled" utility buttons */
.system-btn {
    flex: 1; /* Makes Music and Dark equal width */
    padding: 8px 5px !important; /* Overrides general button padding */
    font-size: 12px !important;
    border-radius: 50px !important; /* High roundness for the pill look */
    background: rgba(255, 255, 255, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    font-family: "Fredoka", sans-serif; /* Clean font for UI */
    margin: 0 !important;
}

/* Specialized Back Button styling */
.back-btn {
    width: 100% !important;
    margin-top: 12px !important;
    background: rgba(0, 0, 0, 0.05) !important;
    opacity: 0.8;
}

/* Hover glow for system buttons to match your theme */
body.pink .system-btn:hover { background: var(--pink-hot) !important; color: #ff4fa3; }
body.lavender .system-btn:hover { background: #f3d1ff !important; color: #b57aff; }
body.blue .system-btn:hover { background: #d6eaf9 !important; color: #4fa3ff; }

/* subtle hover lift (mobile game feel) */
.side-panel:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 14px 35px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

body.dark .side-panel {
    /* glass base */
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);

    border: 1px solid rgba(255, 255, 255, 0.10);

    box-shadow:
        0 18px 45px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);

    color: white;

    transition: all 0.3s ease;
}

/* timer */

#timer {

    text-align: center;

    font-size: 18px;

}

/* ======================
   WIN SCREEN (FIXED RELIABLE VERSION)
====================== */

.win-screen {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none; /* IMPORTANT FIX */
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.win-screen.show {
    display: flex;
}

/* 🌟 UPDATED WIN CARD GLOW-UP 🌟 */
.win-card {
    background: rgba(255, 255, 255, 0.85); /* See-through glass vibe */
    backdrop-filter: blur(10px);           /* Frosted effect */
    padding: 30px;
    border-radius: 30px;
    text-align: center;
    width: 320px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    
    /* This makes it pop out smoothly */
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: 0.3s ease;
}

.win-card.win-hint {
    background: white;
    color: #2a2433;
}

/* PINK */
body.pink .win-card.win-hint {
    background: linear-gradient(135deg, #ffe4ec, #ffd6f6);
    box-shadow: 0 0 20px var(--pink-glow);
}

/* LAVENDER */
body.lavender .win-card.win-hint {
    background: linear-gradient(135deg, #e6ccff, #f3d1ff);
    box-shadow: 0 0 20px var(--lavender-glow);
}

/* BLUE */
body.blue .win-card.win-hint {
    background: linear-gradient(135deg, #d6eaf9, #bde0ff);
    box-shadow: 0 0 20px var(--blue-glow);
}

.win-card.win-win {

    background: linear-gradient(135deg, #ff8fcf, #ffd6f6);
    box-shadow: 0 0 25px rgba(255, 143, 207, 0.6);
    color: white;

}

.win-card.win-loss {
    background: linear-gradient(135deg, #2a2433, #1e1a24);
    box-shadow: 0 0 20px rgba(0,0,0,0.4);
    color: white;

}

/* ======================
   CHALLENGE MODE POPUP
====================== */

.challenge-banner {

    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;

}

.challenge-banner.hidden {
    display: none;

}

.challenge-card {
    background: white;
    padding: 25px;
    border-radius: 25px;
    text-align: center;
    width: 300px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    animation: pop 0.25s ease;

}

@keyframes pop {

    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }

}

/* ======================
   BUTTONS
====================== */

.btn {
    margin: 6px auto;
    padding: 12px;
    border-radius: 15px;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #ffe4ec, #ffd6f6);
    transition: 0.2s;
}

.btn:hover {
    transform: scale(1.05);
}

/* 🌟 THEME BUTTON GLOW (ADD RIGHT HERE) */
body.pink .btn:hover {
    box-shadow: 0 0 12px var(--pink-glow);
}

body.lavender .btn:hover {
    box-shadow: 0 0 12px var(--lavender-glow);
}

body.blue .btn:hover {
    box-shadow: 0 0 12px var(--blue-glow);
}

.btn.selected {
    background: #ff4fa3;
    color: white;
}

/* play button */

.play-btn {

    width: 100%;

    margin-top: 15px;

    padding: 14px;

    border-radius: 20px;

    border: none;

    background: linear-gradient(135deg, var(--pink-main), var(--pink-hot));

    color: white;

}

/* ======================
   START BUTTON PULSE FIX
====================== */

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 79, 163, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(255, 79, 163, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 79, 163, 0.4);
    }
}

.play-btn {
    animation: pulse 1.8s infinite ease-in-out;
}

/* ======================
   🎉 CONFETTI SYSTEM
====================== */

.confetti-container {

    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 9999;
}

/* confetti pieces */

.confetti {

    position: absolute;
    width: 8px;
    height: 14px;
    opacity: 0.9;
    animation: fall linear forwards;

}

/* animation */

@keyframes fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
    }

}

/* Win Screen animation*/
@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* 🎨 THEME COLORS */

/* PINK */

body.pink .confetti {

    background: #ff6fae;

}

/* LAVENDER */

body.lavender .confetti {

    background: #b57aff;

}

/* BLUE */

body.blue .confetti {

    background: #4fa3ff;

}

/* ======================
   SIDE PANEL DARK THEME TINTS
====================== */

body.pink.dark .side-panel {
    background: rgba(255, 79, 163, 0.08);
    border: 1px solid rgba(255, 143, 207, 0.25);
}

body.lavender.dark .side-panel {
    background: rgba(181, 122, 255, 0.08);
    border: 1px solid rgba(181, 122, 255, 0.25);
}

body.blue.dark .side-panel {
    background: rgba(79, 163, 255, 0.08);
    border: 1px solid rgba(79, 163, 255, 0.25);
}

/* ======================
   ✨ CURSOR GLOW + SPARKLES
====================== */

/* subtle glow around cursor via body */
body.pink {
    cursor: auto;
}

body.lavender {
    cursor: auto;
}

body.blue {
    cursor: auto;
}

/* sparkle particles */
.cursor-sparkle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.8;
    animation: sparkle-fade 0.6s linear forwards;
    background: white
}

/* theme colors */
body.pink .cursor-sparkle {
    background: #ff6fae;
}

body.lavender .cursor-sparkle {
    background: #b57aff;
}

body.blue .cursor-sparkle {
    background: #4fa3ff;
}

/* animation */
@keyframes sparkle-fade {
    0% {
        transform: scale(1) translateY(0px);
        opacity: 1;
    }
    100% {
        transform: scale(0.3) translateY(-10px);
        opacity: 0;
    }
}

/* ======================
   TIMER + STREAK SPACING FIX
====================== */

#timer,
#streak {
    margin: 0; /* removes default <p> spacing */
    text-align: center;
    line-height: 1.2;
}

#timer {
    margin-bottom: 4px; /* small controlled spacing ONLY */
}

/* ======================
   💡 HINT READY PULSE
====================== */

@keyframes hintPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 143, 207, 0);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 18px rgba(255, 143, 207, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 143, 207, 0);
    }
}

.hint-ready {
    animation: hintPulse 0.8s ease-in-out 2;
}

/* ======================
   BOARD TRANSITION FX
====================== */

#puzzle-board.fade-out {
    opacity: 0;
    transform: scale(0.98);
    transition: 0.25s ease;
}

#puzzle-board {
    opacity: 1;
    transform: scale(1);
    transition: 0.25s ease;
}

/* 🌟 THEME-AWARE WIN CARDS */

/* PINK THEME */
body.pink .win-card.win-win {
    background: linear-gradient(135deg, #ff8fcf, #ffd6f6);
    box-shadow: 0 0 25px var(--pink-glow);
}

/* LAVENDER THEME */
body.lavender .win-card.win-win {
    background: linear-gradient(135deg, #b57aff, #e6ccff);
    box-shadow: 0 0 25px var(--lavender-glow);
}

/* BLUE THEME */
body.blue .win-card.win-win {
    background: linear-gradient(135deg, #4fa3ff, #d6eaf9);
    box-shadow: 0 0 25px var(--blue-glow);
}


.leaderboard-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 20px;
    color: white;
}

/* 🌌 THE OVERLAY (The background for the Hall of Fame) */
#leaderboard-overlay {
    display: none; /* 🔑 Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6); /* Darkens the game behind the card */
    backdrop-filter: blur(10px); /* Gives that frosty look from your teaser */
    z-index: 9999; /* 🚀 Ensures it stays ON TOP of the start screen */
    justify-content: center;
    align-items: center;
}

/* 🎀 THE TRIGGER (Shows the overlay when 'show' class is added) */
#leaderboard-overlay.show {
    display: flex;
}

/* 📱 Responsive tweak to make sure it's centered */
.leaderboard-card {
    text-align: center;
    min-width: 280px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* ⏳ Cooldown State: Dims the button and stops clicks */
.btn-disabled {
    opacity: 0.5;
    filter: grayscale(100%);
    cursor: not-allowed !important;
    transform: scale(0.98);
    animation: none !important; /* Ensures it doesn't pulse while cooling down */
}

/* ✨ Ready State: Triggers the pulse animation you already defined */
.hint-ready {
    animation: hintPulse 2s infinite ease-in-out;
    border: 2px solid rgba(255, 143, 207, 0.8);
    cursor: pointer;
}

/* 🌪️ THE CHAOS PULSE */
@keyframes chaosPulse {
    0% { transform: scale(1); filter: brightness(1); }
    25% { transform: scale(1.02); filter: brightness(1.2) sepia(0.5) hue-rotate(-50deg); box-shadow: 0 0 30px rgba(255, 0, 0, 0.4); }
    50% { transform: scale(0.98); }
    75% { transform: scale(1.02); filter: brightness(1.2) sepia(0.5) hue-rotate(-50deg); box-shadow: 0 0 30px rgba(255, 0, 0, 0.4); }
    100% { transform: scale(1); filter: brightness(1); }
}
