/* ========================================================
   WESOŁE UCZENIE - Premium Kids Educational Game
   styles.css — Complete visual system
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ========== RESET & ROOT ========== */
*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent;user-select:none}

:root {
    --pink: #FF6B9D;
    --purple: #A855F7;
    --blue: #3B82F6;
    --green: #22C55E;
    --yellow: #EAB308;
    --orange: #F97316;
    --red: #EF4444;
    --cyan: #06B6D4;
    --bg: #FFF8F0;
    --card: #FFFFFF;
    --text: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --border: #E5E7EB;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.12);
    --shadow-xl: 0 24px 64px rgba(0,0,0,0.16);

    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-xl: 36px;
    --radius-full: 50px;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    overflow-x: hidden;
    min-height: 100dvh;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ========== TIME OF DAY BACKGROUNDS ========== */
body.time-morning { background: linear-gradient(180deg, #FFF8E0, #FFEFCC); }
body.time-evening { background: linear-gradient(180deg, #FFE8D0, #FFD8B8); }
body.time-night { background: linear-gradient(180deg, #E8E0F0, #D8D0E8); }

/* ========== SPLASH SCREEN ========== */
.splash-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, #FFF8F0, #FFF0E6, #FFF8F0);
    background-size: 400% 400%;
    animation: splashGradient 3s ease infinite;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
@keyframes splashGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
.splash-screen.hiding {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}
.splash-screen.hidden { display: none; }

.splash-mascot {
    width: 140px; height: 140px;
    animation: splashBounce 1.5s var(--spring) infinite, splashFlyIn 1s var(--ease-out) both;
}
@keyframes splashBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.05); }
}
@keyframes splashFlyIn {
    0% { transform: translateX(-100vw); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

.splash-title {
    font-size: 32px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--pink), var(--purple), var(--blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 20px;
    animation: fadeInUp 0.8s var(--ease-out) 0.3s both, splashLetterSpacing 1s var(--ease-out) 0.3s both;
}
@keyframes splashLetterSpacing {
    0% { letter-spacing: 20px; opacity: 0; }
    100% { letter-spacing: normal; opacity: 1; }
}
.splash-dots {
    display: flex;
    gap: 8px;
    margin-top: 24px;
    animation: fadeInUp 0.8s var(--ease-out) 0.6s both;
}
.splash-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--purple);
    animation: splashDotPulse 1.2s ease-in-out infinite;
}
.splash-dot:nth-child(2) { animation-delay: 0.2s; background: var(--pink); }
.splash-dot:nth-child(3) { animation-delay: 0.4s; background: var(--blue); }
@keyframes splashDotPulse {
    0%, 100% { transform: scale(0.6); opacity: 0.4; }
    50% { transform: scale(1); opacity: 1; }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== BACKGROUND ========== */
.bg-shapes {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0; overflow: hidden;
}
.bg-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.08;
    animation: floatShape 25s ease-in-out infinite;
}
.bg-shape:nth-child(1) { width: 300px; height: 300px; background: var(--pink); top: -80px; left: -60px; }
.bg-shape:nth-child(2) { width: 220px; height: 220px; background: var(--blue); top: 25%; right: -40px; animation-delay: -7s; }
.bg-shape:nth-child(3) { width: 260px; height: 260px; background: var(--yellow); bottom: -50px; left: 15%; animation-delay: -12s; }
.bg-shape:nth-child(4) { width: 180px; height: 180px; background: var(--green); top: 55%; left: 5%; animation-delay: -18s; }
.bg-shape:nth-child(5) { width: 200px; height: 200px; background: var(--purple); bottom: 15%; right: -20px; animation-delay: -9s; }
@keyframes floatShape {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(25px, -15px) scale(1.04); }
    50% { transform: translate(-15px, 25px) scale(0.96); }
    75% { transform: translate(18px, 12px) scale(1.02); }
}

/* Floating particles */
.bg-particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.06;
    animation: floatParticle 20s ease-in-out infinite;
}
.bg-particle:nth-child(6)  { width: 20px; height: 20px; background: var(--pink); top: 10%; left: 20%; animation-delay: 0s; }
.bg-particle:nth-child(7)  { width: 16px; height: 16px; background: var(--blue); top: 30%; left: 70%; animation-delay: -3s; }
.bg-particle:nth-child(8)  { width: 24px; height: 24px; background: var(--green); top: 50%; left: 40%; animation-delay: -6s; }
.bg-particle:nth-child(9)  { width: 14px; height: 14px; background: var(--yellow); top: 70%; left: 15%; animation-delay: -9s; }
.bg-particle:nth-child(10) { width: 18px; height: 18px; background: var(--purple); top: 20%; left: 85%; animation-delay: -12s; }
.bg-particle:nth-child(11) { width: 22px; height: 22px; background: var(--orange); top: 60%; left: 60%; animation-delay: -2s; }
.bg-particle:nth-child(12) { width: 12px; height: 12px; background: var(--cyan); top: 80%; left: 80%; animation-delay: -5s; }
.bg-particle:nth-child(13) { width: 20px; height: 20px; background: var(--red); top: 40%; left: 10%; animation-delay: -8s; }
.bg-particle:nth-child(14) { width: 16px; height: 16px; background: var(--pink); top: 90%; left: 50%; animation-delay: -11s; }
.bg-particle:nth-child(15) { width: 18px; height: 18px; background: var(--blue); top: 5%; left: 55%; animation-delay: -14s; }
@keyframes floatParticle {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(30px, -20px); }
    50% { transform: translate(-20px, 30px); }
    75% { transform: translate(15px, -10px); }
}

/* ========== GLOBAL UI ========== */
.sound-btn {
    position: fixed; top: 16px; right: 16px;
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--card);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 22px;
    cursor: pointer;
    z-index: 50;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s var(--spring);
    color: var(--text);
    overflow: hidden;
    position: fixed;
}
.sound-btn:active { transform: scale(0.85); }
.sound-icon { flex-shrink: 0; }
.sound-btn.muted .sound-wave { display: none; }
.sound-btn.muted .sound-mute-line { display: block; }
.sound-mute-line {
    display: none;
    position: absolute;
    width: 28px; height: 2px;
    background: currentColor;
    transform: rotate(-45deg);
}
.sound-wave {
    animation: soundWaveAnim 1.5s ease-in-out infinite;
}
.sound-wave-2 { animation-delay: 0.3s; }
@keyframes soundWaveAnim {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.confetti-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 99; overflow: hidden;
}
.confetti-piece {
    position: absolute; top: -20px;
    will-change: transform;
    animation: confettiFall 3.5s ease-in forwards;
}
@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg) scale(0.5); opacity: 0; }
}

