/* ===== Math Quiz Styles ===== */

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

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark, #050505);
    color: var(--text-main, #ffffff);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-x: hidden;
}

/* ===== Header ===== */
.g4f-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-card, rgba(20, 20, 25, 0.7));
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass, rgba(255, 255, 255, 0.1));
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main, #fff);
    font-size: 1.2rem;
    font-weight: 600;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-neon, #6366f1), var(--secondary-neon, #ec4899));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.highlight-4 {
    color: var(--secondary-neon, #ec4899);
    font-weight: 700;
}

.lang-switch {
    display: flex;
    gap: 6px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.5);
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.lang-btn.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
    color: #fff;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===== Game Container ===== */
.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* ===== Screens ===== */
.screen {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
}

.screen.active {
    display: flex;
}

/* ===== Start Screen ===== */
#start-screen {
    justify-content: center;
    align-items: center;
    gap: 24px;
    padding: 60px 0;
}

.game-title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.start-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1rem;
    text-align: center;
}

/* ===== Neon Button ===== */
.neon-btn {
    padding: 14px 40px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.neon-btn.primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.neon-btn.primary:hover {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
}

.neon-btn.primary:active {
    transform: translateY(0);
}

/* ===== Stats Bar ===== */
.stats-bar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
    margin-bottom: 12px;
}

.stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    backdrop-filter: blur(8px);
}

.stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.stat-streak .stat-value {
    color: #f59e0b;
}

/* ===== Progress Bar ===== */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    margin-bottom: 24px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #6366f1, #ec4899);
    border-radius: 3px;
    transition: width 0.3s linear;
}

.progress-bar.warning {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.progress-bar.danger {
    background: #ef4444;
    animation: pulse-bar 0.5s ease-in-out infinite;
}

@keyframes pulse-bar {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ===== Problem Area ===== */
.problem-area {
    width: 100%;
    position: relative;
    margin-bottom: 24px;
}

.problem-display {
    width: 100%;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    text-align: center;
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.problem-text {
    font-size: 2.8rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 4px;
    font-variant-numeric: tabular-nums;
}

/* Feedback Flash */
.feedback-flash {
    position: absolute;
    inset: 0;
    border-radius: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.feedback-flash.correct {
    background: rgba(34, 197, 94, 0.15);
    border: 2px solid rgba(34, 197, 94, 0.5);
    opacity: 1;
}

.feedback-flash.wrong {
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid rgba(239, 68, 68, 0.5);
    opacity: 1;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Speed Bonus */
.speed-bonus {
    position: absolute;
    top: -8px;
    right: 16px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
    animation: bonus-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.speed-bonus.hidden {
    display: none;
}

@keyframes bonus-pop {
    0% { transform: scale(0) rotate(-10deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ===== Answer Buttons ===== */
.answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    margin-bottom: 24px;
}

.answer-btn {
    padding: 20px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    min-height: 70px;
}

.answer-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.answer-btn:active {
    transform: translateY(0) scale(0.97);
}

.answer-btn.correct {
    background: rgba(34, 197, 94, 0.25);
    border-color: #22c55e;
    color: #22c55e;
    animation: pop-correct 0.3s ease;
}

.answer-btn.wrong {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #ef4444;
    animation: pop-wrong 0.3s ease;
}

.answer-btn.reveal-correct {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.5);
    color: #22c55e;
}

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

@keyframes pop-wrong {
    0% { transform: scale(1); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-2px); }
    100% { transform: scale(1); }
}

.answer-btn[disabled] {
    pointer-events: none;
    opacity: 0.6;
}

/* ===== Streak Combo Indicator ===== */
.stat-streak .stat-value.on-fire {
    color: #ef4444;
    text-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

/* ===== Results Screen ===== */
.results-panel {
    width: 100%;
    padding: 32px 24px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.results-title {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.new-record {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    animation: bonus-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.new-record.hidden {
    display: none;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.result-item.result-primary {
    grid-column: 1 / -1;
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.result-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.result-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.result-primary .result-value {
    font-size: 2.4rem;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Ad Container ===== */
.g4f-ad-container {
    width: 100%;
    max-width: 600px;
    margin: 24px auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    text-align: center;
}

.ad-placeholder-content {
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.8rem;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ===== Score Pop Animation ===== */
.score-pop {
    position: fixed;
    font-size: 1.4rem;
    font-weight: 700;
    pointer-events: none;
    z-index: 200;
    animation: score-fly 0.8s ease-out forwards;
}

.score-pop.positive {
    color: #22c55e;
}

.score-pop.negative {
    color: #ef4444;
}

@keyframes score-fly {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-60px) scale(1.3); }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .game-container {
        padding: 16px 12px;
    }

    .problem-text {
        font-size: 2.2rem;
        letter-spacing: 2px;
    }

    .answer-btn {
        padding: 16px 12px;
        font-size: 1.3rem;
        min-height: 60px;
    }

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

    .game-title {
        font-size: 2rem;
    }
}

@media (max-width: 360px) {
    .problem-text {
        font-size: 1.8rem;
    }

    .answer-btn {
        font-size: 1.1rem;
        padding: 14px 10px;
    }
}
