:root {
    --primary: #6c5ce7;
    --primary-dark: #5a4bd1;
    --success: #00b894;
    --danger: #e74c3c;
    --warning: #fdcb6e;
    --bg: #0f0f1a;
    --card: #1a1a2e;
    --card-hover: #22223a;
    --text: #e0e0e0;
    --text-muted: #888;
    --border: #2a2a4a;
    --combo-glow: #ff6b6b;
    --streak-gold: #ffd700;
    --xp-blue: #74b9ff;
    --power-purple: #a29bfe;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.container { width: 100%; max-width: 700px; }

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

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

.start-screen { text-align: center; }

.start-screen h1 {
    font-size: 2.8rem;
    background: linear-gradient(135deg, var(--primary), #a29bfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.start-screen p { color: var(--text-muted); margin-bottom: 2rem; font-size: 1.1rem; }

.genre-section { margin-bottom: 1.5rem; }
.genre-section h3 { margin-bottom: 1rem; color: var(--text); font-size: 1.1rem; }

.genre-options {
    display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap;
}

.genre-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.genre-btn:hover { background: var(--card-hover); border-color: var(--primary); }

.genre-btn.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 15px rgba(108, 92, 231, 0.3);
}

.difficulty-section { margin-bottom: 2rem; }
.difficulty-section h3 { margin-bottom: 1rem; color: var(--text); font-size: 1.1rem; }

.difficulty-options { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

.diff-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.diff-btn:hover { background: var(--card-hover); border-color: var(--primary); }

.diff-btn.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.4);
}

.diff-btn .diff-info { font-size: 0.75rem; opacity: 0.7; margin-top: 4px; }

.settings-row { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-bottom: 2rem; }

.sound-toggle {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.sound-toggle:hover { border-color: var(--primary); }
.sound-toggle.on { border-color: var(--success); background: rgba(0, 184, 148, 0.1); }

.start-btn {
    padding: 1rem 3rem; font-size: 1.2rem;
    background: linear-gradient(135deg, var(--primary), #a29bfe);
    color: #fff; border: none; border-radius: 14px;
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 600;
}

.start-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4); }

.high-scores { margin-top: 2rem; padding: 1.2rem; background: var(--card); border-radius: 14px; border: 1px solid var(--border); }
.high-scores h3 { margin-bottom: 0.75rem; color: var(--streak-gold); }
.high-scores .score-entry { display: flex; justify-content: space-between; padding: 0.3rem 0; font-size: 0.9rem; color: var(--text-muted); }

.quiz-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }

.stat-box { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 1rem; text-align: center; min-width: 80px; }
.stat-box .stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-box .stat-value { font-size: 1.3rem; font-weight: 700; }
.stat-box .stat-value.score-val { color: var(--success); }
.stat-box .stat-value.timer-val { color: var(--warning); }
.stat-box .stat-value.xp-val { color: var(--xp-blue); }

.combo-display { position: relative; text-align: center; margin-bottom: 0.5rem; min-height: 40px; display: flex; align-items: center; justify-content: center; }