.encourage-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--card);
    padding: 14px 28px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-secondary);
    opacity: 0;
    transition: all 0.4s var(--spring);
    z-index: 90;
    white-space: nowrap;
}
.encourage-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========== STREAK OVERLAY ========== */
.streak-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 95;
    pointer-events: none;
}
.streak-overlay.active { display: flex; }
.streak-overlay-text {
    font-size: 48px;
    font-weight: 900;
    color: var(--orange);
    text-shadow: 0 0 20px rgba(249,115,22,0.5), 0 0 40px rgba(249,115,22,0.3);
    animation: streakPop 0.8s var(--spring) forwards;
}
@keyframes streakPop {
    0% { transform: scale(0); opacity: 0; }
    40% { transform: scale(1.3); opacity: 1; }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 0; }
}

/* ========== STREAK COUNTER ========== */
.streak-counter {
    display: none;
    align-items: center;
    gap: 2px;
    font-size: 16px;
    font-weight: 900;
    color: var(--orange);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(249,115,22,0.1);
    white-space: nowrap;
}
.streak-counter.visible { display: flex; }
.streak-counter.fire-glow {
    text-shadow: 0 0 8px rgba(249,115,22,0.5);
    animation: fireGlow 1s ease-in-out infinite;
}
@keyframes fireGlow {
    0%, 100% { box-shadow: 0 0 4px rgba(249,115,22,0.2); }
    50% { box-shadow: 0 0 12px rgba(249,115,22,0.4); }
}

/* ========== WHITE FLASH ========== */
.white-flash {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: white;
    z-index: 98;
    opacity: 0;
    pointer-events: none;
    display: none;
}
.white-flash.active {
    display: block;
    animation: flashAnim 0.1s ease-out forwards;
}
@keyframes flashAnim {
    0% { opacity: 0.6; }
    100% { opacity: 0; }
}

/* ========== SCREEN SHAKE ========== */
@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-2px, 1px); }
    40% { transform: translate(2px, -1px); }
    60% { transform: translate(-1px, 2px); }
    80% { transform: translate(1px, -2px); }
}
body.shake { animation: screenShake 0.3s ease; }

/* ========== APP CONTAINER ========== */
.app {
    position: relative;
    z-index: 1;
    max-width: 560px;
    margin: 0 auto;
    padding: 16px 20px 40px;
}

/* ========== SCREEN TRANSITIONS ========== */
.home-screen {
    animation: fadeInUp 0.4s var(--ease-out);
}
.home-screen.hidden {
    display: none;
}
.game-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    min-height: calc(100dvh - 56px);
}
.game-screen.active {
    display: flex;
    animation: screenSlideIn 0.4s var(--ease-out);
}
@keyframes screenSlideIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ========== QUESTION TRANSITIONS ========== */
@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-100%); opacity: 0; }
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.game-area.slide-out-left {
    animation: slideOutLeft 0.25s var(--ease-out) forwards;
}
.game-area.slide-in-right {
    animation: slideInRight 0.25s var(--ease-out) forwards;
}

/* ========== HEADER & MASCOT ========== */
.header {
    text-align: center;
    padding: 16px 0 12px;
}
.header-mascot {
    width: 120px; height: 120px;
    margin: 0 auto 12px;
    animation: mascotFloat 4s ease-in-out infinite;
    filter: drop-shadow(0 8px 16px rgba(139, 92, 246, 0.2));
}
@keyframes mascotFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(2deg); }
    75% { transform: translateY(-4px) rotate(-2deg); }
}

/* Mascot blink animation */
.header-mascot svg .mascot-eye {
    transform-origin: center 52px;
    animation: mascotBlink 4.5s ease-in-out infinite;
}
@keyframes mascotBlink {
    0%, 95%, 100% { transform: scaleY(1); }
    97% { transform: scaleY(0.1); }
}

.header h1 {
    font-size: 32px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--pink), var(--purple), var(--blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}
.header p {
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
}

