/* ============================================
   MATH STAR - BRIGHT & FUN STYLESHEET
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', 'Comic Sans MS', cursive, sans-serif;
}

body {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

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

.app {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

/* ============================================
   SCREENS & LAYOUT
   ============================================ */

.screen {
    display: none;
    width: 100%;
    height: 100%;
    animation: slideIn 0.5s ease-out;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.screen-container {
    background: white;
    border-radius: 30px;
    padding: 40px 30px;
    max-width: 600px;
    width: 95%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.home-container {
    background: white;
    border-radius: 30px;
    padding: 40px;
    max-width: 600px;
    width: 95%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.game-container {
    background: white;
    border-radius: 30px;
    padding: 20px;
    max-width: 800px;
    width: 95%;
    height: 95vh;
    max-height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1 {
    font-size: 3.5rem;
    color: #FF1493;
    margin-bottom: 10px;
    text-shadow: 3px 3px 0 rgba(255, 215, 0, 0.5);
    animation: bounce 1s ease-in-out infinite;
}

h2 {
    font-size: 2.5rem;
    color: #FF1493;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 rgba(255, 215, 0, 0.3);
}

h3 {
    font-size: 1.5rem;
    color: #4facfe;
    margin: 20px 0 15px 0;
}

p, .subtitle {
    font-size: 1.25rem;
    color: #666;
    margin-bottom: 20px;
}

.subtitle {
    font-size: 1.5rem;
    color: #FF69B4;
    font-weight: bold;
}

.instruction {
    font-size: 1.1rem;
    color: #333;
}

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

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    border: none;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    padding: 15px 30px;
    margin: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: scale(0.98);
}

.btn-lg {
    padding: 20px 40px;
    font-size: 1.3rem;
    border-radius: 25px;
}

.btn-primary {
    background: linear-gradient(135deg, #FF1493, #FF69B4);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
}

.btn-back {
    background: linear-gradient(135deg, #999999, #666666);
    color: white;
    font-size: 1rem;
    padding: 12px 25px;
}

.btn-speak {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    font-size: 1rem;
    padding: 10px 20px;
}

.btn-number {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
    font-size: 1.2rem;
    padding: 15px;
    width: calc(33.333% - 10px);
    font-weight: bold;
}

.btn-delete {
    background: linear-gradient(135deg, #FF6B6B, #FF8787);
    color: white;
}

.btn-submit {
    background: linear-gradient(135deg, #00D084, #00E5A0);
    color: white;
    width: calc(33.333% - 10px);
}

.btn-quit {
    background: linear-gradient(135deg, #FF6B6B, #FF8787);
    color: white;
    font-size: 0.9rem;
    padding: 10px 20px;
    margin-top: auto;
    align-self: center;
}

/* ============================================
   HOME SCREEN
   ============================================ */

.welcome-header {
    text-align: center;
    margin-bottom: 30px;
}

.character-display {
    text-align: center;
    margin: 30px 0;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.animal-svg {
    width: 150px;
    height: 150px;
    animation: float 3s ease-in-out infinite;
}

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

.home-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 40px;
}

/* ============================================
   DIFFICULTY SELECTION
   ============================================ */

.difficulty-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.difficulty-btn {
    flex: 1;
    min-width: 120px;
    padding: 20px;
    font-size: 1rem;
    background: linear-gradient(135deg, #E0E0E0, #BDBDBD);
    color: #333;
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.difficulty-btn[data-level="easy"] {
    background: linear-gradient(135deg, #FFB347, #FF8C42);
    color: white;
}

.difficulty-btn[data-level="medium"] {
    background: linear-gradient(135deg, #87CEEB, #4A90E2);
    color: white;
}

.difficulty-btn[data-level="hard"] {
    background: linear-gradient(135deg, #DDA0DD, #BA55D3);
    color: white;
}

.difficulty-btn.selected {
    border: 4px solid #FFD700;
    transform: scale(1.1);
}

/* ============================================
   QUIZ SETUP
   ============================================ */

.quiz-setup {
    background: #F5F5F5;
    border-radius: 20px;
    padding: 30px;
    margin: 20px 0;
    text-align: left;
}

.setup-option {
    margin-bottom: 25px;
}

.setup-option label {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.select-input {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    border: 3px solid #4facfe;
    border-radius: 15px;
    background: white;
    cursor: pointer;
    color: #333;
}

.select-input:focus {
    outline: none;
    border-color: #FF1493;
}

/* ============================================
   GAME SCREEN
   ============================================ */

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 0;
    border-bottom: 3px solid #FFD700;
}

.score-box {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    padding: 10px 20px;
    border-radius: 15px;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
}

.score-label {
    margin-right: 10px;
}

.mode-display {
    background: linear-gradient(135deg, #FF1493, #FF69B4);
    color: white;
    padding: 8px 16px;
    border-radius: 15px;
    font-weight: bold;
}

.quiz-info {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
    padding: 8px 16px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.9rem;
}

/* ============================================
   CHARACTER CONTAINER
   ============================================ */

.character-container {
    text-align: center;
    margin: 20px 0;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.animal-display {
    font-size: 80px;
    animation: charBob 2s ease-in-out infinite;
}

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

@keyframes celebrate {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    50% { transform: scale(1.1) rotate(5deg); }
    75% { transform: scale(1.1) rotate(-5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.celebrate .animal-display {
    animation: celebrate 0.6s ease-in-out;
}

/* ============================================
   PROBLEM AREA
   ============================================ */

.problem-area {
    margin: 20px 0;
    flex-shrink: 0;
}

.problem-box {
    background: linear-gradient(135deg, #E0F2F7, #FFF9E6);
    border: 4px dashed #FF1493;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.problem-display {
    font-size: 3rem;
    font-weight: bold;
    color: #333;
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   ANSWER AREA
   ============================================ */

.answer-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 15px;
}

.feedback-box {
    min-height: 40px;
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    border-radius: 15px;
    padding: 12px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
    color: #2E7D32;
    border: 2px solid #4CAF50;
}

.feedback-box.error {
    background: linear-gradient(135deg, #FFEBEE, #FFCDD2);
    color: #C62828;
    border-color: #FF6B6B;
}

.feedback-box.correct {
    background: linear-gradient(135deg, #E8F5E9, #A5D6A7);
    color: #1B5E20;
    animation: slideIn 0.5s ease-out;
}

.multiple-choice {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.multiple-choice .btn {
    padding: 15px;
    font-size: 1.2rem;
    width: 100%;
    margin: 0;
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-bottom: 10px;
}

.btn-number, .btn-delete, .btn-submit {
    margin: 0;
    padding: 15px 10px;
}

.btn-delete, .btn-submit {
    grid-column: span 1;
}

/* ============================================
   RESULTS SCREEN
   ============================================ */

.results-stats {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
    flex-wrap: wrap;
}

.stat {
    background: linear-gradient(135deg, #F0F4F8, #E8EFF5);
    padding: 20px;
    border-radius: 20px;
    margin: 10px;
    min-width: 120px;
    border: 3px solid #4facfe;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    font-weight: bold;
}

.stat-value {
    display: block;
    font-size: 2rem;
    color: #FF1493;
    font-weight: bold;
    margin-top: 10px;
}

.results-message {
    background: linear-gradient(135deg, #FFF9E6, #FFE082);
    padding: 20px;
    border-radius: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    color: #FF6F00;
    margin: 20px 0;
    border: 3px dashed #FFD700;
}

.results-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.results-buttons .btn {
    flex: 1;
    min-width: 150px;
}

/* ============================================
   PROGRESS DASHBOARD
   ============================================ */

.progress-stats {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
    flex-wrap: wrap;
    gap: 15px;
}

.progress-card {
    background: linear-gradient(135deg, #F5F5F5, #E8E8E8);
    padding: 25px;
    border-radius: 20px;
    flex: 1;
    min-width: 150px;
    border: 3px solid #4facfe;
    text-align: center;
}

.progress-card-title {
    font-size: 0.9rem;
    color: #666;
    font-weight: bold;
    margin-bottom: 10px;
}

.progress-card-value {
    font-size: 2.5rem;
    color: #FF1493;
    font-weight: bold;
}

.progress-by-difficulty {
    background: #F9F9F9;
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    text-align: left;
}

#difficultyStats {
    display: grid;
    gap: 15px;
}

.difficulty-stat {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border-left: 5px solid #4facfe;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.difficulty-stat-name {
    font-weight: bold;
    color: #333;
}

.difficulty-stat-info {
    text-align: right;
    color: #666;
    font-size: 0.9rem;
}

.progress-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    .screen-container,
    .home-container,
    .game-container {
        padding: 20px;
        border-radius: 20px;
    }

    .game-container {
        height: 98vh;
    }

    .problem-display {
        font-size: 2.2rem;
    }

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

    .btn-lg {
        padding: 15px 30px;
        font-size: 1.1rem;
    }

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

    .results-stats {
        flex-direction: column;
    }

    .stat {
        min-width: 100%;
    }

    .difficulty-buttons {
        gap: 8px;
    }

    .difficulty-btn {
        min-width: 100px;
        padding: 15px;
        font-size: 0.9rem;
    }

    .game-header {
        flex-direction: column;
        gap: 10px;
    }

    .score-box,
    .mode-display,
    .quiz-info {
        width: 100%;
        text-align: center;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    body,
    .app,
    .screen {
        height: 100vh;
    }

    .problem-display {
        font-size: 1.8rem;
        min-height: 60px;
    }

    .btn {
        padding: 10px 15px;
        font-size: 0.95rem;
        margin: 5px;
    }

    .multiple-choice {
        grid-template-columns: 1fr;
    }

    .multiple-choice .btn {
        min-width: 100%;
    }

    .progress-card {
        min-width: 100%;
    }

    .results-buttons {
        flex-direction: column;
    }

    .results-buttons .btn {
        width: 100%;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.btn:focus,
.select-input:focus {
    outline: 3px dashed #FFD700;
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
