/**
 * Graph Master - Mission Control Data Center Theme
 *
 * A bright, kid-friendly space-agency dashboard where students read
 * incoming "mission data" as scaled bar graphs and picture graphs.
 * Builds on top of kid-friendly-theme.css
 *
 * Color Palette:
 * - Control Navy: #16324F (titles, text, panel frames)
 * - Radar Cyan: #1B9AAA (bars, accents, primary buttons)
 * - Launch Orange: #FF8C42 (score, highlights, alerts)
 * - Solar Gold: #FFC53D (progress bar, stars, key highlights)
 * - Go-Green: #43AA8B (success states, easy difficulty)
 */

body {
    background: linear-gradient(160deg, #DCF0FB 0%, #EAF6FF 45%, #FFF3E2 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, #FFFFFF 0%, #F0F8FF 100%);
    border: 4px solid #16324F;
    border-radius: 25px;
    padding: 40px;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 8px 30px rgba(22, 50, 79, 0.25);
}

/* Mascot */
.mission-mascot {
    font-size: 5rem;
    text-align: center;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

.mission-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: #16324F;
    text-align: center;
    margin: 20px 0;
}

.kid-friendly-body {
    color: #2C3E50;
    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: #16324F;
    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 #16324F;
}

.kid-difficulty-card:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 8px 25px rgba(27, 154, 170, 0.4);
}