/* ========== LANGUAGE SWITCHER ========== */
.lang-switcher {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 12px 0 18px;
}
.lang-btn {
    width: 52px; height: 40px;
    border-radius: var(--radius-sm);
    border: 3px solid transparent;
    background: var(--card);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font-size: 22px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.25s var(--spring);
}
.lang-btn.active {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2), var(--shadow-sm);
    transform: scale(1.05);
}
.lang-btn:active { transform: scale(0.88); }

/* ========== STARS BAR ========== */
.stars-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 20px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm), 0 0 0 1px rgba(234, 179, 8, 0.15);
}
.stars-bar .star-icon {
    font-size: 24px;
    animation: starPulse 2.5s ease-in-out infinite;
}
@keyframes starPulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(10deg); }
}
.stars-bar .star-count {
    font-size: 22px;
    font-weight: 900;
    color: #D97706;
}
.stars-bar .star-label {
    font-size: 13px;
    color: #B45309;
    font-weight: 600;
    opacity: 0.7;
}

/* ========== LEVEL BAR ========== */
.level-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 24px;
    padding: 0 4px;
}
.level-badge {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), var(--blue));
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 900; color: white;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
    flex-shrink: 0;
}
.level-progress-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.level-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}
.level-track {
    height: 10px;
    background: #E5E7EB;
    border-radius: 5px;
    overflow: hidden;
}
.level-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--purple), var(--blue));
    transition: width 0.6s var(--ease-out);
    min-width: 4px;
}

/* ========== DAILY CHALLENGE ========== */
.daily-challenge {
    margin-bottom: 16px;
    display: none;
}
.daily-challenge.visible { display: block; }
.daily-challenge-card {
    background: linear-gradient(135deg, rgba(234,179,8,0.12), rgba(249,115,22,0.08));
    border: 2px solid rgba(234,179,8,0.25);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s var(--spring);
    animation: cardEntrance 0.5s var(--spring) both;
}
.daily-challenge-card:active { transform: scale(0.96); }
.daily-challenge-title {
    font-size: 18px;
    font-weight: 900;
    color: #D97706;
    margin-bottom: 4px;
}
.daily-challenge-goal {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
}
.daily-challenge-completed {
    font-size: 16px;
    font-weight: 800;
    color: var(--green);
}

/* ========== MODULES GRID ========== */
.modules {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

/* ========== MODULE CARD ========== */
.module-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 20px 14px 18px;
    text-align: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all 0.3s var(--spring);
    position: relative;
    overflow: hidden;
    border-bottom: 4px solid transparent;
}
.module-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    opacity: 0;
    transition: opacity 0.3s;
}
.module-card:active {
    transform: scale(0.93);
}
.module-card .icon {
    font-size: 48px;
    margin-bottom: 8px;
    display: block;
    transition: transform 0.4s var(--spring);
}
.module-card:active .icon {
    transform: scale(1.15) rotate(-8deg);
}
.module-card .label {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}
.module-card .sublabel {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 2px;
}
.module-card .farm-preview {
    font-size: 14px;
    margin-top: 4px;
    letter-spacing: 2px;
}

/* Module progress ring */
.module-progress {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
}
.module-progress svg {
    transform: rotate(-90deg);
}
.module-progress .track {
    fill: none;
    stroke: #E5E7EB;
    stroke-width: 3;
}
.module-progress .fill {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s var(--ease-out);
}
.module-stars-count {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 10px;
    font-weight: 800;
    color: var(--text-muted);
    background: rgba(255,255,255,0.8);
    padding: 2px 6px;
    border-radius: 8px;
}

/* Module color variants */
.module-card.farm { border-bottom-color: #10B981; grid-column: 1/-1; padding: 24px 20px; background: linear-gradient(135deg, rgba(34,197,94,0.06), rgba(234,179,8,0.06)); }
.module-card.farm .icon { font-size: 56px; }
.module-card.farm .label { font-size: 18px; }
.module-card.farm .sublabel { font-size: 13px; }
.module-card.colors { border-bottom-color: var(--pink); background: linear-gradient(135deg, rgba(255,107,157,0.06), rgba(96,165,250,0.06), rgba(74,222,128,0.06)); }
.module-card.shapes { border-bottom-color: var(--blue); background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(147,197,253,0.04)); }
.module-card.numbers { border-bottom-color: var(--green); background: linear-gradient(135deg, rgba(34,197,94,0.08), rgba(16,185,129,0.04)); }
.module-card.animals { border-bottom-color: var(--orange); background: linear-gradient(135deg, rgba(249,115,22,0.08), rgba(251,146,60,0.04)); }
.module-card.letters { border-bottom-color: var(--purple); background: linear-gradient(135deg, rgba(168,85,247,0.08), rgba(192,132,252,0.04)); }
.module-card.fruits { border-bottom-color: var(--yellow); background: linear-gradient(135deg, rgba(234,179,8,0.06), rgba(239,68,68,0.06)); }
.module-card.sizes { border-bottom-color: var(--cyan); background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(255,255,255,0.04)); }

