* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Neue', cursive;
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    min-height: 100vh;
    overflow-x: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

.title {
    font-family: 'Fredoka One', cursive;
    font-size: 3.5rem;
    color: #fff;
    text-shadow: 3px 3px 0px #333, 6px 6px 0px rgba(0,0,0,0.3);
    margin-bottom: 10px;
    animation: bounce 2s ease-in-out infinite;
}

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

.subtitle {
    font-size: 1.2rem;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    margin-bottom: 40px;
}

.main-box {
    width: 300px;
    height: 300px;
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    border: 8px solid #fff;
    border-radius: 20px;
    margin: 50px auto;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    animation: pulse 2s ease-in-out infinite;
}

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

.main-box:hover {
    transform: scale(1.1) rotate(2deg);
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
}

.box-content {
    color: #fff;
    text-align: center;
    padding: 20px;
}

.box-content h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.box-content p {
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    margin: 10% auto;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideIn 0.5s ease;
}

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

.modal-content h2 {
    font-family: 'Fredoka One', cursive;
    color: #333;
    margin-bottom: 30px;
    font-size: 2rem;
}

.age-slider-container {
    margin: 30px 0;
}

.age-slider {
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(to right, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7, #fd79a8);
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 20px;
}

.age-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #333;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.age-display {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
}

.start-button, .reset-button {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: #fff;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-family: 'Fredoka One', cursive;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.start-button:hover, .reset-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.game-boxes {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 30px;
    margin: 50px auto;
    max-width: 1000px;
    animation: explode 1s ease-out;
}

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

.mini-box {
    width: 200px;
    height: 200px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    padding: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    margin: 0 auto;
}

