/* ===== Design Tokens ===== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c28;
    --bg-elevated: #1e1e2a;
    --bg-input: #12121a;

    --text-primary: #eeeef2;
    --text-secondary: #9d9db5;
    --text-muted: #5c5c78;

    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --accent-gradient: linear-gradient(135deg, #6366f1, #a78bfa);

    --green: #34d399;
    --green-dim: rgba(52, 211, 153, 0.12);
    --red: #f87171;
    --red-dim: rgba(248, 113, 113, 0.12);
    --amber: #fbbf24;
    --amber-dim: rgba(251, 191, 36, 0.12);
    --blue: #60a5fa;
    --blue-dim: rgba(96, 165, 250, 0.12);
    --teal: #2dd4bf;
    --teal-dim: rgba(45, 212, 191, 0.12);

    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

    --transition-fast: 0.15s ease;
    --transition-med: 0.3s ease;
    --transition-slow: 0.5s ease;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --navbar-height: 60px;
    --sections-bar-height: 45px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Screen Management ===== */
.screen { display: none; min-height: 100vh; }
.screen.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease;
}

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

/* ===========================
   LANDING SCREEN
   =========================== */
.landing-bg {
    position: fixed; inset: 0; overflow: hidden;
    pointer-events: none; z-index: 0;
}

.orb {
    position: absolute; border-radius: 50%;
    filter: blur(80px); opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}
.orb-1 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #6366f1, transparent 70%);
    top: -100px; right: -100px;
}
.orb-2 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, #a78bfa, transparent 70%);
    bottom: -50px; left: -80px;
    animation-delay: -7s;
}
.orb-3 {
    width: 250px; height: 250px;
    background: radial-gradient(circle, #34d399, transparent 70%);
    top: 40%; left: 50%;
    animation-delay: -14s; opacity: 0.2;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

.landing-header {
    position: relative; z-index: 1; padding: 24px 40px;
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 40px; height: 40px; }
.logo-text {
    font-size: 1.25rem; font-weight: 800; letter-spacing: 2px;
    background: var(--accent-gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-content {
    position: relative; z-index: 1; flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 0 24px; gap: 48px;
}

.landing-hero { text-align: center; }
.landing-hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800; letter-spacing: -1px;
    background: linear-gradient(135deg, #fff 0%, #9d9db5 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; margin-bottom: 12px;
}
.landing-subtitle {
    font-size: 1.1rem; color: var(--text-secondary); font-weight: 400;
}

/* Test selection grid */
.test-selection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1000px;
    width: 100%;
    position: relative;
    z-index: 1;
}

@media (max-width: 900px) {
    .test-selection-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 700px;
    }
}

@media (max-width: 640px) {
    .test-selection-grid {
        grid-template-columns: 1fr;
        max-width: 360px;
    }
}

.test-card {
    position: relative;
    cursor: pointer;
    border-radius: var(--radius-xl);
    transition: transform var(--transition-med), box-shadow var(--transition-med);
    display: flex;
    flex-direction: column;
}

.test-card-glow {
    position: absolute;
    inset: -2px;
    border-radius: calc(var(--radius-xl) + 2px);
    opacity: 0;
    transition: opacity var(--transition-med);
    z-index: 0;
}

.test-card:hover .test-card-glow {
    opacity: 0.6;
}

.test-card-inner {
    position: relative;
    z-index: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
    transition: transform var(--transition-med), box-shadow var(--transition-med);
}

.test-card:hover .test-card-inner {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
    border-color: transparent;
    background: var(--bg-card-hover);
}

.card-body {
    padding: 32px 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

.card-header-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-header-icon.chem {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.card-header-icon.math {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-secondary);
}

.card-header-icon svg {
    width: 28px;
    height: 28px;
}

.card-subject-tag {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.test-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
}

.test-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.card-meta {
    display: flex;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.start-cta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: gap var(--transition-med);
}

.start-cta svg {
    width: 18px;
    height: 18px;
    stroke: var(--accent-secondary);
    transition: transform var(--transition-med);
}

.test-card:hover .start-cta svg {
    transform: translateX(4px);
}

.landing-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ===========================
   TEST SCREEN
   =========================== */
.test-layout { display: flex; flex-direction: column; min-height: 100vh; }

.test-navbar {
    height: var(--navbar-height);
    background: rgba(17,17,24,0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px;
    position: sticky; top: 0; z-index: 100;
}

.navbar-left, .navbar-right { display: flex; align-items: center; gap: 12px; }
.navbar-center { position: absolute; left: 50%; transform: translateX(-50%); }

.nav-btn {
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; font-family: inherit; font-size: 0.85rem;
    transition: color var(--transition-fast);
}
.nav-btn:hover { color: var(--text-primary); }

.icon-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: rgba(255,255,255,0.05); }

.test-title-bar { display: flex; align-items: center; gap: 10px; }
.test-name { font-size: 0.9rem; font-weight: 500; color: var(--text-primary); }

.timer-display {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-card); padding: 6px 16px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    font-family: var(--font-mono); font-size: 1rem; font-weight: 500;
    color: var(--text-primary);
}
.timer-display.warning { color: var(--amber); border-color: rgba(251,191,36,0.3); }
.timer-display.critical { color: var(--red); border-color: rgba(248,113,113,0.3); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.6} }
.timer-icon { width: 18px; height: 18px; }

.submit-btn {
    background: var(--accent-gradient); color: #fff;
    font-weight: 600; padding: 8px 20px;
    border-radius: var(--radius-sm); border: none;
    cursor: pointer; font-family: inherit; font-size: 0.85rem;
    transition: all var(--transition-fast);
}
.submit-btn:hover { opacity: 0.9; transform: scale(1.02); }

/* Test Body */
.test-body { flex: 1; display: flex; }

.question-panel {
    flex: 1; padding: 32px 40px;
    display: flex; flex-direction: column;
    max-width: calc(100% - 260px);
    overflow-y: auto;
}

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

.question-number-group { display: flex; align-items: center; gap: 10px; }
.question-number {
    font-size: 1.1rem; font-weight: 700;
    color: var(--accent-secondary); font-family: var(--font-mono);
}
.question-subject-tag {
    font-size: 0.65rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1px;
    padding: 3px 8px; border-radius: 4px;
}
.question-subject-tag.chem {
    background: rgba(16, 185, 129, 0.12); color: #10b981;
}
.question-subject-tag.math {
    background: var(--accent-glow); color: var(--accent-secondary);
}
.question-subject-tag.phys {
    background: var(--teal-dim); color: var(--teal);
}

.question-actions { display: flex; gap: 8px; }
.action-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); cursor: pointer;
    font-family: inherit; font-size: 0.8rem;
    transition: all var(--transition-fast);
}
.action-btn svg { width: 16px; height: 16px; }
.action-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.action-btn.active {
    background: var(--amber-dim); border-color: var(--amber); color: var(--amber);
}