/* Entrance animation for cards */
.module-card {
    animation: cardEntrance 0.5s var(--spring) both;
}
.module-card:nth-child(1) { animation-delay: 0.05s; }
.module-card:nth-child(2) { animation-delay: 0.1s; }
.module-card:nth-child(3) { animation-delay: 0.15s; }
.module-card:nth-child(4) { animation-delay: 0.2s; }
.module-card:nth-child(5) { animation-delay: 0.25s; }
.module-card:nth-child(6) { animation-delay: 0.3s; }
.module-card:nth-child(7) { animation-delay: 0.35s; }
.module-card:nth-child(8) { animation-delay: 0.4s; }
@keyframes cardEntrance {
    from { opacity: 0; transform: translateY(20px) scale(0.9) rotate(-3deg); }
    to { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

/* ========== TAP RIPPLE EFFECT ========== */
.option-btn, .module-card, .round-btn {
    position: relative;
    overflow: hidden;
}
.option-btn:active::after, .module-card:active::after, .round-btn:active::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    animation: rippleEffect 0.5s ease-out;
}
@keyframes rippleEffect {
    0% { width: 0; height: 0; opacity: 0.3; }
    100% { width: 300px; height: 300px; opacity: 0; }
}

/* ========== BADGES ROW (Home) ========== */
.badges-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 16px;
    margin-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.badges-row::-webkit-scrollbar { display: none; }
.badge-item {
    flex-shrink: 0;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: #F3F4F6;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s var(--spring);
    position: relative;
}
.badge-item.earned {
    background: linear-gradient(135deg, #FEF3C7, #FFFBEB);
    box-shadow: 0 4px 16px rgba(234, 179, 8, 0.25);
}
.badge-item.locked {
    opacity: 0.4;
    filter: grayscale(1);
}
.badge-item.locked::after {
    content: '🔒';
    font-size: 12px;
    position: absolute;
    bottom: -2px; right: -2px;
}

/* Badge unlock notification */
.badge-unlock {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: var(--card);
    border-radius: var(--radius-xl);
    padding: 32px 40px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    z-index: 110;
    transition: transform 0.5s var(--spring), opacity 0.3s;
    opacity: 0;
}
.badge-unlock.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}
.badge-unlock-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 109;
    opacity: 0;
    transition: opacity 0.3s;
    display: none;
}
.badge-unlock-bg.active { display: block; opacity: 1; }
.badge-unlock .badge-big {
    font-size: 72px;
    animation: badgePop 0.6s var(--spring);
}
@keyframes badgePop {
    0% { transform: scale(0) rotate(-30deg); }
    60% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}
.badge-unlock h3 {
    font-size: 22px;
    font-weight: 900;
    color: var(--text);
    margin: 12px 0 4px;
}
.badge-unlock p {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ========== EXIT DIALOG ========== */
.exit-dialog-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 120;
    display: none;
    align-items: center;
    justify-content: center;
}
.exit-dialog-bg.active { display: flex; }
.exit-dialog {
    background: var(--card);
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: exitDialogIn 0.3s var(--spring);
    max-width: 320px;
    width: 90%;
}
@keyframes exitDialogIn {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.exit-dialog-title {
    font-size: 22px;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 24px;
}
.exit-dialog-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.exit-dialog-btn {
    padding: 18px 24px;
    border-radius: var(--radius-full);
    border: none;
    font-family: 'Nunito', sans-serif;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s var(--spring);
    min-height: 60px;
}
.exit-dialog-btn:active { transform: scale(0.93); }
.exit-stay {
    background: linear-gradient(135deg, var(--green), var(--cyan));
    color: white;
    box-shadow: 0 6px 20px rgba(34,197,94,0.3);
}
.exit-leave {
    background: #F3F4F6;
    color: var(--text-secondary);
}

/* ========== TEACHING BUBBLE ========== */
.teaching-bubble {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: var(--card);
    border-radius: var(--radius-xl);
    padding: 24px 32px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    z-index: 85;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: transform 0.4s var(--spring), opacity 0.3s;
    opacity: 0;
}
.teaching-bubble.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}
.teaching-mascot {
    font-size: 48px;
}
.teaching-text {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
}

/* ========== SESSION SUMMARY ========== */
.session-summary-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 115;
    display: none;
    align-items: center;
    justify-content: center;
}
.session-summary-bg.active { display: flex; }
.session-summary {
    background: var(--card);
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: popIn 0.5s var(--spring);
    max-width: 360px;
    width: 90%;
}
.session-summary-title {
    font-size: 20px;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 20px;
}
.session-summary-modules {
    font-size: 32px;
    margin-bottom: 16px;
    letter-spacing: 4px;
}
.session-summary-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}
.session-summary-stat {
    background: #F9FAFB;
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
}
.session-summary-stat .stat-icon { font-size: 24px; }
.session-summary-stat .stat-val { font-size: 22px; font-weight: 900; color: var(--text); }
.session-summary-stat .stat-label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.session-summary-btn {
    padding: 16px 40px;
    border-radius: var(--radius-full);
    border: none;
    background: linear-gradient(135deg, var(--green), var(--cyan));
    color: white;
    font-family: 'Nunito', sans-serif;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.35);
    transition: transform 0.2s var(--spring);
}
.session-summary-btn:active { transform: scale(0.93); }

/* ========== GAME SCREEN ========== */
/* Top bar */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 0;
    margin-bottom: 12px;
}
.back-btn {
    width: 52px; height: 52px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--card);
    box-shadow: var(--shadow-md);
    font-size: 22px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s var(--spring);
    color: var(--text);
}
.back-btn:active { transform: scale(0.85); }
.game-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}
.game-stars-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.game-stars {
    display: flex; align-items: center; gap: 4px;
    background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
    padding: 10px 16px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    font-size: 16px;
    font-weight: 800;
    color: #D97706;
}