.combo-badge { display: none; align-items: center; gap: 0.5rem; padding: 0.4rem 1.2rem; border-radius: 20px; font-weight: 700; font-size: 1rem; animation: comboPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.combo-badge.active { display: flex; }
.combo-badge.streak-3 { background: linear-gradient(135deg, #ff6b6b, #ee5a24); color: #fff; box-shadow: 0 0 15px rgba(255, 107, 107, 0.4); }
.combo-badge.streak-5 { background: linear-gradient(135deg, #ffd700, #f39c12); color: #1a1a2e; box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
.combo-badge.streak-10 { background: linear-gradient(135deg, #a29bfe, #6c5ce7, #fd79a8); color: #fff; box-shadow: 0 0 25px rgba(162, 155, 254, 0.6); animation: comboPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), comboGlow 1.5s ease-in-out infinite; }

@keyframes comboPopIn { 0% { transform: scale(0); } 80% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes comboGlow { 0%, 100% { box-shadow: 0 0 25px rgba(162, 155, 254, 0.6); } 50% { box-shadow: 0 0 40px rgba(162, 155, 254, 0.9); } }

.progress-container { width: 100%; height: 6px; background: var(--border); border-radius: 3px; margin-bottom: 1.5rem; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), #a29bfe); border-radius: 3px; transition: width 0.5s ease; }

.timer-bar-container { width: 100%; height: 4px; background: var(--border); border-radius: 2px; margin-bottom: 1.5rem; overflow: hidden; }
.timer-bar { height: 100%; background: var(--success); border-radius: 2px; transition: width 0.1s linear, background-color 0.3s; }
.timer-bar.warning { background: var(--warning); }
.timer-bar.danger { background: var(--danger); animation: timerPulse 0.5s ease-in-out infinite; }
@keyframes timerPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.question-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; margin-bottom: 1.5rem; }
.question-number { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.question-text { font-size: 1.3rem; font-weight: 600; line-height: 1.4; }

.q-type-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 5px; font-size: 0.7rem; font-weight: 600; margin-left: 0.5rem; vertical-align: middle; background: rgba(108, 92, 231, 0.2); color: var(--primary); border: 1px solid var(--primary); }
.q-diff-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 5px; font-size: 0.7rem; font-weight: 600; margin-left: 0.5rem; vertical-align: middle; }
.q-diff-badge.easy { background: rgba(0, 184, 148, 0.2); color: var(--success); border: 1px solid var(--success); }
.q-diff-badge.medium { background: rgba(253, 203, 110, 0.2); color: var(--warning); border: 1px solid var(--warning); }
.q-diff-badge.hard { background: rgba(231, 76, 60, 0.2); color: var(--danger); border: 1px solid var(--danger); }

.multiplier-badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 6px; font-size: 0.8rem; font-weight: 700; margin-left: 0.5rem; vertical-align: middle; }
.multiplier-badge.easy { background: var(--success); color: #fff; }
.multiplier-badge.medium { background: var(--warning); color: #1a1a2e; }
.multiplier-badge.hard { background: var(--danger); color: #fff; }

.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1rem; }
@media (max-width: 500px) { .options-grid { grid-template-columns: 1fr; } }

.option-btn { padding: 1rem 1.25rem; background: var(--card); border: 2px solid var(--border); border-radius: 12px; color: var(--text); cursor: pointer; transition: all 0.2s ease; font-size: 0.95rem; text-align: left; }
.option-btn:hover:not(:disabled) { border-color: var(--primary); background: var(--card-hover); transform: translateY(-1px); }
.option-btn.correct { border-color: var(--success); background: rgba(0, 184, 148, 0.15); color: var(--success); }
.option-btn.wrong { border-color: var(--danger); background: rgba(231, 76, 60, 0.15); color: var(--danger); }
.option-btn:disabled { cursor: not-allowed; opacity: 0.7; }
.option-btn.eliminated { opacity: 0.3; cursor: not-allowed; }

.tf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.tf-btn { padding: 1.5rem; font-size: 1.2rem; font-weight: 700; border-radius: 14px; border: 2px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; transition: all 0.2s ease; }
.tf-btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--primary); }
.tf-btn.correct { border-color: var(--success); background: rgba(0, 184, 148, 0.15); color: var(--success); }
.tf-btn.wrong { border-color: var(--danger); background: rgba(231, 76, 60, 0.15); color: var(--danger); }

.fillblank-input { width: 100%; padding: 1rem 1.25rem; font-size: 1.1rem; background: var(--card); border: 2px solid var(--border); border-radius: 12px; color: var(--text); outline: none; transition: border-color 0.2s; margin-bottom: 0.75rem; }
.fillblank-input:focus { border-color: var(--primary); }
.fillblank-input.correct { border-color: var(--success); background: rgba(0, 184, 148, 0.1); }
.fillblank-input.wrong { border-color: var(--danger); background: rgba(231, 76, 60, 0.1); }
.fillblank-submit { padding: 0.75rem 2rem; font-size: 1rem; background: var(--primary); color: #fff; border: none; border-radius: 10px; cursor: pointer; font-weight: 600; transition: transform 0.2s; }
.fillblank-submit:hover:not(:disabled) { transform: translateY(-1px); }
.fillblank-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.explanation-panel { display: none; margin-top: 1rem; padding: 1rem 1.25rem; background: rgba(108, 92, 231, 0.08); border: 1px solid rgba(108, 92, 231, 0.3); border-radius: 12px; animation: fadeIn 0.3s ease; }
.explanation-panel.visible { display: block; }
.explanation-panel .expl-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--primary); margin-bottom: 0.4rem; font-weight: 700; }
.explanation-panel .expl-text { font-size: 0.92rem; line-height: 1.5; color: var(--text); }
.explanation-panel .did-you-know { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid rgba(108, 92, 231, 0.2); font-size: 0.85rem; color: var(--warning); }
.explanation-panel .did-you-know::before { content: '💡 '; }
.explanation-panel .why-wrong { margin-top: 0.5rem; font-size: 0.85rem; color: var(--text-muted); font-style: italic; }

.hint-section { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.hint-btn { display: flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1.2rem; background: rgba(253, 203, 110, 0.1); border: 2px solid var(--warning); border-radius: 10px; color: var(--warning); cursor: pointer; transition: all 0.2s ease; font-size: 0.9rem; }
.hint-btn:hover:not(:disabled) { background: rgba(253, 203, 110, 0.2); transform: translateY(-1px); }
.hint-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.hint-text { padding: 0.75rem 1rem; background: rgba(253, 203, 110, 0.1); border: 1px solid rgba(253, 203, 110, 0.3); border-radius: 10px; color: var(--warning); font-size: 0.9rem; display: none; animation: fadeIn 0.3s ease; flex: 1; min-width: 200px; }
.hint-text.visible { display: block; }

.powerups-section { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
.powerup-btn { display: flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1rem; background: rgba(162, 155, 254, 0.1); border: 2px solid var(--power-purple); border-radius: 10px; color: var(--power-purple); cursor: pointer; transition: all 0.2s ease; font-size: 0.85rem; }
.powerup-btn:hover:not(:disabled) { background: rgba(162, 155, 254, 0.2); transform: translateY(-1px); }
.powerup-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.powerup-btn .powerup-count { background: var(--power-purple); color: #fff; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; }

.feedback { text-align: center; padding: 0.75rem; border-radius: 10px; margin-top: 1rem; font-weight: 600; display: none; animation: fadeIn 0.3s ease; }
.feedback.correct { display: block; background: rgba(0, 184, 148, 0.15); color: var(--success); border: 1px solid rgba(0, 184, 148, 0.3); }
.feedback.wrong { display: block; background: rgba(231, 76, 60, 0.15); color: var(--danger); border: 1px solid rgba(231, 76, 60, 0.3); }

.points-popup { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 2rem; font-weight: 800; pointer-events: none; z-index: 100; animation: pointsFloat 1.2s ease-out forwards; }
.points-popup.bonus { color: var(--streak-gold); text-shadow: 0 0 20px rgba(255, 215, 0, 0.6); }
.points-popup.levelup { color: var(--xp-blue); text-shadow: 0 0 20px rgba(116, 185, 255, 0.6); }
@keyframes pointsFloat { 0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); } 30% { opacity: 1; transform: translate(-50%, -70%) scale(1.2); } 100% { opacity: 0; transform: translate(-50%, -150%) scale(0.8); } }

.results-screen { text-align: center; }
.results-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 2.5rem 2rem; margin-bottom: 1.5rem; }
.results-card h2 { font-size: 2rem; margin-bottom: 0.5rem; background: linear-gradient(135deg, var(--primary), #a29bfe); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.final-score { font-size: 3.5rem; font-weight: 800; color: var(--success); margin: 1rem 0; }
.results-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.result-stat { padding: 1rem; background: var(--bg); border-radius: 10px; }
.result-stat .rs-value { font-size: 1.5rem; font-weight: 700; }
.result-stat .rs-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

.new-high-score { display: none; margin-top: 1rem; padding: 0.75rem; background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.05)); border: 1px solid var(--streak-gold); border-radius: 10px; color: var(--streak-gold); font-weight: 600; animation: fadeIn 0.5s ease; }
.new-high-score.visible { display: block; }

.level-up-notification { display: none; margin-top: 1rem; padding: 0.75rem; background: linear-gradient(135deg, rgba(116, 185, 255, 0.1), rgba(116, 185, 255, 0.05)); border: 1px solid var(--xp-blue); border-radius: 10px; color: var(--xp-blue); font-weight: 600; animation: fadeIn 0.5s ease; }
.level-up-notification.visible { display: block; }

.restart-btn { padding: 0.9rem 2.5rem; font-size: 1.1rem; background: linear-gradient(135deg, var(--primary), #a29bfe); color: #fff; border: none; border-radius: 14px; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; font-weight: 600; }
.restart-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4); }

/* ===== SHARE SECTION ===== */
.share-section {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}
.share-section h3 {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.share-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}
.share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.2rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 600;
}
.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
.share-btn.twitter {
    border-color: #1da1f2;
    color: #1da1f2;
}
.share-btn.twitter:hover {
    background: rgba(29, 161, 242, 0.1);
    box-shadow: 0 4px 15px rgba(29, 161, 242, 0.3);
}
.share-btn.line {
    border-color: #00c300;
    color: #00c300;
}
.share-btn.line:hover {
    background: rgba(0, 195, 0, 0.1);
    box-shadow: 0 4px 15px rgba(0, 195, 0, 0.3);
}
.share-btn.copy {
    border-color: var(--primary);
    color: var(--primary);
}
.share-btn.copy:hover {
    background: rgba(108, 92, 231, 0.1);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}
.share-btn.image {
    border-color: var(--success);
    color: var(--success);
}
.share-btn.image:hover {
    background: rgba(0, 184, 148, 0.1);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
}
.share-btn .share-icon {
    font-size: 1.2rem;
}
.share-btn .share-label {
    font-size: 0.85rem;
}
.share-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--success);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
    pointer-events: none;
}
.share-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.result-image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}
.result-image-overlay.visible {
    display: flex;
}
.result-image-overlay canvas {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.result-image-overlay .close-overlay {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--card);
    border: 2px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.result-image-overlay .close-overlay:hover {
    border-color: var(--danger);
    color: var(--danger);
}
.result-image-overlay .download-btn {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.7rem 1.5rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.result-image-overlay .download-btn:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.player-stats { margin-top: 1.5rem; padding: 1rem; background: var(--card); border-radius: 12px; border: 1px solid var(--border); }
.player-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 0.75rem; }
.player-stat-item { text-align: center; }
.player-stat-item .stat-icon { font-size: 1.5rem; margin-bottom: 0.25rem; }
.player-stat-item .stat-value { font-size: 1.2rem; font-weight: 700; color: var(--xp-blue); }
.player-stat-item .stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }

