@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

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

:root {
    --primary: #E11D48;
    --primary-hover: #BE123C;
    --primary-light: #FFE4E6;
    --primary-glow: rgba(225, 29, 72, 0.25);
    --primary-gradient: linear-gradient(135deg, #E11D48 0%, #F43F5E 50%, #FB7185 100%);

    --bg: #FAFBFC;
    --bg-card: #FFFFFF;
    --bg-elevated: #FFFFFF;
    --bg-subtle: #F1F3F5;
    --bg-muted: #E9ECEF;

    --text: #111827;
    --text-secondary: #4B5563;
    --text-muted: #9CA3AF;
    --text-inverse: #FFFFFF;

    --border: rgba(0,0,0,0.08);
    --border-strong: rgba(0,0,0,0.12);

    --success: #059669;
    --success-light: #ECFDF5;
    --success-border: #A7F3D0;
    --error: #DC2626;
    --error-light: #FEF2F2;
    --error-border: #FECACA;
    --warn: #D97706;
    --warn-light: #FFFBEB;
    --warn-border: #FDE68A;

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.03);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow: 0 8px 16px -4px rgba(0,0,0,0.06), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-md: 0 12px 24px -6px rgba(0,0,0,0.08), 0 6px 12px -4px rgba(0,0,0,0.06);
    --shadow-lg: 0 20px 40px -8px rgba(0,0,0,0.12);

    --radius-full: 9999px;
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration: 0.2s;
}

[data-theme="dark"] {
    --bg: #09090B;
    --bg-card: #18181B;
    --bg-elevated: #1F1F23;
    --bg-subtle: #27272A;
    --bg-muted: #3F3F46;

    --text: #F4F4F5;
    --text-secondary: #A1A1AA;
    --text-muted: #71717A;

    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.12);

    --primary-light: rgba(225, 29, 72, 0.15);
    --success-light: rgba(5, 150, 105, 0.15);
    --success-border: rgba(5, 150, 105, 0.3);
    --error-light: rgba(220, 38, 38, 0.15);
    --error-border: rgba(220, 38, 38, 0.3);
    --warn-light: rgba(217, 119, 6, 0.15);
    --warn-border: rgba(217, 119, 6, 0.3);

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ═══════ ANIMATED BG ═══════ */
.bg-aurora {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(225,29,72,0.06) 0%, transparent 70%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(244,63,94,0.04) 0%, transparent 70%);
}

[data-theme="dark"] .bg-aurora {
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(225,29,72,0.08) 0%, transparent 70%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(244,63,94,0.06) 0%, transparent 70%);
}

.bg-grid {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image: linear-gradient(var(--border) 1px, transparent 1px),
                      linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.4;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 70%);
}

#confetti-canvas {
    position: fixed; inset: 0; pointer-events: none; z-index: 9999;
}

/* ═══════ SCREENS ═══════ */
.screen {
    display: none; min-height: 100vh; position: relative; z-index: 1;
}

.screen.active {
    display: block;
    animation: screenIn 0.45s var(--ease-out);
}

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

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

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

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

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.container {
    max-width: 840px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

.hidden { display: none !important; }

/* ═══════ THEME TOGGLE ═══════ */
.theme-toggle {
    width: 42px; height: 42px;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--border-strong);
    background: var(--bg-card);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--duration) var(--ease);
    box-shadow: var(--shadow-sm);
    color: var(--text-secondary);
}

.theme-toggle:hover {
    transform: rotate(15deg) scale(1.08);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.theme-sun { display: none; }
.theme-moon { display: block; }
[data-theme="dark"] .theme-sun { display: block; }
[data-theme="dark"] .theme-moon { display: none; }

.global-theme-toggle {
    position: absolute; top: 20px; right: 20px; z-index: 1000;
}

.header-theme-toggle {
    width: 36px; height: 36px;
    box-shadow: none;
    border: 1.5px solid var(--border);
}

/* ═══════ HERO ═══════ */
.hero-section {
    text-align: center;
    padding: 20px 0 36px;
}

.logo-wrapper {
    position: relative; display: inline-block; margin-bottom: 18px;
}

.logo {
    font-size: 72px;
    position: relative; z-index: 2;
    filter: drop-shadow(0 6px 16px rgba(225,29,72,0.2));
    animation: float 4s ease-in-out infinite;
}

.logo-glow {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 110px; height: 110px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.1;
    filter: blur(30px);
    animation: glow-pulse 4s ease-in-out infinite;
}

.hero-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.7em;
    font-weight: 700;
    letter-spacing: 0.12em;
    padding: 6px 18px;
    border-radius: var(--radius-full);
    margin-bottom: 16px;
    border: 1px solid rgba(225,29,72,0.15);
}