/* Game area */
.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 20px;
}
.game-area.animate-in {
    animation: fadeInUp 0.35s var(--ease-out);
}
.game-prompt {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    text-align: center;
    line-height: 1.3;
}

/* ========== MODULE-SPECIFIC GAME DECORATIONS ========== */
.game-area.module-colors::before {
    content: '🟥🟦🟩🟨';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 14px;
    opacity: 0.06;
    letter-spacing: 4px;
}
.game-area.module-shapes::before {
    content: '🔷🔶⬟';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 14px;
    opacity: 0.06;
    letter-spacing: 4px;
}
.game-area.module-numbers::before {
    content: '1234567890';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 14px;
    opacity: 0.05;
    letter-spacing: 4px;
}
.game-area.module-animals::before {
    content: '🐱🐶🦁🐘';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 14px;
    opacity: 0.06;
    letter-spacing: 4px;
}
.game-area.module-letters::before {
    content: 'ABCDEFG';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 14px;
    opacity: 0.05;
    letter-spacing: 4px;
    font-weight: 900;
}
.game-area.module-fruits::before {
    content: '🍎🍌🍊🍓';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 14px;
    opacity: 0.06;
    letter-spacing: 4px;
}
.game-area.module-sizes::before {
    content: '📏';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 14px;
    opacity: 0.06;
}

/* ========== DISPLAY ITEM ========== */
.display-item {
    width: 180px; height: 180px;
    border-radius: var(--radius-xl);
    display: flex; align-items: center; justify-content: center;
    font-size: 90px;
    background: var(--card);
    box-shadow: var(--shadow-lg);
    animation: popIn 0.5s var(--spring), displayGlow 3s ease-in-out infinite;
    position: relative;
}
@keyframes popIn {
    0% { transform: scale(0) rotate(-10deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes displayGlow {
    0%, 100% { box-shadow: var(--shadow-lg); }
    50% { box-shadow: var(--shadow-lg), 0 0 20px rgba(168,85,247,0.15); }
}
.display-item svg, .display-item .quiz-animal-svg svg {
    width: 120px;
    height: 120px;
}

.shape-display {
    width: 160px; height: 160px;
    display: flex; align-items: center; justify-content: center;
    animation: popIn 0.5s var(--spring);
}
.shape-display svg {
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.15));
}
.letter-display {
    font-size: 140px;
    font-weight: 900;
    animation: popIn 0.5s var(--spring);
    text-shadow: 4px 4px 0 rgba(0,0,0,0.08);
    line-height: 1;
}
.counting-objects {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 12px;
    max-width: 320px;
    animation: popIn 0.5s var(--spring);
}
.counting-objects .obj {
    font-size: 48px;
    animation: popIn 0.5s var(--spring);
}
.counting-objects .obj:nth-child(2) { animation-delay: 0.05s; }
.counting-objects .obj:nth-child(3) { animation-delay: 0.1s; }
.counting-objects .obj:nth-child(4) { animation-delay: 0.15s; }
.counting-objects .obj:nth-child(5) { animation-delay: 0.2s; }
.counting-objects .obj:nth-child(6) { animation-delay: 0.25s; }
.counting-objects .obj:nth-child(7) { animation-delay: 0.3s; }
.counting-objects .obj:nth-child(8) { animation-delay: 0.35s; }
.counting-objects .obj:nth-child(9) { animation-delay: 0.4s; }
.counting-objects .obj:nth-child(10) { animation-delay: 0.45s; }

/* ========== SIZES MODULE ========== */
.sizes-display {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 24px;
    animation: popIn 0.5s var(--spring);
}
.sizes-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.3s var(--spring);
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 4px solid transparent;
    background: var(--card);
    box-shadow: var(--shadow-md);
}
.sizes-item:active { transform: scale(0.92); }
.sizes-item.correct {
    border-color: var(--green);
    background: #D1FAE5;
    animation: correctPulse 0.6s ease;
}
.sizes-item.wrong {
    border-color: #FCD34D;
    background: #FEF3C7;
    animation: gentleShake 0.4s ease;
}
.sizes-item .size-emoji {
    line-height: 1;
    transition: transform 0.3s var(--spring);
}
.sizes-item .size-label {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-secondary);
}

