/* === MATHDRILL STYLES === */

:root {
    --primary-color: #2563eb;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* === HEADER === */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* === SCREENS === */
.screen {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.hidden {
    display: none;
}

/* === START SCREEN === */
.intro {
    margin-bottom: 2rem;
}

.intro h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.intro ul {
    list-style: none;
    margin: 1.5rem 0;
}

.intro li {
    padding: 0.5rem 0;
    font-size: 1.1rem;
}

/* === FORMULA REFERENCE === */
.formula-reference {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.formula-reference h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.formula-box {
    background: white;
    padding: 1rem;
    margin: 0.75rem 0;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-size: 1.1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #1d4ed8;
}

/* === STATS BAR === */
.stats-bar {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-value.success {
    color: var(--success-color);
}

.stat-value.error {
    color: var(--error-color);
}

/* === QUESTION CONTAINER === */
.question-container {
    position: relative;
    text-align: center;
    margin-bottom: 2rem;
}

.function-display p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.math-large {
    font-size: 2rem;
    margin: 1.5rem 0;
}

/* === CHOICES CONTAINER === */
.choices-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.choice-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.choice-btn:hover {
    border-color: var(--primary-color);
    background: white;
}

.choice-number {
    font-weight: bold;
    color: var(--text-secondary);
    min-width: 2rem;
}

.choice-math {
    flex: 1;
    text-align: left;
}

/* === FEEDBACK ANIMATIONS === */
.choice-btn.correct {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.choice-btn.wrong {
    background: var(--error-color);
    border-color: var(--error-color);
    color: white;
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
    .container {
        padding: 1rem 0.5rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .math-large {
        font-size: 1.5rem;
    }
    
    .stats-bar {
        gap: 0.5rem;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
}


/* === MASTERY STAR ANIMATION === */
.mastery-star {
    position: absolute;
    font-size: 2rem;
    animation: starBurst 2s ease-out forwards;
    pointer-events: none;
    z-index: 1000;
}

@keyframes starBurst {
    0% {
        transform: translateY(0) scale(0);
        opacity: 1;
    }
    40% {
        transform: translateY(-50px) scale(1.5);
        opacity: 1;
    }
    100% {
        transform: translateY(-120px) scale(1);
        opacity: 0;
    }
}

/* === MASTERY HIGHLIGHT FOR STATS BAR === */
.stats-bar.mastery-highlight {
    background: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
    transition: all 0.3s ease;
}

/* === MILESTONE CELEBRATION === */
.milestone-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-in;
}

.milestone-overlay.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

.milestone-content {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    animation: scaleIn 0.5s ease-out;
}

.milestone-stars {
    font-size: 3rem;
    margin: 1rem 0;
    animation: pulse 1s ease-in-out infinite;
}

.milestone-message {
    color: var(--primary-color);
    font-size: 2rem;
    margin: 1rem 0;
}


/* === ANIMATIONS === */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes scaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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


/* === VARIATION UNLOCK NOTIFICATION === */
.variation-unlock-notification {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 2rem 3rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.4);
    z-index: 9999;
    animation: slideDown 0.5s ease-out;
}

.variation-unlock-notification.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

.unlock-content {
    text-align: center;
}

.unlock-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 1s ease-in-out infinite;
}

.unlock-content h3 {
    font-size: 1.8rem;
    margin: 0.5rem 0;
    font-weight: bold;
}

.unlock-content p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0.5rem 0 0 0;
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -100px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

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

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