/* =====================================================
   QUIZ APP - Complete Professional CSS
   ===================================================== */

:root {
    --bg-primary: #0f0f13;
    --bg-secondary: #16161d;
    --bg-tertiary: #1c1c26;
    --bg-elevated: #22222e;
    --bg-hover: #2a2a38;
    
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.4);
    
    --success: #10b981;
    --success-light: #34d399;
    --success-glow: rgba(16, 185, 129, 0.3);
    
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --warning-glow: rgba(245, 158, 11, 0.3);
    
    --danger: #ef4444;
    --danger-light: #f87171;
    --danger-glow: rgba(239, 68, 68, 0.3);
    
    --info: #3b82f6;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    
    --transition: all 0.2s ease;
    
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-text-size-adjust: 100%;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overscroll-behavior: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    touch-action: manipulation;
}

input, select, textarea { font-size: 16px !important; }

a {
    color: var(--primary-light);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

button, .btn, .nav-link, .quiz-answer {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    background: var(--bg-tertiary);
    -webkit-user-drag: none;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 3px; }

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

main {
    min-height: calc(100vh - 56px);
    min-height: calc(100dvh - 56px);
    padding-bottom: calc(2rem + var(--safe-bottom));
}

/* Navbar */
.navbar {
    background: rgba(15, 15, 19, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 0.5rem;
}

.navbar-brand {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.6rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    min-height: 44px;
    min-width: 44px;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.nav-link .icon { font-size: 1.25rem; }

/* Bouton spécial rédacteur */
.nav-link-special {
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%) !important;
    color: white !important;
    border-radius: 8px !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    transition: all 0.2s ease;
}

.nav-link-special:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%) !important;
}

.nav-link-special.active {
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%) !important;
}

@media (max-width: 600px) {
    .nav-link span:not(.icon) { display: none; }
    .nav-link { padding: 0.5rem; }
}

/* Page Header */
.page-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    border: none;
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    border: none;
    color: #1a1a1a;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    border: none;
    color: white;
}

.btn-secondary { background: var(--bg-tertiary); }
.btn-outline { background: transparent; color: var(--text-secondary); }

.btn-sm { padding: 0.5rem 0.75rem; font-size: 0.8rem; min-height: 36px; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1rem; min-height: 50px; }
.btn-block { width: 100%; }

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.card-title { font-size: 0.95rem; font-weight: 600; margin: 0; }
.card-body { padding: 1rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group > label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 16px !important;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    min-height: 48px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

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

/* Custom Checkbox */
.custom-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
}

