/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Paula's Playhouse vibrant palette */
    --paula-bg-start: #ffe27f;
    --paula-bg-end: #ffb86c;
    --paula-primary: #ff6fb7;
    --paula-primary-dark: #ff4fa3;
    --paula-secondary: #3fd5d0;
    --paula-secondary-dark: #1fb3b4;
    --paula-accent: #ff9a3b;
    --paula-accent-dark: #ff7a1c;
    --paula-soft-green: #c2f970;
    --paula-text: #3a2a26;
    --paula-text-muted: #6f5149;
    --paula-surface: #fff6eb;
}

body {
    font-family: 'Nunito', sans-serif;
    color: var(--paula-text);
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-bg-end) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.screens-stack {
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
}

.screens-stack:focus {
    outline: none;
}

.skip-link {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: -100px;
    background: #333;
    color: #fff;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
    z-index: 1400;
    transition: top 0.25s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.skip-link:focus {
    top: calc(0.75rem + env(safe-area-inset-top));
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1200;
}

/* Respect device safe areas */
.header {
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
    padding-top: calc(0.8rem + env(safe-area-inset-top));
    padding-bottom: calc(0.8rem + env(safe-area-inset-bottom));
}

.title {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    color: var(--paula-primary);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    animation: bounce 2s infinite;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: bounce 2s infinite;
}

.fox-mascot {
    height: clamp(2.2rem, 3vw + 1rem, 4rem);
    width: clamp(2.2rem, 3vw + 1rem, 4rem);
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.1));
    animation: foxBounce 3s ease-in-out infinite;
}

.logo {
    height: clamp(2.2rem, 3.2vw + 1rem, 4rem);
    width: auto;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.1));
}

@keyframes foxBounce {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(-2deg); }
    50% { transform: translateY(-12px) rotate(0deg); }
    75% { transform: translateY(-8px) rotate(2deg); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.settings-btn {
    background: var(--paula-secondary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(63, 213, 208, 0.35);
}

.settings-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(63, 213, 208, 0.45);
}

/* Screen Management */
.screen {
    display: none;
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable both-edges;
    overscroll-behavior-y: contain;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Add bottom safe-area padding to avoid overlap with device UI */
.screen {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
}

/* Prefer dynamic viewport height when supported (mobile address bar) */
@supports (min-height: 100dvh) {
    body, #app {
        min-height: 100dvh;
    }
}

/* Home Button */
.home-btn {
    background: var(--paula-primary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 111, 183, 0.35);
}

.home-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 111, 183, 0.45);
}

/* Hub Screen */
.hub-container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.hub-container h2 {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(1.8rem, 2.8vw + 1rem, 3rem);
    color: var(--paula-primary);
    margin-bottom: 0.5rem;
    text-shadow: 0 6px 18px rgba(255, 111, 183, 0.35);
    animation: bounce 2s infinite;
}

.hub-subtitle {
    font-size: 1.2rem;
    color: var(--paula-secondary-dark);
    margin-bottom: 2rem;
    font-weight: 600;
    text-shadow: 0 4px 12px rgba(63, 213, 208, 0.28);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.games-empty-message {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 1.25rem;
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, rgba(255, 226, 127, 0.6) 0%, rgba(255, 111, 183, 0.18) 100%);
    border-radius: 20px;
    color: var(--paula-text);
    font-weight: 600;
    box-shadow: 0 14px 34px rgba(255, 111, 183, 0.25);
}

.game-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 226, 127, 0.22) 100%);
    border-radius: 20px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 12px 30px rgba(255, 111, 183, 0.22);
    border: 3px solid transparent;
    position: relative;
    overflow: visible;
    aspect-ratio: 1.15;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.game-card:hover,
.game-card:focus-within {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 22px 48px rgba(255, 122, 28, 0.28);
}



.game-card.available {
    border-color: var(--paula-secondary);
    box-shadow: 0 16px 36px rgba(63, 213, 208, 0.3);
}

.game-card.coming-soon {
    opacity: 0.8;
    cursor: not-allowed;
    filter: grayscale(20%);
}



.game-icon {
    font-size: 4rem;
    margin-bottom: 1.2rem;
    display: block;
    animation: float 3s ease-in-out infinite;
}

.game-card.available .game-icon {
    animation: gameIconBounce 3s ease-in-out infinite;
}

@keyframes gameIconBounce {
    0%, 100% { transform: translateY(0px) scale(1); }
    25% { transform: translateY(-8px) scale(1.05); }
    50% { transform: translateY(-12px) scale(1.1); }
    75% { transform: translateY(-8px) scale(1.05); }
}

.game-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.6rem;
    color: var(--paula-text);
    margin-bottom: 0.6rem;
    line-height: 1.2;
}

.game-description {
    color: var(--paula-text-muted);
    font-size: 1rem;
    line-height: 1.4;
    margin-bottom: 1rem;
}

.game-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--paula-secondary) 0%, var(--paula-secondary-dark) 100%);
    color: white;
    font-family: 'Fredoka One', cursive;
    font-size: 0.9rem;
    padding: 0.45rem 1rem;
    border-radius: 25px;
    box-shadow: 0 6px 20px rgba(63, 213, 208, 0.55);
    z-index: 100;
    animation: badgePulse 2s ease-in-out infinite;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    border: 3px solid white;
    font-weight: 600;
    transform: none;
}

.game-badge.coming-soon-badge {
    background: linear-gradient(135deg, var(--paula-primary) 0%, var(--paula-accent) 100%);
    box-shadow: 0 6px 20px rgba(255, 111, 183, 0.45);
    animation: comingSoonBadgePulse 2s ease-in-out infinite;
    transform: rotate(0deg);
}

@keyframes comingSoonBadgePulse {
    0%, 100% {
        transform: rotate(0deg) scale(1);
        box-shadow: 0 6px 20px rgba(255, 111, 183, 0.45);
    }
    50% {
        transform: rotate(0deg) scale(1.05);
        box-shadow: 0 8px 25px rgba(108, 92, 231, 0.7);
    }
}

/* Math Game Styles */
.math-problem-container {
    margin-bottom: 2rem;
    text-align: center;
}

.math-visual-container {
    position: relative;
    display: inline-block;
}

.math-visual {
    margin-bottom: 1.5rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 3px solid var(--paula-secondary);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.math-problem {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(1.6rem, 2.8vw + 0.8rem, 3rem);
    color: var(--paula-text);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.math-answer-area {
    margin-bottom: 2rem;
    text-align: center;
}

.answer-slots {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.answer-slot {
    width: 80px;
    height: 80px;
    background: white;
    border: 3px dashed #ddd;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--paula-text);
    transition: all 0.3s ease;
    position: relative;
}

.answer-slot.filled {
    border-color: var(--paula-secondary);
    border-style: solid;
    background: #f0fffe;
    animation: slotFill 0.5s ease;
}

.answer-slot.correct {
    border-color: var(--paula-soft-green);
    background: #e8f5e8;
}

.answer-slot.drag-over {
    border-color: var(--paula-primary);
    background: #fff0f0;
    transform: scale(1.1);
}

.math-numbers-container {
    margin-bottom: 2rem;
}

.number-tiles {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    min-height: 100px;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.number-tile {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-accent) 100%);
    border: none;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
    cursor: grab;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    user-select: none;
    touch-action: none;
}

.number-tile:active, .number-tile.dragging {
    cursor: grabbing;
    transform: scale(1.1) rotate(5deg);
    z-index: 1000;
    opacity: 0.8;
}

.visual-object {
    font-size: 2.5rem;
    margin: 0.2rem;
    animation: objectBounce 2s ease-in-out infinite;
}

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

@keyframes tileShake {
    0%, 100% { transform: translateX(0) scale(1); }
    25% { transform: translateX(-5px) scale(1.05); }
    75% { transform: translateX(5px) scale(1.05); }
}

.equals-sign {
    font-size: 3rem;
    color: var(--paula-text);
    font-weight: bold;
    margin: 0 1rem;
    display: flex;
    align-items: center;
}

/* Main Screen - Categories */
.categories-container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.categories-container h2 {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(1.4rem, 2.2vw + 0.9rem, 2.5rem);
    color: white;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Responsive grid improvements */
@media (min-width: 1400px) {
    .categories-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
        max-width: 1400px;
    }
}

@media (min-width: 1024px) and (max-width: 1399px) {
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

.category-card {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
    aspect-ratio: 1.2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

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

.category-card:hover::before {
    left: 100%;
}

/* Disable shimmer effect for coming soon cards */
.category-card.coming-soon::before {
    display: none !important;
}

.category-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border-color: var(--paula-primary);
}

.category-icon {
    font-size: clamp(3rem, 10vw, 4rem);
    margin-bottom: 1rem;
    display: block;
    animation: float 3s ease-in-out infinite;
}

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

.category-name {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(1.25rem, 4.5vw, 1.5rem);
    color: var(--paula-text);
    margin-bottom: 0.5rem;
}

.category-description {
    color: var(--paula-text-muted);
    font-size: clamp(0.95rem, 3.5vw, 1.05rem);
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.back-btn {
    background: var(--paula-primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 111, 183, 0.45);
}

.score-info {
    display: flex;
    gap: 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    color: var(--paula-text);
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    align-items: center;
}

.game-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 0 0.75rem;
    text-align: center;
}

@media (min-width: 900px) {
    .game-container {
        padding: 0;
    }
}

/* Word Image */
.word-image-container {
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
    display: inline-block;
}

.word-image {
    display: inline-block;
    font-size: 8rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 3px solid var(--paula-secondary);
    animation: imageFloat 3s ease-in-out infinite;
    min-width: 200px;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.word-image.hidden {
    display: none;
}

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

/* Speaker Button */
.speaker-btn {
    position: absolute;
    bottom: -20px;
    right: -20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--paula-primary) 0%, var(--paula-primary-dark) 100%);
    border: none;
    border-radius: 50%;
    font-size: 1.8rem;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 111, 183, 0.45);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: speakerPulse 2s ease-in-out infinite;
    z-index: 10;
    border: 3px solid white;
}

.speaker-btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
    animation: speakerPulse 0.5s ease-in-out infinite;
}