h1 {
    font-size: 2.6em;
    font-weight: 800;
    color: var(--text);
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
}

.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1em;
    font-weight: 400;
    margin-bottom: 20px;
}

.free-notice {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--success-light);
    border: 1px solid var(--success-border);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    margin-bottom: 28px;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.15);
    text-align: left;
    transition: transform 0.3s var(--ease-spring);
    cursor: default;
}

[data-theme="dark"] .free-notice {
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.08);
}

.free-notice:hover {
    transform: translateY(-4px) scale(1.02);
}

.free-notice-icon {
    font-size: 1.4em;
    animation: float 3s ease-in-out infinite;
}

.free-notice-text {
    display: flex;
    flex-direction: column;
}

.free-notice-text strong {
    color: var(--success);
    font-size: 1.05em;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.free-notice-text span {
    color: var(--text-secondary);
    font-size: 0.85em;
    font-weight: 600;
}

.hero-stats {
    display: inline-flex;
    align-items: center;
    gap: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 12px 32px;
    box-shadow: var(--shadow-sm);
}

.hero-stat {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
}

.hero-stat strong {
    font-size: 1.2em; font-weight: 800; color: var(--primary);
}

.hero-stat span {
    font-size: 0.72em; color: var(--text-muted); font-weight: 500;
}

.hero-stat-divider {
    width: 1px; height: 30px; background: var(--border-strong);
}

/* ═══════ MODE SELECTION ═══════ */
.mode-selection {
    margin-bottom: 28px;
}

.mode-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.mode-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    cursor: pointer;
    transition: all 0.4s var(--ease-spring);
    position: relative;
    overflow: hidden;
    text-align: left;
    box-shadow: var(--shadow-sm);
}

.mode-card::after {
    content: '';
    position: absolute; inset: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.4s;
}

.mode-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-md), 0 0 0 2px var(--primary-glow);
}

.mode-card:hover::after { opacity: 0.03; }

.mode-card > * { position: relative; z-index: 1; }

.mode-card-icon {
    font-size: 2.2em;
    margin-bottom: 12px;
}

.mode-card-badge {
    position: absolute;
    top: 16px; right: 16px;
    background: var(--primary);
    color: white;
    font-size: 0.62em;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    z-index: 2;
}

.mode-card h3 {
    font-size: 1.15em;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

.mode-card p {
    font-size: 0.82em;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.4;
}

.mode-card-details {
    display: flex;
    gap: 12px;
    font-size: 0.75em;
    color: var(--text-secondary);
    font-weight: 500;
}

.mode-card-arrow {
    position: absolute;
    bottom: 20px; right: 20px;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--bg-subtle);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1em;
    color: var(--text-muted);
    transition: all var(--duration) var(--ease);
    z-index: 2;
}

.mode-card:hover .mode-card-arrow {
    background: var(--primary);
    color: white;
    transform: translateX(4px);
}

.btn-categories-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.92em;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.btn-categories-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.chevron-icon { transition: transform 0.3s var(--ease); }
.btn-categories-toggle.open .chevron-icon { transform: rotate(180deg); }

/* ═══════ CATEGORIES ═══════ */
.category-selection {
    margin-bottom: 28px;
    animation: slideUp 0.35s var(--ease-out);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.category-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.3s var(--ease-spring);
    text-align: center;
    position: relative;
    box-shadow: var(--shadow-xs);
}

.category-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-5px);
    box-shadow: var(--shadow-md), 0 0 0 1px var(--primary-glow);
}

.category-card .cat-icon {
    font-size: 1.8em; display: block; margin-bottom: 8px;
}

.category-card .cat-name {
    font-weight: 600; font-size: 0.82em; color: var(--text); margin-bottom: 4px;
}

.category-card .cat-count {
    font-size: 0.7em; color: var(--text-muted); font-weight: 500;
}

/* ═══════ STATS ═══════ */
.stats-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

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