.custom-checkbox.checked {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.custom-checkbox input[type="checkbox"] {
    width: 24px;
    height: 24px;
    accent-color: var(--primary);
}

.custom-checkbox-title { font-weight: 600; }
.custom-checkbox-desc { font-size: 0.8rem; color: var(--text-secondary); }

.explanation-section {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-elevated);
    border-left: 3px solid var(--primary);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.explanation-section.hidden { display: none; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 50px;
}

.badge-primary { background: rgba(99, 102, 241, 0.2); color: var(--primary-light); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-played { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-new { background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3)); color: #a78bfa; }
.badge-replay { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-expired { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }
.badge-archived { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }
.badge-user { background: rgba(100, 116, 139, 0.15); color: var(--text-secondary); }
.badge-redacteur { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.badge-admin { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-super-admin { background: rgba(239, 68, 68, 0.2); color: var(--danger); }

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

.quiz-tile {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.quiz-tile:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.quiz-tile-image-wrapper {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.quiz-tile-image-wrapper img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.quiz-tile:hover .quiz-tile-image-wrapper img { transform: scale(1.05); }

.quiz-tile-image.placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.quiz-tile-badges {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.4rem;
    z-index: 5;
}

.quiz-tile-sound {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(0, 0, 0, 0.8);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
}

.quiz-tile-content { padding: 0.875rem; }
.quiz-tile-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.35rem; }
.quiz-tile-description { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.quiz-tile-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 0.75rem; color: var(--text-muted); }

.quiz-tile-active { border: 2px solid var(--warning); }

/* Quiz déjà joué */
.quiz-tile-played {
    position: relative;
}

.quiz-tile-played::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--success), #059669);
}

.quiz-tile-score-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 1.5rem 0.75rem 0.5rem;
}

.quiz-tile-score-overlay .best-score {
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.quiz-tile-history {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.quiz-tile-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.quiz-tile-actions .btn { flex: 1; min-height: 40px; }

/* Tables */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table th, .table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.table th { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); background: var(--bg-tertiary); }
.archived-row { opacity: 0.6; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
}

.stat-card-icon { font-size: 1.25rem; margin-bottom: 0.35rem; }
.stat-card-icon.primary { color: var(--primary); }
.stat-card-icon.success { color: var(--success); }
.stat-card-icon.warning { color: var(--warning); }
.stat-card-icon.info { color: var(--info); }

.stat-card-value, .stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-card-label, .stat-label { font-size: 0.65rem; text-transform: uppercase; color: var(--text-muted); }

/* Answer Rows */
.answer-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--radius);
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.answer-row.correct { border-color: var(--success); background: rgba(16, 185, 129, 0.1); }

.answer-letter {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
}

.answer-row.correct .answer-letter { background: linear-gradient(135deg, var(--success), #059669); }
.answer-input { flex: 1; min-width: 120px; }
.correct-radio { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; min-height: 44px; }
.correct-radio input[type="radio"] { width: 20px; height: 20px; accent-color: var(--success); }

/* File Upload */
.file-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
}

.file-upload-icon { font-size: 1.75rem; margin-bottom: 0.4rem; }
.file-upload-text { font-size: 0.8rem; color: var(--text-secondary); }

.file-selected-indicator { display: none; margin-top: 0.75rem; padding: 0.75rem; background: rgba(16, 185, 129, 0.1); border: 1px solid var(--success); border-radius: var(--radius); }
.file-selected-indicator.show { display: block; }
.file-selected-indicator img { max-width: 250px; max-height: 180px; margin: 0.75rem auto 0; object-fit: contain; }
.remove-file { width: 28px; height: 28px; background: var(--danger); color: white; border: none; border-radius: 50%; margin-left: auto; }

/* Quiz Game */
.quiz-game { max-width: 600px; margin: 0 auto; padding: 0.5rem 0 2rem; }
.quiz-game .card-body img:not(#explanationImage) { max-width: 350px; max-height: 220px; margin: 0 auto 1.25rem; object-fit: contain; }

.quiz-progress { margin-bottom: 1.25rem; }
.quiz-progress-bar { height: 5px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; margin-bottom: 0.6rem; }
.quiz-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); transition: width 0.3s; }
.quiz-progress-text { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-secondary); }

.quiz-timer {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.35rem;
    font-weight: 700;
    background: var(--bg-tertiary);
    border: 3px solid var(--border-light);
    border-radius: 50%;
}

.quiz-timer.warning { color: var(--warning); border-color: var(--warning); background: rgba(245, 158, 11, 0.1); }
.quiz-timer.danger { color: var(--danger); border-color: var(--danger); background: rgba(239, 68, 68, 0.1); animation: pulse 0.5s infinite alternate; }

@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.05); } }

.quiz-answer {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    text-align: left;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    min-height: 54px;
}

.quiz-answer.selected { border-color: var(--primary); background: rgba(99, 102, 241, 0.15); }
.quiz-answer.correct { border-color: var(--success) !important; background: rgba(16, 185, 129, 0.15) !important; }
.quiz-answer.incorrect { border-color: var(--danger) !important; background: rgba(239, 68, 68, 0.15) !important; }

.quiz-answer .letter {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
}