.speaker-btn:active {
    transform: translateY(-1px) scale(1.05);
}

.speaker-btn.speaking {
    animation: speakerActive 0.8s ease-in-out infinite;
    background: linear-gradient(135deg, #11998e 0%, #00b894 100%);
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.6);
}

@keyframes speakerPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(255, 111, 183, 0.45);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
    }
}

@keyframes speakerActive {
    0%, 100% { 
        transform: scale(1.05);
        box-shadow: 0 8px 25px rgba(0, 184, 148, 0.6);
    }
    25% { 
        transform: scale(1.15);
        box-shadow: 0 12px 30px rgba(0, 184, 148, 0.8);
    }
    75% { 
        transform: scale(1.1);
        box-shadow: 0 10px 28px rgba(0, 184, 148, 0.7);
    }
}

/* Word Display */
.word-display {
    margin-bottom: 2rem;
}

.word-slots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.letter-slot {
    width: 60px;
    height: 60px;
    background: white;
    border: 3px dashed #ddd;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: var(--paula-text);
    transition: all 0.3s ease;
    position: relative;
}

.letter-slot.filled {
    border-color: var(--paula-secondary);
    border-style: solid;
    background: #f0fffe;
    animation: slotFill 0.5s ease;
}

@keyframes slotFill {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.letter-slot.correct {
    border-color: var(--paula-soft-green);
    background: #e8f5e8;
}

.letter-slot.drag-over {
    border-color: var(--paula-primary);
    background: #fff0f0;
    transform: scale(1.1);
}

/* Scrambled Letters */
.letters-container {
    margin-bottom: 2rem;
}

.scrambled-letters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    min-height: 80px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.letter-tile {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--paula-primary) 0%, #fde0ed 100%);
    border: none;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    cursor: grab;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    user-select: none;
    touch-action: none;
}

.letter-tile:hover {
    transform: translateY(-5px) rotate(5deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.letter-tile:active, .letter-tile.dragging {
    cursor: grabbing;
    transform: scale(1.1) rotate(10deg);
    z-index: 1000;
    opacity: 0.8;
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    transition: opacity 0.3s ease;
    padding-bottom: env(safe-area-inset-bottom);
}

.score-toggle-btn {
    border: none;
    background: rgba(255, 255, 255, 0.85);
    color: var(--paula-text);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.score-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.score-toggle-btn.is-active {
    background: linear-gradient(135deg, #11998e 0%, #00b894 100%);
    color: #fff;
    box-shadow: 0 10px 28px rgba(0, 206, 201, 0.35);
}

.score-toggle-btn.is-active::after {
    content: 'ON';
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
    letter-spacing: 0.08em;
    margin-left: 0.35rem;
}

.score-toggle-btn:not(.is-active)::after {
    content: 'OFF';
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.07);
    letter-spacing: 0.08em;
    margin-left: 0.35rem;
}

.game-btn {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-bg-end) 100%);
    color: white;
    border: none;
    padding: 0.7rem 1.4rem;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.hint-btn {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-primary) 100%);
    color: var(--paula-text);
}



.next-btn {
    background: linear-gradient(135deg, #11998e 0%, #00b894 100%);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4); }
    50% { box-shadow: 0 8px 25px rgba(0, 184, 148, 0.6); }
    100% { box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4); }
}

/* Settings Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

/* Improve modal sizing on mobile (iOS URL bar, notches) */
@supports (height: 100dvh) {
    .modal-content { max-height: calc(100dvh - 2rem); }
}

.modal-body {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
}

@keyframes modalSlideIn {
    from { transform: scale(0.8) translateY(-50px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-bg-end) 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 2rem;
}

.settings-section + .settings-section {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid #eef0f7;
}

.settings-section h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--paula-accent);
    margin: 0 0 0.35rem;
}

.settings-section-note {
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
    color: var(--paula-text-muted);
}

.setting-note {
    margin: 0.25rem 0 0.75rem;
    font-size: 0.9rem;
    color: var(--paula-text-muted);
}

.setting-group {
    margin-bottom: 2rem;
    text-align: left;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--paula-text);
}

.setting-group select,
.setting-group input[type="checkbox"] {
    padding: 0.8rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    width: 100%;
}

.setting-group input[type="checkbox"] {
    width: auto;
    transform: scale(1.5);
    margin: 0.5rem 0 0;
}

/* Success Animation */
.success-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(5px);
}

.success-animation.active {
    display: flex;
    animation: successFade 2s ease;
}