/* ========== OPTIONS GRID ========== */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 400px;
}
.option-btn {
    padding: 18px 12px;
    border-radius: var(--radius-md);
    border: 3px solid transparent;
    background: var(--card);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    transition: all 0.2s var(--spring);
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    min-height: 72px;
    will-change: transform;
}
.option-btn:active { transform: scale(0.93); }
.option-btn.correct {
    background: #D1FAE5;
    border-color: var(--green);
    animation: correctPulse 0.6s ease;
}
.option-btn.wrong {
    background: #FEF3C7;
    border-color: #FCD34D;
    animation: gentleShake 0.4s ease;
}
@keyframes correctPulse {
    0% { transform: scale(1); }
    30% { transform: scale(1.06); }
    100% { transform: scale(1); }
}
@keyframes gentleShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ========== SEGMENTED PROGRESS BAR ========== */
.progress-bar-container {
    width: 100%;
    max-width: 400px;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.progress-segments {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.progress-segment {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #E5E7EB;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    transition: all 0.4s var(--spring);
    color: var(--text-muted);
    font-weight: 800;
}
.progress-segment.completed {
    background: linear-gradient(135deg, var(--green), var(--cyan));
    color: white;
    animation: segmentFill 0.4s var(--spring);
}
.progress-segment.current {
    border: 3px solid var(--purple);
    background: #F3E8FF;
    color: var(--purple);
}
@keyframes segmentFill {
    0% { transform: scale(0.5); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
.progress-text {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-muted);
    min-width: 36px;
    text-align: right;
}

/* ========== FARM ========== */
.farm-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    overflow-x: auto;
    padding: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.farm-tabs::-webkit-scrollbar { display: none; }
.farm-tab {
    padding: 10px 16px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--card);
    box-shadow: var(--shadow-md);
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s var(--spring);
    flex-shrink: 0;
}
.farm-tab.active {
    background: linear-gradient(135deg, var(--orange), var(--yellow));
    color: white;
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.35);
    transform: scale(1.02);
}
.farm-tab:active { transform: scale(0.93); }

.farm-scene {
    width: calc(100% + 40px);
    margin-left: -20px;
    max-width: 100vw;
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    aspect-ratio: 9/14;
    min-height: 440px;
}
.farm-sun {
    position: absolute;
    top: 18px; right: 28px;
    width: 55px; height: 55px;
    border-radius: 50%;
    background: radial-gradient(circle, #FFE066, #FFB800);
    box-shadow: 0 0 40px rgba(255,184,0,0.5), 0 0 80px rgba(255,184,0,0.2);
    animation: sunPulse 4s ease-in-out infinite;
}
@keyframes sunPulse {
    0%, 100% { box-shadow: 0 0 40px rgba(255,184,0,0.5), 0 0 80px rgba(255,184,0,0.2); }
    50% { box-shadow: 0 0 50px rgba(255,184,0,0.6), 0 0 100px rgba(255,184,0,0.3); }
}
.farm-cloud {
    position: absolute;
    background: white;
    border-radius: var(--radius-full);
    opacity: 0.8;
    animation: cloudDrift 30s linear infinite;
}
.farm-cloud:nth-child(1) { top: 12px; left: -70px; width: 80px; height: 28px; animation-duration: 25s; }
.farm-cloud:nth-child(2) { top: 42px; left: -100px; width: 100px; height: 32px; animation-duration: 35s; animation-delay: -10s; }
.farm-cloud:nth-child(3) { top: 6px; left: -60px; width: 60px; height: 22px; animation-duration: 28s; animation-delay: -18s; }
@keyframes cloudDrift {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(580px + 150px)); }
}

.farm-animal {
    position: absolute;
    cursor: pointer;
    transition: transform 0.2s var(--spring);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
    will-change: transform;
}
.farm-animal:active { transform: scale(0.88) !important; }
.farm-animal .animal-emoji {
    font-size: 52px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    transition: transform 0.4s var(--spring);
}
.farm-animal .animal-emoji svg {
    width: 56px;
    height: 56px;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.15));
}
.farm-animal .animal-emoji .animal-svg {
    display: flex;
    align-items: center;
    justify-content: center;
}
.farm-animal.playing .animal-emoji {
    animation: animalJump 0.6s var(--spring);
}
@keyframes animalJump {
    0% { transform: translateY(0) scale(1); }
    30% { transform: translateY(-20px) scale(1.15); }
    50% { transform: translateY(-24px) scale(1.18); }
    70% { transform: translateY(-8px) scale(1.08); }
    100% { transform: translateY(0) scale(1); }
}
.farm-animal .animal-name {
    font-size: 12px;
    font-weight: 800;
    color: white;
    background: rgba(0,0,0,0.5);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    margin-top: 2px;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s var(--ease-out);
    white-space: nowrap;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.farm-animal.show-name .animal-name {
    opacity: 1;
    transform: translateY(0);
}

.sound-bubble {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: var(--card);
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    box-shadow: var(--shadow-md);
    white-space: nowrap;
    pointer-events: none;
    z-index: 20;
}
.sound-bubble::after {
    content: '';
    position: absolute;
    bottom: -5px; left: 50%;
    width: 10px; height: 10px;
    background: var(--card);
    border-radius: 2px;
    transform: translateX(-50%) rotate(45deg);
}
.sound-bubble.show {
    animation: bubblePop 2.2s var(--spring) forwards;
}
@keyframes bubblePop {
    0% { transform: translateX(-50%) scale(0); opacity: 0; }
    12% { transform: translateX(-50%) scale(1.1); opacity: 1; }
    22% { transform: translateX(-50%) scale(1); opacity: 1; }
    80% { transform: translateX(-50%) scale(1); opacity: 1; }
    100% { transform: translateX(-50%) scale(0.8); opacity: 0; }
}

.farm-instruction {
    text-align: center;
    margin: 14px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-secondary);
}
.farm-instruction span { color: var(--orange); }