.xp-bar-container { margin-top: 0.75rem; }
.xp-bar-label { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.xp-bar { width: 100%; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.xp-bar-fill { height: 100%; background: linear-gradient(90deg, var(--xp-blue), #0984e3); border-radius: 4px; transition: width 0.5s ease; }

.daily-challenge-card { margin-top: 1.5rem; padding: 1rem; background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(253, 203, 110, 0.05)); border: 2px solid var(--streak-gold); border-radius: 12px; }
.daily-challenge-card h3 { color: var(--streak-gold); margin-bottom: 0.5rem; }
.daily-challenge-card p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.daily-challenge-btn { padding: 0.6rem 1.5rem; background: linear-gradient(135deg, var(--streak-gold), #f39c12); color: #1a1a2e; border: none; border-radius: 10px; cursor: pointer; font-weight: 700; transition: transform 0.2s; }
.daily-challenge-btn:hover:not(:disabled) { transform: translateY(-2px); }
.daily-challenge-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.streak-calendar { margin-top: 1.5rem; padding: 1rem; background: var(--card); border-radius: 12px; border: 1px solid var(--border); }
.streak-calendar h3 { margin-bottom: 0.75rem; color: var(--success); }
.streak-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.25rem; }
.streak-day { aspect-ratio: 1; background: var(--bg); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; color: var(--text-muted); }
.streak-day.active { background: var(--success); color: #fff; font-weight: 700; }
.streak-day.today { border: 2px solid var(--streak-gold); }

.leaderboard-section { margin-top: 1.5rem; padding: 1.2rem; background: var(--card); border-radius: 14px; border: 1px solid var(--border); }
.leaderboard-section h3 { margin-bottom: 0.75rem; color: var(--streak-gold); }
.leaderboard-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.leaderboard-tab { flex: 1; padding: 0.5rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text-muted); cursor: pointer; text-align: center; font-size: 0.85rem; transition: all 0.2s; }
.leaderboard-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.leaderboard-entry { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.leaderboard-entry:last-child { border-bottom: none; }
.leaderboard-entry .rank { color: var(--streak-gold); font-weight: 700; min-width: 30px; }
.leaderboard-entry .player-name { flex: 1; color: var(--text); }
.leaderboard-entry .player-score { color: var(--success); font-weight: 600; }

/* ===== STATISTICS SCREEN ===== */
.stats-screen { text-align: center; padding: 1rem 0; }
.stats-screen h2 {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary), #a29bfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
}
.stats-screen .back-btn {
    background: var(--card);
    border: 2px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
    float: left;
}
.stats-screen .back-btn:hover {
    border-color: var(--primary);
    background: var(--card-hover);
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: linear-gradient(135deg, var(--card), var(--card-hover));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 0.5rem;
    text-align: center;
}
.stat-card .stat-icon { font-size: 1.5rem; margin-bottom: 0.25rem; }
.stat-card .stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}
.stat-card .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-section {
    margin-bottom: 2rem;
    padding: 1.2rem;
    background: var(--card);
    border-radius: 14px;
    border: 1px solid var(--border);
    text-align: left;
}
.stats-section h3 {
    margin-bottom: 1rem;
    color: var(--text);
    font-size: 1.1rem;
    text-align: center;
}
.chart-container {
    width: 100%;
    display: flex;
    justify-content: center;
}
.chart-container canvas {
    width: 100%;
    max-width: 100%;
    height: auto;
}

.heatmap-container {
    display: flex;
    justify-content: center;
    overflow-x: auto;
}
.heatmap-cell {
    transition: transform 0.2s;
    cursor: default;
}
.heatmap-cell:hover {
    transform: scale(1.3);
}

/* Stats button in settings row */
.stats-btn {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2), rgba(162, 155, 254, 0.1));
    border-color: var(--primary) !important;
}
.stats-btn:hover {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.4), rgba(162, 155, 254, 0.2));
}

/* Educational Features */
.expl-jp {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 215, 0, 0.08);
    border-left: 3px solid var(--streak-gold);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text);
    display: none;
}

.learn-more-btn {
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--primary), #a29bfe);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}

.learn-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
}

.learn-more-content {
    margin-top: 0.75rem;
    padding: 1rem;
    background: rgba(108, 92, 231, 0.08);
    border-left: 3px solid var(--primary);
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.educational-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.edu-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.edu-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.edu-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.edu-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.edu-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.edu-btn {
    padding: 0.4rem 0.8rem;
    background: rgba(108, 92, 231, 0.15);
    border: 1px solid var(--primary);
    border-radius: 6px;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
}

.edu-btn:hover {
    background: rgba(108, 92, 231, 0.25);
}

.secondary-btn {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2), rgba(162, 155, 254, 0.1)) !important;
    border: 2px solid var(--primary) !important;
}

.secondary-btn:hover {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.4), rgba(162, 155, 254, 0.2)) !important;
}