@keyframes successFade {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

.success-content {
    text-align: center;
    color: white;
    animation: successBounce 2s ease;
}

@keyframes successBounce {
    0% { transform: scale(0.5); }
    20% { transform: scale(1.2); }
    40% { transform: scale(0.9); }
    60% { transform: scale(1.1); }
    80% { transform: scale(1); }
    100% { transform: scale(1); }
}

.success-emoji {
    font-size: 8rem;
    margin-bottom: 1rem;
    animation: spin 2s ease;
}

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

.success-text {
    font-family: 'Fredoka One', cursive;
    font-size: 3rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hub-container h2 { font-size: clamp(1.6rem, 4vw + 0.8rem, 2.5rem); }
    
    .hub-subtitle {
        font-size: 1rem;
    }
    
    .games-grid { grid-template-columns: repeat(2, 1fr); gap: 0.9rem; max-width: 700px; }
    
    .game-card {
        padding: 1.2rem;
        aspect-ratio: 1;
    }
    
    .game-icon { font-size: 3rem; }
    
    .game-title { font-size: 1.25rem; }
    
    .game-description { font-size: 0.85rem; }
    
    .game-badge {
        font-size: 0.75rem;
        padding: 0.35rem 0.9rem;
        top: 8px;
        right: 8px;
        transform: none;
    }
    
    .header {
        padding: calc(0.6rem + env(safe-area-inset-top)) calc(1rem + env(safe-area-inset-right))
                 calc(0.6rem + env(safe-area-inset-bottom)) calc(1rem + env(safe-area-inset-left));
        flex-direction: row;
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .header > * {
        flex-shrink: 0;
    }

    .title {
        font-size: 1.6rem;
    }

    .logo-container {
        gap: 0.3rem;
        justify-content: center;
        flex-basis: 100%;
        order: -1;
    }

    .home-btn,
    .settings-btn {
        flex: 1 1 140px;
        text-align: center;
    }
    
    .fox-mascot {
        height: 3rem;
        width: 3rem;
    }
    
    .logo {
        height: 3rem;
    }
    
    .categories-container h2 {
        font-size: 2rem;
    }
    
    .categories-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; max-width: 100%; }
    
    .category-card { padding: 1.2rem; aspect-ratio: 1.05; }
    
    .category-icon { font-size: clamp(2.8rem, 13vw, 3.4rem); }
    
    .category-name { font-size: clamp(1.15rem, 5.5vw, 1.35rem); }
    
    .category-description { font-size: clamp(0.95rem, 4vw, 1.05rem); }
    
    .game-header {
        flex-direction: row;
        gap: 0.8rem;
        text-align: center;
        padding: 0.5rem 0.8rem;
    }
    
    .score-info {
        flex-direction: row;
        gap: 1rem;
        font-size: 0.9rem;
    }

    .score-toggle-btn {
        font-size: 0.75rem;
        padding: 0.35rem 0.75rem;
        gap: 0.25rem;
    }
    
    .word-slots {
        gap: 0.3rem;
    }
    
    .letter-slot,
    .letter-tile {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .scrambled-letters {
        gap: 0.5rem;
    }
    
    .game-controls { flex-direction: column; align-items: center; margin-top: 0.6rem; }
    
    .game-btn { width: 100%; max-width: 220px; }
    
    .success-emoji {
        font-size: 6rem;
    }
    
    .success-text {
        font-size: 2rem;
    }
    
    .word-image { font-size: 5rem; padding: 1.2rem; min-width: 140px; min-height: 110px; }
    
    .speaker-btn {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        bottom: -15px;
        right: -15px;
    }
}

@media (max-width: 600px) {
    .games-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
    .screen { padding: 1rem; }

    .hub-container,
    .categories-container {
        padding: 0 0.4rem;
    }

    .game-container { padding: 0 0.5rem; }

    .game-header { justify-content: center; }

    .game-controls {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .games-grid { grid-template-columns: 1fr; }
    .hub-container h2 { font-size: 2rem; }
    
    .hub-subtitle { font-size: 0.9rem; display: none; }
    
    .games-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .game-card {
        padding: 1.2rem;
    }
    
    .game-icon {
        font-size: 3rem;
    }
    
    .game-title {
        font-size: 1.2rem;
    }
    
    .game-description {
        font-size: 0.8rem;
    }
    
    .game-badge { font-size: 0.7rem; padding: 0.3rem 0.8rem; top: 8px; right: 8px; transform: none; }
    
    .screen {
        padding: 0.8rem;
    }
    
    .title {
        font-size: 1.4rem;
    }
    
    .header {
        padding: calc(0.5rem + env(safe-area-inset-top)) calc(0.8rem + env(safe-area-inset-right))
                 calc(0.5rem + env(safe-area-inset-bottom)) calc(0.8rem + env(safe-area-inset-left));
    }
    
    .logo-container {
        gap: 0.2rem;
    }
    
    .fox-mascot {
        height: 2.5rem;
        width: 2.5rem;
    }
    
    .logo {
        height: 2.5rem;
    }
    
    .categories-container h2 {
        font-size: 1.5rem;
    }
    
    .categories-grid { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
    
    .letter-slot,
    .letter-tile {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .word-image {
        font-size: 4rem;
        padding: 1rem;
        min-width: 120px;
        min-height: 100px;
    }
    
    .speaker-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
        bottom: -10px;
        right: -10px;
    }
    
    /* Math Game Mobile Styles */
    .math-visual {
        padding: 1rem;
        min-height: 80px;
        gap: 0.5rem;
    }
    
    .math-problem {
        font-size: 2rem;
    }
    
    .answer-slot {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .number-tile {
        width: 55px;
        height: 55px;
        font-size: 2rem;
    }
    
    .visual-object {
        font-size: 2rem;
    }
    
    .equals-sign {
        font-size: 2rem;
        margin: 0 0.5rem;
    }
}

@media (max-width: 360px) {
    .header {
        gap: 0.4rem;
    }

    .home-btn,
    .settings-btn {
        flex-basis: 100%;
        max-width: none;
    }

    .games-grid,
    .categories-grid {
        grid-template-columns: 1fr;
    }

    .category-card,
    .game-card {
        padding: 1rem;
    }

    .letter-slot,
    .letter-tile {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .game-btn {
        max-width: 240px;
    }

    .phonics-options {
        grid-template-columns: 1fr;
        padding: 0.7rem;
        gap: 0.6rem;
    }

    .phonics-option {
        width: 100%;
        min-height: 88px;
        padding: 0.6rem;
    }

    .phonics-emoji {
        font-size: 2.4rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .letter-tile {
        cursor: pointer;
    }
    
    .letter-tile:hover {
        transform: none;
    }
    
    .letter-tile:active {
        transform: scale(1.1);
    }
    
    .category-card:hover {
        transform: none;
    }
    
    .category-card:active {
        transform: scale(0.95);
    }
}

/* Small-height landscape (e.g., phones rotated) */
@media (max-height: 600px) and (orientation: landscape) {
    .game-container { max-width: 900px; }
    .word-image { font-size: 4rem; padding: 1rem; min-width: 120px; min-height: 100px; }
    .speaker-btn { width: 46px; height: 46px; font-size: 1.2rem; bottom: -10px; right: -10px; }
    .letter-slot, .letter-tile { width: 46px; height: 46px; font-size: 1.3rem; }
    .number-tile { width: 52px; height: 52px; font-size: 1.6rem; }
    .math-problem { font-size: clamp(1.2rem, 3.2vw + 0.6rem, 2.2rem); }
    .game-header { padding: 0.4rem 0.6rem; }
    .score-info { font-size: 0.85rem; gap: 0.6rem; }
}

/* Make game header wrap nicely on narrow screens */
@media (max-width: 600px) {
    .game-header { flex-wrap: wrap; row-gap: 0.5rem; }
    .score-info { width: 100%; justify-content: center; }
}

/* Improve button responsiveness on touch devices */
button, .game-btn { touch-action: manipulation; }

/* Phonics setup grid */
.phonics-sound-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.9rem;
}

@media (max-width: 480px) {
    .phonics-sound-list { grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); }
}

/* Chip-style sound selector */
.phonics-sound-list label {
    position: relative;
    display: block;
    padding: 0;
    user-select: none;
}

.phonics-sound-list label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.phonics-sound-list label span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.85rem 0.9rem;
    background: linear-gradient(180deg, #f9fafb 0%, #f1f3f5 100%);
    border: 2px solid #e9ecef;
    border-radius: 14px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--paula-text);
    box-shadow: 0 2px 0 rgba(0,0,0,0.04), inset 0 -3px 0 rgba(0,0,0,0.02);
    transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.phonics-sound-list label:hover span {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.phonics-sound-list label input[type="checkbox"]:focus + span {
    outline: 3px solid rgba(255, 111, 183, 0.45);
    outline-offset: 2px;
}

.phonics-sound-list label input[type="checkbox"]:checked + span {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-bg-end) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 10px 24px rgba(255, 111, 183, 0.45);
}

.phonics-sound-list label input[type="checkbox"]:checked + span::after {
    content: '✓';
    font-weight: 900;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

/* Phonics modal sizing and spacing */
#phonicsModal .modal-content {
    max-width: 680px;
}

#phonicsModal .modal-header {
    background: linear-gradient(135deg, var(--paula-primary) 0%, var(--paula-accent) 100%);
}

#phonicsModal .modal-body {
    padding: 1.8rem 2.2rem 1.6rem 2.2rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(244,246,255,0.92) 100%);
}

.phonics-modal-intro {
    display: grid;
    gap: 0.3rem;
    margin-bottom: 1.1rem;
}

.modal-body-title {
    font-weight: 700;
    color: var(--paula-text);
    margin: 0;
}

.modal-body-tip {
    margin: 0;
    font-size: 0.95rem;
    color: var(--paula-text-muted);
}

.phonics-modal-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    box-shadow: 0 10px 24px rgba(63, 213, 208, 0.2);
    margin-bottom: 1.2rem;
}

.summary-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--paula-text-muted);
}

.summary-value {
    font-family: 'Fredoka One', cursive;
    font-size: 1.6rem;
    color: var(--paula-accent);
}

.summary-value.is-empty {
    color: #ef4444;
}

#phonicsModal .modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    margin-top: 1.6rem;
    background: rgba(255,255,255,0.85);
    border-radius: 18px;
    padding: 1.1rem 1.3rem;
    box-shadow: 0 18px 40px rgba(79,114,205,0.14);
}

.modal-actions-group {
    flex: 1 1 240px;
    display: grid;
    gap: 0.6rem;
}

.group-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--paula-text);
}

.group-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

#phonicsModal .modal-actions .game-btn {
    border-radius: 16px;
    padding: 0.65rem 1.1rem;
    background: linear-gradient(135deg, var(--paula-primary) 0%, var(--paula-primary-dark) 100%);
    color: #fff;
    box-shadow: 0 12px 24px rgba(114,128,255,0.25);
}

#phonicsModal .modal-actions .game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(114,128,255,0.3);
}

.modal-actions-cta {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    gap: 0.5rem;
}

.cta-label {
    font-weight: 600;
    color: var(--paula-text);
}

#phonicsModal .modal-actions .next-btn {
    background: linear-gradient(135deg, #11998e 0%, #00b894 100%);
    box-shadow: 0 16px 36px rgba(0, 184, 148, 0.35);
    animation: none;
}

#phonicsModal .modal-actions .next-btn:hover {
    box-shadow: 0 20px 42px rgba(0, 184, 148, 0.45);
}

#phonicsModal #phonicsStarterBtn {
    background: linear-gradient(135deg, #f43f8c 0%, #d81b72 100%);
    box-shadow: 0 12px 24px rgba(216, 27, 114, 0.32);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

#phonicsModal #phonicsSelectAll {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-bg-end) 100%);
}

