/**
 * Fraction Forge - Blacksmith's Forge Theme
 *
 * Step into an enchanted blacksmith's forge to hammer out equivalent fractions
 * and compare them on the anvil. Glowing molten metal, ember sparks, dark iron,
 * and warm forge-stone give this game a fiery smithy feel.
 * Builds on top of kid-friendly-theme.css
 *
 * Color Palette:
 * - Iron Charcoal: #2B2D33 (dark forge metal, borders, titles, anvil stroke)
 * - Molten Orange: #E25822 (primary heat glow, score accents, primary buttons)
 * - Ember Gold: #F2A33C (highlights, progress fill, fraction shading, accents)
 * - Forge Cream: #FDF3E3 (warm parchment/light backgrounds, cards, unfilled bars)
 * - Cooled Steel: #5A6472 (steel gray, secondary buttons, neutral trim)
 */

body {
    background:
        radial-gradient(circle at 50% 0%, rgba(226, 88, 34, 0.25) 0%, transparent 55%),
        linear-gradient(135deg, #3A3D45 0%, #2B2D33 55%, #1C1D21 100%);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    font-family: 'Nunito', sans-serif;
}

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

.kid-game-card {
    background: linear-gradient(135deg, #FFFDF7 0%, #FDF3E3 100%);
    border: 4px solid #2B2D33;
    border-radius: 25px;
    padding: 40px;
    max-width: 800px;
    width: 100%;
    box-shadow:
        0 0 0 2px rgba(242, 163, 60, 0.4),
        0 8px 30px rgba(0, 0, 0, 0.5);
}

/* Mascot */
.forge-mascot {
    font-size: 5rem;
    text-align: center;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 12px rgba(226, 88, 34, 0.6));
}

.forge-mascot.excited {
    animation: bounce 0.6s ease-in-out 3;
}

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

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

/* Title */
.kid-friendly-title {
    color: #2B2D33;
    text-align: center;
    margin: 20px 0;
    text-shadow: 0 1px 0 rgba(242, 163, 60, 0.5);
}

.kid-friendly-body {
    color: #3A3D45;
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 30px;
}

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

.section-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #E25822;
    text-align: center;
    margin-bottom: 25px;
}

.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;
    border: 3px solid #2B2D33;
    text-align: center;
}

.kid-difficulty-card:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 8px 25px rgba(226, 88, 34, 0.45);
}