.bookmark-item, .note-item, .review-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.bookmark-genre, .note-genre, .review-genre {
    font-size: 0.75rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.bookmark-question, .note-question, .review-question {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.bookmark-explanation, .note-explanation, .review-explanation {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: rgba(108, 92, 231, 0.08);
    border-radius: 6px;
}

.bookmark-dyk, .note-dyk, .review-dyk {
    font-size: 0.85rem;
    color: var(--streak-gold);
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 215, 0, 0.08);
    border-radius: 6px;
}

.bookmark-remove-btn {
    padding: 0.3rem 0.6rem;
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid var(--danger);
    border-radius: 6px;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.note-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    margin-top: 0.75rem;
}

.note-acc-good { color: var(--success); }
.note-acc-ok { color: var(--warning); }
.note-acc-bad { color: var(--danger); }
.note-correct { color: var(--success); }
.note-wrong { color: var(--danger); }

.review-answer {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
}

.correct-answer {
    background: rgba(0, 184, 148, 0.1);
    color: var(--success);
}

.wrong-answer {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
}

.review-whywrong {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.5rem;
    background: rgba(253, 203, 110, 0.08);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.review-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.flashcard-screen {
    text-align: center;
}

.flashcard-header {
    margin-bottom: 2rem;
}

.flashcard-progress {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.flashcard-container {
    perspective: 1000px;
    margin: 2rem 0;
}

.flashcard {
    width: 100%;
    max-width: 500px;
    height: 350px;
    margin: 0 auto;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.flashcard-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), rgba(162, 155, 254, 0.05));
    border-color: var(--primary);
}

.flashcard-genre {
    font-size: 0.75rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.flashcard-question {
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.flashcard-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

.flashcard-answer {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 1rem;
}

.flashcard-expl {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    text-align: center;
}

.flashcard-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

.fc-btn {
    padding: 0.8rem 1.5rem;
    border: 2px solid;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.fc-wrong {
    background: rgba(231, 76, 60, 0.15);
    border-color: var(--danger);
    color: var(--danger);
}

.fc-wrong:hover {
    background: rgba(231, 76, 60, 0.25);
    transform: translateY(-2px);
}

.fc-correct {
    background: rgba(0, 184, 148, 0.15);
    border-color: var(--success);
    color: var(--success);
}

.fc-correct:hover {
    background: rgba(0, 184, 148, 0.25);
    transform: translateY(-2px);
}

.review-screen, .bookmarks-screen, .notes-screen {
    padding: 1rem;
}

.review-subtitle, .notes-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Challenges Menu Button */
.challenges-menu-btn {
    width: 100%;
    padding: 1rem;
    margin: 1.5rem 0;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.challenges-menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

/* Challenges Container */
.challenges-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.challenges-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
}

.back-btn {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.5rem 1rem;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: var(--card-hover);
    border-color: var(--primary);
}

/* Challenge Cards */
.challenge-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.challenge-card:hover {
    background: var(--card-hover);
    border-color: var(--primary);
}

.challenge-header h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.challenge-header p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Tournament Setup */
.tournament-setup label {
    display: block;
    margin-bottom: 1rem;
    color: var(--text);
}

.tournament-setup select,
.tournament-setup input {
    width: 100%;
    padding: 0.75rem;
    margin-top: 0.5rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
}

.tournament-setup select:focus,
.tournament-setup input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Tournament Screen */
.tournament-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.tournament-container h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.tournament-bracket {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.bracket-round h4 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.bracket-match {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.bracket-player {
    padding: 0.5rem;
    margin: 0.25rem 0;
    background: var(--card);
    border-radius: 6px;
}

.bracket-vs {
    text-align: center;
    color: var(--text-muted);
    font-weight: bold;
    margin: 0.5rem 0;
}

.tournament-status {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.tournament-status h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.tournament-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Time Attack */
.time-attack-leaderboard {
    margin-top: 1.5rem;
}

.time-attack-leaderboard h4 {
    margin-bottom: 1rem;
    color: var(--primary);
}

/* Streak Challenges */
.streak-challenges-list {
    margin-bottom: 1.5rem;
}

.streak-challenge-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.streak-challenge-item.completed {
    border-color: var(--success);
    background: rgba(0, 184, 148, 0.1);
}

.streak-challenge-item.active {
    border-color: var(--warning);
    background: rgba(253, 203, 110, 0.1);
    animation: pulse 2s infinite;
}

.streak-challenge-icon {
    font-size: 2rem;
}

.streak-challenge-info {
    flex: 1;
}

.streak-challenge-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.streak-challenge-reward {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.streak-challenge-status {
    font-weight: bold;
    color: var(--primary);
}

.current-streak-info {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(238, 90, 111, 0.1));
    border: 2px solid var(--warning);
    border-radius: 12px;
}

.streak-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.streak-icon {
    font-size: 2rem;
}

.streak-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--warning);
}

.streak-label {
    font-size: 1rem;
    color: var(--text-muted);
}

/* Mini-Games Grid */
.mini-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.mini-game-btn {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.mini-game-btn:hover {
    background: var(--card-hover);
    border-color: var(--primary);
    transform: translateY(-4px);
}

.mini-game-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.mini-game-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.mini-game-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Achievements Grid */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.achievement-item {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.achievement-item.unlocked {
    border-color: var(--success);
    background: rgba(0, 184, 148, 0.1);
}

.achievement-item.locked {
    opacity: 0.5;
}

.achievement-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.achievement-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.achievement-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Quiz Codes */
.quiz-code-section {
    text-align: center;
}

.quiz-code-display {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.quiz-code-text {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.quiz-code-text strong {
    color: var(--primary);
    font-family: monospace;
    font-size: 1.5rem;
}

.quiz-code-stats {
    text-align: left;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.quiz-code-stats p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.copy-btn, .view-code-btn {
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: white;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.copy-btn:hover, .view-code-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

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

/* === ACCESSIBILITY STYLES === */

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip navigation link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 10000;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* Accessibility toggle button */
.a11y-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: 2px solid var(--primary-dark);
    font-size: 24px;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.a11y-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(108, 92, 231, 0.6);
}

.a11y-toggle-btn:focus {
    outline: 3px solid var(--warning);
    outline-offset: 2px;
}

/* Accessibility panel */
.a11y-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 380px;
    max-height: 85vh;
    background: var(--card);
    border: 2px solid var(--primary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 9998;
    overflow-y: auto;
    animation: slideIn 0.3s ease-out;
}

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

.a11y-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: 10px 10px 0 0;
}

.a11y-panel-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.a11y-close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.a11y-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.a11y-close-btn:focus {
    outline: 2px solid var(--warning);
    outline-offset: 2px;
}

.a11y-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.a11y-section:last-child {
    border-bottom: none;
}

.a11y-section h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.a11y-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 0;
}

.a11y-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

.a11y-toggle input[type="checkbox"]:focus {
    outline: 2px solid var(--warning);
    outline-offset: 2px;
}

.a11y-toggle span {
    font-size: 15px;
    color: var(--text);
}

.a11y-desc {
    font-size: 13px;
    color: var(--text-light);
    margin: 8px 0 12px 0;
    line-height: 1.5;
}

.a11y-slider-label {
    display: block;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 8px;
}

.a11y-slider-label span {
    color: var(--primary);
    font-weight: 600;
}

.a11y-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    -webkit-appearance: none;
}

.a11y-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid var(--primary-dark);
}

.a11y-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid var(--primary-dark);
}

.a11y-slider:focus {
    outline: 2px solid var(--warning);
    outline-offset: 2px;
}

.a11y-font-presets {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.a11y-preset-btn {
    flex: 1;
    min-width: 70px;
    padding: 8px 12px;
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.a11y-preset-btn:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.a11y-preset-btn:focus {
    outline: 2px solid var(--warning);
    outline-offset: 2px;
}

.a11y-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.a11y-radio {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 0;
}

.a11y-radio input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

.a11y-radio input[type="radio"]:focus {
    outline: 2px solid var(--warning);
    outline-offset: 2px;
}

.a11y-radio span {
    font-size: 14px;
    color: var(--text);
}

.a11y-voice-btn {
    width: 100%;
    padding: 12px;
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.a11y-voice-btn:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.a11y-voice-btn.listening {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
    animation: pulse 1s infinite;
}

.a11y-voice-btn:focus {
    outline: 2px solid var(--warning);
    outline-offset: 2px;
}

.a11y-reset-btn {
    width: calc(100% - 40px);
    margin: 20px;
    padding: 12px;
    background: transparent;
    color: var(--danger);
    border: 2px solid var(--danger);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.a11y-reset-btn:hover {
    background: var(--danger);
    color: #fff;
}

.a11y-reset-btn:focus {
    outline: 2px solid var(--warning);
    outline-offset: 2px;
}

/* Focus indicators */
body[data-focus="on"] *:focus {
    outline: 3px solid var(--warning) !important;
    outline-offset: 2px !important;
}

body[data-focus="on"] button:focus,
body[data-focus="on"] input:focus,
body[data-focus="on"] select:focus,
body[data-focus="on"] textarea:focus {
    outline: 3px solid var(--warning) !important;
    outline-offset: 2px !important;
}

/* Reduced motion */
body[data-reduced-motion="on"] *,
body[data-reduced-motion="on"] *::before,
body[data-reduced-motion="on"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* Font size scaling */
body[data-font-scale] {
    --font-scale: attr(data-font-scale);
}

body[data-font-scale="0.8"] {
    --font-scale: 0.8;
}

body[data-font-scale="0.9"] {
    --font-scale: 0.9;
}

body[data-font-scale="1"] {
    --font-scale: 1;
}

body[data-font-scale="1.1"] {
    --font-scale: 1.1;
}

body[data-font-scale="1.2"] {
    --font-scale: 1.2;
}

body[data-font-scale="1.3"] {
    --font-scale: 1.3;
}

body[data-font-scale="1.4"] {
    --font-scale: 1.4;
}

body[data-font-scale="1.5"] {
    --font-scale: 1.5;
}

body[data-font-scale="1.6"] {
    --font-scale: 1.6;
}

body[data-font-scale="1.7"] {
    --font-scale: 1.7;
}

body[data-font-scale="1.8"] {
    --font-scale: 1.8;
}

body {
    font-size: calc(16px * var(--font-scale, 1));
}

/* Dyslexia-friendly font */
body[data-dyslexia="on"] {
    font-family: 'OpenDyslexic', 'Comic Sans MS', 'Verdana', sans-serif !important;
    letter-spacing: 0.05em;
    word-spacing: 0.1em;
    line-height: 1.6;
}

body[data-dyslexia="on"] * {
    font-family: inherit !important;
}

/* Color-blind modes */
body[data-colorblind="deuteranopia"] {
    filter: url(#deuteranopia-filter);
}

body[data-colorblind="protanopia"] {
    filter: url(#protanopia-filter);
}

body[data-colorblind="tritanopia"] {
    filter: url(#tritanopia-filter);
}

body[data-colorblind="highcontrast"] {
    --bg: #000;
    --card: #1a1a1a;
    --text: #fff;
    --text-light: #e0e0e0;
    --border: #555;
    --primary: #ffff00;
    --primary-dark: #cccc00;
    --primary-bg: rgba(255, 255, 0, 0.1);
    --success: #00ff00;
    --danger: #ff0000;
    --warning: #ffff00;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .a11y-panel {
        width: calc(100% - 40px);
        max-width: 380px;
        right: 20px;
        top: 80px;
    }
    
    .a11y-toggle-btn {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}

/* Print styles */
@media print {
    .a11y-toggle-btn,
    .a11y-panel,
    .skip-link {
        display: none !important;
    }
}

/* ===== ANALYTICS MENU BUTTON ===== */
.analytics-menu-btn {
    display: block;
    width: 100%;
    padding: 1rem 2rem;
    margin: 1rem 0;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2), rgba(162, 155, 254, 0.2));
    border: 2px solid var(--primary);
    border-radius: 12px;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.analytics-menu-btn:hover {
    background: linear-gradient(135deg, var(--primary), #a29bfe);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(108, 92, 231, 0.3);
}

/* ===== ANALYTICS SCREEN ===== */
.analytics-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.analytics-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary);
}

.back-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    background: rgba(108, 92, 231, 0.1);
    border: 2px solid var(--primary);
    border-radius: 8px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: var(--primary);
    color: white;
}

.analytics-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
}

.analytics-tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.analytics-tab:hover {
    color: var(--primary);
}

.analytics-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.analytics-panel {
    display: none;
}

.analytics-panel.active {
    display: block;
}

.analytics-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.analytics-stat-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.analytics-stat-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.analytics-stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.analytics-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.analytics-stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.analytics-chart-section {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.analytics-chart-section h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.analytics-chart-section canvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.weak-areas-list,
.genre-details-list,
.predictions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.weak-area-item,
.genre-detail-item,
.prediction-item {
    background: rgba(108, 92, 231, 0.1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.weak-area-genre,
.genre-detail-name,
.prediction-genre {
    font-weight: 600;
    color: var(--text);
    flex: 1;
    min-width: 150px;
}

.weak-area-accuracy {
    font-weight: 700;
    font-size: 1.1rem;
}

.weak-area-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.genre-detail-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.genre-stat {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.genre-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.genre-stat-value {
    font-weight: 600;
    color: var(--primary);
}

.prediction-days {
    font-weight: 700;
    color: var(--success);
    font-size: 1.1rem;
}

.export-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.export-btn {
    flex: 1;
    min-width: 150px;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary), #a29bfe);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(108, 92, 231, 0.3);
}

.danger-btn {
    width: 100%;
    padding: 1rem;
    background: rgba(231, 76, 60, 0.1);
    border: 2px solid var(--danger);
    border-radius: 8px;
    color: var(--danger);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.danger-btn:hover {
    background: var(--danger);
    color: white;
}

@media (max-width: 600px) {
    .analytics-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .analytics-tabs {
        flex-wrap: nowrap;
    }
    
    .analytics-tab {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* === MULTIMEDIA QUESTION STYLES === */

/* Image questions */
.image-question-area {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Audio questions */
.audio-question-area {
    text-align: center;
}

.audio-play-btn {
    background: linear-gradient(135deg, var(--primary), #a29bfe);
    border: none;
    border-radius: 50px;
    color: white;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 1rem 0;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.audio-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.6);
}

.audio-play-btn:active {
    transform: scale(0.95);
}

/* Sequence questions */
.sequence-display {
    text-align: center;
}

.sequence-items {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
    font-size: 1.5rem;
}

.sequence-item {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 0.5rem 1rem;
    min-width: 50px;
    font-weight: bold;
    color: var(--primary);
}

.sequence-item.question-mark {
    background: rgba(108, 92, 231, 0.2);
    border-color: var(--primary);
    color: var(--warning);
    font-size: 1.8rem;
    animation: pulse 1s infinite;
}

/* Pattern questions */
.pattern-display {
    text-align: center;
}

.pattern-items {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0;
    font-size: 2rem;
}

.pattern-item {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 0.5rem 1rem;
    min-width: 50px;
    color: var(--text);
}

.pattern-item.question-mark {
    background: rgba(108, 92, 231, 0.2);
    border-color: var(--primary);
    color: var(--warning);
    animation: pulse 1s infinite;
}

/* Memory questions */
.memory-display {
    text-align: center;
}

.memory-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.memory-item {
    background: linear-gradient(135deg, var(--primary), #a29bfe);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1.1rem;
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
}

.memory-hidden {
    color: var(--warning);
    font-size: 1.3rem;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.memory-timer {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 1rem;
}

#memoryCountdown {
    color: var(--warning);
    font-weight: bold;
    font-size: 1.4rem;
}

/* Speed questions */
.speed-question-area {
    text-align: center;
}

.speed-prompt {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--warning);
    margin: 1rem 0;
    text-shadow: 0 0 10px rgba(253, 203, 110, 0.3);
}

.speed-option {
    font-size: 1.1rem;
    padding: 1rem;
    transition: all 0.15s ease;
}

.speed-option:hover {
    transform: scale(1.03);
}

/* Drag and drop questions */
.dragdrop-container {
    padding: 0.5rem;
}

.dragdrop-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.dragdrop-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    cursor: grab;
    transition: all 0.3s ease;
    user-select: none;
}

.dragdrop-item:hover {
    border-color: var(--primary);
    background: var(--card-hover);
}

.dragdrop-item.selected {
    border-color: var(--warning);
    background: rgba(253, 203, 110, 0.1);
    box-shadow: 0 0 10px rgba(253, 203, 110, 0.3);
}

.dragdrop-item.dragging {
    opacity: 0.5;
}

.dragdrop-item.correct {
    border-color: var(--success);
    background: rgba(0, 184, 148, 0.1);
}

.dragdrop-item.wrong {
    border-color: var(--danger);
    background: rgba(231, 76, 60, 0.1);
}

.drag-handle {
    color: var(--text-muted);
    cursor: grab;
}

.drag-target {
    color: var(--text-muted);
    margin-left: auto;
    font-style: italic;
}

.dragdrop-targets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.dragdrop-target {
    background: rgba(108, 92, 231, 0.1);
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text);
    font-weight: 500;
}

.dragdrop-target:hover {
    border-color: var(--primary);
    background: rgba(108, 92, 231, 0.2);
}

/* Mobile optimization for multimedia */
@media (max-width: 600px) {
    .sequence-items {
        font-size: 1.2rem;
        gap: 0.3rem;
    }
    
    .sequence-item {
        padding: 0.4rem 0.75rem;
        min-width: 40px;
    }
    
    .pattern-items {
        font-size: 1.5rem;
        gap: 0.5rem;
    }
    
    .memory-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.95rem;
    }
    
    .speed-prompt {
        font-size: 1.4rem;
    }
    
    .dragdrop-item {
        padding: 0.6rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .dragdrop-target {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}

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

/* Reduced motion mode */
.reduced-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

.reduced-motion .parallax-bg {
    display: none !important;
}

/* Ripple Effect */
@keyframes rippleExpand {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: rippleExpand 0.6s ease-out forwards;
    pointer-events: none;
}

/* Card Flip Animations */
.card-flip-out {
    animation: cardFlipOut 0.3s ease-in forwards;
}

.card-flip-in {
    animation: cardFlipIn 0.5s ease-out forwards;
}

@keyframes cardFlipOut {
    0% { transform: perspective(800px) rotateY(0); opacity: 1; }
    100% { transform: perspective(800px) rotateY(-90deg); opacity: 0; }
}

@keyframes cardFlipIn {
    0% { transform: perspective(800px) rotateY(90deg); opacity: 0; }
    100% { transform: perspective(800px) rotateY(0); opacity: 1; }
}

/* Question Transition Animations */
.slide-out-left {
    animation: slideOutLeft 0.4s ease-in forwards;
}

@keyframes slideOutLeft {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(-100px); opacity: 0; }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
}

@keyframes fadeInUp {
    0% { transform: translateY(30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* Progress Bar Enhanced */
.progress-bar {
    background: linear-gradient(90deg, var(--primary), #a29bfe, var(--primary));
    background-size: 200% 100%;
    animation: progressGradient 3s ease infinite;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Combo Meter Fire Effect */
.combo-badge.streak-5::before,
.combo-badge.streak-10::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 25px;
    background: conic-gradient(from 0deg, #ff6b6b, #ffd700, #ff6b6b);
    animation: comboFire 2s linear infinite;
    opacity: 0.5;
    z-index: -1;
    filter: blur(4px);
}

@keyframes comboFire {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.combo-badge.streak-10 {
    position: relative;
    animation: comboPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), comboGlow 1.5s ease-in-out infinite, comboScale 0.5s ease-in-out infinite alternate;
}

@keyframes comboScale {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

/* Achievement Reveal Animation */
.achievement-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: achievementFadeIn 0.5s ease;
    cursor: pointer;
    backdrop-filter: blur(5px);
}

.achievement-card {
    background: linear-gradient(135deg, #1a1a2e, #2a2a4a);
    border: 2px solid var(--streak-gold);
    border-radius: 20px;
    padding: 2.5rem 3rem;
    text-align: center;
    position: relative;
    animation: achievementPopIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 60px rgba(255, 215, 0, 0.4), 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.achievement-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(255, 215, 0, 0.1), transparent, rgba(255, 215, 0, 0.1), transparent);
    animation: achievementGlowRotate 4s linear infinite;
}

@keyframes achievementGlowRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.achievement-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: achievementIconBounce 0.8s ease-out;
    position: relative;
    z-index: 1;
}

@keyframes achievementIconBounce {
    0% { transform: scale(0) rotate(-180deg); }
    60% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.achievement-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--streak-gold);
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    animation: achievementTextSlide 0.5s ease-out 0.3s both;
}

.achievement-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
    animation: achievementTextSlide 0.5s ease-out 0.5s both;
}

.achievement-xp {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--xp-blue);
    padding: 0.5rem 1rem;
    background: rgba(116, 185, 255, 0.1);
    border: 1px solid var(--xp-blue);
    border-radius: 10px;
    display: inline-block;
    position: relative;
    z-index: 1;
    animation: achievementXPulse 0.6s ease-out 0.7s both;
}

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

@keyframes achievementPopIn {
    0% { transform: scale(0.3) translateY(50px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes achievementTextSlide {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes achievementXPulse {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.achievement-dismiss {
    animation: achievementDismiss 0.5s ease-in forwards;
}

@keyframes achievementDismiss {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Wrong Answer Flash */
.wrong-answer-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(231, 76, 60, 0.15);
    pointer-events: none;
    z-index: 9997;
    animation: wrongFlash 0.5s ease-out forwards;
}

@keyframes wrongFlash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Level Up Flash */
.level-up-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(116, 185, 255, 0.3) 0%, transparent 70%);
    pointer-events: none;
    z-index: 9997;
    animation: levelUpFlash 1s ease-out forwards;
}

@keyframes levelUpFlash {
    0% { opacity: 0; transform: scale(0.5); }
    30% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.5); }
}

/* Score Popup Animation */
.score-popup-anim {
    position: fixed;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--success);
    text-shadow: 0 0 10px rgba(0, 184, 148, 0.6);
    pointer-events: none;
    z-index: 9999;
    animation: scorePopup 1.5s ease-out forwards;
}

.score-popup-big {
    font-size: 2.2rem;
    color: var(--streak-gold);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

@keyframes scorePopup {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    20% { transform: translateY(-20px) scale(1.2); opacity: 1; }
    100% { transform: translateY(-80px) scale(0.8); opacity: 0; }
}

/* Timer Warning Pulse */
.timer-warning-pulse {
    animation: timerWarningPulse 0.5s ease-in-out;
}

@keyframes timerWarningPulse {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 30px rgba(231, 76, 60, 0.3); }
}

/* Parallax Background */
.parallax-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.parallax-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    transition: transform 0.1s ease-out;
}

.parallax-layer.layer-1 {
    background: radial-gradient(ellipse at 20% 50%, rgba(108, 92, 231, 0.05) 0%, transparent 50%);
}

.parallax-layer.layer-2 {
    background: radial-gradient(ellipse at 80% 30%, rgba(162, 155, 254, 0.04) 0%, transparent 50%);
}

.parallax-layer.layer-3 {
    background: radial-gradient(ellipse at 50% 80%, rgba(253, 203, 110, 0.03) 0%, transparent 50%);
}

/* Theme Transition */
.theme-transitioning {
    transition: all 0.8s ease;
}

.theme-transitioning * {
    transition: background-color 0.8s ease, color 0.8s ease, border-color 0.8s ease !important;
}

/* Loading Skeleton */
.skeleton-loading {
    position: relative;
    overflow: hidden;
    background: var(--card);
    border-radius: 12px;
    padding: 2rem;
}

.skeleton-line {
    background: linear-gradient(90deg, var(--border) 25%, rgba(255,255,255,0.05) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-text {
    height: 16px;
    width: 100%;
}

.skeleton-text.short {
    width: 40%;
}

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

/* Button hover glow on focus */
button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 15px rgba(108, 92, 231, 0.4);
}

/* Smooth scroll for internal navigation */
html {
    scroll-behavior: smooth;
}

/* Enhanced option buttons with hover animation */
.option-btn {
    position: relative;
    overflow: hidden;
}

.option-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(108, 92, 231, 0.1), transparent);
    transition: left 0.5s ease;
}

.option-btn:hover::before {
    left: 100%;
}

/* Stagger animation for option buttons */
.options-grid .option-btn:nth-child(1) { animation-delay: 0.05s; }
.options-grid .option-btn:nth-child(2) { animation-delay: 0.1s; }
.options-grid .option-btn:nth-child(3) { animation-delay: 0.15s; }
.options-grid .option-btn:nth-child(4) { animation-delay: 0.2s; }

.options-grid .option-btn {
    animation: optionFadeIn 0.4s ease-out both;
}

@keyframes optionFadeIn {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* Combo badge enhanced */
.combo-badge {
    position: relative;
    transition: all 0.3s ease;
}

/* XP bar pulse animation when gaining XP */
.xp-bar-fill.gaining {
    animation: xpGainPulse 0.5s ease-out;
}

@keyframes xpGainPulse {
    0% { box-shadow: 0 0 0 0 rgba(116, 185, 255, 0.6); }
    100% { box-shadow: 0 0 20px 5px rgba(116, 185, 255, 0); }
}

/* Stat box bounce on update */
.stat-box.updating .stat-value {
    animation: statBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes statBounce {
    0% { transform: scale(1); }
    40% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Powerup button shine effect */
.powerup-btn {
    position: relative;
    overflow: hidden;
}

.powerup-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.powerup-btn:hover::after {
    transform: translateX(100%);
}

/* ========================================
   MULTIPLAYER MODE STYLES
   ======================================== */

.multiplayer-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    color: #e0e0e0;
}

.multiplayer-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #a29bfe;
}

.back-btn {
    background: #636e72;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: background 0.2s;
}

.back-btn:hover {
    background: #74b9ff;
}

/* Player Selection */
.player-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.player-card {
    background: #2d3436;
    border: 2px solid #636e72;
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.player-card:hover {
    border-color: #a29bfe;
    transform: translateY(-2px);
}

.player-card.active {
    border-color: #00b894;
    background: #1e3a3a;
}

.player-card-avatar {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.player-card-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #dfe6e9;
    margin-bottom: 0.5rem;
}

.player-card-stats {
    font-size: 0.9rem;
    color: #b2bec3;
}

.player-card-active {
    color: #00b894;
    font-weight: bold;
    margin-top: 0.5rem;
}

.create-player-section {
    background: #2d3436;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.create-player-section h3 {
    color: #a29bfe;
    margin-bottom: 1rem;
}

.create-player-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.create-player-input {
    background: #34495e;
    border: 2px solid #636e72;
    color: #ecf0f1;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 1rem;
}

.create-player-input:focus {
    outline: none;
    border-color: #a29bfe;
}

.avatar-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.avatar-option {
    font-size: 2rem;
    background: #34495e;
    border: 2px solid #636e72;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.avatar-option:hover {
    border-color: #a29bfe;
    transform: scale(1.1);
}

.avatar-option.selected {
    border-color: #00b894;
    background: #1e3a3a;
}

/* Multiplayer Hub */
.current-player-banner {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.player-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.player-avatar {
    font-size: 3rem;
}

.player-banner-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

.player-banner-level {
    font-size: 1rem;
    color: #dfe6e9;
}

.multiplayer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.mp-card {
    background: #2d3436;
    border: 2px solid #636e72;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.mp-card:hover {
    border-color: #a29bfe;
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.mp-card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.mp-card-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #dfe6e9;
    margin-bottom: 0.5rem;
}

.mp-card-desc {
    font-size: 0.9rem;
    color: #b2bec3;
}

.mp-section {
    background: #2d3436;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.mp-section h3 {
    color: #a29bfe;
    margin-bottom: 1rem;
}

.mp-secondary-btn {
    background: #6c5ce7;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.mp-secondary-btn:hover {
    background: #a29bfe;
}

/* Challenges */
.challenges-list {
    margin-bottom: 1rem;
}

.challenge-item {
    background: #34495e;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.challenge-from {
    color: #dfe6e9;
    font-weight: bold;
}

.challenge-msg {
    color: #b2bec3;
    font-style: italic;
}

.mp-small-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.mp-small-btn.accept {
    background: #00b894;
    color: white;
}

.mp-small-btn.accept:hover {
    background: #00cec9;
}

.mp-small-btn.decline {
    background: #d63031;
    color: white;
}

.mp-small-btn.decline:hover {
    background: #ff7675;
}

/* Setup Forms */
.setup-form {
    background: #2d3436;
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.setup-form label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: #dfe6e9;
    font-weight: 500;
}

.setup-form select,
.setup-form input {
    background: #34495e;
    border: 2px solid #636e72;
    color: #ecf0f1;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 1rem;
}

.setup-form select:focus,
.setup-form input:focus {
    outline: none;
    border-color: #a29bfe;
}

/* Turn Screen */
#hotSeatTurnScreen h2 {
    margin-top: 2rem;
}

.mp-scores-summary {
    margin: 2rem 0;
}

.mp-scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.mp-score-item {
    background: #34495e;
    border: 2px solid #636e72;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.mp-score-item.current {
    border-color: #a29bfe;
    background: #2d3436;
}

.mp-score-item span {
    display: block;
}

.mp-score-item span:first-child {
    font-weight: bold;
    color: #dfe6e9;
    margin-bottom: 0.5rem;
}

.mp-score-item span:last-child {
    color: #74b9ff;
    font-size: 1.2rem;
}

/* Results */
#mpResultsScreen h2 {
    margin-top: 2rem;
}

.mp-results-content {
    margin: 2rem 0;
}

.mp-result-item {
    background: #2d3436;
    border: 2px solid #636e72;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
}

.mp-result-item.winner {
    border-color: #ffd700;
    background: linear-gradient(135deg, #2d3436, #34495e);
}

.mp-result-rank {
    font-size: 2rem;
}

.mp-result-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #dfe6e9;
}

.mp-result-score {
    font-size: 1.5rem;
    font-weight: bold;
    color: #74b9ff;
}

.mp-result-acc {
    color: #b2bec3;
    font-size: 0.9rem;
    grid-column: 2 / 4;
}

.mp-winner-banner {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #2d3436;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 2rem;
}

.mp-team-result,
.mp-coop-result {
    background: #2d3436;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}

.mp-team-result h3,
.mp-coop-result h3 {
    color: #a29bfe;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.mp-team-score {
    font-size: 3rem;
    font-weight: bold;
    color: #74b9ff;
    margin: 1rem 0;
}

.mp-team-acc {
    color: #b2bec3;
    font-size: 1.1rem;
    margin: 0.5rem 0;
}

.mp-team-members {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.mp-team-members span {
    background: #34495e;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: #dfe6e9;
}

/* Quiz Creation */
.quiz-creation-form {
    background: #2d3436;
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.quiz-creation-form h3 {
    color: #a29bfe;
    margin-top: 1rem;
}

.quiz-questions-builder {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.quiz-question-item {
    background: #34495e;
    border: 2px solid #636e72;
    border-radius: 8px;
    padding: 1.5rem;
}

.quiz-q-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    color: #a29bfe;
    font-weight: bold;
}

.quiz-question-item label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: #dfe6e9;
    margin-bottom: 1rem;
}

.quiz-question-item input,
.quiz-question-item select {
    background: #2d3436;
    border: 2px solid #636e72;
    color: #ecf0f1;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
}

.quiz-question-item input:focus,
.quiz-question-item select:focus {
    outline: none;
    border-color: #a29bfe;
}

.quiz-creation-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.quiz-item {
    background: #34495e;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quiz-item-title {
    color: #dfe6e9;
    font-weight: bold;
    font-size: 1.1rem;
}

.quiz-item-meta {
    color: #b2bec3;
    font-size: 0.9rem;
}

.quiz-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.quiz-import-section {
    margin-top: 1rem;
    text-align: center;
}

/* Menu Button */
.multiplayer-menu-btn {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s;
    margin: 1rem auto;
    display: block;
}

.multiplayer-menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(108, 92, 231, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .multiplayer-container {
        padding: 1rem;
    }
    
    .multiplayer-grid {
        grid-template-columns: 1fr;
    }
    
    .player-list {
        grid-template-columns: 1fr;
    }
    
    .mp-scores-grid {
        grid-template-columns: 1fr;
    }
    
    .mp-result-item {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .mp-result-acc {
        grid-column: 1;
    }
}