.farm-info-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 10px;
}
.farm-info-card {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    box-shadow: var(--shadow-sm);
    display: flex; align-items: center; gap: 8px;
    cursor: pointer;
    transition: all 0.25s var(--spring);
    border: 2px solid transparent;
}
.farm-info-card:active { transform: scale(0.93); }
.farm-info-card.active-card {
    border-color: var(--orange);
    background: #FFF7ED;
    transform: scale(1.02);
}
.farm-info-card .fi-emoji { font-size: 28px; display: flex; align-items: center; }
.farm-info-card .fi-emoji svg { width: 36px; height: 36px; }
.farm-info-card .fi-text { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.2; }
.farm-info-card .fi-sound { font-size: 11px; color: var(--text-muted); font-weight: 600; }

.grass-tuft {
    position: absolute;
    font-size: 18px;
    animation: grassSway 3s ease-in-out infinite;
}
@keyframes grassSway {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

.fence-row {
    position: absolute;
    bottom: 40%; left: 0;
    width: 100%; height: 28px;
    display: flex; align-items: flex-end;
}
.fence-post {
    width: 7px; height: 26px;
    background: #C4956A;
    border-radius: 2px 2px 0 0;
    margin: 0 16px;
    flex-shrink: 0;
}
.fence-rail {
    position: absolute;
    left: 0; width: 100%;
    height: 4px;
    background: #D4A574;
    border-radius: 2px;
}
.fence-rail:nth-child(1) { bottom: 18px; }
.fence-rail:nth-child(2) { bottom: 9px; }

/* ========== CELEBRATION ========== */
.celebration {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: rgba(255,255,255,0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
}
.celebration.active { display: flex; }
.celebration-content {
    background: var(--card);
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: celebEnter 0.6s var(--spring);
    max-width: 300px;
    width: 88%;
    will-change: transform;
}
@keyframes celebEnter {
    0% { transform: scale(0) rotate(-15deg); opacity: 0; }
    60% { transform: scale(1.05) rotate(2deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.celebration-emoji {
    font-size: 72px;
    animation: celebEmojiBounce 1s ease-in-out infinite;
}
.celebration-emoji.mega { font-size: 96px; }
@keyframes celebEmojiBounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.05) rotate(5deg); }
}
.celebration-text {
    font-size: 26px;
    font-weight: 900;
    color: var(--text);
    margin: 12px 0 4px;
}
.celebration-sub {
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 16px;
}
.celebration-stars {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 20px;
    font-size: 28px;
}
.celebration-stars span {
    animation: starAppear 0.3s var(--spring) both;
}
.celebration-stars span:nth-child(1) { animation-delay: 0.1s; }
.celebration-stars span:nth-child(2) { animation-delay: 0.2s; }
.celebration-stars span:nth-child(3) { animation-delay: 0.3s; }
@keyframes starAppear {
    0% { transform: scale(0) rotate(-30deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.celebration-btn {
    padding: 14px 36px;
    border-radius: var(--radius-full);
    border: none;
    background: linear-gradient(135deg, var(--green), var(--cyan));
    color: white;
    font-family: 'Nunito', sans-serif;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.35);
    transition: transform 0.2s var(--spring);
    min-height: 56px;
}
.celebration-btn:active { transform: scale(0.93); }

/* Flying stars in celebration */
.flying-star {
    position: absolute;
    font-size: 32px;
    animation: flyingStar 1s var(--ease-out) forwards;
    pointer-events: none;
}
@keyframes flyingStar {
    0% { transform: scale(0) translate(0, 0); opacity: 1; }
    100% { transform: scale(1.5) translate(var(--fly-x), var(--fly-y)); opacity: 0; }
}

/* ========== ROUND COMPLETE ========== */
.round-complete {
    text-align: center;
    animation: fadeInUp 0.5s var(--ease-out);
}
.round-trophy {
    font-size: 100px;
    animation: trophyBounce 2s ease-in-out infinite;
}
@keyframes trophyBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-12px) rotate(-5deg); }
    75% { transform: translateY(-6px) rotate(5deg); }
}
.round-title {
    font-size: 28px;
    font-weight: 900;
    color: var(--text);
    margin: 16px 0 8px;
}
.round-subtitle {
    font-size: 17px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 12px;
}
.round-stars {
    font-size: 40px;
    margin: 16px 0;
    display: flex;
    justify-content: center;
    gap: 4px;
}
.round-stars span {
    animation: starAppear 0.4s var(--spring) both;
}
.round-stars span:nth-child(1) { animation-delay: 0.1s; }
.round-stars span:nth-child(2) { animation-delay: 0.2s; }
.round-stars span:nth-child(3) { animation-delay: 0.3s; }
.round-stars span:nth-child(4) { animation-delay: 0.4s; }
.round-stars span:nth-child(5) { animation-delay: 0.5s; }
.round-buttons {
    display: flex;
    gap: 12px;
    margin-top: 28px;
    justify-content: center;
    flex-wrap: wrap;
}
.round-btn {
    padding: 16px 32px;
    border-radius: var(--radius-full);
    border: none;
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s var(--spring);
}
.round-btn:active { transform: scale(0.93); }
.round-btn.primary {
    background: linear-gradient(135deg, var(--green), var(--cyan));
    color: white;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
}
.round-btn.secondary {
    background: linear-gradient(135deg, var(--pink), var(--purple));
    color: white;
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.3);
}

/* ========== PARENT ZONE ========== */
.parent-link {
    text-align: center;
    margin-top: 12px;
    padding: 14px;
    font-size: 13px;
    color: #D1D5DB;
    cursor: pointer;
    transition: color 0.2s;
}
.parent-link:active { color: var(--text-muted); }

