/* ===========================
   CSS VARIABLES & RESET
   =========================== */

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

:root {
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --secondary: #10b981;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    --accent: #8b5cf6;
    --navbar-bg: #ffffff;
    --gradient: linear-gradient(135deg, #8b5cf6 0%, #10b981 100%);
    --code-bg: #1e1e1e;
    --code-text: #d4d4d4;
    --mono: 'IBM Plex Mono', monospace;
    --correct: #10b981;
    --wrong: #ef4444;
    --warning: #f59e0b;
    --timer-radius: 28;
    --timer-circumference: 175.93;
}

[data-theme="dark"] {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-card: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border: #374151;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
    --navbar-bg: #111827;
    --code-bg: #0f172a;
    --code-text: #cbd5e1;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

/* ===========================
   HERO SECTION
   =========================== */

.hero {
    background: var(--gradient);
    padding: 4rem 2rem;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
    border-bottom: 2px solid var(--border);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero-h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.hero-para {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.hero-stats span {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
}

[data-theme="dark"] .hero {
    background: linear-gradient(to right, #111827, #1f2937);
}

[data-theme="dark"] .hero-para {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .hero-h1 {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .hero-stats span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border: 1px solid #7c3aed;
}

/* ===========================
   MAIN CONTAINER
   =========================== */

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* ===========================
   SCREEN MANAGEMENT
   =========================== */

.screen {
    display: none;
    animation: fadeIn 0.4s ease;
}

.screen.active {
    display: block;
}

/* ===========================
   LOBBY SCREEN
   =========================== */

.lobby-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 2px solid var(--border);
    box-shadow: 0 4px 20px var(--shadow);
    padding: 40px;
    text-align: center;
    margin-bottom: 30px;
}

.lobby-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: white;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.lobby-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.lobby-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 35px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ===========================
   SELECTOR GROUPS
   =========================== */

.question-count-selector,
.difficulty-selector,
.topic-selector {
    margin-bottom: 28px;
    text-align: left;
}

.selector-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.selector-btns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.selector-btn,
.diff-btn {
    padding: 10px 24px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'Inter', sans-serif;
}

.selector-btn:hover,
.diff-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.selector-btn.active,
.diff-btn.active {
    background: var(--gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

/* ===========================
   TOPIC CHIPS
   =========================== */

.topic-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.topic-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
}

.topic-chip input[type="checkbox"] {
    display: none;
}

.topic-chip.active {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.topic-chip:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* ===========================
   START BUTTON
   =========================== */

.btn-start {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 48px;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
    margin-top: 10px;
}

.btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.5);
}

.btn-start:active {
    transform: translateY(-1px);
}

/* ===========================
   PERSONAL BEST STATS
   =========================== */

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 10px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 2px solid var(--border);
    box-shadow: 0 4px 20px var(--shadow);
    padding: 20px 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card i {
    font-size: 1.4rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: var(--mono);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===========================
   COUNTDOWN SCREEN
   =========================== */

.countdown-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 20px;
}

.countdown-ring {
    width: 160px;
    height: 160px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 40px rgba(139, 92, 246, 0.5);
    animation: pulsate 1s ease infinite;
}

#countdown-number {
    font-size: 5rem;
    font-weight: 900;
    color: white;
    font-family: var(--mono);
    line-height: 1;
}

.countdown-label {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
}

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

/* ===========================
   QUIZ SCREEN
   =========================== */

.quiz-progress-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    margin-bottom: 24px;
    overflow: hidden;
    border: 1px solid var(--border);
}

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

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

.quiz-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.quiz-q-counter {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--mono);
}

.quiz-type-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: rgba(139, 92, 246, 0.12);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.quiz-topic-badge {
    padding: 4px 12px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--secondary);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.quiz-diff-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
}

.quiz-diff-badge.beginner { background: rgba(16,185,129,0.12); color: #10b981; border: 1px solid rgba(16,185,129,0.3); }
.quiz-diff-badge.intermediate { background: rgba(245,158,11,0.12); color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }
.quiz-diff-badge.advanced { background: rgba(239,68,68,0.12); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }

/* ===========================
   TIMER RING
   =========================== */

.timer-wrap {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.timer-ring {
    width: 64px;
    height: 64px;
    transform: rotate(-90deg);
}

.timer-track {
    fill: none;
    stroke: var(--border);
    stroke-width: 4;
}

.timer-arc {
    fill: none;
    stroke: var(--primary);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: var(--timer-circumference);
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.timer-arc.urgent {
    stroke: #ef4444;
    animation: urgentPulse 0.5s ease infinite;
}

@keyframes urgentPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--mono);
    pointer-events: none;
}

/* ===========================
   STREAK BAR
   =========================== */

.streak-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 20px;
    width: fit-content;
    transition: all 0.3s ease;
}

.streak-bar.hot {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.streak-bar i {
    font-size: 1rem;
}

/* ===========================
   QUESTION CARD
   =========================== */

.question-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 2px solid var(--border);
    box-shadow: 0 4px 20px var(--shadow);
    padding: 30px;
    margin-bottom: 20px;
    animation: slideUp 0.3s ease;
}

.question-card.correct {
    border-color: var(--correct);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.2);
}

