:root {
    --cell-size: 64px;
    --grid-gap: 10px;
    --bg-color: #fff0f5;
    --grid-bg: #ffe4e1;
    --wall-color: #b0c4de;
    --font-main: 'Comic Sans MS', 'Chalkboard SE', 'Quicksand', sans-serif;
    --primary-pink: #ffb7b2;
    --secondary-pink: #ff8b94;
    --kawaii-blue: #a2d2ff;
    --kawaii-yellow: #ffd166;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 182, 193, 0.4) 0%, transparent 20%),
        radial-gradient(circle at 80% 70%, rgba(173, 216, 230, 0.4) 0%, transparent 20%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 224, 0.4) 0%, transparent 30%);
    background-size: 100% 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow: hidden;
}

/* Background floating icons */
.bg-icon {
    position: fixed;
    font-size: 30px;
    opacity: 0.15;
    pointer-events: none;
    z-index: -1;
    filter: blur(1px);
}

.screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    background-color: rgba(255, 240, 245, 0.95);
    backdrop-filter: blur(5px);
}

.intro-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
    padding: 20px;
}

.intro-cat {
    margin: 20px 0;
    animation: floatCat 3s ease-in-out infinite;
    filter: drop-shadow(0 10px 0 rgba(0,0,0,0.1));
}

@keyframes floatCat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(2deg); }
}

.intro-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    align-items: center;
    margin-top: 30px;
}

.hidden { display: none !important; }

#music-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    font-size: 1.5rem;
    background: #fff;
    border: 3px solid var(--primary-pink);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--primary-pink);
    transition: transform 0.2s;
}

#music-toggle:hover { transform: scale(1.1); }

.animated-title {
    display: flex;
    gap: 30px; /* Space between words */
    font-size: 4rem;
    color: var(--secondary-pink);
    text-shadow: 4px 4px 0 #fff, 6px 6px 0 rgba(0,0,0,0.1);
    font-family: 'Fredoka One', 'Comic Sans MS', cursive;
    margin-bottom: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.word {
    display: flex;
    gap: 5px; /* Space between letters */
}

.animated-title span span {
    display: inline-block;
    animation: bounceLetter 0.6s ease-in-out infinite alternate;
}

/* Stagger animations - targeting the inner spans */
.word:nth-child(1) span:nth-child(1) { animation-delay: 0s; }
.word:nth-child(1) span:nth-child(2) { animation-delay: 0.1s; }
.word:nth-child(1) span:nth-child(3) { animation-delay: 0.2s; }
.word:nth-child(1) span:nth-child(4) { animation-delay: 0.3s; }
.word:nth-child(2) span:nth-child(1) { animation-delay: 0.4s; }
.word:nth-child(2) span:nth-child(2) { animation-delay: 0.5s; }
.word:nth-child(2) span:nth-child(3) { animation-delay: 0.6s; }
.word:nth-child(3) span:nth-child(1) { animation-delay: 0.7s; }
.word:nth-child(3) span:nth-child(2) { animation-delay: 0.8s; }
.word:nth-child(3) span:nth-child(3) { animation-delay: 0.9s; }
.word:nth-child(3) span:nth-child(4) { animation-delay: 1.0s; }

button {
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: bold;
    border: none;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.big-btn {
    background: linear-gradient(180deg, #ffb7b2 0%, #ff8b94 100%);
    padding: 18px 0;
    width: 80%;
    max-width: 320px;
    font-size: 1.8rem;
    border-radius: 100px;
    color: white;
    box-shadow: 0 8px 0 #e5989b;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.big-btn::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.big-btn:hover {
    transform: scale(1.05) translateY(-4px);
    box-shadow: 0 12px 0 #e5989b;
}

.big-btn:hover::after { opacity: 1; }

.big-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #e5989b;
}

.big-btn.alt {
    background: linear-gradient(180deg, #a2d2ff 0%, #8ecae6 100%);
    box-shadow: 0 8px 0 #78b1cc;
}

.big-btn.alt:hover {
    box-shadow: 0 12px 0 #78b1cc;
}

.big-btn.alt:active {
    box-shadow: 0 2px 0 #78b1cc;
}

#reset-btn {
    background: linear-gradient(180deg, #b2e2f2 0%, #8ecae6 100%);
    box-shadow: 0 5px 0 #78b1cc;
    padding: 10px 25px;
    font-size: 1.1rem;
    border-radius: 50px;
    color: white;
    margin-left: 15px;
}

#reset-btn:hover { transform: scale(1.1); }

.small-btn {
    background: linear-gradient(180deg, #ffb7b2 0%, #ff8b94 100%);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 1.4rem;
    margin-left: 10px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 0 #e5989b;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.1);
}

.small-btn:hover {
    transform: scale(1.15) translateY(-3px);
    filter: brightness(1.1);
}

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

#home-btn {
    background: linear-gradient(180deg, #ffd330 0%, #f9ca24 100%);
    box-shadow: 0 4px 0 #d4a017;
}

#game-instr-btn {
    background: linear-gradient(180deg, #a2d2ff 0%, #70a1ff 100%);
    box-shadow: 0 4px 0 #5352ed;
}

header {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

header h1 {
    font-family: 'Fredoka One', 'Comic Sans MS', cursive;
    color: var(--secondary-pink);
    text-shadow: 2px 2px 0 #fff, 4px 4px 0 rgba(0,0,0,0.05);
    font-size: 2.5rem;
    margin: 15px 0 20px 0;
    text-align: center;
    letter-spacing: 1px;
}

#status-bar {
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: #ff8b94;
    font-weight: bold;
    background: #fff;
    padding: 10px 30px;
    border-radius: 50px;
    box-shadow: 0 5px 0 rgba(255, 139, 148, 0.1);
}

#grid-container {
    display: grid;
    background-color: var(--grid-bg);
    padding: var(--grid-gap);
    border-radius: 30px;
    gap: var(--grid-gap);
    margin: 0 auto;
    border: 6px solid #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    touch-action: none; /* Prevents browser scrolling/zooming on the game grid */
}

canvas {
    touch-action: none;
    display: block; /* Removes bottom spacing */
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .animated-title {
        font-size: 2.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .big-btn {
        padding: 15px 40px;
        font-size: 1.5rem;
    }

    .intro-cat svg {
        width: 100px;
        height: 100px;
    }

    #music-toggle {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        top: 10px;
        right: 10px;
    }
    
    #status-bar {
        font-size: 1rem;
        padding: 8px 15px;
    }
    
    .small-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    header h1 {
        font-size: 1.5rem;
        margin: 10px 0;
    }

    .level-content {
        padding: 30px 20px;
        border-width: 6px;
    }

    .level-content::before, .level-content::after {
        font-size: 1.5rem;
    }

    #next-level-title {
        font-size: 2.2rem;
        margin-bottom: 20px;
    }

    #start-level-btn {
        min-width: 180px;
        font-size: 1.2rem;
        padding: 12px 25px;
    }
}