.question-body {
    font-size: 0.95rem; line-height: 1.8; color: var(--text-primary);
    margin-bottom: 24px; padding: 20px 24px;
    background: var(--bg-card); border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.options-container { display: flex; flex-direction: column; gap: 10px; flex: 1; }

.option-btn {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px 18px; border-radius: var(--radius-md);
    border: 1px solid var(--border); background: var(--bg-card);
    cursor: pointer; transition: all var(--transition-fast);
    text-align: left; color: var(--text-primary);
    font-family: inherit; font-size: 0.92rem; line-height: 1.6; width: 100%;
}
.option-btn:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.option-btn.selected { border-color: var(--accent-primary); background: var(--accent-glow); }
.option-btn.correct { border-color: var(--green); background: var(--green-dim); }
.option-btn.wrong { border-color: var(--red); background: var(--red-dim); }

.option-label {
    width: 28px; height: 28px; min-width: 28px;
    border-radius: 50%; border: 2px solid var(--border-hover);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.8rem; color: var(--text-secondary);
    transition: all var(--transition-fast); margin-top: 1px;
}
.option-btn.selected .option-label { background: var(--accent-primary); border-color: var(--accent-primary); color: #fff; }
.option-btn.correct .option-label { background: var(--green); border-color: var(--green); color: #fff; }
.option-btn.wrong .option-label { background: var(--red); border-color: var(--red); color: #fff; }
.option-text { flex: 1; padding-top: 2px; }

/* Bottom Nav */
.question-nav-bottom {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border);
}
.nav-btn-bottom {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); cursor: pointer;
    font-family: inherit; font-size: 0.85rem; font-weight: 500;
    transition: all var(--transition-fast);
}
.nav-btn-bottom svg { width: 16px; height: 16px; }
.nav-btn-bottom:hover { border-color: var(--border-hover); color: var(--text-primary); }
.nav-btn-bottom.primary {
    background: var(--accent-gradient); border: none; color: #fff; font-weight: 600;
}
.nav-btn-bottom.primary:hover { opacity: 0.9; }

/* Palette Sidebar */
.palette-sidebar {
    width: 260px; min-width: 260px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
    height: calc(100vh - var(--navbar-height) - var(--sections-bar-height));
    position: sticky; top: calc(var(--navbar-height) + var(--sections-bar-height));
    overflow-y: auto;
}

.palette-section { display: flex; flex-direction: column; gap: 10px; }
.palette-section-title {
    font-size: 0.7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-muted);
}

.palette-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }

.palette-btn {
    width: 100%; aspect-ratio: 1;
    border-radius: 6px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text-secondary);
    font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600;
    cursor: pointer; transition: all var(--transition-fast);
    display: flex; align-items: center; justify-content: center;
}
.palette-btn:hover { border-color: var(--border-hover); }
.palette-btn.current { background: var(--accent-primary); border-color: var(--accent-primary); color: #fff; }
.palette-btn.answered { background: var(--green); border-color: var(--green); color: #fff; }
.palette-btn.marked { background: var(--amber); border-color: var(--amber); color: #000; }

.palette-legend {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
    padding-top: 8px; border-top: 1px solid var(--border);
}
.legend-item {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.68rem; color: var(--text-muted);
}
.legend-dot {
    width: 9px; height: 9px; border-radius: 3px;
}
.legend-dot.answered { background: var(--green); }
.legend-dot.not-answered { background: var(--bg-card); border: 1px solid var(--border-hover); }
.legend-dot.marked { background: var(--amber); }
.legend-dot.current { background: var(--accent-primary); }

.palette-stats {
    display: flex; gap: 8px; margin-top: auto;
    padding-top: 12px; border-top: 1px solid var(--border);
}
.stat { flex: 1; text-align: center; }
.stat-num {
    display: block; font-size: 1.1rem; font-weight: 700;
    color: var(--text-primary); font-family: var(--font-mono);
}
.stat-label {
    font-size: 0.6rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}

/* ===========================
   RESULT SCREEN
   =========================== */
#result-screen { align-items: center; justify-content: center; position: relative; }
.result-container { position: relative; z-index: 1; width: 100%; max-width: 480px; padding: 20px; }
.result-bg { position: fixed; inset: 0; pointer-events: none; }

.result-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 40px 36px;
    text-align: center; box-shadow: var(--shadow-lg);
}
.result-header h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 6px; }
.result-header p { color: var(--text-secondary); font-size: 0.9rem; }

.score-ring-container { position: relative; width: 180px; height: 180px; margin: 28px auto; }
.score-ring { width: 100%; height: 100%; }
.score-center {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); text-align: center;
}
.score-value {
    font-size: 3rem; font-weight: 800; line-height: 1;
    background: var(--accent-gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.score-total { display: block; font-size: 1rem; color: var(--text-muted); font-weight: 500; }

.result-breakdown {
    display: flex; flex-direction: column; gap: 8px;
    margin: 20px 0; padding: 16px;
    background: var(--bg-elevated); border-radius: var(--radius-md);
}
.breakdown-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.85rem;
}
.breakdown-label { color: var(--text-secondary); }
.breakdown-val { font-weight: 700; font-family: var(--font-mono); color: var(--text-primary); }

.result-stats { display: flex; gap: 12px; margin: 20px 0; }
.result-stat {
    flex: 1; padding: 14px 8px; border-radius: var(--radius-md); text-align: center;
}
.result-stat.correct { background: var(--green-dim); }
.result-stat.wrong { background: var(--red-dim); }
.result-stat.skipped { background: var(--blue-dim); }
.result-stat-num { display: block; font-size: 1.4rem; font-weight: 700; font-family: var(--font-mono); }
.result-stat.correct .result-stat-num { color: var(--green); }
.result-stat.wrong .result-stat-num { color: var(--red); }
.result-stat.skipped .result-stat-num { color: var(--blue); }
.result-stat-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.result-actions { display: flex; gap: 12px; }
.result-btn {
    flex: 1; padding: 12px 20px; border-radius: var(--radius-sm);
    font-family: inherit; font-size: 0.9rem; font-weight: 600;
    cursor: pointer; transition: all var(--transition-fast); border: none;
}
.result-btn.primary { background: var(--accent-gradient); color: #fff; }
.result-btn.primary:hover { opacity: 0.9; }
.result-btn.secondary { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
.result-btn.secondary:hover { color: var(--text-primary); border-color: var(--border-hover); }

/* ===========================
   SOLUTIONS SCREEN
   =========================== */
#solutions-screen { min-height: 100vh; }
.solutions-navbar { position: sticky; top: 0; z-index: 100; }

.solutions-body {
    padding: 28px 40px; max-width: 900px; margin: 0 auto;
    display: flex; flex-direction: column; gap: 24px;
    padding-bottom: 60px;
}

.solution-section-divider {
    display: flex; align-items: center; gap: 12px;
    margin-top: 8px;
}
.solution-section-divider span {
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.5px; color: var(--text-muted); white-space: nowrap;
}
.solution-section-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

.solution-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
}

.solution-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.solution-q-num { font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem; }
.solution-status {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.75rem; font-weight: 600; padding: 3px 10px; border-radius: 100px;
}
.solution-status.correct { background: var(--green-dim); color: var(--green); }
.solution-status.wrong { background: var(--red-dim); color: var(--red); }
.solution-status.skipped { background: var(--blue-dim); color: var(--blue); }

.solution-card-body { padding: 20px; }
.solution-question { margin-bottom: 14px; line-height: 1.7; color: var(--text-secondary); font-size: 0.9rem; }

.solution-options { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.sol-option {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); font-size: 0.85rem; line-height: 1.6;
}
.sol-option.correct { background: var(--green-dim); border-color: rgba(52,211,153,0.3); }
.sol-option.wrong { background: var(--red-dim); border-color: rgba(248,113,113,0.3); }
.sol-option-label {
    min-width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 600;
    border: 1.5px solid var(--border-hover); color: var(--text-muted); margin-top: 2px;
}
.sol-option.correct .sol-option-label { background: var(--green); border-color: var(--green); color: #fff; }
.sol-option.wrong .sol-option-label { background: var(--red); border-color: var(--red); color: #fff; }

.solution-explanation {
    padding: 14px 16px; background: var(--bg-elevated);
    border-radius: var(--radius-sm); border-left: 3px solid var(--accent-primary);
}
.solution-explanation-title {
    font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 1px; color: var(--accent-secondary); margin-bottom: 6px;
}
.solution-explanation p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.7; }

/* ===== Confirm Dialog ===== */
.dialog-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}
.dialog-box {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 32px;
    max-width: 420px; width: 90%; text-align: center; box-shadow: var(--shadow-lg);
}
.dialog-box h2 { font-size: 1.15rem; margin-bottom: 8px; }
.dialog-box p { color: var(--text-secondary); font-size: 0.88rem; margin-bottom: 24px; line-height: 1.6; }
.dialog-actions { display: flex; gap: 12px; }
.dialog-btn {
    flex: 1; padding: 10px; border-radius: var(--radius-sm);
    font-family: inherit; font-size: 0.85rem; font-weight: 600;
    cursor: pointer; border: none; transition: all var(--transition-fast);
}
.dialog-btn.cancel { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
.dialog-btn.confirm { background: var(--accent-gradient); color: #fff; }
.dialog-btn:hover { opacity: 0.85; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .test-body { flex-direction: column; }
    .question-panel { max-width: 100%; padding: 20px 16px; }
    .palette-sidebar {
        width: 100%; min-width: 100%; position: static;
        height: auto; border-left: none; border-top: 1px solid var(--border);
        flex-direction: row; flex-wrap: wrap;
    }
    .palette-section { width: 100%; }
    .palette-grid { grid-template-columns: repeat(10, 1fr); }
    .test-title-bar { display: none; }
    .navbar-center { position: static; transform: none; }
    .solutions-body { padding: 20px 16px; }
    .landing-content { padding: 0 16px; }
    .card-footer { flex-direction: column; gap: 12px; align-items: flex-start; }
}

/* ===== Question & Solution Images ===== */
.question-image,
.solution-image {
    margin: 16px 0 8px;
    text-align: center;
}

.question-image img,
.solution-image img {
    max-width: 100%;
    max-height: 320px;
    background: #fff;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 12px;
    object-fit: contain;
    box-shadow: var(--shadow-sm);
}

.solution-explanation .solution-image {
    margin-top: 12px;
}

.solution-explanation .solution-image img {
    max-height: 200px;
}

/* MathJax overrides */
mjx-container { color: inherit !important; }

/* ===== Unified/Combined Test Styles ===== */
.test-selection-grid.single-card-layout {
    display: flex;
    justify-content: center;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}
.test-card.large-card {
    width: 100%;
}
.card-header-icon.combined {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-secondary);
}
.card-description {
    margin-top: 10px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.sections-list {
    list-style: none;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sections-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}
.bullet {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.bullet.math { background: var(--accent-secondary); }
.bullet.chem { background: #10b981; }

/* ===== Sections Navigation Bar ===== */
.sections-bar {
    display: flex;
    background: rgba(22, 22, 31, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 8px 40px;
    gap: 10px;
    align-items: center;
    z-index: 99;
    position: sticky;
    top: var(--navbar-height);
    height: var(--sections-bar-height);
}
.section-tab {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-sans);
}
.section-tab:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: var(--border-hover);
}
.section-tab.active {
    background: var(--accent-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.35);
}

/* ===== Section Result Breakdown ===== */
.section-result-row {
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
    margin-bottom: 14px;
}
.section-result-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}
.section-result-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.section-result-name {
    color: var(--text-primary);
}
.section-result-score {
    color: var(--accent-secondary);
    font-family: var(--font-mono);
}
.section-result-stats {
    display: flex;
    gap: 14px;
    font-size: 0.75rem;
}
.sec-stat {
    font-weight: 500;
}
.sec-stat.correct { color: var(--green); }
.sec-stat.wrong { color: var(--red); }
.sec-stat.skipped { color: var(--blue); }