#phonicsModal #phonicsClearAll {
    background: rgba(241,245,249,0.95);
    color: var(--paula-text);
    box-shadow: none;
}

#phonicsModal #phonicsClearAll:hover {
    box-shadow: 0 10px 22px rgba(148,163,184,0.28);
}

/* Color Studio Game */
#colorStudioScreen .game-container {
    background: linear-gradient(180deg, rgba(250,252,255,0.95) 0%, rgba(233,238,255,0.9) 100%);
    border-radius: 28px;
    padding: 1.8rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 20px 60px rgba(80,110,255,0.18);
    min-height: min(600px, 70vh);
}

.color-studio-intro {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.4rem;
    background: rgba(255,255,255,0.92);
    border-radius: 24px;
    padding: 1rem 1.4rem;
    box-shadow: 0 16px 36px rgba(100,118,255,0.18);
}

.color-studio-mascot {
    font-size: 2.4rem;
    line-height: 1;
    filter: drop-shadow(0 6px 12px rgba(99,102,241,0.25));
}

.color-studio-intro-text {
    display: grid;
    gap: 0.2rem;
}

.color-studio-heading {
    margin: 0;
    font-family: 'Fredoka One', cursive;
    font-size: 1.6rem;
    color: var(--paula-accent-dark);
}

.color-studio-subheading {
    margin: 0;
    font-size: 0.95rem;
    color: var(--paula-text);
}

.color-studio-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.color-studio-card {
    background: rgba(255,255,255,0.94);
    border-radius: 24px;
    padding: 1.4rem;
    box-shadow: 0 14px 35px rgba(123, 138, 255, 0.18);
    display: grid;
    gap: 0.9rem;
    position: relative;
}

.color-card-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
    color: var(--paula-accent);
    margin: 0;
}

.color-swatch {
    width: 100%;
    height: 170px;
    border-radius: 20px;
    background: linear-gradient(135deg, #f5f5f5 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--paula-text-muted);
    font-weight: 600;
    text-align: center;
    box-shadow: inset 0 6px 18px rgba(15,23,42,0.1);
    position: relative;
    overflow: hidden;
}

.mix-swatch {
    transition: background 0.3s ease;
}

#colorStudioMixSwatch::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0.32) 0%, rgba(255,255,255,0) 60%);
    pointer-events: none;
}

#colorStudioMixEmpty {
    font-size: 1rem;
    opacity: 0.8;
}

.color-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--paula-text);
    letter-spacing: 0.02em;
}

.color-story {
    margin: 0;
    color: var(--paula-text-muted);
    font-size: 0.95rem;
    line-height: 1.4;
}

.drop-summary {
    background: rgba(99,102,241,0.1);
    border-radius: 14px;
    padding: 0.65rem 0.9rem;
    font-weight: 600;
    color: var(--paula-accent);
    min-height: 44px;
    display: flex;
    align-items: center;
}

.color-feedback {
    min-height: 48px;
    border-radius: 16px;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.8);
    color: var(--paula-text);
    box-shadow: inset 0 0 0 1px rgba(79,111,255,0.12);
    font-weight: 600;
    display: none;
}

.color-feedback.visible {
    display: block;
}

.color-feedback.tone-success {
    background: linear-gradient(135deg, rgba(167,243,208,0.85) 0%, rgba(187,247,208,0.95) 100%);
    color: #3d7f4d;
    box-shadow: 0 12px 24px rgba(34,197,94,0.18);
}

.color-feedback.tone-warn {
    background: linear-gradient(135deg, rgba(254,215,170,0.85) 0%, rgba(255,237,213,0.95) 100%);
    color: var(--paula-accent-dark);
    box-shadow: 0 12px 24px rgba(253,186,116,0.25);
}

.color-feedback.tone-info {
    background: linear-gradient(135deg, rgba(226,232,240,0.88) 0%, rgba(241,245,249,0.96) 100%);
    color: var(--paula-text);
    box-shadow: inset 0 0 0 1px rgba(148,163,184,0.25);
}

.color-studio-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.4rem;
}

.color-studio-container .game-btn {
    border-radius: 16px;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    box-shadow: 0 12px 28px rgba(97,119,255,0.22);
}

.color-studio-container .game-btn.secondary {
    background: rgba(236,239,255,0.95);
    color: var(--paula-text);
    box-shadow: none;
}

.color-studio-container .game-btn.secondary:hover {
    box-shadow: 0 12px 24px rgba(148,163,184,0.25);
}

.color-studio-container .game-btn.hint-btn {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-primary) 100%);
    color: #7c2d12;
}

.color-studio-container #colorStudioCheckBtn {
    background: linear-gradient(135deg, #11998e 0%, #00b894 100%);
    box-shadow: 0 16px 36px rgba(20,184,166,0.32);
}

.color-studio-container #colorStudioCheckBtn:hover {
    box-shadow: 0 20px 42px rgba(20,184,166,0.38);
}

.color-studio-container #colorStudioNextBtn {
    background: linear-gradient(135deg, var(--paula-accent) 0%, var(--paula-accent-dark) 100%);
    box-shadow: 0 16px 36px rgba(249,115,22,0.32);
}

.color-studio-container .game-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.color-studio-palette {
    margin-top: 1.5rem;
    background: rgba(255,255,255,0.92);
    border-radius: 22px;
    padding: 1.2rem 1.4rem;
    box-shadow: 0 14px 38px rgba(75,108,255,0.16);
}

.palette-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.palette-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--paula-accent);
}

.palette-tip {
    margin: 0;
    font-size: 0.9rem;
    color: var(--paula-text-muted);
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.8rem;
    margin-top: 1rem;
}

.palette-button {
    border: none;
    border-radius: 18px;
    padding: 0.8rem 0.9rem;
    background: rgba(247,248,255,0.92);
    box-shadow: 0 12px 26px rgba(117,135,255,0.18);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-weight: 600;
    color: var(--paula-text);
}

.palette-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(117,135,255,0.28);
}

.palette-button:focus-visible {
    outline: 3px solid rgba(99,102,241,0.45);
    outline-offset: 3px;
}

.palette-swatch {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--swatch-color, var(--paula-text-muted));
    box-shadow: inset 0 3px 8px rgba(255,255,255,0.6), inset 0 -4px 10px rgba(0,0,0,0.15);
    position: relative;
}

.palette-swatch::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 65%);
}

.palette-label {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.palette-label .drop-name {
    font-weight: 700;
    font-size: 1rem;
}

.palette-label .drop-note {
    font-size: 0.75rem;
    color: var(--paula-text-muted);
}

.color-studio-container .next-btn {
    animation: none;
}

.color-studio-summary {
    background: rgba(255,255,255,0.92);
    border-radius: 18px;
    padding: 1rem 1.2rem;
    display: none;
    font-weight: 600;
    color: var(--paula-text);
    box-shadow: 0 12px 30px rgba(79,111,255,0.16);
}

.color-studio-summary.visible {
    display: block;
}

/* Poop Patrol Game */
.poop-header {
    background: linear-gradient(135deg, #11998e 0%, #00b894 100%);
    box-shadow: inset 0 -4px 10px rgba(0, 0, 0, 0.12);
}

.poop-scoreboard {
    display: flex;
    gap: 1rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.poop-game-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    padding: 1.2rem;
}

.poop-prompt {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-accent) 100%);
    color: var(--paula-accent-dark);
    font-family: 'Fredoka One', cursive;
    font-size: 1.4rem;
    padding: 0.8rem 1.4rem;
    border-radius: 24px;
    box-shadow: 0 10px 25px rgba(255, 170, 0, 0.35);
    text-align: center;
    max-width: 720px;
}

.poop-play-area {
    position: relative;
    width: min(90vw, 720px);
    height: clamp(340px, 55vh, 520px);
    background: linear-gradient(180deg, #d4f1f7 0%, #fdfcdc 100%);
    border-radius: 28px;
    border: 4px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    cursor: grab;
    touch-action: none;
}

.poop-play-area:active {
    cursor: grabbing;
}

.poop-toilet {
    position: absolute;
    bottom: 12px;
    left: 50%;
    width: 110px;
    height: 120px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    transition: transform 0.12s ease;
    pointer-events: none;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.25));
}

.poop-toilet.wiggle {
    animation: toiletWiggle 0.45s ease;
}

.poop-toilet.sad {
    animation: toiletDroop 0.5s ease;
}

.poop-toilet-face {
    font-size: 2.2rem;
    margin-bottom: -28px;
    z-index: 2;
    transition: transform 0.2s ease;
}

.poop-toilet-bowl {
    font-size: 4.2rem;
    transform: scaleX(-1);
}

.poop-dropping {
    position: absolute;
    top: -72px;
    width: 78px;
    height: 78px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    pointer-events: none;
    transform-origin: center;
    filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.18));
}

.poop-dropping .poop-emoji {
    font-size: 2.6rem;
    line-height: 1;
}