.stats-title {
    display: flex; align-items: center; gap: 8px; color: var(--text);
}

.stats-title h3 { font-size: 0.95em; font-weight: 700; }

.btn-clear-stats {
    display: flex; align-items: center; gap: 5px;
    background: none; border: 1px solid var(--border);
    color: var(--text-muted); font-size: 0.72em; padding: 5px 12px;
    border-radius: var(--radius-xs); cursor: pointer;
    font-family: inherit; font-weight: 500;
    transition: all var(--duration) var(--ease);
}

.btn-clear-stats:hover { border-color: var(--error); color: var(--error); }

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

.stat-item {
    text-align: center; padding: 14px 6px;
    background: var(--bg-subtle); border-radius: var(--radius-md);
    transition: all var(--duration) var(--ease);
}

.stat-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-xs); }

.stat-value {
    font-size: 1.5em; font-weight: 800; color: var(--primary); line-height: 1.2;
}

.stat-label {
    font-size: 0.65em; color: var(--text-muted); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px;
}

/* ═══════ EXAM HEADER ═══════ */
.exam-header {
    position: sticky; top: 0; z-index: 100;
    background: color-mix(in srgb, var(--bg-card) 85%, transparent);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    padding: 12px 20px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
    gap: 14px;
}

.header-right, .header-left {
    display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}

.header-center { flex: 1; min-width: 0; }

.question-counter-wrap {
    background: var(--bg-subtle);
    padding: 5px 14px;
    border-radius: var(--radius-full);
}

.counter {
    font-weight: 700; color: var(--text); font-size: 0.85em;
    font-variant-numeric: tabular-nums;
}

.category-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.7em; font-weight: 600;
}

.progress-bar {
    height: 5px; background: var(--bg-muted); border-radius: 10px; overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 10px;
    transition: width 0.5s var(--ease);
    width: 0%;
    position: relative;
}

.progress-fill::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.timer {
    font-weight: 800; font-size: 0.95em; color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    padding: 6px 16px;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    border-radius: var(--radius-full);
    box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--primary) 20%, transparent);
}

.timer.warning {
    color: var(--error);
    background: var(--error-light);
    border-color: var(--error-border);
    animation: pulse 0.6s ease infinite;
}

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

.btn-quit {
    width: 36px; height: 36px;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    transition: all var(--duration) var(--ease);
}

.btn-quit:hover {
    border-color: var(--error); color: var(--error);
    background: var(--error-light);
}

/* ═══════ QUESTION CARD ═══════ */
.exam-container {
    max-width: 720px; margin: 24px auto; padding: 0 20px;
}

.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    animation: slideUp 0.3s var(--ease-out);
}

.question-meta {
    display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
}

.question-number {
    background: var(--primary-gradient);
    color: white; font-size: 0.72em; font-weight: 700;
    padding: 4px 14px; border-radius: var(--radius-full);
    letter-spacing: 0.02em;
}

.question-category-tag {
    font-size: 0.72em; color: var(--text-muted); font-weight: 500;
}

.question-text {
    font-size: 1.1em; font-weight: 600; line-height: 1.75;
    margin-bottom: 24px; color: var(--text);
}

/* ═══════ OPTIONS ═══════ */
.options { display: flex; flex-direction: column; gap: 10px; }

.option {
    padding: 16px 20px;
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    font-size: 0.96em; line-height: 1.6;
    display: flex; align-items: center; gap: 16px;
    background: var(--bg-elevated);
    position: relative;
    box-shadow: var(--shadow-xs);
}

.option:hover {
    border-color: color-mix(in srgb, var(--primary) 40%, transparent);
    background: var(--bg-card);
    transform: translateX(6px) scale(1.01);
    box-shadow: var(--shadow-sm);
}

.option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(225,29,72,0.08);
}

.option.correct {
    border-color: var(--success);
    background: var(--success-light);
    box-shadow: 0 0 0 3px rgba(5,150,105,0.08);
    pointer-events: none;
}

.option.wrong {
    border-color: var(--error);
    background: var(--error-light);
    box-shadow: 0 0 0 3px rgba(220,38,38,0.08);
    pointer-events: none;
}

.option-letter {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--bg-subtle);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85em; flex-shrink: 0;
    transition: all var(--duration) var(--ease);
    color: var(--text-secondary);
}