.question-card.wrong {
    border-color: var(--wrong);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.2);
}

.question-card.timeout {
    border-color: var(--warning);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.2);
}

.question-number-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--gradient);
    color: white;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: var(--mono);
    margin-bottom: 16px;
}

.question-text {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
    line-height: 1.7;
}

/* ===========================
   MCQ OPTIONS
   =========================== */

.mcq-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mcq-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    font-weight: 500;
    min-height: 56px;
}

.mcq-option:hover:not(:disabled) {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
    transform: translateY(-1px);
}

.mcq-option .option-letter {
    min-width: 26px;
    height: 26px;
    background: var(--gradient);
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.mcq-option.selected {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

.mcq-option.correct {
    border-color: var(--correct);
    background: rgba(16, 185, 129, 0.12);
}

.mcq-option.correct .option-letter {
    background: var(--correct);
}

.mcq-option.wrong {
    border-color: var(--wrong);
    background: rgba(239, 68, 68, 0.1);
}

.mcq-option.wrong .option-letter {
    background: var(--wrong);
}

.mcq-option:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* ===========================
   WRITE QUERY AREA
   =========================== */

.write-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.write-hint {
    padding: 12px 16px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    font-family: 'Inter', sans-serif;
}

.write-hint strong {
    color: var(--primary);
}

.query-textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px 16px;
    background: var(--code-bg);
    color: var(--code-text);
    border: 2px solid var(--border);
    border-radius: 10px;
    font-family: var(--mono);
    font-size: 0.95rem;
    resize: vertical;
    line-height: 1.6;
    transition: border-color 0.3s ease;
}

.query-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.btn-submit-query {
    align-self: flex-end;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'Inter', sans-serif;
}

.btn-submit-query:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

/* ===========================
   FEEDBACK CARD
   =========================== */

.feedback-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 2px solid var(--border);
    box-shadow: 0 4px 20px var(--shadow);
    overflow: hidden;
    animation: slideUp 0.3s ease;
    margin-bottom: 20px;
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    font-size: 1.15rem;
    font-weight: 700;
    background: rgba(139, 92, 246, 0.1);
    border-bottom: 2px solid var(--border);
}

.feedback-header.correct-header {
    background: rgba(16, 185, 129, 0.12);
    border-bottom-color: rgba(16, 185, 129, 0.3);
    color: var(--correct);
}

.feedback-header.wrong-header {
    background: rgba(239, 68, 68, 0.1);
    border-bottom-color: rgba(239, 68, 68, 0.3);
    color: var(--wrong);
}