.poop-dropping .poop-letter {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -10%);
    font-size: 1.4rem;
    color: #fff5d6;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.poop-dropping.correct {
    animation: poopGlow 1.1s ease infinite;
}

.poop-dropping.splat {
    animation: poopSplat 0.35s ease forwards;
}

.poop-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
}

.poop-game-over {
    margin: 1.2rem auto 1.8rem;
    max-width: 640px;
    background: #fff6e8;
    border-radius: 24px;
    border: 3px dashed #ff922b;
    box-shadow: 0 12px 28px rgba(255, 146, 43, 0.25);
    padding: 1.5rem;
    text-align: center;
}

.poop-game-over[hidden] {
    display: none;
}

.poop-game-over-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: var(--paula-primary);
    margin-bottom: 0.6rem;
}

.poop-game-over-text {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.poop-game-over-actions {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    flex-wrap: wrap;
}

@keyframes toiletWiggle {
    0%, 100% { transform: translateX(-50%) rotate(0deg); }
    25% { transform: translateX(-50%) rotate(-6deg); }
    50% { transform: translateX(-50%) rotate(6deg); }
    75% { transform: translateX(-50%) rotate(-3deg); }
}

@keyframes toiletDroop {
    0% { transform: translateX(-50%) scale(1); }
    40% { transform: translateX(-50%) scale(0.9); }
    100% { transform: translateX(-50%) scale(1); }
}

@keyframes poopGlow {
    0%, 100% { filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.18)); }
    50% { filter: drop-shadow(0 12px 20px rgba(255, 200, 0, 0.45)); }
}

@keyframes poopSplat {
    0% { transform: scale(1) translateY(0); opacity: 1; }
    70% { transform: scale(1.3, 0.6) translateY(8px); opacity: 0.7; }
    100% { transform: scale(1.4, 0.3) translateY(16px); opacity: 0; }
}

@media (max-width: 768px) {
    .poop-scoreboard {
        font-size: 0.95rem;
        gap: 0.6rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .poop-prompt {
        font-size: 1.2rem;
        padding: 0.7rem 1.1rem;
    }

    .poop-toilet {
        width: 90px;
        height: 100px;
    }

    .poop-toilet-face {
        font-size: 1.8rem;
        margin-bottom: -24px;
    }

    .poop-toilet-bowl {
        font-size: 3.4rem;
    }

    .poop-dropping {
        width: 64px;
        height: 64px;
    }

    .poop-dropping .poop-letter {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .poop-prompt {
        font-size: 1.05rem;
        border-radius: 18px;
    }

    .poop-play-area {
        height: clamp(280px, 50vh, 420px);
        border-radius: 22px;
    }

    .poop-controls {
        gap: 0.6rem;
    }

    .poop-game-over {
        padding: 1.2rem;
    }
}

@media (max-width: 900px) {
    #colorStudioScreen .game-container {
        padding: 1.4rem;
    }
    .color-studio-intro {
        flex-direction: column;
        text-align: center;
    }
    .color-studio-controls {
        justify-content: center;
    }
    .color-studio-container .game-btn {
        flex: 1 1 calc(50% - 0.6rem);
    }
    .palette-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    }
}

@media (max-width: 640px) {
    #colorStudioScreen .game-container {
        padding: 1.2rem;
        border-radius: 20px;
    }
    .color-studio-heading {
        font-size: 1.4rem;
    }
    .color-studio-card {
        padding: 1.1rem;
    }
    .color-swatch {
        height: 140px;
    }
    .color-studio-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .color-studio-container .game-btn {
        width: 100%;
    }
}

@media (max-width: 640px) {
    #phonicsModal .modal-body {
        padding: 1.4rem 1.4rem 1.2rem 1.4rem;
    }

    .phonics-modal-summary {
        flex-direction: column;
        gap: 0.3rem;
        text-align: center;
    }

    .modal-actions-cta {
        align-items: stretch;
    }

    .modal-actions-cta .next-btn {
        width: 100%;
    }
}

/* Focus Mode: cleaner UI during gameplay */
body.focus-mode.focus-game {
    background: #f6f7fb !important;
}

body.focus-mode.focus-game .header {
    display: none !important;
}

/* Hide score counters, keep progress text */
body.focus-mode.focus-game #score,
body.focus-mode.focus-game #mathScore,
body.focus-mode.focus-game #phonicsScore {
    display: none !important;
}

/* Suppress celebratory and decorative effects */
body.focus-mode.focus-game .success-animation,
body.focus-mode.focus-game .confetti-container,
body.focus-mode.focus-game .floating-star {
    display: none !important;
}

/* Reduce motion, shadows, and pulses for key gameplay elements */
body.focus-mode.focus-game .game-btn,
body.focus-mode.focus-game .letter-tile,
body.focus-mode.focus-game .number-tile,
body.focus-mode.focus-game .word-image,
body.focus-mode.focus-game .math-visual,
body.focus-mode.focus-game .scrambled-letters,
body.focus-mode.focus-game .answer-slot,
body.focus-mode.focus-game .category-icon,
body.focus-mode.focus-game .game-icon,
body.focus-mode.focus-game .next-btn {
    animation: none !important;
    transition: none !important;
    box-shadow: none !important;
}

body.focus-mode.focus-game .letter-tile:hover,
body.focus-mode.focus-game .number-tile:hover,
body.focus-mode.focus-game .game-btn:hover {
    transform: none !important;
}

/* Phonics Flashcards */
.phonics-flashcard {
    background: white;
    border-radius: 24px;
    padding: 2rem 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    max-width: 520px;
    margin: 0 auto 1rem auto;
    border: 3px solid var(--paula-accent);
    position: relative;
}

.phonics-flashcard-letter {
    font-family: 'Fredoka One', cursive;
    font-size: 5rem;
    color: var(--paula-accent);
    text-shadow: 2px 2px 0 rgba(108, 92, 231, 0.15);
    letter-spacing: 2px;
}

.phonics-flashcard-example {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.phonics-flashcard-actions {
    display: flex;
    gap: 0.5rem;
}

/* Phonics Fun - Special Recommended Category Styling */
.category-card.phonics-recommended {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-primary) 100%);
    border: 3px solid var(--paula-bg-start);
    position: relative;
    animation: phonicsGlow 2s ease-in-out infinite alternate;
    box-shadow: 0 8px 25px rgba(253, 203, 110, 0.3);
}

.category-card.phonics-recommended:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 15px 35px rgba(253, 203, 110, 0.4);
    border-color: var(--paula-accent);
    animation: phonicsGlow 1s ease-in-out infinite alternate;
}

@keyframes phonicsGlow {
    0% {
        box-shadow: 0 8px 25px rgba(253, 203, 110, 0.3);
    }
    100% {
        box-shadow: 0 12px 30px rgba(253, 203, 110, 0.5);
    }
}

.recommended-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, var(--paula-accent) 0%, #d63031 100%);
    color: white;
    font-family: 'Fredoka One', cursive;
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(225, 112, 85, 0.4);
    z-index: 10;
    animation: badgePulse 2s ease-in-out infinite;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
}

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

/* Coming Soon Badge */
.coming-soon-badge {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--paula-accent) 0%, var(--paula-accent-dark) 100%);
    color: white;
    font-family: 'Fredoka One', cursive;
    font-size: 0.9rem;
    padding: 0.4rem 1.2rem;
    border-radius: 20px;
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
    z-index: 15;
    animation: comingSoonPulse 2s ease-in-out infinite;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
    font-weight: 600;
}

@keyframes comingSoonPulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
        box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
    }
    50% {
        transform: translateX(-50%) scale(1.05);
        box-shadow: 0 8px 25px rgba(255, 111, 183, 0.6);
    }
}

/* Coming Soon Card Disabled State */
.category-card.coming-soon {
    cursor: not-allowed !important;
    position: relative;
    overflow: visible;
    background: white !important;
    opacity: 0.9;
    filter: grayscale(20%);
}

.category-card.coming-soon:hover {
    transform: translateY(-5px) scale(1.02) !important;
    box-shadow: 0 10px 25px rgba(108, 92, 231, 0.2) !important;
    border-color: var(--paula-accent) !important;
    filter: grayscale(10%);
}

.category-card.coming-soon .category-name {
    color: var(--paula-accent) !important;
    font-weight: 700;
}

.category-card.coming-soon .category-description {
    color: var(--paula-text-muted) !important;
    font-style: italic;
    font-weight: 500;
}

.category-card.coming-soon .category-icon {
    opacity: 0.9;
    animation: comingSoonIconFloat 4s ease-in-out infinite;
    filter: none;
}

/* Override phonics-recommended background for coming soon state */
.category-card.phonics-recommended.coming-soon {
    background: white !important;
    border: 3px solid var(--paula-accent) !important;
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.15) !important;
    animation: none !important;
}