.option.selected .option-letter { background: var(--primary); color: white; }
.option.correct .option-letter { background: var(--success); color: white; }
.option.wrong .option-letter { background: var(--error); color: white; }

.option-text { flex: 1; }

/* ═══════ NAV ═══════ */
.exam-nav {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-bottom: 16px;
}

.btn-nav {
    width: 44px; height: 44px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    transition: all var(--duration) var(--ease);
    flex-shrink: 0;
}

.btn-nav:hover {
    border-color: var(--primary); color: var(--primary);
    background: var(--primary-light);
}

.btn-nav:disabled { opacity: 0.3; cursor: not-allowed; }

.question-dots {
    display: flex; flex-wrap: wrap; gap: 4px;
    justify-content: center; max-width: 500px;
}

.dot {
    width: 26px; height: 26px;
    border-radius: var(--radius-xs);
    background: var(--bg-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.62em; font-weight: 700; cursor: pointer;
    transition: all var(--duration) var(--ease);
    color: var(--text-muted);
}

.dot:hover { background: var(--primary-light); color: var(--primary); }

.dot.current {
    background: var(--primary); color: white;
    transform: scale(1.12);
    box-shadow: 0 2px 6px var(--primary-glow);
}

.dot.answered {
    background: var(--primary-light); color: var(--primary);
}

/* ═══════ BUTTONS ═══════ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 10px; padding: 14px 24px;
    border: none; border-radius: var(--radius-md);
    font-family: inherit; font-size: 0.92em; font-weight: 600;
    cursor: pointer; transition: all var(--duration) var(--ease);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient); color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--primary-glow);
}

.btn-secondary {
    background: var(--bg-card); color: var(--text);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover {
    border-color: var(--primary); color: var(--primary);
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent; color: var(--text-secondary);
    border: 1.5px solid transparent;
}
.btn-ghost:hover { color: var(--primary); background: var(--primary-light); }

.btn-sm { padding: 8px 16px; font-size: 0.82em; }

.btn-submit {
    width: 100%; padding: 18px; font-size: 1em;
    background: var(--primary-gradient); color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
    border-radius: var(--radius-md);
}
.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--primary-glow);
}

.keyboard-hint {
    text-align: center; margin-top: 14px;
    font-size: 0.72em; color: var(--text-muted);
}

.keyboard-hint kbd {
    display: inline-block; padding: 2px 7px;
    font-family: inherit; font-size: 0.9em; font-weight: 600;
    background: var(--bg-subtle); border: 1px solid var(--border);
    border-radius: 4px; margin: 0 1px;
}

/* ═══════ RESULTS ═══════ */
.result-header {
    text-align: center; margin-bottom: 28px;
    padding: 40px 28px; border-radius: var(--radius-xl);
    position: relative; overflow: hidden;
}

.result-header::before {
    content: ''; position: absolute; inset: 0; opacity: 0.03;
    background-image: radial-gradient(circle at 30% 50%, currentColor 1px, transparent 1px);
    background-size: 16px 16px;
}

.result-header.pass {
    background: linear-gradient(135deg, var(--success-light) 0%, rgba(5,150,105,0.08) 100%);
    border: 1px solid var(--success-border);
}
.result-header.fail {
    background: linear-gradient(135deg, var(--error-light) 0%, rgba(220,38,38,0.08) 100%);
    border: 1px solid var(--error-border);
}

.result-icon {
    font-size: 56px; margin-bottom: 14px;
    animation: scaleIn 0.5s var(--ease-spring);
}

.result-header h2 {
    font-size: 1.7em; margin-bottom: 8px; font-weight: 800;
    position: relative;
}
.result-header p { position: relative; color: var(--text-secondary); font-size: 0.95em; }
.result-header.pass h2 { color: var(--success); }
.result-header.fail h2 { color: var(--error); }

/* ═══════ SCORE DISPLAY ═══════ */
.score-display {
    display: flex; align-items: center; gap: 32px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 32px;
    box-shadow: var(--shadow-sm); margin-bottom: 20px;
    flex-wrap: wrap; justify-content: center;
}

.score-ring-wrapper {
    position: relative; width: 150px; height: 150px; flex-shrink: 0;
}

.score-ring { width: 100%; height: 100%; transform: rotate(-90deg); }

.score-ring-bg {
    fill: none; stroke: var(--bg-muted); stroke-width: 10;
}

.score-ring-fill {
    fill: none; stroke: var(--primary); stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 377; stroke-dashoffset: 377;
    transition: stroke-dashoffset 1.5s var(--ease);
}
.score-ring-fill.pass { stroke: var(--success); }
.score-ring-fill.fail { stroke: var(--error); }

.score-ring-text {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); text-align: center;
}