.quiz-answer.correct .letter { background: linear-gradient(135deg, var(--success), #059669); }
.quiz-answer.incorrect .letter { background: linear-gradient(135deg, var(--danger), #dc2626); }

.quiz-hint { padding: 0.65rem; background: rgba(245, 158, 11, 0.1); border-left: 3px solid var(--warning); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 0.85rem; }

.quiz-explanation { margin-top: 1.25rem; padding: 1rem; border-radius: var(--radius); animation: fadeIn 0.3s; }
.quiz-explanation.correct { background: rgba(16, 185, 129, 0.1); border: 1px solid var(--success); }
.quiz-explanation.incorrect { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--danger); }
.quiz-explanation img, #explanationImage { max-height: 300px; margin: 0.75rem auto 0; object-fit: contain; }

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

/* Leaderboard */
.quiz-selector { display: flex; flex-direction: column; gap: 0.5rem; padding: 1rem; }
@media (min-width: 480px) { .quiz-selector { flex-direction: row; align-items: center; } .quiz-selector .form-control { flex: 1; } }

.quiz-info-banner { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.25rem; text-align: center; }
.quiz-info-banner h2 { font-size: 1.25rem; margin-bottom: 0.35rem; }

.user-position-card { display: flex; align-items: center; justify-content: space-between; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border-radius: var(--radius-lg); padding: 1rem; margin-bottom: 1.25rem; color: white; }
.position-label { font-size: 0.8rem; opacity: 0.9; }
.position-value { font-size: 1.75rem; font-weight: 700; }

.podium { display: flex; justify-content: center; align-items: flex-end; gap: 0.5rem; padding: 1.5rem 0.5rem; }
.podium-place { display: flex; flex-direction: column; align-items: center; flex: 1; max-width: 110px; }
.podium-avatar { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; background: var(--bg-tertiary); border-radius: 50%; margin-bottom: 0.4rem; }
.podium-name { font-size: 0.8rem; font-weight: 600; text-align: center; }
.podium-score { font-size: 0.7rem; color: var(--text-secondary); margin-bottom: 0.4rem; }
.podium-block { width: 100%; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; font-weight: 700; border-radius: var(--radius) var(--radius) 0 0; }

.podium-place.first .podium-block { height: 70px; background: linear-gradient(180deg, #ffd700, #b8860b); color: #1a1a1a; }
.podium-place.first .podium-avatar { border: 2px solid #ffd700; }
.podium-place.second .podium-block { height: 52px; background: linear-gradient(180deg, #c0c0c0, #808080); color: #1a1a1a; }
.podium-place.second .podium-avatar { border: 2px solid #c0c0c0; }
.podium-place.third .podium-block { height: 40px; background: linear-gradient(180deg, #cd7f32, #8b4513); color: white; }
.podium-place.third .podium-avatar { border: 2px solid #cd7f32; }

.leaderboard-list { padding: 0.25rem; }
.leaderboard-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; border-radius: var(--radius); min-height: 56px; }
.leaderboard-item.highlight { background: rgba(99, 102, 241, 0.1); border: 1px solid var(--primary); }
.leaderboard-rank { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-weight: 700; border-radius: 50%; }
.leaderboard-rank.gold { background: linear-gradient(135deg, #ffd700, #b8860b); color: #1a1a1a; }
.leaderboard-rank.silver { background: linear-gradient(135deg, #c0c0c0, #808080); color: #1a1a1a; }
.leaderboard-rank.bronze { background: linear-gradient(135deg, #cd7f32, #8b4513); color: white; }
.leaderboard-rank.normal { background: var(--bg-tertiary); color: var(--text-secondary); }
.leaderboard-info { flex: 1; }
.leaderboard-name { font-weight: 600; font-size: 0.9rem; }
.leaderboard-score { font-weight: 700; color: var(--primary-light); }

/* Admin Layout */
.admin-layout { display: flex; flex-direction: column; min-height: calc(100vh - 56px); }
.admin-sidebar { background: var(--bg-secondary); border-bottom: 1px solid var(--border-color); padding: 0.5rem; overflow-x: auto; }
.admin-sidebar nav { display: flex; gap: 0.25rem; }
.admin-sidebar a { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.85rem; color: var(--text-secondary); border-radius: var(--radius); font-size: 0.85rem; font-weight: 500; white-space: nowrap; min-height: 44px; }
.admin-sidebar a.active { color: var(--text-primary); background: var(--bg-elevated); }
.admin-content { flex: 1; padding: 1rem; overflow-x: auto; }

@media (min-width: 768px) {
    .admin-layout { flex-direction: row; }
    .admin-sidebar { width: 200px; border-bottom: none; border-right: 1px solid var(--border-color); padding: 1rem 0.5rem; }
    .admin-sidebar nav { flex-direction: column; }
    .admin-content { padding: 1.5rem; }
}

/* =====================================================
   STATS PAGE - Enhanced Styles
   ===================================================== */

/* Stats Selector */
.stats-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 1.25rem;
}

.stats-selector-icon { font-size: 2rem; }
.stats-selector-content { flex: 1; }
.stats-selector-content label { display: block; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.4rem; }

/* Stats Header */
.stats-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 1.25rem;
}

.stats-header-info h2 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.stats-header-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.stats-header-actions { display: flex; gap: 0.5rem; }

/* Stats Cards - Large */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 640px) { .stats-cards { grid-template-columns: repeat(4, 1fr); } }

.stats-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.stats-card:hover { transform: translateY(-2px); border-color: var(--border-light); }
.stats-card.accent-primary { border-left: 3px solid var(--primary); }
.stats-card.accent-success { border-left: 3px solid var(--success); }

.stats-card-icon { font-size: 1.5rem; }
.stats-card-data { flex: 1; }
.stats-card-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stats-card-label { font-size: 0.7rem; text-transform: uppercase; color: var(--text-muted); }

/* Insights Row */
.insights-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 640px) { .insights-row { grid-template-columns: repeat(3, 1fr); } }

.insight-card {
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.insight-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.insight-icon { font-size: 1.25rem; }
.insight-icon.success { color: var(--success); }
.insight-icon.primary { color: var(--primary); }
.insight-icon.danger { color: var(--danger); }
.insight-title { font-size: 0.8rem; color: var(--text-secondary); }
.insight-value { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; }
.insight-desc { font-size: 0.75rem; color: var(--text-muted); line-height: 1.3; }

.insight-bar { height: 4px; background: var(--bg-tertiary); border-radius: 2px; overflow: hidden; margin-top: 0.5rem; }
.insight-bar-fill { height: 100%; background: var(--success); border-radius: 2px; transition: width 0.5s ease; }

/* Distribution Chart */
.distribution-chart { display: flex; flex-direction: column; gap: 0.6rem; }
.distribution-item { display: flex; align-items: center; gap: 0.75rem; }
.distribution-label { width: 100px; display: flex; flex-direction: column; }
.distribution-range { font-size: 0.85rem; font-weight: 600; }
.distribution-name { font-size: 0.7rem; color: var(--text-muted); }
.distribution-bar-wrap { flex: 1; height: 24px; background: var(--bg-tertiary); border-radius: var(--radius-sm); overflow: hidden; }
.distribution-bar { height: 100%; border-radius: var(--radius-sm); transition: width 0.5s ease; }
.distribution-bar.success { background: linear-gradient(90deg, var(--success), var(--success-light)); }
.distribution-bar.warning { background: linear-gradient(90deg, var(--warning), var(--warning-light)); }
.distribution-bar.danger { background: linear-gradient(90deg, var(--danger), var(--danger-light)); }
.distribution-count { width: 40px; text-align: right; font-weight: 600; font-size: 0.9rem; }

/* Tabs */
.tabs-wrapper { margin-bottom: 1rem; }
.tabs { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.25rem; }
.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.tab-btn:hover { border-color: var(--primary); color: var(--text-primary); }
.tab-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.tab-count { background: rgba(255,255,255,0.2); padding: 0.15rem 0.5rem; border-radius: 50px; font-size: 0.75rem; }
.tab-btn.active .tab-count { background: rgba(255,255,255,0.3); }

.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }

/* Players Grid */
.players-grid { display: flex; flex-direction: column; gap: 0.5rem; }

.player-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: var(--transition);
    flex-wrap: wrap;
}

.player-card:hover { border-color: var(--border-light); }
.player-card.archived { opacity: 0.6; }

.player-rank { width: 40px; text-align: center; flex-shrink: 0; }
.rank-medal { font-size: 1.5rem; }
.rank-num { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: var(--bg-tertiary); border-radius: 50%; font-size: 0.85rem; font-weight: 600; }
.rank-archived { font-size: 1.25rem; opacity: 0.5; }

.player-main { flex: 1; min-width: 150px; }
.player-name { font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.player-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }

.player-score { text-align: center; min-width: 60px; }
.player-score-value { font-size: 1.25rem; font-weight: 700; color: var(--primary-light); }
.player-score-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; }

.player-rate { text-align: center; min-width: 50px; }
.player-rate-value { font-size: 1rem; font-weight: 700; }
.player-rate-value.success { color: var(--success); }
.player-rate-value.warning { color: var(--warning); }
.player-rate-value.danger { color: var(--danger); }
.player-rate-label { font-size: 0.65rem; color: var(--text-muted); }

.player-action { flex-shrink: 0; }

/* Questions Grid */
.questions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 768px) { .questions-grid { grid-template-columns: repeat(2, 1fr); } }

.question-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    transition: var(--transition);
}

.question-card:hover { border-color: var(--border-light); }

.question-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.question-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 50%;
}

.question-answer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--success);
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    border-radius: 50%;
}

.question-points {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.question-text {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.question-progress { margin-bottom: 0.75rem; }
.question-progress-bar { height: 6px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; margin-bottom: 0.35rem; }
.question-progress-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.question-progress-fill.success { background: var(--success); }
.question-progress-fill.warning { background: var(--warning); }
.question-progress-fill.danger { background: var(--danger); }
.question-progress-info { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); }
.question-progress-info .success { color: var(--success); font-weight: 600; }
.question-progress-info .warning { color: var(--warning); font-weight: 600; }
.question-progress-info .danger { color: var(--danger); font-weight: 600; }

.question-metrics { display: flex; justify-content: space-around; padding-top: 0.75rem; border-top: 1px solid var(--border-color); }
.qmetric { display: flex; align-items: center; gap: 0.25rem; font-size: 0.8rem; color: var(--text-secondary); }
.qmetric-icon { font-size: 0.9rem; }
.qmetric-value { font-weight: 600; }

/* Empty State Large */
.empty-state-large {
    text-align: center;
    padding: 4rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.empty-state-large .empty-state-icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state-large h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.empty-state-large p { color: var(--text-muted); }

/* =====================================================
   ADMIN QUIZ EDITOR - Professional Interface
   ===================================================== */

/* Quiz Admin Grid */
.quiz-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.quiz-admin-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

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

.quiz-admin-card.inactive {
    opacity: 0.7;
}

.quiz-admin-image {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.quiz-admin-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.quiz-admin-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.quiz-admin-badges {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.35rem;
}

.quiz-admin-body {
    padding: 1rem;
}

.quiz-admin-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
}

.quiz-admin-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
}

.quiz-admin-stat {
    display: flex;
    flex-direction: column;
}

.quiz-admin-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-light);
}

.quiz-admin-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.quiz-admin-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.quiz-admin-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

.quiz-admin-actions .btn { flex: 1; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    z-index: 1;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.1rem;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

/* Quiz Editor Layout */
.quiz-editor {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 900px) {
    .quiz-editor {
        grid-template-columns: 1fr;
    }
}

.quiz-editor-sidebar .card {
    position: sticky;
    top: 70px;
}

/* Toggle Switch */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 500;
}

.toggle-label input {
    display: none;
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    position: relative;
    transition: var(--transition);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-label input:checked + .toggle-switch {
    background: var(--success);
}

.toggle-label input:checked + .toggle-switch::after {
    transform: translateX(20px);
    background: white;
}

/* Current Media Preview */
.current-media {
    margin-bottom: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.current-media img {
    max-width: 100%;
    max-height: 150px;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.current-media audio {
    width: 100%;
    margin-bottom: 0.5rem;
}

.remove-media {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--danger);
    cursor: pointer;
}

.remove-media input {
    accent-color: var(--danger);
}

/* Answers Editor */
.answers-editor {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.answer-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--radius);
    transition: var(--transition);
}

.answer-row.correct {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.answer-letter {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    flex-shrink: 0;
}

.answer-row.correct .answer-letter {
    background: linear-gradient(135deg, var(--success), #059669);
}

.answer-row .form-control {
    flex: 1;
    min-width: 0;
}

.correct-radio {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: var(--transition);
}

.correct-radio:hover {
    background: var(--bg-hover);
    color: var(--success);
}

.correct-radio input {
    display: none;
}

.correct-radio span {
    font-size: 1.25rem;
    opacity: 0.3;
}

.correct-radio input:checked + span {
    opacity: 1;
    color: var(--success);
}

/* Add Question Panel */
.add-question-panel {
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.add-question-panel.hidden {
    display: none;
}

.form-details {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius);
}

.form-details summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-details[open] summary {
    margin-bottom: 0.75rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Questions List */
.questions-list {
    display: flex;
    flex-direction: column;
}

.question-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: grab;
}

.question-item:hover {
    background: var(--bg-hover);
}

.question-item.dragging {
    opacity: 0.5;
    background: var(--bg-tertiary);
}

.question-drag {
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: grab;
    padding: 0.25rem;
}

.question-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.question-content {
    flex: 1;
    min-width: 0;
}

.question-text {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.question-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    align-items: center;
}

.question-answer {
    color: var(--success);
    font-weight: 600;
}

.correct-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.question-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

/* Hints */
.hints-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.hint-text {
    flex: 1;
    font-size: 0.9rem;
}

.hint-penalty {
    font-size: 0.8rem;
    color: var(--danger);
    font-weight: 600;
}

.hint-form-row {
    display: flex;
    gap: 0.5rem;
}

.hint-form-row .form-control:first-child {
    flex: 1;
}

/* =====================================================
   USER PROFILE PAGE
   ===================================================== */

.profile-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--neon-gradient);
    border-radius: 50%;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.profile-info h1 {
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.profile-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}

.profile-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

.profile-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.profile-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.profile-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.profile-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.profile-tab.active {
    background: var(--primary);
    color: white;
}

.profile-content .card {
    margin-bottom: 1rem;
}

.card-danger {
    border-color: var(--danger);
}

.card-danger .card-header {
    background: rgba(239, 68, 68, 0.1);
    border-bottom-color: var(--danger);
}

/* Adult Toggle */
.adult-toggle {
    padding: 0.75rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius);
}

/* Adult Badge */
.badge-adult {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: white !important;
}

.badge-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: white !important;
}

/* Archived row styling */
.archived-row {
    opacity: 0.6;
}

.archived-row td {
    color: var(--text-muted);
}

.score-badge.archived {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.result-percent {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Top100 Quiz Badge */
.top100-quiz-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    border-radius: var(--radius-sm);
}

/* Hidden Adult Section (Konami Code) */
.adult-hidden-section {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.1) 0%, transparent 100%);
    border-top: 2px solid var(--danger);
    padding: 2rem 0;
    margin-top: 2rem;
    animation: adultReveal 0.5s ease-out;
}

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

.adult-hidden-section .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.adult-quiz {
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.adult-quiz:hover {
    border-color: var(--danger);
}

/* Page Header Actions */
.page-header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* My Results */
.progress-bar-mini { height: 4px; background: var(--bg-tertiary); border-radius: 2px; margin-top: 0.2rem; }
.progress-bar-mini .progress-bar-fill { height: 100%; background: var(--success); border-radius: 2px; }
.score-badge { display: inline-block; padding: 0.2rem 0.5rem; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border-radius: 50px; font-weight: 600; font-size: 0.8rem; }

/* =====================================================
   TOP 100 PAGE
   ===================================================== */

/* Top 100 Tabs */
.top100-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.top100-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    transition: var(--transition);
    text-decoration: none;
}

.top100-tab:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.top100-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: transparent;
    color: white;
}

.top100-tab-icon { font-size: 1.25rem; }

@media (max-width: 480px) {
    .top100-tab { padding: 0.75rem 1rem; font-size: 0.85rem; }
    .top100-tab-text { display: none; }
    .top100-tab-icon { font-size: 1.5rem; }
}

/* Top 100 List */
.top100-list {
    display: flex;
    flex-direction: column;
}

.top100-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.top100-item:last-child { border-bottom: none; }
.top100-item:hover { background: var(--bg-hover); }

.top100-item.highlight {
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid var(--primary);
    margin-left: -3px;
}

/* Rank */
.top100-rank {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    background: var(--bg-tertiary);
    border-radius: 50%;
    flex-shrink: 0;
}

.top100-rank.gold {
    background: linear-gradient(135deg, #ffd700, #b8860b);
    color: #1a1a1a;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.top100-rank.silver {
    background: linear-gradient(135deg, #c0c0c0, #808080);
    color: #1a1a1a;
    font-size: 1.25rem;
}

.top100-rank.bronze {
    background: linear-gradient(135deg, #cd7f32, #8b4513);
    color: white;
    font-size: 1.25rem;
}

/* Player Info */
.top100-player {
    flex: 1;
    min-width: 0;
}

.top100-name {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.top100-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Score */
.top100-score {
    text-align: right;
    flex-shrink: 0;
}

.top100-score-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-light);
    line-height: 1.2;
}

.top100-score-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Podium enhancements for Top 100 */
.podium-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

/* Responsive */
@media (max-width: 480px) {
    .top100-item { padding: 0.75rem; }
    .top100-rank { width: 36px; height: 36px; font-size: 0.85rem; }
    .top100-name { font-size: 0.9rem; }
    .top100-score-value { font-size: 1.1rem; }
}

/* Top 100 Quiz Grid (Tiles) */
.top100-quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

@media (max-width: 640px) {
    .top100-quiz-grid {
        grid-template-columns: 1fr;
    }
}

.top100-quiz-tile {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.top100-quiz-tile:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 24px var(--primary-glow);
}

.top100-quiz-tile:hover .top100-quiz-overlay {
    opacity: 1;
}

.top100-quiz-tile:hover .top100-quiz-image img {
    transform: scale(1.05);
}

/* Quiz Image */
.top100-quiz-image {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-elevated));
    overflow: hidden;
}

.top100-quiz-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.top100-quiz-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.top100-quiz-overlay {
    position: absolute;
    inset: 0;
    background: rgba(99, 102, 241, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.top100-quiz-cta {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius);
    backdrop-filter: blur(4px);
}

/* Quiz Content */
.top100-quiz-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.top100-quiz-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}

/* Quiz Stats */
.top100-quiz-stats {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.top100-quiz-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.top100-quiz-stat-icon {
    font-size: 1rem;
    margin-bottom: 0.15rem;
}

.top100-quiz-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.top100-quiz-stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Quiz Leader */
.top100-quiz-leader {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.05));
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: var(--radius);
}

.top100-quiz-leader-icon {
    font-size: 1.25rem;
}

.top100-quiz-leader-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
}

.top100-quiz-leader-score {
    font-weight: 700;
    color: #ffd700;
    font-size: 0.9rem;
}

.top100-quiz-leader.empty {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Auth */
.auth-container { min-height: calc(100vh - 56px); display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 380px; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-xl); padding: 1.5rem; }
.auth-title { font-size: 1.35rem; font-weight: 700; text-align: center; margin-bottom: 1.25rem; }
.auth-footer { text-align: center; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border-color); font-size: 0.85rem; color: var(--text-secondary); }