.category-card.phonics-recommended.coming-soon:hover {
    background: white !important;
    box-shadow: 0 10px 30px rgba(255, 111, 183, 0.25) !important;
    animation: none !important;
}

@keyframes comingSoonIconFloat {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg); 
        opacity: 0.8;
    }
    25% { 
        transform: translateY(-5px) rotate(-1deg); 
        opacity: 0.9;
    }
    50% { 
        transform: translateY(-8px) rotate(0deg); 
        opacity: 1;
    }
    75% { 
        transform: translateY(-5px) rotate(1deg); 
        opacity: 0.9;
    }
}

.category-card.phonics-recommended .category-name {
    color: #d63031;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.category-card.phonics-recommended .category-description {
    color: var(--paula-text);
    font-weight: 600;
}

.category-card.phonics-recommended .category-icon {
    animation: phonicsIconFloat 3s ease-in-out infinite;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.1));
}

@keyframes phonicsIconFloat {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg); 
    }
    25% { 
        transform: translateY(-8px) rotate(-2deg); 
    }
    50% { 
        transform: translateY(-12px) rotate(0deg); 
    }
    75% { 
        transform: translateY(-8px) rotate(2deg); 
    }
}

/* Mobile responsive adjustments for phonics badge */
@media (max-width: 768px) {
    .recommended-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
        top: -8px;
        right: -8px;
    }
    
    .coming-soon-badge {
        font-size: 0.8rem;
        padding: 0.3rem 1rem;
        top: -12px;
    }
}

@media (max-width: 480px) {
    .recommended-badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.5rem;
        top: -6px;
        right: -6px;
    }
    
    .coming-soon-badge {
        font-size: 0.7rem;
        padding: 0.3rem 0.8rem;
        top: -10px;
    }
}

/* Phonics Pattern Highlighting */
.letter-slot.phonics-pattern {
    background: linear-gradient(135deg, var(--paula-primary) 0%, var(--paula-accent) 100%) !important;
    border-color: var(--paula-accent-dark) !important;
    color: white !important;
    position: relative;
    animation: phonicsPatternGlow 2s ease-in-out infinite alternate;
}

.letter-slot.phonics-pattern.filled {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-accent) 100%) !important;
    border-color: var(--paula-secondary) !important;
    animation: phonicsPatternPulse 1.5s ease-in-out infinite;
}

.letter-slot.phonics-onset {
    background: linear-gradient(135deg, var(--paula-primary-dark) 0%, #d96a99 100%) !important;
    border-color: var(--paula-primary-dark) !important;
    color: white !important;
    animation: phonicsOnsetGlow 2s ease-in-out infinite alternate;
}

.letter-slot.phonics-onset.filled {
    background: linear-gradient(135deg, #11998e 0%, #00b894 100%) !important;
    border-color: var(--paula-secondary-dark) !important;
    animation: phonicsOnsetPulse 1.5s ease-in-out infinite;
}

@keyframes phonicsPatternGlow {
    0% {
        box-shadow: 0 0 10px rgba(255, 111, 183, 0.45);
    }
    100% {
        box-shadow: 0 0 20px rgba(108, 92, 231, 0.8);
    }
}

@keyframes phonicsPatternPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 15px rgba(9, 132, 227, 0.6);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 25px rgba(9, 132, 227, 0.9);
    }
}

@keyframes phonicsOnsetGlow {
    0% {
        box-shadow: 0 0 10px rgba(232, 67, 147, 0.5);
    }
    100% {
        box-shadow: 0 0 20px rgba(232, 67, 147, 0.8);
    }
}

@keyframes phonicsOnsetPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 15px rgba(0, 184, 148, 0.6);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 25px rgba(0, 184, 148, 0.9);
    }
}

/* Phonics letter tiles hover effect */
.letter-tile:hover {
    transform: translateY(-5px) rotate(5deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Special phonics hover effect */
.phonics-recommended .letter-tile:hover {
    transform: translateY(-8px) rotate(8deg) scale(1.1);
    box-shadow: 0 12px 30px rgba(253, 203, 110, 0.4);
    animation: phonicsLetterBounce 0.3s ease;
}

@keyframes phonicsLetterBounce {
    0% { transform: translateY(-8px) rotate(8deg) scale(1.1); }
    50% { transform: translateY(-12px) rotate(10deg) scale(1.15); }
    100% { transform: translateY(-8px) rotate(8deg) scale(1.1); }
}

/* Completion Screen Styles */
.completion-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-bg-end) 100%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.completion-screen.active {
    display: flex;
    opacity: 1;
}

.completion-backdrop {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--paula-primary);
    animation: confettiFall 3s linear infinite;
}

.confetti:nth-child(2n) { background: var(--paula-secondary); }
.confetti:nth-child(3n) { background: var(--paula-soft-green); }
.confetti:nth-child(4n) { background: var(--paula-bg-start); }
.confetti:nth-child(5n) { background: var(--paula-accent); }
.confetti:nth-child(6n) { background: var(--paula-primary-dark); }
.confetti:nth-child(7n) { background: var(--paula-primary); }

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.completion-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 3rem 2.5rem;
    max-width: 600px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.5);
    animation: completionSlideIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: visible;
}

@keyframes completionSlideIn {
    0% {
        transform: scale(0.5) translateY(50px);
        opacity: 0;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.completion-header {
    margin-bottom: 2.5rem;
}

.completion-trophy {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: trophyBounce 2s ease-in-out infinite;
    display: inline-block;
}

@keyframes trophyBounce {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(-5deg);
    }
    50% {
        transform: translateY(-30px) rotate(0deg);
    }
    75% {
        transform: translateY(-20px) rotate(5deg);
    }
}

.completion-title {
    font-family: 'Fredoka One', cursive;
    font-size: 3rem;
    color: var(--paula-text);
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% {
        transform: scale(1);
        color: var(--paula-text);
    }
    50% {
        transform: scale(1.05);
        color: var(--paula-primary);
    }
}

.completion-subtitle {
    font-size: 1.3rem;
    color: var(--paula-text-muted);
    font-weight: 600;
    margin-bottom: 0;
}

.completion-stats {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.stat-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 20px;
    padding: 1.5rem 1rem;
    min-width: 120px;
    flex: 1;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.8);
    animation: statCardFloat 3s ease-in-out infinite;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.05);
}

.stat-card:nth-child(1) {
    animation-delay: 0.2s;
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-primary) 100%);
}

.stat-card:nth-child(2) {
    animation-delay: 0.4s;
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-accent) 100%);
}

.stat-card:nth-child(3) {
    animation-delay: 0.6s;
    background: linear-gradient(135deg, #11998e 0%, #00b894 100%);
}

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

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    animation: iconSpin 4s ease-in-out infinite;
}

@keyframes iconSpin {
    0%, 90%, 100% {
        transform: rotate(0deg);
    }
    45% {
        transform: rotate(360deg);
    }
}

.stat-value {
    font-family: 'Fredoka One', cursive;
    font-size: 2.2rem;
    color: var(--paula-text);
    margin-bottom: 0.3rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--paula-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.completion-message {
    background: linear-gradient(135deg, var(--paula-primary) 0%, var(--paula-accent) 100%);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    margin-bottom: 2.5rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.completion-message::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: messageShimmer 3s ease-in-out infinite;
}

@keyframes messageShimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.message-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    animation: messageIconTwinkle 2s ease-in-out infinite;
}

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

.message-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.completion-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.completion-btn {
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    text-transform: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

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

.completion-btn:hover::before {
    left: 100%;
}

.completion-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.completion-btn:active {
    transform: translateY(-1px) scale(1.02);
}

.completion-btn.primary {
    background: linear-gradient(135deg, #11998e 0%, #00b894 100%);
    color: white;
}

.completion-btn.primary:hover {
    background: linear-gradient(135deg, var(--paula-secondary-dark) 0%, var(--paula-secondary) 100%);
}

.completion-btn.secondary {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-accent) 100%);
    color: white;
}

.completion-btn.secondary:hover {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-accent-dark) 100%);
}

.completion-btn.tertiary {
    background: linear-gradient(135deg, var(--paula-primary-dark) 0%, #d96a99 100%);
    color: white;
}

.completion-btn.tertiary:hover {
    background: linear-gradient(135deg, var(--paula-primary) 0%, var(--paula-primary-dark) 100%);
}

.btn-icon {
    font-size: 1.3rem;
    animation: btnIconBounce 2s ease-in-out infinite;
}

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

/* Floating Stars Animation */
.floating-star {
    position: absolute;
    color: #ffd700;
    font-size: 1.5rem;
    animation: floatingStar 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes floatingStar {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.7;
    }
    25% {
        transform: translateY(-20px) rotate(90deg);
        opacity: 1;
    }
    50% {
        transform: translateY(-40px) rotate(180deg);
        opacity: 0.8;
    }
    75% {
        transform: translateY(-20px) rotate(270deg);
        opacity: 1;
    }
}

/* Math Completion Screen Styles */
.completion-screen.math-theme {
    background: linear-gradient(135deg, var(--paula-secondary) 0%, var(--paula-secondary-dark) 100%);
}

.completion-screen.math-theme .completion-trophy {
    filter: hue-rotate(120deg);
}

.completion-screen.math-theme .stat-card:nth-child(1) {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-accent) 100%);
}