.score-percent {
    font-size: 2.4em; font-weight: 900; color: var(--text); line-height: 1;
}

.score-breakdown {
    display: flex; flex-direction: column; gap: 12px; flex: 1; min-width: 180px;
}

.score-stat {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 16px; background: var(--bg-subtle);
    border-radius: var(--radius-md);
    transition: all var(--duration) var(--ease);
}
.score-stat:hover { transform: translateX(4px); }

.score-stat-icon { font-size: 1.2em; flex-shrink: 0; }

.score-stat-info { display: flex; flex-direction: column; }

.score-stat-value { font-size: 1.3em; font-weight: 800; color: var(--text); }
.score-stat-label { font-size: 0.72em; color: var(--text-muted); font-weight: 500; }

.correct-stat .score-stat-value { color: var(--success); }
.wrong-stat .score-stat-value { color: var(--error); }
.skip-stat .score-stat-value { color: var(--warn); }

/* ═══════ CATEGORY SCORES ═══════ */
.category-scores {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 24px;
    box-shadow: var(--shadow-sm); margin-bottom: 24px;
}

.category-scores h3 {
    margin-bottom: 16px; text-align: center;
    font-weight: 700; font-size: 0.95em; color: var(--text);
}

.cat-score-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.88em;
}
.cat-score-item:last-child { border-bottom: none; }

.cat-score-bar {
    flex: 1; height: 6px; background: var(--bg-muted);
    border-radius: 10px; overflow: hidden;
}

.cat-score-fill {
    height: 100%; border-radius: 10px;
    transition: width 0.8s var(--ease);
}
.cat-score-fill.good { background: var(--success); }
.cat-score-fill.bad { background: var(--error); }
.cat-score-fill.ok { background: var(--warn); }

.result-actions {
    display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}
.result-actions .btn { flex: 1; min-width: 140px; max-width: 200px; }

/* ═══════ REVIEW ═══════ */
.review-top {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; gap: 12px;
}

.review-top h2 {
    font-size: 1.3em; font-weight: 800; color: var(--text); flex: 1; text-align: center;
}

.btn-back {
    display: flex; align-items: center; gap: 6px;
    background: none; border: 1.5px solid var(--border);
    padding: 8px 14px; border-radius: var(--radius-md);
    font-family: inherit; font-size: 0.82em; font-weight: 600;
    color: var(--text-secondary); cursor: pointer;
    transition: all var(--duration) var(--ease);
}
.btn-back:hover { border-color: var(--primary); color: var(--primary); }

.review-filter {
    display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 7px 16px; border-radius: var(--radius-full);
    border: 1.5px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); font-family: inherit;
    font-size: 0.8em; font-weight: 600; cursor: pointer;
    transition: all var(--duration) var(--ease);
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.review-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 30px; }

.review-item {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px; box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    border-left: 4px solid var(--bg-muted);
    transition: all var(--duration) var(--ease);
}
.review-item:hover { box-shadow: var(--shadow-sm); }
.review-item.correct { border-left-color: var(--success); }
.review-item.wrong { border-left-color: var(--error); }
.review-item.unanswered { border-left-color: var(--warn); }

.review-question {
    font-weight: 600; margin-bottom: 14px;
    font-size: 0.95em; line-height: 1.7; color: var(--text);
}
.review-question span { color: var(--primary); margin-right: 6px; font-weight: 700; }

.review-answer {
    padding: 10px 14px; border-radius: var(--radius-sm);
    margin: 6px 0; font-size: 0.88em; line-height: 1.5;
}
.review-answer.user-correct {
    background: var(--success-light); color: var(--success);
    font-weight: 600; border: 1px solid var(--success-border);
}
.review-answer.user-wrong {
    background: var(--error-light); color: var(--error);
    text-decoration: line-through; border: 1px solid var(--error-border);
}
.review-answer.correct-answer {
    background: var(--success-light); color: var(--success);
    font-weight: 600; border: 1px solid var(--success-border);
}