/* Alerts */
.alert { padding: 0.85rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.85rem; }
.alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid var(--success); color: var(--success); }
.alert-warning { background: rgba(245, 158, 11, 0.1); border: 1px solid var(--warning); color: var(--warning); }
.alert-danger { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--danger); color: var(--danger); }

/* Empty State */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state p { margin-bottom: 1rem; }

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.success { color: var(--success); }
.warning { color: var(--warning); }
.danger { color: var(--danger); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.py-4 { padding-top: 2rem; padding-bottom: 2rem; }
.hidden { display: none !important; }

/* =====================================================
   ANIMATIONS & TRANSITIONS
   ===================================================== */

/* Confetti Container */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    animation: confetti-fall 3s ease-out forwards;
}

.confetti.square { border-radius: 0; }
.confetti.circle { border-radius: 50%; }
.confetti.triangle {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 10px solid currentColor;
    background: transparent !important;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(-100px) rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg) scale(0.5);
    }
}

/* Score Animation */
.score-animate {
    display: inline-block;
    animation: score-pop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes score-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); color: var(--success); }
    100% { transform: scale(1); }
}

.score-counting {
    transition: all 0.1s ease-out;
}

/* Points earned floating animation */
.points-float {
    position: absolute;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
    text-shadow: 0 2px 10px rgba(16, 185, 129, 0.5);
    animation: float-up 1.5s ease-out forwards;
    pointer-events: none;
    z-index: 100;
}