.kid-difficulty-card.easy {
    background: linear-gradient(135deg, #C9F2E5 0%, #9FE3CC 100%);
    border-color: #43AA8B;
}

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

.kid-difficulty-card.hard {
    background: linear-gradient(135deg, #FFD3B0 0%, #FFAB76 100%);
    border-color: #FF8C42;
}

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

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

.difficulty-example {
    font-size: 0.95rem;
    font-weight: 600;
    font-style: italic;
    color: #16324F;
    background: rgba(255, 255, 255, 0.6);
    padding: 5px 10px;
    border-radius: 8px;
    margin-top: 10px;
}

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

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

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

.practice-mode-card p {
    font-size: 1.2rem;
    color: #2C3E50;
    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: #16324F;
}

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

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

/* Progress Bar */
.kid-progress-bar {
    background: rgba(22, 50, 79, 0.15);
    border: 2px solid #16324F;
    border-radius: 15px;
    height: 25px;
    margin-bottom: 30px;
    overflow: hidden;
}

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

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

.question-text {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.7rem;
    font-weight: 700;
    color: #16324F;
    margin: 25px 0 5px;
}

/* ============================================================
   Mission Control Chart Panel
   ============================================================ */

.chart-panel {
    background: #FFFFFF;
    border: 3px solid #16324F;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(22, 50, 79, 0.2);
    text-align: left;
}

.chart-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(90deg, #16324F 0%, #1B9AAA 130%);
    padding: 10px 16px;
}

.panel-lights {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.panel-lights i {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.panel-lights i:nth-child(1) { background: #FF8C42; }
.panel-lights i:nth-child(2) { background: #FFC53D; }
.panel-lights i:nth-child(3) { background: #43AA8B; animation: blink 1.6s ease-in-out infinite; }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.chart-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: #FFFFFF;
    text-transform: uppercase;
}

.chart-area {
    padding: 20px 24px 16px;
}

/* ---------------- Bar Graph ---------------- */

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bar-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    align-items: center;
    gap: 10px;
}

.bar-label {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #16324F;
    text-align: right;
}

.bar-emoji {
    font-size: 1.2rem;
}

.bar-track {
    position: relative;
    height: 34px;
    background-color: #EFF7FB;
    border: 2px solid rgba(22, 50, 79, 0.25);
    border-radius: 8px;
    overflow: hidden;
    /* Gridline every scale step (axis max is always 10 steps) */
    background-image: linear-gradient(to right, rgba(22, 50, 79, 0.15) 2px, transparent 2px);
    background-size: 10% 100%;
}

.bar-fill {
    height: 100%;
    border-radius: 0 6px 6px 0;
    transition: width 0.6s ease;
}

.bar-color-0 { background: linear-gradient(90deg, #1B9AAA 0%, #36BBC9 100%); }
.bar-color-1 { background: linear-gradient(90deg, #FF8C42 0%, #FFAB76 100%); }
.bar-color-2 { background: linear-gradient(90deg, #FFC53D 0%, #FFD166 100%); }
.bar-color-3 { background: linear-gradient(90deg, #43AA8B 0%, #5FC9A8 100%); }
.bar-color-4 { background: linear-gradient(90deg, #5C7CA8 0%, #7E9CC4 100%); }

.axis-row {
    margin-top: -4px;
}

.bar-axis {
    position: relative;
    height: 22px;
}

.axis-tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-family: 'Fredoka', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #16324F;
}

.axis-tick:first-child {
    transform: translateX(0);
}

.axis-caption {
    text-align: center;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1B9AAA;
    margin-top: 2px;
    padding-left: 130px;
}

/* ---------------- Picture Graph ---------------- */

.picto-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.picto-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 2px dashed rgba(22, 50, 79, 0.15);
}

.picto-label {
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #16324F;
    text-align: right;
}

.picto-symbols {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 1.5rem;
    line-height: 1.2;
}

.picto-key {
    align-self: center;
    margin-top: 8px;
    background: linear-gradient(135deg, #FFE9B3 0%, #FFD166 100%);
    border: 2px solid #FFC53D;
    border-radius: 10px;
    padding: 6px 16px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #16324F;
}

/* ---------------- Answer Choices ---------------- */

.answer-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin: 25px 0;
}

.kid-answer-btn {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #16324F;
    background: linear-gradient(135deg, #FFFFFF 0%, #E5F4F9 100%);
    border: 3px solid #1B9AAA;
    border-radius: 15px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.kid-answer-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(27, 154, 170, 0.4);
    background: linear-gradient(135deg, #FFE9B3 0%, #FFD166 100%);
    border-color: #FFC53D;
}

.kid-answer-btn.correct {
    background: linear-gradient(135deg, #C9F2E5 0%, #9FE3CC 100%);
    border-color: #43AA8B;
    animation: pulse 0.5s ease-in-out;
}

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

@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: 20px;
    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, #C9F2E5 0%, #9FE3CC 100%);
    color: #1E7A5E;
    border: 3px solid #43AA8B;
}

.feedback-message.incorrect {
    background: linear-gradient(135deg, #FFD3B0 0%, #FFAB76 100%);
    color: #A33B12;
    border: 3px solid #E0572F;
}

/* 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, #E5F4F9 0%, #FFFFFF 100%);
    border: 3px solid #16324F;
    border-radius: 20px;
    padding: 25px;
}

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

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

/* Missed Problems Section */
.missed-problems {
    background: linear-gradient(135deg, #EAF6FF 0%, #E5F4F9 100%);
    border: 3px solid #16324F;
    border-radius: 20px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: 0 4px 15px rgba(22, 50, 79, 0.15);
}

.missed-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #16324F;
    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 #1B9AAA;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
}

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

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

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

.correct-answer {
    color: #1E7A5E;
    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.2);
}

.kid-btn-primary {
    background: linear-gradient(135deg, #1B9AAA 0%, #36BBC9 100%);
    color: white;
    border: 3px solid #16324F;
}

.kid-btn-secondary {
    background: linear-gradient(135deg, #D3D3D3 0%, #A9A9A9 100%);
    color: #2C3E50;
    border: 3px solid #808080;
}

.kid-btn-accent {
    background: linear-gradient(135deg, #FFC53D 0%, #FF8C42 100%);
    color: #16324F;
    border: 3px solid #FF8C42;
}

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

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

    .mission-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.4rem;
    }

    .chart-area {
        padding: 15px 14px 12px;
    }

    .bar-row,
    .picto-row {
        grid-template-columns: 90px 1fr;
        gap: 8px;
    }

    .bar-label,
    .picto-label {
        font-size: 0.85rem;
        flex-wrap: wrap;
    }

    .bar-emoji {
        font-size: 1rem;
    }

    .bar-track {
        height: 28px;
    }

    .axis-tick {
        font-size: 0.75rem;
    }

    .axis-caption {
        padding-left: 98px;
        font-size: 0.85rem;
    }

    .picto-symbols {
        font-size: 1.2rem;
        gap: 3px;
    }

    .answer-choices {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .kid-answer-btn {
        font-size: 1.3rem;
        padding: 14px;
    }

    .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: 16px;
    }

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

    .chart-title {
        font-size: 0.85rem;
    }

    .bar-row,
    .picto-row {
        grid-template-columns: 76px 1fr;
        gap: 6px;
    }

    .bar-label,
    .picto-label {
        font-size: 0.75rem;
    }

    .axis-caption {
        padding-left: 82px;
    }

    .picto-symbols {
        font-size: 1.05rem;
    }

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