.review-explanation {
    margin-top: 12px; padding: 12px 16px;
    background: var(--bg-subtle); border-radius: var(--radius-sm);
    font-size: 0.84em; color: var(--text-secondary); line-height: 1.7;
    border-left: 3px solid var(--primary);
}

/* ═══════ INSTANT FEEDBACK ═══════ */
.instant-feedback {
    margin-top: 20px; padding: 20px;
    border-radius: var(--radius-lg);
    animation: slideUp 0.3s var(--ease-out); line-height: 1.7;
}
.instant-feedback.feedback-correct {
    background: var(--success-light); border: 1.5px solid var(--success-border);
}
.instant-feedback.feedback-wrong {
    background: var(--error-light); border: 1.5px solid var(--error-border);
}

.feedback-header { font-size: 1.08em; font-weight: 700; margin-bottom: 12px; }
.feedback-correct .feedback-header { color: var(--success); }
.feedback-wrong .feedback-header { color: var(--error); }

.feedback-correct-answer {
    background: var(--success-light); padding: 12px 16px;
    border-radius: var(--radius-sm); margin-bottom: 12px;
    color: var(--success); font-size: 0.9em;
    border: 1px solid var(--success-border);
}

.feedback-explanation {
    padding: 12px 16px; background: var(--bg-subtle);
    border-radius: var(--radius-sm); font-size: 0.86em;
    color: var(--text-secondary); border-left: 3px solid var(--primary);
}

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 768px) {
    .container { padding: 28px 18px 50px; }
    h1 { font-size: 2em; }
    .logo { font-size: 58px; }
    .hero-stats { gap: 16px; padding: 10px 24px; }
    .mode-cards { grid-template-columns: 1fr; }
    .mode-card { padding: 24px 20px; }
    .exam-header { padding: 10px 16px; gap: 10px; }
    .question-card { padding: 24px 20px; }
    .score-display { gap: 24px; padding: 24px 20px; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
    .container { padding: 20px 14px 40px; }
    h1 { font-size: 1.6em; }
    .logo { font-size: 48px; }
    .logo-glow { width: 80px; height: 80px; }
    .hero-badge { font-size: 0.6em; }
    .subtitle { font-size: 0.88em; }

    .hero-stats { flex-direction: row; gap: 12px; padding: 10px 20px; }
    .hero-stat strong { font-size: 1em; }
    .hero-stat-divider { height: 24px; }

    .categories-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .category-card { padding: 14px 8px; }
    .category-card .cat-icon { font-size: 1.5em; }

    .exam-header { flex-wrap: wrap; padding: 8px 12px; gap: 6px; }
    .header-left { flex: 1; }
    .header-right { order: 2; }
    .header-center { order: 3; width: 100%; }
    .counter { font-size: 0.78em; }
    .timer { font-size: 0.82em; padding: 4px 10px; }

    .exam-container { padding: 0 12px; margin: 16px auto; }
    .question-card { padding: 20px 16px; margin-bottom: 14px; }
    .question-text { font-size: 0.95em; margin-bottom: 18px; }
    .option { padding: 12px 14px; font-size: 0.88em; gap: 10px; }
    .option-letter { width: 30px; height: 30px; font-size: 0.78em; }

    .btn-nav { width: 38px; height: 38px; }
    .question-dots { max-width: 100%; }
    .dot { width: 22px; height: 22px; font-size: 0.58em; }

    .score-display { flex-direction: column; }
    .score-ring-wrapper { width: 130px; height: 130px; }
    .score-percent { font-size: 2em; }
    .result-header { padding: 28px 16px; }
    .result-header h2 { font-size: 1.4em; }
    .result-icon { font-size: 48px; }
    .result-actions { flex-direction: column; }
    .result-actions .btn { max-width: 100%; }

    .review-top { flex-wrap: wrap; }
    .review-top h2 { font-size: 1.1em; order: -1; width: 100%; margin-bottom: 8px; }
    .keyboard-hint { display: none; }
}

@media (max-width: 380px) {
    h1 { font-size: 1.35em; }
    .categories-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-stats { flex-wrap: wrap; justify-content: center; }
    .hero-stat-divider { display: none; }
}