.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    background-color: #fff;
    border-radius: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: 0 5px 0 #f0f0f0;
}

.cat-wrapper {
    width: 95%;
    height: 95%;
    z-index: 5;
}

.selection-indicator {
    position: absolute;
    top: -30px;
    font-size: 28px;
    z-index: 10;
}

.sparkle-pop {
    position: absolute;
    font-size: 20px;
    pointer-events: none;
    z-index: 100;
}

#version-display {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: var(--secondary-pink);
    opacity: 0.6;
    z-index: 1000;
    pointer-events: none;
    font-family: monospace;
    font-weight: bold;
    white-space: nowrap;
}

#creators-display {
    position: absolute;
    bottom: 45px;
    width: 100%;
    text-align: center;
    font-family: 'Fredoka One', 'Comic Sans MS', cursive;
    color: var(--primary-pink);
    font-size: 1.1rem;
    text-shadow: 2px 2px 0 #fff;
    animation: pulseText 3s ease-in-out infinite;
    pointer-events: none;
    z-index: 1000;
}

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

@media (max-width: 600px) {
    #version-display {
        bottom: 15px;
        font-size: 0.7rem;
    }
    
    #creators-display {
        font-size: 0.9rem;
        bottom: 35px;
    }
}
.balloon { position: fixed; bottom: -120px; width: 60px; height: 80px; border-radius: 50%; z-index: 1500; animation: floatUp 5s forwards; }
@keyframes floatUp { to { transform: translateY(-130vh) rotate(30deg); opacity: 0; } }

/* Level Transition Screen */
.level-content {
    background: #fff;
    padding: 50px;
    border-radius: 40px;
    box-shadow: 0 15px 0 rgba(255, 139, 148, 0.1), 0 25px 50px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 8px solid var(--primary-pink);
    position: relative;
    max-width: 90%;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.level-content::before, .level-content::after {
    content: '🐾';
    position: absolute;
    font-size: 2.5rem;
    top: -20px;
    animation: floatCat 2s ease-in-out infinite;
}

.level-content::before { left: -20px; }
.level-content::after { right: -20px; animation-delay: 1s; }

#next-level-title {
    font-size: 3.5rem;
    color: var(--secondary-pink);
    margin: 0 0 30px 0;
    text-shadow: 3px 3px 0 #fff;
    font-family: 'Fredoka One', 'Comic Sans MS', cursive;
    text-align: center;
}

#start-level-btn {
    min-width: 250px;
    padding: 18px 40px;
    width: auto;
}