.points-float.wrong {
    color: var(--danger);
    text-shadow: 0 2px 10px rgba(239, 68, 68, 0.5);
}

@keyframes float-up {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-80px) scale(1.2);
    }
}

/* Card Flip Effect */
.quiz-tile-flip {
    perspective: 1000px;
}

.quiz-tile-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.quiz-tile-flip:hover .quiz-tile-flip-inner {
    transform: rotateY(10deg) scale(1.02);
}

.quiz-tile-flip.flipped .quiz-tile-flip-inner {
    transform: rotateY(180deg);
}

.quiz-tile-front,
.quiz-tile-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-lg);
}

.quiz-tile-back {
    transform: rotateY(180deg);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Question Transitions */
.question-container {
    animation: question-enter 0.4s ease-out;
}

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

.question-exit {
    animation: question-exit 0.3s ease-in forwards;
}

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

/* Answer button animations */
.quiz-answer {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.quiz-answer:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.quiz-answer:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.quiz-answer.correct {
    animation: correct-answer 0.5s ease-out;
}

@keyframes correct-answer {
    0% { transform: scale(1); }
    25% { transform: scale(1.05); background: rgba(16, 185, 129, 0.3); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.quiz-answer.incorrect {
    animation: incorrect-answer 0.5s ease-out;
}

@keyframes incorrect-answer {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Quiz tile hover effects */
.quiz-tile {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.quiz-tile:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 
                0 0 30px rgba(99, 102, 241, 0.15);
}

.quiz-tile:hover .quiz-tile-image-wrapper img {
    transform: scale(1.1);
}

.quiz-tile-image-wrapper {
    overflow: hidden;
}

.quiz-tile-image-wrapper img {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* New record celebration */
.new-record {
    position: relative;
}

.new-record::before {
    content: '🎉 NOUVEAU RECORD !';
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--warning), #f97316);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.9rem;
    animation: record-bounce 1s ease-in-out infinite;
    white-space: nowrap;
}

@keyframes record-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

/* Pulse animation for important elements */
.pulse {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.8),
                    0 0 40px rgba(99, 102, 241, 0.4);
    }
}

/* Shimmer loading effect */
.shimmer {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 0%,
        var(--bg-hover) 50%,
        var(--bg-tertiary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Staggered fade in for lists */
.stagger-in > * {
    opacity: 0;
    animation: stagger-fade-in 0.4s ease-out forwards;
}

.stagger-in > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-in > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-in > *:nth-child(8) { animation-delay: 0.4s; }

@keyframes stagger-fade-in {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Timer pulse when low */
.timer-critical {
    animation: timer-pulse 0.5s ease-in-out infinite;
    color: var(--danger) !important;
}

@keyframes timer-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* Success checkmark animation */
.checkmark-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    animation: checkmark-pop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.checkmark-circle::after {
    content: '✓';
    font-size: 2.5rem;
    color: white;
}

@keyframes checkmark-pop {
    0% { transform: scale(0); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Streak fire animation */
.streak-fire {
    display: inline-block;
    animation: fire-flicker 0.3s ease-in-out infinite alternate;
}

@keyframes fire-flicker {
    0% { transform: scale(1) rotate(-3deg); }
    100% { transform: scale(1.1) rotate(3deg); }
}

/* Button ripple effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Slide up modal */
.modal-slide-up {
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-slide-up.show {
    transform: translateY(0);
}

/* Badge unlock animation */
.badge-unlock {
    animation: badge-unlock 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes badge-unlock {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.3) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Glowing border for active elements */
.glow-border {
    position: relative;
}

.glow-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--primary), var(--success), var(--warning), var(--primary));
    background-size: 400% 400%;
    border-radius: inherit;
    z-index: -1;
    animation: glow-rotate 3s linear infinite;
    opacity: 0.7;
}

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

/* Number counter animation */
.counter {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}