.completion-screen.math-theme .stat-card:nth-child(2) {
    background: linear-gradient(135deg, var(--paula-primary-dark) 0%, #d96a99 100%);
}

.completion-screen.math-theme .stat-card:nth-child(3) {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-accent) 100%);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .completion-content {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }
    
    .completion-trophy {
        font-size: 4rem;
    }
    
    .completion-title {
        font-size: 2.2rem;
    }
    
    .completion-subtitle {
        font-size: 1.1rem;
    }
    
    .completion-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stat-card {
        min-width: auto;
    }
    
    .stat-value {
        font-size: 1.8rem;
    }
    
    .completion-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .completion-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
    
    .message-text {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .completion-content {
        padding: 1.5rem 1rem;
    }
    
    .completion-trophy {
        font-size: 3.5rem;
    }
    
    .completion-title {
        font-size: 1.8rem;
    }
    
    .completion-subtitle {
        font-size: 1rem;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .message-text {
        font-size: 1rem;
    }
    
    .completion-btn {
        font-size: 1rem;
        padding: 0.8rem 1.5rem;
    }
}

/* Phonics Game Styles */

/* Responsive improvements for completion popup sizing */
/* Ensure the popup fits without zooming and scrolls if needed */
.completion-content {
    max-height: min(88vh, 720px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

@media (max-width: 768px) {
    .completion-content { max-height: 90vh; }
}

/* Short viewport adjustments (landscape phones/tablets, small laptops) */
@media (max-height: 720px) {
    .completion-header { margin-bottom: 1.25rem; }
    .completion-trophy { font-size: 3.8rem; margin-bottom: 0.5rem; }
    .completion-title { font-size: 2rem; }
    .completion-subtitle { font-size: 1.05rem; }
    .completion-stats { margin-bottom: 1.25rem; gap: 0.75rem; }
    .stat-card { padding: 1rem 0.75rem; }
    .stat-value { font-size: 1.7rem; }
    .completion-message { padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
    .message-text { font-size: 1.05rem; }
    .completion-actions { gap: 0.6rem; }
    .completion-btn { padding: 0.75rem 1.25rem; font-size: 1rem; }
}

@media (max-height: 580px) {
    .completion-content { padding: 1.25rem 1rem; border-radius: 20px; }
    .completion-trophy { font-size: 3.2rem; }
    .completion-title { font-size: 1.7rem; }
    .completion-subtitle { font-size: 0.95rem; }
    .completion-actions { flex-direction: column; }
    .completion-btn { width: 100%; max-width: 280px; }
}

/* Use dynamic viewport units when available to avoid mobile URL bar jumps */
@supports (height: 100dvh) {
    .completion-screen,
    .completion-backdrop,
    .confetti-container { height: 100dvh; }
}
.phonics-prompt-container {
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    display: inline-block;
}

.phonics-prompt {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(1.4rem, 1.8vw + 1rem, 2.5rem);
    color: var(--paula-text);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: clamp(1rem, 1.2vw + 0.6rem, 2rem) clamp(1.2rem, 1.8vw + 0.8rem, 3rem);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 3px solid var(--paula-secondary);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    animation: promptFloat 3s ease-in-out infinite;
    margin-bottom: 1rem;
    position: relative;
    z-index: 5;
}

/* Rhyming game extras */
.rhyming-base-word {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-family: 'Fredoka One', cursive;
    font-size: clamp(1.7rem, 2vw + 1rem, 2.8rem);
    color: var(--paula-accent);
    margin: 0.5rem auto 0.75rem;
}

.rhyming-emoji {
    font-size: clamp(2.2rem, 2.6vw + 1rem, 3.2rem);
}

.rhyming-word {
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.rhyming-hint {
    min-height: 1.5rem;
    text-align: center;
    font-size: 1.05rem;
    color: var(--paula-secondary);
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s ease;
    margin: -0.25rem auto 1rem;
}

.rhyming-hint.visible {
    opacity: 1;
}

.puzzle-prompt-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

/* Puzzle Palace styles */
.puzzle-pattern {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(0.75rem, 1vw + 0.5rem, 1.5rem);
    margin: 0 auto 1.75rem;
    flex-wrap: wrap;
    max-width: min(680px, 100%);
}

.puzzle-pattern-item {
    min-width: clamp(60px, 9vw, 90px);
    min-height: clamp(60px, 9vw, 90px);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(2rem, 2.6vw + 1rem, 3rem);
    font-family: 'Fredoka One', cursive;
    color: var(--paula-text);
    position: relative;
    padding: 0.75rem;
}

.puzzle-pattern-item.missing {
    background: linear-gradient(135deg, rgba(248, 215, 122, 0.25), rgba(63, 213, 208, 0.35));
    border: 3px dashed rgba(255, 111, 183, 0.6);
    color: var(--paula-accent);
    animation: puzzleGlow 1.8s ease-in-out infinite;
}

@keyframes puzzleGlow {
    0%, 100% { box-shadow: 0 0 12px rgba(255, 111, 183, 0.25); }
    50% { box-shadow: 0 0 24px rgba(255, 111, 183, 0.45); }
}

.puzzle-options-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.puzzle-options {
    max-width: min(720px, 100%);
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    background: rgba(255, 255, 255, 0.15);
}

.puzzle-options .phonics-option {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-primary) 100%);
}

.puzzle-options .phonics-option:hover {
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-primary) 100%);
}

.puzzle-options.correct-picked .phonics-option:not(.correct) {
    opacity: 0.35;
}

.puzzle-hint {
    min-height: 1.5rem;
    text-align: center;
    font-size: 1.05rem;
    color: var(--paula-accent);
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s ease;
    margin: -0.25rem auto 1rem;
}

.puzzle-hint.visible {
    opacity: 1;
}

.puzzle-option .phonics-emoji {
    font-size: clamp(2.5rem, 3vw + 1rem, 3.5rem);
}

.puzzle-option .phonics-name {
    font-size: 1rem;
    letter-spacing: 0.05em;
}

.puzzle-completion {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(1.3rem, 2vw + 0.8rem, 1.8rem);
    font-weight: 700;
    color: var(--paula-text);
    text-align: center;
    padding: 1.5rem 1rem;
}

.rhyming-completion {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--paula-text);
    padding: 2rem 1rem;
    text-align: center;
}

.rhyming-completion strong {
    color: var(--paula-accent);
}

.rhyming-option .phonics-name {
    text-transform: capitalize;
}

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

.phonics-options-container {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 0 0.5rem;
}

.phonics-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.25rem;
    max-width: min(720px, 100%);
    width: 100%;
    padding: 2rem;
    margin: 0 auto;
    justify-content: center;
    justify-items: stretch;
    align-content: start;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    backdrop-filter: blur(5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.phonics-option {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, var(--paula-bg-start) 0%, var(--paula-accent) 100%);
    border: none;
    border-radius: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    justify-self: stretch;
    margin: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    animation: optionFloat 4s ease-in-out infinite;
}

.phonics-option:nth-child(1) { animation-delay: 0s; }
.phonics-option:nth-child(2) { animation-delay: 0.2s; }
.phonics-option:nth-child(3) { animation-delay: 0.4s; }
.phonics-option:nth-child(4) { animation-delay: 0.6s; }
.phonics-option:nth-child(5) { animation-delay: 0.8s; }

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

.phonics-option:hover {
    transform: translateY(-10px) scale(1.1);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #11998e 0%, #00b894 100%);
}

.phonics-option:active {
    transform: translateY(-5px) scale(1.05);
}

.phonics-emoji {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    animation: emojiPulse 2s ease-in-out infinite;
}

/* Letter Sounds tiles use this and scale with breakpoints */
.letter-symbol { font-size: clamp(2rem, 6vw, 3.4rem); }

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

.phonics-name {
    font-family: 'Fredoka One', cursive;
    font-size: 0.9rem;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    font-weight: 600;
}

.phonics-option.correct {
    background: linear-gradient(135deg, #11998e 0%, #00b894 100%) !important;
    animation: correctPulse 1.1s ease-in-out;
    border: 3px solid var(--paula-secondary-dark);
    transform: scale(1.2);
    box-shadow: 0 0 40px rgba(0, 184, 148, 0.9);
}

/* Add a celebratory halo and a check badge on the correct tile */
.phonics-option.correct::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 28px;
    box-shadow: 0 0 0 6px rgba(0, 184, 148, 0.25), 0 0 35px rgba(0, 184, 148, 0.9);
    animation: correctHalo 1.6s ease-in-out infinite;
    pointer-events: none;
}