.parent-gate {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    content-visibility: auto;
}
.parent-gate.active { display: flex; }
.parent-gate-box {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 360px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: popIn 0.4s var(--spring);
}
.parent-gate-box h2 {
    font-size: 20px;
    color: var(--text);
    margin-bottom: 8px;
}
.parent-gate-box p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.4;
}
.parent-gate-box .pg-math {
    font-size: 28px;
    font-weight: 900;
    color: var(--purple);
    margin-bottom: 14px;
}
.parent-gate-box input {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    font-family: 'Nunito', sans-serif;
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    outline: none;
    letter-spacing: 6px;
    transition: border-color 0.3s;
}
.parent-gate-box input:focus { border-color: var(--purple); }
.pg-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.pg-actions button {
    flex: 1;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s var(--spring);
}
.pg-actions button:active { transform: scale(0.95); }
.pg-cancel { background: #F3F4F6; color: var(--text-secondary); }
.pg-confirm {
    background: linear-gradient(135deg, var(--purple), var(--blue));
    color: white;
}

/* Parent Panel */
.parent-panel {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg);
    z-index: 210;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    padding: 24px;
    animation: slideInRightPanel 0.35s var(--ease-out);
    content-visibility: auto;
}
.parent-panel.active { display: flex; }
@keyframes slideInRightPanel {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.parent-panel h2 {
    font-size: 22px;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
}
.parent-panel .pp-close {
    width: 44px; height: 44px;
    border-radius: var(--radius-sm);
    border: none;
    background: #F3F4F6;
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s var(--spring);
}
.parent-panel .pp-close:active { transform: scale(0.9); }

.pp-section {
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}
.pp-section h3 {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.pp-section p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

.pp-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.pp-stat-card {
    background: #F9FAFB;
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}
.pp-stat-card .pp-stat-icon { font-size: 28px; }
.pp-stat-card .pp-stat-val {
    font-size: 24px;
    font-weight: 900;
    color: var(--text);
    margin: 4px 0 2px;
}
.pp-stat-card .pp-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.pp-module-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pp-module-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}
.pp-module-emoji { font-size: 24px; }
.pp-module-name {
    flex: 1;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.pp-module-bar {
    width: 80px;
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    overflow: hidden;
}
.pp-module-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--green);
    transition: width 0.4s var(--ease-out);
}
.pp-module-stars {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
    min-width: 24px;
    text-align: right;
}

.pp-timer-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}
.pp-timer-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}
.pp-timer-toggle label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.toggle-switch {
    width: 48px; height: 28px;
    background: #D1D5DB;
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}
.toggle-switch.active { background: var(--green); }
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 22px; height: 22px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s var(--spring);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.toggle-switch.active::after { transform: translateX(20px); }

/* Toddler mode toggle in parent panel */
.toddler-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}
.toddler-info {
    flex: 1;
}
.toddler-info .toddler-label {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}
.toddler-info .toddler-desc {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}
.toddler-status {
    font-size: 12px;
    font-weight: 700;
    margin-top: 2px;
}
.toddler-status.on { color: var(--green); }
.toddler-status.off { color: var(--text-muted); }

.pp-reset {
    margin-top: 12px;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    border: none;
    background: #FEE2E2;
    color: #DC2626;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s var(--spring);
    width: 100%;
}
.pp-reset:active { transform: scale(0.95); }

/* ========== SESSION TIMER OVERLAY ========== */
.session-timer {
    position: fixed;
    top: 16px;
    left: 16px;
    background: var(--card);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    z-index: 49;
    display: none;
}
.session-timer.active { display: block; }
.session-timer.warning { color: var(--orange); background: #FFF7ED; }

/* ========== TODDLER MODE OVERRIDES ========== */
body.toddler-mode .option-btn {
    min-height: 80px;
    font-size: 22px;
}
body.toddler-mode .celebration-content {
    animation-duration: 0.78s;
}
body.toddler-mode .module-card,
body.toddler-mode .option-btn,
body.toddler-mode .celebration-content {
    transition-duration: 0.39s;
}

/* ========== PERFORMANCE ========== */
.farm-animal { will-change: transform; }
.option-btn { will-change: transform; }
.celebration-content { will-change: transform; }
.confetti-piece { will-change: transform; }

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .splash-mascot { animation: none; }
    .header-mascot { animation: none; }
    .confetti-piece { animation: none; display: none; }
    .bg-shape { animation: none; }
    .bg-particle { animation: none; }
}

/* ========== RESPONSIVE ========== */
@media (min-width: 768px) {
    .app { max-width: 620px; padding: 24px; }
    .modules { grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
    .module-card.farm { grid-column: 1/-1; }
    .module-card .icon { font-size: 54px; }
    .farm-scene { aspect-ratio: 4/3; }
    .farm-animal .animal-emoji { font-size: 58px; }
    .farm-animal .animal-emoji svg { width: 68px; height: 68px; }
    .option-btn { min-height: 80px; font-size: 20px; }
    .display-item { width: 200px; height: 200px; }
    .game-prompt { font-size: 26px; }
}
@media (min-width: 1024px) {
    .app { max-width: 720px; }
    .modules { grid-template-columns: repeat(4, 1fr); }
    .module-card.farm { grid-column: 1/-1; }
}