.feedback-header.timeout-header {
    background: rgba(245, 158, 11, 0.1);
    border-bottom-color: rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

.feedback-header i {
    font-size: 1.3rem;
}

.feedback-points {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 1rem;
    opacity: 0.85;
}

.feedback-body {
    padding: 20px 24px;
}

.feedback-explanation {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 16px;
}

.correct-answer-block {
    background: var(--code-bg);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.correct-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(139, 92, 246, 0.1);
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

.correct-sql {
    padding: 14px 16px;
    font-family: var(--mono);
    font-size: 0.9rem;
    color: var(--code-text);
    white-space: pre-wrap;
    overflow-x: auto;
    line-height: 1.7;
}

/* Syntax highlighting in correct SQL */
.correct-sql .keyword { color: #569cd6; font-weight: 600; }
.correct-sql .function { color: #dcdcaa; }
.correct-sql .string { color: #ce9178; }
.correct-sql .number { color: #b5cea8; }
.correct-sql .comment { color: #6a9955; font-style: italic; }
.correct-sql .operator { color: #d4d4d4; }

.btn-next {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 24px 24px auto;
    padding: 12px 28px;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'Inter', sans-serif;
    width: fit-content;
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

/* ===========================
   RESULTS SCREEN
   =========================== */

.results-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 2px solid var(--border);
    box-shadow: 0 4px 20px var(--shadow);
    padding: 40px;
    text-align: center;
    margin-bottom: 30px;
}

.results-trophy {
    width: 80px;
    height: 80px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: white;
    box-shadow: 0 4px 25px rgba(139, 92, 246, 0.4);
}

.results-trophy.gold { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 4px 25px rgba(245,158,11,0.4); }
.results-trophy.silver { background: linear-gradient(135deg, #94a3b8, #64748b); box-shadow: 0 4px 25px rgba(100,116,139,0.4); }
.results-trophy.bronze { background: linear-gradient(135deg, #c2956c, #92400e); box-shadow: 0 4px 25px rgba(146,64,14,0.3); }

.results-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.results-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 30px;
}

/* Score ring */
.results-score-ring {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 30px;
}

.results-score-ring svg {
    width: 140px;
    height: 140px;
    transform: rotate(-90deg);
}

.score-track {
    fill: none;
    stroke: var(--border);
    stroke-width: 8;
}

.score-fill {
    fill: none;
    stroke: url(#scoreGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    stroke-dashoffset: 326.73;
    transition: stroke-dashoffset 1.2s ease;
}

.score-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-fraction {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: var(--mono);
    line-height: 1.2;
}

.score-pct {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Results stats */
.results-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

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

.result-stat i {
    font-size: 1.3rem;
    margin-bottom: 2px;
}

.result-stat:nth-child(1) i { color: var(--correct); }
.result-stat:nth-child(2) i { color: var(--wrong); }
.result-stat:nth-child(3) i { color: var(--warning); }
.result-stat:nth-child(4) i { color: var(--primary); }

.rs-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: var(--mono);
}

.rs-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Performance badges */
.performance-badges {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.perf-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

.perf-badge.speed { background: rgba(139, 92, 246, 0.12); color: var(--primary); border: 1px solid rgba(139, 92, 246, 0.3); }
.perf-badge.accuracy { background: rgba(16, 185, 129, 0.12); color: var(--correct); border: 1px solid rgba(16, 185, 129, 0.3); }
.perf-badge.perfect { background: rgba(245, 158, 11, 0.12); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.perf-badge.streak { background: rgba(239, 68, 68, 0.12); color: var(--wrong); border: 1px solid rgba(239, 68, 68, 0.3); }

/* Perf row */
.perf-row {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.perf-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.perf-item i {
    font-size: 1.2rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.perf-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.perf-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===========================
   ACTION BUTTONS (matches generator pattern)
   =========================== */

.results-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-format, .btn-copy, .btn-download, .btn-clear, .btn-share, .btn-save, .btn-restart {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'Inter', sans-serif;
}

.btn-format {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-copy {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-share {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-restart {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-format:hover, .btn-restart:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.btn-copy:hover, .btn-share:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

/* ===========================
   REVIEW SECTION
   =========================== */

.review-section {
    margin-top: 20px;
}

.editor-panel {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid var(--border);
    box-shadow: 0 4px 20px var(--shadow);
}

.panel-header {
    padding: 18px 25px;
    background: rgba(139, 92, 246, 0.1);
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 1.05em;
}

.panel-header span {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.panel-btn {
    padding: 6px 12px;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.panel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.review-list {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.review-item {
    border: 2px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.review-item.correct-item { border-color: rgba(16, 185, 129, 0.4); }
.review-item.wrong-item { border-color: rgba(239, 68, 68, 0.4); }
.review-item.timeout-item { border-color: rgba(245, 158, 11, 0.4); }

.review-item-header {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 600;
}

.review-item.correct-item .review-item-header { background: rgba(16,185,129,0.1); color: var(--correct); }
.review-item.wrong-item .review-item-header { background: rgba(239,68,68,0.08); color: var(--wrong); }
.review-item.timeout-item .review-item-header { background: rgba(245,158,11,0.1); color: var(--warning); }

.review-item-body {
    padding: 14px 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.review-item-question {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.review-your-answer,
.review-correct-answer {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    align-items: baseline;
}

.review-answer-label {
    font-weight: 600;
    min-width: 120px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.review-answer-value {
    font-family: var(--mono);
    font-size: 0.85rem;
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ===========================
   SYNTAX HIGHLIGHTING
   =========================== */

.keyword { color: #569cd6; font-weight: 600; }
.function { color: #dcdcaa; }
.string { color: #ce9178; }
.number { color: #b5cea8; }
.comment { color: #6a9955; font-style: italic; }
.operator { color: #d4d4d4; }

/* ===========================
   NOTIFICATION
   =========================== */

.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 16px 24px;
    background: var(--gradient);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
    transform: translateX(400px);
    transition: transform 0.4s ease;
    z-index: 1000;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.notification.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.notification.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* ===========================
   ANIMATIONS
   =========================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    70% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */

@media (max-width: 1200px) {
    .container { padding: 2rem; }
}

@media (max-width: 992px) {
    .hero-h1 { font-size: 2.8rem; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .hero-h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .hero-para { font-size: 1rem; }
    .hero-stats { gap: 1rem; }
    .hero-stats span { padding: 6px 15px; font-size: 0.9rem; }
    .container { padding: 1.5rem; }

    .lobby-card { padding: 24px 20px; }
    .mcq-options { grid-template-columns: 1fr; }

    .quiz-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .timer-wrap {
        position: absolute;
        right: 1.5rem;
        top: 0;
    }

    .quiz-header { position: relative; }

    .results-stats { gap: 20px; }
    .perf-row { gap: 20px; flex-wrap: wrap; }

    .results-actions {
        flex-direction: column;
        align-items: center;
    }

    .results-actions button {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    .cookie-buttons { flex-direction: column; }
    .cookie-btn { width: 100%; justify-content: center; }
    .cookie-settings-buttons { flex-direction: column; }
    .cookie-settings-btn { width: 100%; justify-content: center; }
}

@media (max-width: 576px) {
    .container { padding: 1rem; }

    .hero { padding: 2rem 1rem; }
    .hero-h1 { font-size: 1.8rem; }

    .lobby-card { padding: 20px 16px; }
    .lobby-title { font-size: 1.5rem; }

    .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }

    .selector-btns { flex-wrap: wrap; }
    .selector-btn, .diff-btn { padding: 8px 16px; font-size: 0.9rem; }

    .question-card { padding: 20px; }
    .question-text { font-size: 1rem; }

    .feedback-card .btn-next { margin: 0 16px 16px auto; }

    .notification {
        left: 10px;
        right: 10px;
        width: calc(100% - 20px);
        top: 70px;
        transform: translateY(-100px);
    }

    .notification.show { transform: translateY(0); }

    .results-card { padding: 24px 16px; }
    .results-title { font-size: 1.5rem; }

    .panel-header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

@media (max-width: 380px) {
    .hero-stats { flex-direction: column; align-items: center; }
    .hero-stats span { width: 100%; justify-content: center; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .diff-btn { min-width: calc(50% - 5px); }
}
