/**
 * Inchworm's Garden - Sunny Garden Theme
 *
 * A bright, friendly vegetable-garden scene: leafy greens, warm soil,
 * sky blue, and cheerful flower accents. Inchy the inchworm measures
 * everything on a wooden ruler. Builds on top of kid-friendly-theme.css.
 *
 * Color Palette:
 * - Leaf Green: #4CAF50 (primary buttons, progress, highlights)
 * - Deep Vine: #2E7D32 (titles, borders, accents, counters)
 * - Soil Brown: #8D6E63 (secondary accents, ruler, earthy tones)
 * - Sky Blue: #4FC3F7 (scene background, score, info accents)
 * - Petal Pink: #F06292 (flower accents, incorrect/highlight pops)
 * - Sunflower Yellow: #FDD835 (score, stars, blanks, warm highlights)
 */

body {
    background:
        radial-gradient(circle at 18% 12%, rgba(253, 216, 53, 0.18) 0%, transparent 38%),
        radial-gradient(circle at 85% 20%, rgba(79, 195, 247, 0.18) 0%, transparent 40%),
        linear-gradient(170deg, #E3F4D7 0%, #C9E8B4 45%, #A8D58A 100%);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    font-family: 'Nunito', 'Comic Sans MS', sans-serif;
    color: #33402A;
}

.game-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.kid-game-card {
    background: linear-gradient(165deg, #FFFFFF 0%, #F4FBEE 100%);
    border: 4px solid #4CAF50;
    border-radius: 24px;
    padding: 40px;
    max-width: 820px;
    width: 100%;
    box-shadow: 0 0 0 6px rgba(76, 175, 80, 0.12), 0 14px 34px rgba(46, 125, 50, 0.25);
    color: #33402A;
}

/* Mascot */
.garden-mascot {
    font-size: 5rem;
    text-align: center;
    margin-bottom: 10px;
    animation: wiggle 2.4s ease-in-out infinite;
    display: block;
}

.garden-mascot.excited {
    animation: hop 0.7s ease-in-out 4;
}

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

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

/* Title */
.kid-friendly-title {
    font-family: 'Fredoka', 'Nunito', cursive;
    font-size: 2.4rem;
    color: #2E7D32;
    text-shadow: 2px 2px 0 rgba(141, 110, 99, 0.25);
    text-align: center;
    margin: 10px 0 16px;
}

.kid-friendly-body {
    font-family: 'Nunito', sans-serif;
    color: #4A5840;
    text-align: center;
    font-size: 1.25rem;
    line-height: 1.5;
    margin-bottom: 30px;
}

/* Difficulty Selection */
.difficulty-selection {
    margin: 36px 0;
}

.section-title {
    font-family: 'Fredoka', 'Nunito', cursive;
    font-size: 1.4rem;
    color: #2E7D32;
    text-align: center;
    margin-bottom: 22px;
}

.difficulty-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kid-difficulty-card {
    cursor: pointer;
    transition: all 0.3s ease;
    background: #FFFFFF;
    border-radius: 18px;
    padding: 24px 18px;
    margin: 0;
    min-width: 0;
    text-align: center;
    display: block;
}

.kid-difficulty-card:hover {
    transform: translateY(-6px) scale(1.03);
}

.kid-difficulty-card.easy {
    background: linear-gradient(165deg, #F1F9E8 0%, #DCF0C6 100%);
    border: 3px solid #7CB342;
}

.kid-difficulty-card.easy:hover {
    box-shadow: 0 10px 22px rgba(124, 179, 66, 0.45);
    border-color: #4CAF50;
}

.kid-difficulty-card.medium {
    background: linear-gradient(165deg, #FFFBE8 0%, #FFF3C4 100%);
    border: 3px solid #FBC02D;
}

.kid-difficulty-card.medium:hover {
    box-shadow: 0 10px 22px rgba(251, 192, 45, 0.45);
    border-color: #F9A825;
}

.kid-difficulty-card.hard {
    background: linear-gradient(165deg, #FDEFF4 0%, #FAD4E2 100%);
    border: 3px solid #F06292;
}

.kid-difficulty-card.hard:hover {
    box-shadow: 0 10px 22px rgba(240, 98, 146, 0.45);
    border-color: #E91E63;
}

.difficulty-title {
    font-family: 'Fredoka', 'Nunito', cursive;
    font-size: 1.35rem;
    font-weight: 700;
    color: #2E7D32;
    margin-bottom: 10px;
}

.difficulty-description {
    font-size: 1rem;
    color: #4A5840;
    line-height: 1.4;
    margin-bottom: 12px;
}

.difficulty-example {
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #5D4037;
    background: rgba(141, 110, 99, 0.14);
    padding: 6px 12px;
    border-radius: 10px;
    display: inline-block;
}

/* Practice Mode Section */
.practice-mode-section {
    margin: 28px 0;
}

.practice-mode-card {
    background: linear-gradient(165deg, #FFF8E1 0%, #FFECB3 100%);
    border: 3px dashed #FBC02D;
    border-radius: 18px;
    padding: 26px;
    text-align: center;
}

.practice-mode-card h3 {
    font-family: 'Fredoka', 'Nunito', cursive;
    font-size: 1.4rem;
    color: #2E7D32;
    margin: 0 0 12px;
}

.practice-mode-card p {
    font-size: 1.15rem;
    color: #4A5840;
    margin-bottom: 20px;
}

#missed-count {
    font-weight: 800;
    color: #E91E63;
}

/* Game Actions */
.game-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 28px;
}

/* ---------------------------------------------------------------------------
   Game Screen
   --------------------------------------------------------------------------- */

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 14px;
}

.question-counter {
    font-family: 'Fredoka', 'Nunito', cursive;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2E7D32;
}

.score-display {
    font-family: 'Fredoka', 'Nunito', cursive;
    font-size: 1.25rem;
    font-weight: 700;
    color: #F57F17;
}

.btn-small {
    padding: 9px 20px;
    font-size: 1rem;
}

/* Progress Bar */
.kid-progress-bar {
    background: rgba(141, 110, 99, 0.18);
    border: 2px solid #7CB342;
    border-radius: 15px;
    height: 24px;
    margin-bottom: 28px;
    overflow: hidden;
}

.kid-progress-fill {
    background: linear-gradient(90deg, #7CB342 0%, #4CAF50 60%, #FDD835 100%);
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 13px;
}

/* Problem Display */
.problem-display {
    text-align: center;
    margin: 26px 0;
}

.question-text {
    font-family: 'Fredoka', 'Nunito', cursive;
    font-size: 1.7rem;
    font-weight: 700;
    color: #2E7D32;
    margin-bottom: 20px;
}

/* Scene / Ruler Visual */
.scene-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 18px auto;
    padding: 18px;
    background:
        linear-gradient(180deg, #D9F0FB 0%, #BDE6FA 55%, #EADBC4 55%, #DCC8A8 100%);
    border: 3px solid #8D6E63;
    border-radius: 18px;
    box-shadow: inset 0 2px 10px rgba(46, 125, 50, 0.12);
    min-height: 120px;
    overflow: hidden;
}

.ruler-svg {
    width: 100%;
    max-width: 560px;
    height: auto;
    display: block;
}

/* Estimate / best-unit icon questions */
.item-icon {
    font-size: 6rem;
    line-height: 1;
    text-align: center;
    filter: drop-shadow(0 6px 8px rgba(46, 125, 50, 0.25));
    animation: float 3s ease-in-out infinite;
}

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

/* Answer Choices */
.answer-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 28px 0;
}

.kid-answer-btn {
    font-family: 'Fredoka', 'Nunito', cursive;
    font-size: 1.4rem;
    font-weight: 700;
    color: #33402A;
    background: #FFFFFF;
    border: 3px solid #7CB342;
    border-radius: 16px;
    padding: 18px;
    margin: 0;
    min-width: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(46, 125, 50, 0.12);
}

.kid-answer-btn:hover {
    transform: translateY(-4px) scale(1.03);
    background: #F1F9E8;
    border-color: #4CAF50;
    box-shadow: 0 8px 18px rgba(76, 175, 80, 0.35);
}

.kid-answer-btn.correct {
    background: linear-gradient(135deg, #81C784 0%, #4CAF50 100%);
    color: #FFFFFF;
    border-color: #2E7D32;
    box-shadow: 0 0 18px rgba(76, 175, 80, 0.55);
    animation: pop 0.5s ease-in-out;
}

.kid-answer-btn.incorrect {
    background: linear-gradient(135deg, #F8A5C2 0%, #F06292 100%);
    color: #FFFFFF;
    border-color: #E91E63;
    animation: shake 0.5s ease-in-out;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* Feedback Area */
.feedback-area {
    margin-top: 26px;
    text-align: center;
}

.feedback-message {
    font-family: 'Fredoka', 'Nunito', cursive;
    font-size: 1.35rem;
    font-weight: 700;
    padding: 16px 26px;
    border-radius: 16px;
    display: inline-block;
}

.feedback-message.correct {
    background: rgba(76, 175, 80, 0.16);
    color: #2E7D32;
    border: 3px solid #4CAF50;
}

.feedback-message.incorrect {
    background: rgba(240, 98, 146, 0.16);
    color: #C2185B;
    border: 3px solid #F06292;
}

/* ---------------------------------------------------------------------------
   Results Screen
   --------------------------------------------------------------------------- */

.kid-stars {
    font-size: 3.6rem;
    text-align: center;
    margin: 24px 0;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 22px;
    margin: 36px 0;
}

.result-stat {
    text-align: center;
    background: linear-gradient(165deg, #F4FBEE 0%, #E4F3D5 100%);
    border: 3px solid #7CB342;
    border-radius: 18px;
    padding: 24px 18px;
}

.stat-value {
    font-family: 'Fredoka', 'Nunito', cursive;
    font-size: 2.3rem;
    font-weight: 700;
    color: #2E7D32;
    margin-bottom: 8px;
}

.stat-label {
    font-family: 'Nunito', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #5D4037;
}

/* Missed Problems Section */
.missed-problems {
    background: linear-gradient(165deg, #FFF8E1 0%, #FFF1C9 100%);
    border: 3px solid #FBC02D;
    border-radius: 18px;
    padding: 28px;
    margin: 30px 0;
}

.missed-title {
    font-family: 'Fredoka', 'Nunito', cursive;
    font-size: 1.4rem;
    color: #5D4037;
    text-align: center;
    margin: 0 0 22px;
}

.missed-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.missed-item {
    background: #FFFFFF;
    border: 2px solid #7CB342;
    border-radius: 14px;
    padding: 18px;
    text-align: center;
}

.missed-question {
    font-family: 'Fredoka', 'Nunito', cursive;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2E7D32;
    margin-bottom: 12px;
}

.missed-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 1rem;
}

.your-answer {
    color: #C2185B;
    font-weight: 700;
}

.correct-answer {
    color: #2E7D32;
    font-weight: 700;
}

/* Results Actions */
.results-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 30px;
}

/* ---------------------------------------------------------------------------
   Buttons (theme overrides)
   --------------------------------------------------------------------------- */

.kid-btn {
    font-family: 'Fredoka', 'Nunito', cursive;
    font-size: 1.15rem;
    font-weight: 700;
    padding: 14px 34px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0.5px;
}

.kid-btn:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 8px 18px rgba(46, 125, 50, 0.3);
}

.kid-btn-primary {
    background: linear-gradient(135deg, #66BB6A 0%, #388E3C 100%);
    color: #FFFFFF;
}

.kid-btn-secondary {
    background: linear-gradient(135deg, #A1887F 0%, #6D4C41 100%);
    color: #FFFFFF;
}

.kid-btn-accent {
    background: linear-gradient(135deg, #FDD835 0%, #F9A825 100%);
    color: #4E342E;
}

/* ---------------------------------------------------------------------------
   Responsive Design
   --------------------------------------------------------------------------- */

@media (max-width: 768px) {
    .kid-game-card {
        padding: 26px 20px;
    }

    .garden-mascot {
        font-size: 4rem;
    }

    .kid-friendly-title {
        font-size: 1.8rem;
    }

    .kid-friendly-body {
        font-size: 1.1rem;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .difficulty-options {
        grid-template-columns: 1fr;
    }

    .question-text {
        font-size: 1.4rem;
    }

    .item-icon {
        font-size: 5rem;
    }

    .answer-choices {
        grid-template-columns: 1fr 1fr;
    }

    .kid-answer-btn {
        font-size: 1.2rem;
        padding: 15px;
    }

    .results-summary {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 1.9rem;
    }

    .missed-items-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .game-content {
        padding: 8px;
    }

    .kid-game-card {
        padding: 20px 14px;
    }

    .garden-mascot {
        font-size: 3.2rem;
    }

    .kid-friendly-title {
        font-size: 1.4rem;
    }

    .game-header {
        gap: 10px;
    }

    .question-counter {
        font-size: 0.95rem;
    }

    .score-display {
        font-size: 1.05rem;
    }

    .scene-container {
        padding: 10px;
        min-height: 100px;
    }

    .question-text {
        font-size: 1.2rem;
    }

    .item-icon {
        font-size: 4rem;
    }

    .answer-choices {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .kid-answer-btn {
        font-size: 1.05rem;
        padding: 13px 8px;
    }

    .kid-btn {
        font-size: 1rem;
        padding: 12px 24px;
    }

    .game-actions,
    .results-actions {
        flex-direction: column;
    }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    .garden-mascot,
    .garden-mascot.excited,
    .item-icon,
    .kid-answer-btn.correct,
    .kid-answer-btn.incorrect {
        animation: none !important;
    }
}
