:root {
    --primary: #E8962E;
    --primary-glow: rgba(232, 150, 46, 0.3);
    --bg-dark: #0F172A;
    --bg-surface: #1E293B;
    --glass-bg: rgba(30, 41, 59, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --accent-green: #10B981;
    --accent-red: #EF4444;
    --accent-yellow: #F59E0B;
    --radius: 16px;
    --radius-sm: 10px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 16px) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 16px);
}

#app {
    width: 100%;
    max-width: 460px;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ---- HUD ---- */
.hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 4px 12px;
    flex-shrink: 0;
}

.hud-score {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.hud-score .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
#score-value { font-family: 'Outfit', 'Inter', sans-serif; font-size: 28px; font-weight: 800; color: var(--primary); }
#question-counter { font-size: 13px; color: var(--text-muted); }

#streak-indicator {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-yellow);
    animation: pulse 0.6s ease infinite alternate;
}
#streak-indicator.hidden { display: none; }

@keyframes pulse { from { opacity: 0.7; } to { opacity: 1; } }

/* ---- Timer ---- */
.timer-track {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.timer-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.05s linear, background 0.3s ease;
}
.timer-bar.green { background: var(--accent-green); }
.timer-bar.yellow { background: var(--accent-yellow); }
.timer-bar.red { background: var(--accent-red); }

/* ---- Game Area ---- */
#game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    gap: 16px;
}
#game-area.hidden { display: none; }

.question-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.difficulty-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 10px;
    border-radius: 20px;
}
.diff-1 { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.diff-2 { background: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); }
.diff-3 { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

#prompt-text {
    font-size: 17px;
    line-height: 1.55;
    font-weight: 500;
}

/* ---- Choices ---- */
#choices-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.choice-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 15px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.choice-btn:hover:not(:disabled) {
    background: rgba(232, 150, 46, 0.1);
    border-color: rgba(232, 150, 46, 0.3);
    transform: translateY(-1px);
}

.choice-btn:active:not(:disabled) { transform: scale(0.98); }

.choice-num {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    color: var(--text-muted);
}

.choice-text { flex: 1; line-height: 1.4; }

.choice-btn.correct {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--accent-green);
}
.choice-btn.correct .choice-num { background: var(--accent-green); color: #fff; }

.choice-btn.wrong {
    background: rgba(239, 68, 68, 0.12);
    border-color: var(--accent-red);
    animation: shake 0.4s ease;
}
.choice-btn.wrong .choice-num { background: var(--accent-red); color: #fff; }

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

.choice-btn:disabled { cursor: default; opacity: 0.85; }

/* ---- Feedback ---- */
.feedback-area {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.5;
    transition: opacity 0.2s;
}
.feedback-area.hidden { display: none; }
.feedback-area.correct { background: rgba(16, 185, 129, 0.1); border-left: 3px solid var(--accent-green); }
.feedback-area.wrong { background: rgba(239, 68, 68, 0.08); border-left: 3px solid var(--accent-red); }
.feedback-text { color: var(--text-muted); }

/* ---- Floating Feedback ---- */
.floating-feedback {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 36px;
    font-weight: 800;
    pointer-events: none;
    animation: floatUp 1.1s ease forwards;
    z-index: 100;
    text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.floating-feedback.positive { color: var(--accent-green); }
.floating-feedback.negative { color: var(--accent-red); }

@keyframes floatUp {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.7); }
    30% { opacity: 1; transform: translate(-50%, -70%) scale(1.1); }
    100% { opacity: 0; transform: translate(-50%, -120%) scale(0.9); }
}

/* ---- End Screen ---- */
#end-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 20px 0;
    text-align: center;
}
#end-screen.hidden { display: none; }

.end-rank-emoji { font-size: 64px; }
.end-rank { font-family: 'Outfit', 'Inter', sans-serif; font-size: 26px; font-weight: 800; color: var(--primary); }

.score-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px 32px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 32px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    max-width: 340px;
}

.score-card .stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.score-card .stat-value { font-family: 'Outfit', 'Inter', sans-serif; font-size: 28px; font-weight: 800; }

#new-high-score {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-yellow);
    animation: pulse 0.8s ease infinite alternate;
}
#new-high-score.hidden { display: none; }

.end-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 300px;
}

.btn-primary {
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Outfit', 'Inter', sans-serif;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.share-row {
    display: flex;
    gap: 10px;
}

.share-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s;
}
.share-btn:hover { opacity: 0.85; }
.share-btn.whatsapp { background: #25D366; }
.share-btn.x { background: #1DA1F2; }

/* ---- Responsive ---- */
@media (max-width: 400px) {
    #prompt-text { font-size: 15px; }
    .choice-btn { padding: 12px 14px; font-size: 14px; }
    .score-card { padding: 18px 20px; gap: 14px 20px; }
}