.kid-difficulty-card.easy {
    background: linear-gradient(135deg, #FBE0B6 0%, #F2A33C 100%);
    border-color: #C77B1E;
}

.kid-difficulty-card.medium {
    background: linear-gradient(135deg, #F4A777 0%, #E25822 100%);
    border-color: #B23A12;
}

.kid-difficulty-card.hard {
    background: linear-gradient(135deg, #7A828F 0%, #4A525E 100%);
    border-color: #2B2D33;
}

.difficulty-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #2B2D33;
    margin-bottom: 10px;
}

.kid-difficulty-card.hard .difficulty-title {
    color: #FDF3E3;
}

.difficulty-description {
    font-size: 1rem;
    color: #3A3D45;
    margin-bottom: 8px;
}

.kid-difficulty-card.hard .difficulty-description {
    color: #E8EBEF;
}

.difficulty-example {
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2B2D33;
    background: rgba(255, 255, 255, 0.6);
    padding: 5px 10px;
    border-radius: 8px;
    margin-top: 10px;
    display: inline-block;
}

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

.practice-mode-card {
    background: linear-gradient(135deg, #F4A777 0%, #E25822 100%);
    border: 3px solid #B23A12;
    border-radius: 20px;
    padding: 25px;
    text-align: center;
}

.practice-mode-card h3 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.6rem;
    color: #FDF3E3;
    margin-bottom: 15px;
}

.practice-mode-card p {
    font-size: 1.2rem;
    color: #FFF6EA;
    margin-bottom: 20px;
}

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

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.question-counter {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #2B2D33;
}

.score-display {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #E25822;
}

.btn-small {
    padding: 8px 16px;
    font-size: 1rem;
}

/* Progress Bar (themeable via CSS variables) */
body {
    --progress-bar-bg: rgba(43, 45, 51, 0.25);
    --progress-bar-border: #2B2D33;
    --progress-fill-bg: linear-gradient(90deg, #E25822 0%, #F2A33C 100%);
    --progress-text-color: #FDF3E3;
}

.kid-progress-bar {
    background: rgba(43, 45, 51, 0.2);
    border: 2px solid #2B2D33;
    border-radius: 15px;
    height: 25px;
    margin-bottom: 30px;
    overflow: hidden;
}

.kid-progress-fill {
    background: linear-gradient(90deg, #E25822 0%, #F2A33C 100%);
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 13px;
}

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

.question-text {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #2B2D33;
    margin-bottom: 25px;
}

/* Fraction display (the big problem expression) */
.fraction-display {
    font-family: 'Fredoka', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 18px;
    font-size: 2.6rem;
    color: #2B2D33;
    background: linear-gradient(135deg, #FFFFFF 0%, #FDF3E3 100%);
    border: 4px dashed #E25822;
    border-radius: 20px;
    padding: 30px 25px;
    margin: 0 auto 10px;
    max-width: 540px;
    box-shadow: 0 4px 15px rgba(43, 45, 51, 0.2);
}

/* Stacked fraction (numerator over denominator) */
.frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.05;
    vertical-align: middle;
}

.frac-num {
    display: block;
    padding: 0 8px 4px;
    border-bottom: 4px solid #2B2D33;
}

.frac-den {
    display: block;
    padding: 4px 8px 0;
}

.eq-sign {
    font-size: 2.4rem;
    font-weight: 700;
    color: #E25822;
}

.cmp-circle {
    font-size: 2.4rem;
    font-weight: 700;
    color: #C77B1E;
}

.mystery {
    font-size: 2.6rem;
    font-weight: 700;
    color: #E25822;
    background: rgba(242, 163, 60, 0.25);
    border: 2px dashed #E25822;
    border-radius: 10px;
    padding: 2px 16px;
}

/* Fraction Bars */
.bars-section {
    margin: 20px 0 0;
}

#show-bars-btn {
    margin-bottom: 15px;
}

.bars-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 420px;
    margin: 10px auto 0;
    background: rgba(43, 45, 51, 0.05);
    border: 2px solid rgba(43, 45, 51, 0.2);
    border-radius: 16px;
    padding: 18px;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bar-label {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #2B2D33;
    min-width: 56px;
    text-align: right;
}

.fraction-bar-svg {
    flex: 1;
    height: 46px;
    width: 100%;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(43, 45, 51, 0.25);
}

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

/* Comparison choices (< = >) sit in a tidy row of three */
.answer-choices.symbol-choices {
    grid-template-columns: repeat(3, 1fr);
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

.answer-choices.symbol-choices .kid-answer-btn {
    font-size: 2.2rem;
    font-weight: 700;
}

.kid-answer-btn {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.6rem;
    font-weight: 600;
    color: #2B2D33;
    background: linear-gradient(135deg, #FFFFFF 0%, #FDF3E3 100%);
    border: 3px solid #5A6472;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 0;
    margin: 0;
}

.kid-answer-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(226, 88, 34, 0.4);
    background: linear-gradient(135deg, #FBE0B6 0%, #F2A33C 100%);
    border-color: #E25822;
}

/* Fractions inside answer buttons */
.kid-answer-btn .frac-num {
    border-bottom-color: #2B2D33;
}

.kid-answer-btn.correct {
    background: linear-gradient(135deg, #FBE0B6 0%, #F2A33C 100%);
    border-color: #C77B1E;
    color: #2B2D33;
    animation: pulse 0.5s ease-in-out;
}

.kid-answer-btn.correct .frac-num {
    border-bottom-color: #2B2D33;
}

.kid-answer-btn.incorrect {
    background: linear-gradient(135deg, #8A929E 0%, #5A6472 100%);
    border-color: #2B2D33;
    color: #FDF3E3;
    animation: shake 0.5s ease-in-out;
}

.kid-answer-btn.incorrect .frac-num {
    border-bottom-color: #FDF3E3;
}

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

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

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

.feedback-message {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    padding: 15px 25px;
    border-radius: 15px;
    display: inline-block;
}

.feedback-message.correct {
    background: linear-gradient(135deg, #FBE0B6 0%, #F2A33C 100%);
    color: #6E3A0E;
    border: 3px solid #C77B1E;
}

.feedback-message.incorrect {
    background: linear-gradient(135deg, #7A828F 0%, #5A6472 100%);
    color: #FDF3E3;
    border: 3px solid #2B2D33;
}

/* Results Screen */
.kid-stars {
    font-size: 4rem;
    text-align: center;
    margin: 30px 0;
}

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

.result-stat {
    text-align: center;
    background: linear-gradient(135deg, #FDF3E3 0%, #FFFFFF 100%);
    border: 3px solid #2B2D33;
    border-radius: 20px;
    padding: 25px;
}

.stat-value {
    font-family: 'Fredoka', sans-serif;
    font-size: 3.5rem;
    font-weight: 700;
    color: #E25822;
    margin-bottom: 10px;
}

.stat-label {
    font-family: 'Nunito', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2B2D33;
}

/* Missed Problems Section */
.missed-problems {
    background: linear-gradient(135deg, #FBF3E0 0%, #FDF3E3 100%);
    border: 3px solid #2B2D33;
    border-radius: 20px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: 0 4px 15px rgba(43, 45, 51, 0.15);
}

.missed-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #E25822;
    text-align: center;
    margin-bottom: 25px;
}

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

.missed-item {
    background: #FFFFFF;
    border: 2px solid #E25822;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
}

.missed-question {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2B2D33;
    margin-bottom: 15px;
}

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

.your-answer {
    color: #B23A12;
    font-weight: 600;
}

.correct-answer {
    color: #C77B1E;
    font-weight: 600;
}

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

/* Buttons */
.kid-btn {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 15px 35px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.kid-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.kid-btn-primary {
    background: linear-gradient(135deg, #E25822 0%, #F2792F 100%);
    color: white;
    border: 3px solid #B23A12;
}

.kid-btn-secondary {
    background: linear-gradient(135deg, #7A828F 0%, #5A6472 100%);
    color: #FDF3E3;
    border: 3px solid #2B2D33;
}

.kid-btn-accent {
    background: linear-gradient(135deg, #F2A33C 0%, #F7BC63 100%);
    color: #2B2D33;
    border: 3px solid #C77B1E;
    font-weight: 700;
}

/* Utility Classes */
.kid-hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .kid-game-card {
        padding: 25px;
    }

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

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

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

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

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

    .fraction-display {
        font-size: 2.1rem;
        padding: 24px 18px;
        gap: 14px;
    }

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

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

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

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

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

    .game-content {
        padding: 10px;
    }

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

    .forge-mascot {
        font-size: 3rem;
    }

    .fraction-display {
        font-size: 1.8rem;
        padding: 20px 14px;
    }

    .eq-sign,
    .cmp-circle {
        font-size: 1.9rem;
    }

    .bar-label {
        min-width: 44px;
        font-size: 1rem;
    }

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

    .answer-choices.symbol-choices {
        grid-template-columns: repeat(3, 1fr);
    }

    .answer-choices.symbol-choices .kid-answer-btn {
        font-size: 1.8rem;
        padding: 16px 8px;
    }

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