.mini-box:hover {
    transform: translateY(-10px) rotate(5deg);
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

.trivia-box {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
}

.joke-box {
    background: linear-gradient(45deg, #f39c12, #e67e22);
}

.riddle-box {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
}

.feud-box {
    background: linear-gradient(45deg, #3498db, #2980b9);
}

.coloring-box {
    background: linear-gradient(45deg, #e74c3c, #f39c12);
}

.maze-box {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
}

.mini-box h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.mini-box p {
    font-size: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.game-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

.question {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.option {
    background: linear-gradient(45deg, #74b9ff, #0984e3);
    color: #fff;
    border: none;
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.option:hover {
    transform: translateX(10px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.result {
    margin-top: 20px;
    padding: 20px;
    border-radius: 10px;
    font-size: 1.2rem;
    text-align: center;
}

.correct {
    background: linear-gradient(45deg, #00b894, #00cec9);
    color: #fff;
}

.incorrect {
    background: linear-gradient(45deg, #e17055, #d63031);
    color: #fff;
}

.joke-content {
    text-align: center;
    padding: 20px;
}

.joke-setup {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.5;
}

.joke-punchline {
    font-size: 1.5rem;
    color: #e74c3c;
    font-weight: bold;
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(45deg, #fff3cd, #ffeaa7);
    border-radius: 10px;
    border: 3px dashed #f39c12;
}

.reset-button {
    margin-top: 30px;
    background: linear-gradient(45deg, #fd79a8, #e84393);
}

@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }
    
    .main-box {
        width: 250px;
        height: 250px;
    }
    
    .game-boxes {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .mini-box {
        width: 180px;
        height: 180px;
    }
    
    .modal-content {
        margin: 5% auto;
        padding: 20px;
    }
}

/* Narrator Styles */
.narrator {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 300px;
}

.narrator-character {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8));
}

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

.narrator-character .hat {
    font-size: 2rem;
    animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.narrator-character .face {
    font-size: 2.5rem;
    margin: -5px 0;
    animation: blink 4s ease-in-out infinite;
}

@keyframes blink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}

.narrator-character .bow-tie {
    font-size: 1.5rem;
    animation: spin 3s ease-in-out infinite;
}

@keyframes spin {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(10deg); }
}

.speech-bubble {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border: 3px solid #333;
    border-radius: 20px;
    padding: 15px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    max-width: 200px;
    animation: bubble-bounce 0.5s ease-out;
}

@keyframes bubble-bounce {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.speech-bubble::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-right: 15px solid #333;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-right: 12px solid #fff;
}

#narratorText {
    font-family: 'Comic Neue', cursive;
    font-size: 0.9rem;
    color: #333;
    line-height: 1.4;
    font-weight: bold;
}

/* Confetti Styles */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ff6b6b;
    animation: confetti-fall 3s linear infinite;
}

.confetti:nth-child(2n) { background: #4ecdc4; animation-delay: 0.2s; }
.confetti:nth-child(3n) { background: #45b7d1; animation-delay: 0.4s; }
.confetti:nth-child(4n) { background: #96ceb4; animation-delay: 0.6s; }
.confetti:nth-child(5n) { background: #ffeaa7; animation-delay: 0.8s; }
.confetti:nth-child(6n) { background: #fd79a8; animation-delay: 1s; }

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Success Animation */
.success-animation {
    animation: success-pulse 1s ease-in-out;
}

@keyframes success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); filter: brightness(1.2); }
    100% { transform: scale(1); }
}

/* Fanfare Styles */
.fanfare {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    z-index: 999;
    animation: fanfare-burst 2s ease-out forwards;
    pointer-events: none;
}

@keyframes fanfare-burst {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    80% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
}

/* Mobile Narrator Adjustments */
@media (max-width: 768px) {
    .narrator {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        margin: 20px auto;
        justify-content: center;
    }
    
    .speech-bubble {
        max-width: 250px;
    }
    
    .speech-bubble::before,
    .speech-bubble::after {
        left: 50%;
        top: -15px;
        transform: translateX(-50%);
        border-left: 15px solid transparent;
        border-right: 15px solid transparent;
        border-top: none;
        border-bottom: 15px solid #333;
    }
    
    .speech-bubble::after {
        top: -12px;
        border-bottom-color: #fff;
    }
    
    .game-boxes {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Coloring Page Styles */
.coloring-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.coloring-page-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.page-selector-btn {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-weight: bold;
    transition: all 0.3s ease;
}

.page-selector-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.page-selector-btn.active {
    background: linear-gradient(45deg, #e74c3c, #f39c12);
    transform: scale(1.1);
}

.coloring-canvas-container {
    position: relative;
    border: 5px solid #333;
    border-radius: 10px;
    background: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.coloring-canvas {
    display: block;
    cursor: crosshair;
}

.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
    justify-content: center;
    max-width: 600px;
}

.color-btn {
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-btn:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.color-btn.active {
    border-width: 5px;
    transform: scale(1.3);
}

.coloring-tools {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
    justify-content: center;
}

.tool-btn {
    background: linear-gradient(45deg, #74b9ff, #0984e3);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-weight: bold;
    transition: all 0.3s ease;
}

.tool-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.tool-btn.active {
    background: linear-gradient(45deg, #00b894, #00cec9);
}

.hidden {
    display: none !important;
}

/* Maze Game Styles */
.maze-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.maze-difficulty-display {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.difficulty-indicator {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-family: 'Comic Neue', cursive;
    font-weight: bold;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.maze-canvas-container {
    position: relative;
    border: 5px solid #333;
    border-radius: 15px;
    background: white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    padding: 10px;
}

.maze-canvas {
    display: block;
    border-radius: 10px;
    background: linear-gradient(135deg, #fff, #f8f9fa);
}

.maze-controls {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.maze-btn {
    background: linear-gradient(45deg, #74b9ff, #0984e3);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.maze-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

.maze-btn:active {
    transform: translateY(-1px);
}

.maze-btn.success {
    background: linear-gradient(45deg, #00b894, #00cec9);
}

.maze-btn.hint {
    background: linear-gradient(45deg, #fdcb6e, #e17055);
}

.maze-stats {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 15px 0;
    font-family: 'Comic Neue', cursive;
    font-weight: bold;
    font-size: 1.1rem;
}

.stat-item {
    background: linear-gradient(45deg, #a29bfe, #6c5ce7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    text-align: center;
    min-width: 80px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.maze-completion {
    background: linear-gradient(45deg, #00b894, #00cec9);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin: 20px 0;
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    animation: success-pulse 1s ease-in-out;
}

.maze-completion .trophy {
    font-size: 3rem;
    margin-bottom: 10px;
    animation: trophy-bounce 1s ease-in-out infinite;
}

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

.maze-instructions {
    background: linear-gradient(45deg, #fff3cd, #ffeaa7);
    border: 3px solid #f39c12;
    border-radius: 15px;
    padding: 15px;
    margin: 10px 0;
    text-align: center;
    font-family: 'Comic Neue', cursive;
    font-weight: bold;
    color: #333;
    max-width: 500px;
}

.maze-path-hint {
    position: absolute;
    pointer-events: none;
    z-index: 10;
    opacity: 0.7;
    animation: hint-glow 1.5s ease-in-out infinite;
}

@keyframes hint-glow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* Mobile maze adjustments */
@media (max-width: 768px) {
    .maze-canvas {
        max-width: 90vw;
    }
    
    .maze-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .maze-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .maze-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .stat-item {
        min-width: 60px;
        padding: 6px 12px;
        font-size: 1rem;
    }
}