.phonics-option.correct::after {
    content: "✓";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--paula-soft-green);
    color: #fff;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    transform: scale(1);
    pointer-events: none;
}

@keyframes correctPulse {
    0% {
        transform: scale(1.2);
        box-shadow: 0 0 28px rgba(0, 184, 148, 0.85);
    }
    25% {
        transform: scale(1.3);
        box-shadow: 0 0 40px rgba(0, 184, 148, 1);
    }
    50% {
        transform: scale(1.35);
        box-shadow: 0 0 48px rgba(0, 184, 148, 1);
    }
    75% {
        transform: scale(1.3);
        box-shadow: 0 0 40px rgba(0, 184, 148, 1);
    }
    100% {
        transform: scale(1.2);
        box-shadow: 0 0 28px rgba(0, 184, 148, 0.85);
    }
}

@keyframes correctHalo {
    0% { box-shadow: 0 0 0 4px rgba(0, 184, 148, 0.18), 0 0 30px rgba(0, 184, 148, 0.9); }
    50% { box-shadow: 0 0 0 10px rgba(0, 184, 148, 0.08), 0 0 50px rgba(0, 184, 148, 1); }
    100% { box-shadow: 0 0 0 4px rgba(0, 184, 148, 0.18), 0 0 30px rgba(0, 184, 148, 0.9); }
}

/* When a correct pick is made, subtly dim and shrink other options */
.phonics-options.correct-picked .phonics-option:not(.correct) {
    opacity: 0.25;
    filter: grayscale(0.15) brightness(0.9);
    transform: scale(0.96);
}

.phonics-option.incorrect {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
    animation: incorrectShake 0.8s ease-in-out;
    border: 3px solid #a93226;
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0) scale(1); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px) scale(1.05); }
    20%, 40%, 60%, 80% { transform: translateX(8px) scale(1.05); }
}

.phonics-option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Phonics feedback message */
.phonics-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, var(--paula-primary-dark) 0%, #d96a99 100%);
    color: white;
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    padding: 2rem 3rem;
    border-radius: 25px;
    box-shadow: 0 15px 35px rgba(232, 67, 147, 0.5);
    z-index: 2000;
    animation: feedbackPop 2.5s ease-in-out;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    border: 3px solid white;
}

@keyframes feedbackPop {
    0% { 
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    15% { 
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
    25% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    85% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% { 
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
}

/* Mobile responsive adjustments for phonics game */
@media (max-width: 768px) {
    .phonics-prompt { font-size: 1.7rem; padding: 1rem 1.4rem; }
    .phonics-prompt-container { margin-bottom: 0.8rem; width: 100%; }
    .phonics-options-container { margin-bottom: 0.8rem; width: 100%; }
    .phonics-prompt-container .speaker-btn { top: 50%; bottom: auto; right: -10px; transform: translateY(-50%); }
    
    .phonics-options {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 1rem;
        padding: 1.2rem 1rem;
        width: 100%;
        max-width: min(580px, 100%);
        justify-content: center;
        justify-items: stretch;
    }
    
    .phonics-option {
        max-width: none;
    }
    
    .phonics-emoji { font-size: 3.2rem; }
    
    .phonics-name {
        font-size: 0.8rem;
    }
    
    .phonics-feedback { font-size: 1.4rem; padding: 1.2rem 1.6rem; }
}

@media (max-width: 480px) {
    .phonics-prompt { font-size: 1.35rem; padding: 0.8rem 1rem; }
    .phonics-prompt-container { margin-bottom: 0.6rem; width: 100%; }
    .phonics-options-container { margin-bottom: 0.6rem; width: 100%; }
    .phonics-prompt-container .speaker-btn { top: 50%; bottom: auto; right: -8px; width: 44px; height: 44px; font-size: 1.1rem; transform: translateY(-50%); }
    
    .phonics-options {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
        gap: 0.75rem;
        padding: 0.9rem 0.75rem;
        max-width: min(420px, 100%);
        justify-items: stretch;
    }
    
    .phonics-option {
        max-width: none;
    }
    
    .phonics-emoji { font-size: 2.8rem; }
    
    .phonics-name {
        font-size: 0.7rem;
    }
    
    .phonics-feedback {
        font-size: 1.2rem;
        padding: 1rem 1.5rem;
    }
}

/* New Feature Styles */

/* Clear All Button */
.clear-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

/* Wrong feedback animation */
.letter-slot.wrong-feedback {
    border-color: #e74c3c !important;
    background: #ffe9f3 !important;
    animation: wrongSlotShake 0.8s ease-in-out;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
}

@keyframes wrongSlotShake {
    0%, 100% { transform: translateX(0) scale(1); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px) scale(1.05); }
    20%, 40%, 60%, 80% { transform: translateX(8px) scale(1.05); }
}

/* Bouncing back tile animation */
.bouncing-back {
    animation: bounceBack 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceBack {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.2) rotate(10deg); }
    50% { transform: scale(0.9) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Encouraging message animation */
@keyframes encouragingPop {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    20% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    30% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    90% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
}

/* Clear all animation */
@keyframes clearPulse {
    0% { transform: scale(1); }
    25% { transform: scale(1.05); opacity: 0.8; }
    50% { transform: scale(0.95); opacity: 0.6; }
    75% { transform: scale(1.02); opacity: 0.9; }
    100% { transform: scale(1); opacity: 1; }
}

/* Enhanced error glow effect */
.letter-slot.error-glow {
    animation: errorGlow 1s ease-in-out;
}

@keyframes errorGlow {
    0%, 100% { 
        box-shadow: 0 0 5px rgba(231, 76, 60, 0.3);
        border-color: #ddd;
    }
    50% { 
        box-shadow: 0 0 25px rgba(231, 76, 60, 0.8);
        border-color: #e74c3c;
        background: rgba(231, 76, 60, 0.1);
    }
}

/* Progressive help indicator */
.progressive-help-indicator {
    position: fixed;
    top: 100px;
    right: 20px;
    background: linear-gradient(135deg, var(--paula-accent) 0%, var(--paula-accent-dark) 100%);
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-family: 'Fredoka One', cursive;
    font-size: 0.9rem;
    z-index: 1500;
    animation: helpPulse 2s infinite;
}

@keyframes helpPulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* Letter spelling highlight animations */
.letter-slot.spelling-highlight {
    background: linear-gradient(135deg, var(--paula-accent) 0%, var(--paula-accent-dark) 100%) !important;
    border-color: #d35400 !important;
    color: white !important;
    transform: scale(1.2);
    animation: spellingPulse 0.8s ease-in-out infinite;
    box-shadow: 0 0 25px rgba(243, 156, 18, 0.8), 0 0 40px rgba(243, 156, 18, 0.4);
    z-index: 10;
    position: relative;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease-in-out;
}

@keyframes spellingPulse {
    0% { 
        transform: scale(1.2);
        box-shadow: 0 0 25px rgba(243, 156, 18, 0.8), 0 0 40px rgba(243, 156, 18, 0.4);
    }
    50% { 
        transform: scale(1.4);
        box-shadow: 0 0 35px rgba(243, 156, 18, 1), 0 0 50px rgba(243, 156, 18, 0.6);
    }
    100% { 
        transform: scale(1.2);
        box-shadow: 0 0 25px rgba(243, 156, 18, 0.8), 0 0 40px rgba(243, 156, 18, 0.4);
    }
}

/* Complete word highlight animation */
.letter-slot.word-highlight {
    background: linear-gradient(135deg, var(--paula-accent) 0%, var(--paula-accent) 100%) !important;
    border-color: var(--paula-accent) !important;
    color: white !important;
    transform: scale(1.15);
    animation: wordCelebration 1.5s ease-in-out;
    box-shadow: 0 0 20px rgba(155, 89, 182, 0.7), 0 0 35px rgba(155, 89, 182, 0.3);
    position: relative;
    z-index: 5;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}

@keyframes wordCelebration {
    0% { 
        transform: scale(1.15) rotate(0deg);
        box-shadow: 0 0 20px rgba(155, 89, 182, 0.7);
    }
    25% { 
        transform: scale(1.25) rotate(3deg);
        box-shadow: 0 0 30px rgba(155, 89, 182, 0.9);
    }
    50% { 
        transform: scale(1.3) rotate(-3deg);
        box-shadow: 0 0 35px rgba(155, 89, 182, 1);
    }
    75% { 
        transform: scale(1.25) rotate(2deg);
        box-shadow: 0 0 30px rgba(155, 89, 182, 0.9);
    }
    100% { 
        transform: scale(1.15) rotate(0deg);
        box-shadow: 0 0 20px rgba(155, 89, 182, 0.7);
    }
}
