/* ===== Design System ===== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c28;
    --bg-input: #1e1e2a;
    --text-primary: #f0f0f5;
    --text-secondary: #9090a8;
    --text-muted: #606078;
    --accent: #6c5ce7;
    --accent-light: #a29bfe;
    --accent-glow: rgba(108, 92, 231, 0.25);
    --success: #00cec9;
    --success-glow: rgba(0, 206, 201, 0.2);
    --danger: #ff6b6b;
    --danger-glow: rgba(255, 107, 107, 0.2);
    --warning: #feca57;
    --border: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== Screens ===== */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; animation: fadeIn 0.4s ease; }

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

/* ===== Hero ===== */
.hero {
    position: relative;
    text-align: center;
    padding: 80px 24px 48px;
    overflow: hidden;
}

.hero-glow {
    position: absolute;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(ellipse, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.hero-content { position: relative; z-index: 1; }

.badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(108, 92, 231, 0.15);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-light);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 12px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-light), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 480px;
    margin: 0 auto;
}

/* ===== Stats Bar ===== */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    padding: 0 24px;
    max-width: 900px;
    margin: 0 auto 48px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-light);
    background: var(--bg-card-hover);
}

.stat-number {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent-light);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* ===== Topic Grid ===== */
.topic-grid {
    padding: 0 24px;
    max-width: 900px;
    margin: 0 auto 48px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.topics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.topic-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.topic-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 0 30px var(--accent-glow);
}

.topic-card .topic-icon {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.topic-card .topic-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.topic-card .topic-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.topic-card .topic-progress-bar {
    height: 3px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    margin-top: 14px;
    overflow: hidden;
}

.topic-card .topic-progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.topic-progress-fill.good { background: var(--success); }
.topic-progress-fill.mid { background: var(--warning); }
.topic-progress-fill.bad { background: var(--danger); }
.topic-progress-fill.none { background: var(--text-muted); width: 0 !important; }

.topic-accuracy {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 8px;
}

.topic-accuracy.good { color: var(--success); }
.topic-accuracy.mid { color: var(--warning); }
.topic-accuracy.bad { color: var(--danger); }
.topic-accuracy.none { color: var(--text-muted); }

/* ===== Buttons ===== */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 24px 60px;
    max-width: 500px;
    margin: 0 auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #5a4bd1);
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(108, 92, 231, 0.4);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover { color: var(--text-primary); }

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg { padding: 16px 32px; font-size: 1rem; }
.btn-icon { font-size: 1.2em; }

/* ===== Quiz Screen ===== */
.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.quiz-progress { flex: 1; margin: 0 20px; max-width: 400px; }

.progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    border-radius: 10px;
    transition: width 0.4s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    display: block;
}

.quiz-score {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-light);
}

/* ===== Quiz Body ===== */
.quiz-body {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

.topic-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(108, 92, 231, 0.12);
    border: 1px solid rgba(108, 92, 231, 0.2);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-light);
    margin-bottom: 20px;
}

.question-text {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 32px;
    color: var(--text-primary);
}

/* ===== Options ===== */
.options { display: flex; flex-direction: column; gap: 12px; }

.option {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.95rem;
    line-height: 1.5;
    user-select: none;
}

.option:hover:not(.disabled) {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateX(4px);
}

.option .option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.option:hover:not(.disabled) .option-letter {
    background: var(--accent);
    color: white;
}

.option.correct {
    border-color: var(--success);
    background: rgba(0, 206, 201, 0.08);
}

.option.correct .option-letter {
    background: var(--success);
    color: var(--bg-primary);
}

.option.incorrect {
    border-color: var(--danger);
    background: rgba(255, 107, 107, 0.08);
}

.option.incorrect .option-letter {
    background: var(--danger);
    color: white;
}

.option.disabled { pointer-events: none; opacity: 0.6; }
.option.correct.disabled { opacity: 1; }

/* ===== Feedback Panel ===== */
.feedback-panel {
    display: none;
    margin-top: 28px;
    padding: 24px;
    border-radius: var(--radius-md);
    animation: slideUp 0.35s ease;
}

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

.feedback-panel.show { display: block; }

.feedback-panel.correct-panel {
    background: rgba(0, 206, 201, 0.06);
    border: 1px solid rgba(0, 206, 201, 0.2);
}

.feedback-panel.incorrect-panel {
    background: rgba(255, 107, 107, 0.06);
    border: 1px solid rgba(255, 107, 107, 0.2);
}

.feedback-icon { font-size: 2rem; margin-bottom: 8px; }

.feedback-text {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.feedback-panel.correct-panel .feedback-text { color: var(--success); }
.feedback-panel.incorrect-panel .feedback-text { color: var(--danger); }

.explanation {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* ===== Results Screen ===== */
.results-content {
    max-width: 700px;
    margin: 0 auto;
    padding: 60px 24px;
    text-align: center;
}

.results-hero { margin-bottom: 40px; }

.results-emoji {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: bounce 0.6s ease;
}

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

.results-content h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.results-score {
    font-size: 1.3rem;
    color: var(--text-secondary);
}

.results-score strong {
    color: var(--accent-light);
    font-size: 1.5rem;
}

/* ===== Results Breakdown ===== */
.results-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
    text-align: left;
}

.breakdown-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
}

.breakdown-card .bd-topic {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.breakdown-card .bd-score {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.breakdown-card .bd-bar {
    height: 4px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    margin-top: 10px;
    overflow: hidden;
}

.breakdown-card .bd-fill {
    height: 100%;
    border-radius: 10px;
}

/* ===== Results Weak Topics ===== */
.results-weak {
    background: rgba(255, 107, 107, 0.06);
    border: 1px solid rgba(255, 107, 107, 0.15);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 32px;
    text-align: left;
}

.results-weak h3 {
    color: var(--danger);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.results-weak ul {
    list-style: none;
    padding: 0;
}

.results-weak li {
    padding: 6px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.results-weak li:last-child { border-bottom: none; }

.results-weak li strong { color: var(--text-primary); }

/* ===== Mobile ===== */
@media (max-width: 640px) {
    .hero { padding: 50px 16px 32px; }
    .hero h1 { font-size: 2rem; }
    .stats-bar { grid-template-columns: repeat(2, 1fr); padding: 0 16px; }
    .topic-grid { padding: 0 16px; }
    .topics { grid-template-columns: 1fr; }
    .action-buttons { padding: 0 16px 40px; }
    .quiz-body { padding: 24px 16px 40px; }
    .question-text { font-size: 1.1rem; }
    .quiz-header { padding: 12px 16px; }
    .results-breakdown { grid-template-columns: 1fr; }
}
