/* QUIMI - Plataforma Educativa de Quizzes */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;

    --purple: #8b5cf6;
    --blue: #3b82f6;
    --orange: #f97316;
    --green: #10b981;

    --radius: 12px;
    --radius-lg: 20px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.bg-pattern {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(99,102,241,0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139,92,246,0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(245,158,11,0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.main-content { flex: 1; position: relative; z-index: 1; }

/* --- NAVBAR --- */
.navbar {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 1.25rem;
}

.nav-logo { width: 36px; height: 36px; border-radius: 8px; }

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: color var(--transition);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
}

.nav-link:hover { color: var(--primary); }
.nav-link-cta { color: var(--primary); font-weight: 600; }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9375rem;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-color: transparent;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99,102,241,0.35);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1.0625rem; }
.btn-block { width: 100%; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-loader {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.pulse { animation: pulse 2s infinite; }

/* --- HERO --- */
.hero {
    padding: 4rem 0 5rem;
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.hero-badge {
    display: inline-block;
    background: rgba(99,102,241,0.1);
    color: var(--primary);
    padding: 0.375rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.15;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.hero-description {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 480px;
}

.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Quiz Preview */
.quiz-preview {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.preview-header {
    background: #f1f5f9;
    padding: 0.75rem 1rem;
    display: flex;
    gap: 6px;
}

.preview-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #cbd5e1;
}
.preview-dot:first-child { background: #ef4444; }
.preview-dot:nth-child(2) { background: #f59e0b; }
.preview-dot:nth-child(3) { background: #10b981; }

.preview-body { padding: 1.5rem; }

.preview-level {
    font-size: 0.8125rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.preview-question {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.preview-options { display: flex; flex-direction: column; gap: 0.5rem; }

.preview-option {
    padding: 0.625rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: var(--transition);
}

.preview-option.active {
    border-color: var(--primary);
    background: rgba(99,102,241,0.08);
    color: var(--primary);
}

.preview-timer {
    margin-top: 1rem;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px;
    transition: width 1s linear;
}

/* --- SECTIONS --- */
.section-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

.categories-section, .features-section {
    padding: 4rem 0;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    border: 1px solid var(--border);
    transition: all var(--transition);
    box-shadow: var(--shadow);
}

.category-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.category-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.category-card h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.category-card p { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.25rem; }

.card-purple { border-top: 4px solid var(--purple); }
.card-blue { border-top: 4px solid var(--blue); }
.card-orange { border-top: 4px solid var(--orange); }
.card-green { border-top: 4px solid var(--green); }

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.75rem;
    border: 1px solid var(--border);
    text-align: center;
}

.feature-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.feature-card h3 { margin-bottom: 0.5rem; font-size: 1.0625rem; }
.feature-card p { color: var(--text-muted); font-size: 0.875rem; }

/* --- AUTH --- */
.auth-section {
    padding: 3rem 0;
    display: flex;
    align-items: center;
    min-height: calc(100vh - 200px);
}

.auth-card {
    max-width: 440px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-header h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.auth-header p { color: var(--text-muted); }

.auth-form { display: flex; flex-direction: column; gap: 1.25rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; color: var(--text-muted); font-size: 0.875rem; }
.auth-footer a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* --- FORMS --- */
.form-group { display: flex; flex-direction: column; gap: 0.375rem; }
.form-group label { font-weight: 600; font-size: 0.875rem; color: var(--text); }

.form-group input,
.form-group textarea,
.form-group select,
.form-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9375rem;
    transition: border-color var(--transition);
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.form-message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
}
.form-message.error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.form-message.success { background: #ecfdf5; color: var(--success); border: 1px solid #a7f3d0; }

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* --- DASHBOARD --- */
.dashboard-section { padding: 2.5rem 0 4rem; }

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.user-welcome { display: flex; align-items: center; gap: 1rem; }
.user-avatar {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.stat-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.8125rem; color: var(--text-muted); font-weight: 500; }

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.dashboard-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.dashboard-card h2 { font-size: 1.25rem; margin-bottom: 1.25rem; }

.games-list { display: flex; flex-direction: column; gap: 0.75rem; max-height: 500px; overflow-y: auto; }

.game-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.game-item:hover { border-color: var(--primary); background: rgba(99,102,241,0.04); }

.game-item-info h4 { font-size: 0.9375rem; margin-bottom: 0.25rem; }
.game-item-info span { font-size: 0.8125rem; color: var(--text-muted); }

.grade-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.875rem;
}
.grade-high { background: #ecfdf5; color: var(--success); }
.grade-mid { background: #fffbeb; color: var(--warning); }
.grade-low { background: #fef2f2; color: var(--danger); }

.quick-play-grid { display: flex; flex-direction: column; gap: 0.75rem; }

.quick-play-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: var(--transition);
}

.quick-play-item:hover { border-color: var(--primary); background: rgba(99,102,241,0.04); }
.qp-icon { font-size: 1.25rem; }

/* --- QUIZ --- */
.quiz-page .main-content { padding: 0; }
.quiz-page .footer { display: none; }

.quiz-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.quiz-screen { width: 100%; max-width: 900px; }

.quiz-select-content { text-align: center; }
.quiz-select-content h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.quiz-select-content p { color: var(--text-muted); margin-bottom: 2rem; }

.quiz-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.quiz-cat-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
}

.quiz-cat-btn:hover { border-color: var(--primary); transform: translateY(-3px); }
.quiz-cat-btn.selected {
    border-color: var(--primary);
    background: rgba(99,102,241,0.08);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.cat-icon { font-size: 2rem; }

.quiz-game-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    position: relative;
}

.quiz-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.quiz-info { display: flex; gap: 1rem; align-items: center; }
.quiz-category-label {
    background: rgba(99,102,241,0.1);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8125rem;
    font-weight: 600;
}
.quiz-progress-label { font-weight: 600; color: var(--text-muted); }

.quiz-controls { display: flex; gap: 0.5rem; align-items: center; }

.music-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: white;
    cursor: pointer;
    font-size: 1.125rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.music-btn:hover { border-color: var(--primary); }
.music-btn.playing { border-color: var(--primary); background: rgba(99,102,241,0.1); }

.quiz-level-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius);
}

.level-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.9375rem;
}

.timer-container { position: relative; }

.timer-circle {
    width: 70px; height: 70px;
    position: relative;
}

.timer-circle svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.timer-bg { fill: none; stroke: var(--border); stroke-width: 6; }
.timer-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.timer-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
}

.timer-circle.warning .timer-progress { stroke: var(--warning); }
.timer-circle.danger .timer-progress { stroke: var(--danger); }

.score-display { text-align: center; }
.score-label { display: block; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.score-value { font-size: 1.75rem; font-weight: 800; color: var(--success); }

.question-area { margin-bottom: 1.5rem; }

.question-number {
    font-size: 0.8125rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.question-text {
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 1.5rem;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.option-btn {
    padding: 1rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    text-align: left;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.option-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: rgba(99,102,241,0.04);
    transform: translateY(-2px);
}

.option-btn:disabled { cursor: default; }

.option-letter {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8125rem;
    flex-shrink: 0;
}

.option-btn.selected { border-color: var(--primary); background: rgba(99,102,241,0.1); }
.option-btn.correct { border-color: var(--success); background: #ecfdf5; }
.option-btn.correct .option-letter { background: var(--success); color: white; }
.option-btn.incorrect { border-color: var(--danger); background: #fef2f2; }
.option-btn.incorrect .option-letter { background: var(--danger); color: white; }

.option-btn.correct-reveal { border-color: #2563eb; background: #eff6ff; }
.option-btn.correct-reveal .option-letter { background: #2563eb; color: white; }

.correct-answer-hint {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: #eff6ff;
    border: 2px solid #2563eb;
    color: #1e40af;
    font-size: 0.95rem;
}

.correct-answer-hint strong { color: #1d4ed8; }

/* Level Ladder */
.level-ladder {
    position: absolute;
    right: -80px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ladder-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    background: #f1f5f9;
    color: var(--text-muted);
    transition: var(--transition);
    white-space: nowrap;
}

.ladder-step.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: 700;
    transform: scale(1.05);
}

.ladder-step.completed { background: #ecfdf5; color: var(--success); }
.ladder-num { font-weight: 800; width: 16px; }

/* Results */
.results-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.results-header { margin-bottom: 2rem; }
.results-trophy { font-size: 4rem; margin-bottom: 0.5rem; }
.results-header h1 { font-size: 1.75rem; }

.results-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
    text-align: left;
}

.result-item {
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius);
}

.result-item label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; display: block; margin-bottom: 0.25rem; }
.result-item span { font-size: 1.125rem; font-weight: 700; }

.result-grade {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.08));
    border-radius: var(--radius);
}

.result-grade .grade-value {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.answers-breakdown {
    text-align: left;
    margin-bottom: 2rem;
    max-height: 300px;
    overflow-y: auto;
}

.answer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.answer-item.correct-answer { color: var(--success); }
.answer-item.wrong-answer { color: var(--danger); }

.results-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.quiz-copyright {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 1.5rem;
    opacity: 0.8;
}

/* Feedback overlay */
.feedback-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.3s;
}

.feedback-content {
    font-size: 4rem;
    animation: bounceIn 0.5s;
}

.feedback-overlay-light {
    background: rgba(0, 0, 0, 0.2);
    align-items: flex-start;
    padding-top: 2rem;
}

.feedback-overlay-light .feedback-content {
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.feedback-correct-hint {
    font-size: 1rem;
    margin-top: 0.5rem;
    color: #1d4ed8;
}

/* --- ADMIN --- */
.admin-section { padding: 2rem 0 4rem; }

.admin-header { margin-bottom: 2rem; }
.admin-header h1 { font-size: 2rem; }
.admin-header p { color: var(--text-muted); }

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.admin-stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.admin-stat-icon { font-size: 1.5rem; display: block; margin-bottom: 0.5rem; }
.admin-stat-value { font-size: 2rem; font-weight: 800; color: var(--primary); display: block; }
.admin-stat-label { font-size: 0.8125rem; color: var(--text-muted); }

.admin-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.admin-nav-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--border);
    transition: all var(--transition);
    box-shadow: var(--shadow);
}

.admin-nav-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.admin-nav-icon { font-size: 2rem; display: block; margin-bottom: 0.75rem; }
.admin-nav-card h3 { margin-bottom: 0.375rem; }
.admin-nav-card p { color: var(--text-muted); font-size: 0.875rem; }

.admin-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.5rem;
}
.back-link:hover { color: var(--primary); }

.admin-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.admin-filters {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.admin-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table tr:hover { background: rgba(99,102,241,0.03); }

.table-responsive { overflow-x: auto; }

.role-badge {
    padding: 0.25rem 0.625rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}
.role-admin { background: #fef3c7; color: #d97706; }
.role-user { background: #f1f5f9; color: var(--text-muted); }

.action-btns { display: flex; gap: 0.5rem; }

.questions-list { display: flex; flex-direction: column; gap: 0.75rem; }

.question-admin-item {
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.question-admin-item h4 { font-size: 0.9375rem; margin-bottom: 0.375rem; }
.question-admin-meta { font-size: 0.8125rem; color: var(--text-muted); }

.options-inputs { display: flex; flex-direction: column; gap: 0.5rem; }

.option-input-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.option-input-row input[type="text"] {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
}

.admin-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.5rem;
}

.admin-settings-grid h2 { font-size: 1.125rem; margin-bottom: 1.25rem; }

.level-times-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.level-time-item label {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.level-time-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.level-time-input input {
    width: 100%;
    max-width: 90px;
}

.level-time-input span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.logo-preview {
    text-align: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius);
}

.logo-preview img { max-width: 120px; max-height: 120px; }

/* --- MODAL --- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.3s;
}

.modal-lg { max-width: 640px; }

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

/* --- FOOTER --- */
.footer {
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 1;
}

.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* --- ANIMATIONS --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.4); }
    50% { box-shadow: 0 0 0 12px rgba(99,102,241,0); }
}
@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.animate-fade-up {
    animation: fadeInUp 0.6s ease-out both;
}
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
    .level-ladder { display: none; }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .hero .container { grid-template-columns: 1fr; }
    .hero-title { font-size: 2.25rem; }
    .hero-visual { order: -1; }

    .nav-toggle { display: flex; }
    .nav-menu {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
    }
    .nav-menu.open { display: flex; }

    .options-grid { grid-template-columns: 1fr; }
    .results-info { grid-template-columns: 1fr; }
    .quiz-level-bar { flex-wrap: wrap; gap: 1rem; justify-content: center; }

    .admin-page-header { flex-direction: column; }
}

@media (max-width: 480px) {
    .hero { padding: 2rem 0 3rem; }
    .auth-card { padding: 1.75rem; }
    .quiz-game-wrapper { padding: 1rem; }
    .question-text { font-size: 1.125rem; }
}

/* --- NUEVAS MEJORAS --- */
.card-red { border-top: 4px solid #ef4444; }

.confetti-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 500;
}

.correct-glow {
    animation: correctGlow 0.6s ease-out;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.4), 0 0 60px rgba(99, 102, 241, 0.2);
}

.wrong-shake {
    animation: wrongShake 0.4s ease-out;
}

@keyframes correctGlow {
    0% { box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
    50% { box-shadow: 0 0 40px rgba(16, 185, 129, 0.5); }
    100% { box-shadow: var(--shadow-lg); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.feedback-correct {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--success);
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    animation: bounceIn 0.5s;
}

.feedback-wrong {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--danger);
    animation: bounceIn 0.5s;
}

.volume-slider {
    width: 80px;
    accent-color: var(--primary);
    cursor: pointer;
}

.ladder-step.level-up { animation: levelUp 0.5s; }
.ladder-step.level-down { animation: levelDown 0.5s; }

@keyframes levelUp {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); background: #ecfdf5; }
    100% { transform: scale(1.05); }
}

@keyframes levelDown {
    0% { transform: scale(1); }
    50% { transform: scale(0.9); background: #fef2f2; }
    100% { transform: scale(1); }
}

/* Level progress */
.level-progress-card {
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.08));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.level-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.level-progress-header h2 { font-size: 1.125rem; }

.level-badge-lg {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 0.375rem 1rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.875rem;
}

.level-progress-bar-wrap {
    height: 10px;
    background: var(--border);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.level-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 5px;
    transition: width 0.6s ease;
}

.level-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 600;
}

.header-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.sidebar-cards { display: flex; flex-direction: column; gap: 1.5rem; }
.input-disabled { background: #f1f5f9; color: var(--text-muted); cursor: not-allowed; }

/* Ranking */
.ranking-section { padding: 2.5rem 0 4rem; }

.ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.ranking-title-wrap { display: flex; align-items: center; gap: 1rem; }
.ranking-trophy { font-size: 3rem; }
.ranking-controls { display: flex; align-items: center; gap: 0.75rem; }

.my-rank-card {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 1.0625rem;
}

.ranking-table-wrap {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
}

.ranking-table th,
.ranking-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.ranking-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.ranking-row-me { background: rgba(99, 102, 241, 0.06); }
.rank-position { font-weight: 800; font-size: 1rem; width: 50px; }
.level-badge-sm {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding: 0.2rem 0.5rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Groups admin */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.group-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.group-toggle:has(input:checked) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.06);
}

.group-toggle input { accent-color: var(--primary); }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.question-text strong { color: var(--primary); }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.card-teal { border-top: 4px solid #14b8a6; }

.open-answer-wrap { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 0.75rem; }
.options-grid.open-mode { grid-template-columns: 1fr; }

.open-answer-input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1.125rem;
    transition: border-color var(--transition);
}

.open-answer-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.type-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}
.type-badge.choice { background: #ede9fe; color: var(--primary); }
.type-badge.open { background: #fef3c7; color: #d97706; }

.question-admin-top { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.25rem; }
.q-id { font-size: 0.7rem; color: var(--text-muted); }

@media (max-width: 768px) {
    .form-row-2 { grid-template-columns: 1fr; }
}

/* === GAMIFICACIÓN === */
.nav-gami {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.35rem 0.75rem;
    background: rgba(99,102,241,0.08);
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}
.nav-gami-item { white-space: nowrap; }

.profile-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.profile-hero-left { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.profile-avatar-wrap { text-align: center; }
.profile-avatar {
    width: 88px; height: 88px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    border: 3px solid white;
    box-shadow: var(--shadow-md);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-hero-info h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.profile-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.gami-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}
.coins-badge { background: #fef3c7; color: #b45309; }
.streak-badge { background: #ffedd5; color: #c2410c; }

.gami-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.gami-stat-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: transform var(--transition), box-shadow var(--transition);
}
.gami-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.gami-stat-card.streak-card { background: linear-gradient(135deg, #fff7ed, #ffedd5); }
.gami-stat-card.highlight-card { background: linear-gradient(135deg, #eff6ff, #dbeafe); }
.gami-stat-icon { font-size: 1.75rem; }
.gami-stat-value { font-size: 1.35rem; font-weight: 700; }
.gami-stat-label { font-size: 0.75rem; color: var(--text-muted); }

.category-chart { display: flex; flex-direction: column; gap: 0.75rem; }
.chart-row { display: grid; grid-template-columns: 120px 1fr 50px; gap: 0.75rem; align-items: center; }
.chart-label { font-size: 0.85rem; font-weight: 500; }
.chart-bar-wrap { height: 10px; background: #f1f5f9; border-radius: 50px; overflow: hidden; }
.chart-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #818cf8);
    border-radius: 50px;
    transition: width 0.8s ease-out;
}
.chart-value { font-size: 0.8rem; font-weight: 700; color: var(--primary); text-align: right; }

.inventory-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.inventory-item {
    text-align: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.inventory-item span { font-size: 2rem; display: block; margin-bottom: 0.25rem; }
.inventory-item strong { font-size: 1.5rem; display: block; }
.inventory-item small { color: var(--text-muted); }

.avatar-purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.avatar-blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.avatar-orange { background: linear-gradient(135deg, #f97316, #ea580c); }
.avatar-gold { background: linear-gradient(135deg, #fbbf24, #d97706); }
.avatar-red { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.avatar-teal { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.avatar-indigo { background: linear-gradient(135deg, #6366f1, #4338ca); }
.avatar-pink { background: linear-gradient(135deg, #ec4899, #be185d); }
.avatar-yellow { background: linear-gradient(135deg, #eab308, #ca8a04); }
.avatar-green { background: linear-gradient(135deg, #22c55e, #15803d); }
.avatar-cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.avatar-violet { background: linear-gradient(135deg, #a855f7, #7c3aed); }

.avatar-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.5rem; }
.avatar-pick-btn {
    width: 48px; height: 48px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex; align-items: center; justify-content: center;
    transition: transform var(--transition), border-color var(--transition);
}
.avatar-pick-btn:hover { transform: scale(1.1); }
.avatar-pick-btn.selected { border-color: var(--primary); box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary); }

/* Tienda */
.shop-section { padding: 2rem 0 4rem; }
.shop-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.shop-balance-card {
    text-align: center;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: var(--radius-lg);
    border: 2px solid #fbbf24;
}
.shop-balance-card strong { display: block; font-size: 2rem; color: #b45309; }
.shop-inventory-bar {
    display: flex; gap: 2rem;
    padding: 0.75rem 1.25rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.shop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; }
.shop-item-card {
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-align: center;
    transition: transform var(--transition), box-shadow var(--transition);
}
.shop-item-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.shop-item-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.shop-item-price { font-size: 1.25rem; font-weight: 700; color: #b45309; margin: 1rem 0; }
.shop-info { margin-top: 2rem; padding: 1.25rem; background: #f0fdf4; border-radius: var(--radius); border: 1px solid #86efac; }

/* Ranking mejorado */
.ranking-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1rem;
    margin: 2rem 0;
    min-height: 220px;
}
.podium-place {
    text-align: center;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    min-width: 140px;
    transition: transform var(--transition);
}
.podium-place:hover { transform: translateY(-6px); }
.podium-1 { order: 2; padding-bottom: 2rem; background: linear-gradient(180deg, #fffbeb, var(--surface)); border-color: #fbbf24; }
.podium-2 { order: 1; padding-bottom: 1.25rem; }
.podium-3 { order: 3; padding-bottom: 0.75rem; }
.podium-medal { font-size: 2rem; }
.podium-level { display: block; font-size: 0.8rem; color: var(--text-muted); }
.podium-score { font-weight: 700; color: var(--primary); }

.rank-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    overflow: hidden;
}
.rank-avatar.lg { width: 64px; height: 64px; font-size: 1.75rem; }
.rank-avatar.md { width: 48px; height: 48px; }
.rank-avatar img { width: 100%; height: 100%; object-fit: cover; }

.ranking-list { display: flex; flex-direction: column; gap: 0.5rem; }
.ranking-row {
    display: grid;
    grid-template-columns: 40px 48px 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: transform var(--transition), background var(--transition);
}
.ranking-row:hover { transform: translateX(4px); background: #fafafa; }
.ranking-row-me { background: rgba(99,102,241,0.08); border-color: var(--primary); }
.rank-pos { font-weight: 700; color: var(--text-muted); text-align: center; }
.rank-info strong { display: block; }
.rank-info small { color: var(--text-muted); font-size: 0.75rem; }
.rank-stats { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.rank-score { font-weight: 700; color: var(--primary); }
.rank-streak { font-size: 0.8rem; }

.my-rank-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(129,140,248,0.05));
    border-radius: var(--radius);
    border: 1px solid var(--primary);
    margin-bottom: 1rem;
}

/* Quiz gamificación */
.quiz-gami-pill {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    background: rgba(255,255,255,0.9);
    border-radius: 50px;
    border: 1px solid var(--border);
}
.btn-hint {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 2px solid #fbbf24;
    color: #92400e;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform var(--transition);
}
.btn-hint:hover { transform: scale(1.03); }
.option-btn.hint-hidden { opacity: 0.25; pointer-events: none; text-decoration: line-through; }
.question-tools { margin-bottom: 0.75rem; }

.rewards-banner {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-weight: 700;
    color: #92400e;
}

.home-gami-section { padding: 0 0 2rem; margin-top: -1rem; }
.home-gami-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.home-gami-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: transform var(--transition), box-shadow var(--transition);
    text-decoration: none;
    color: inherit;
}
.home-gami-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.home-gami-card.streak { background: linear-gradient(135deg, #fff7ed, #ffedd5); }
.home-gami-card span { font-size: 1.75rem; }
.home-gami-card strong { display: block; font-size: 1.1rem; }
.home-gami-card small { color: var(--text-muted); font-size: 0.75rem; }
.link-card { cursor: pointer; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.animate-float { animation: float 3s ease-in-out infinite; }

@keyframes slideRight {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}
.animate-slide-right { animation: slideRight 0.5s ease-out both; }

@keyframes bounceIn {
    0% { opacity: 0; transform: scale(0.8); }
    60% { transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}
.animate-bounce-in { animation: bounceIn 0.6s ease-out both; }

.btn-success-flash { animation: bounceIn 0.4s ease-out; }

/* Avatar 3D — mascota de racha */
.avatar-3d-canvas {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 80%, rgba(99,102,241,0.12), transparent 70%);
    flex-shrink: 0;
}
.avatar-3d-canvas canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    border-radius: inherit;
}
.avatar-3d-xs { width: 56px; height: 56px; }
.avatar-3d-sm { width: 100px; height: 100px; }
.avatar-3d-md { width: 200px; height: 220px; }
.avatar-3d-lg { width: 100%; height: 360px; max-width: 420px; }

.profile-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.mascot-card-home {
    gap: 0.5rem !important;
    padding: 0.75rem 1rem !important;
}

.mascot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}
.mascot-card {
    padding: 1.25rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.mascot-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.mascot-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99,102,241,0.08), var(--surface));
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.mascot-card.locked { opacity: 0.75; }
.mascot-card-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.mascot-card h3 { font-size: 1rem; margin-bottom: 0.35rem; }
.mascot-card p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.mascot-price { font-weight: 700; color: #b45309; margin-bottom: 0.5rem; }
.owned-badge {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    background: #dcfce7;
    color: #166534;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}
.shop-mascot-card { border-color: #c4b5fd; }

/* Pantalla de racha */
.streak-section { padding: 2rem 0 3rem; }
.streak-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(251,191,36,0.06));
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
}
.streak-badge-lg {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}
.streak-tier-bar {
    display: flex;
    gap: 0.5rem;
    margin: 1.25rem 0;
}
.tier-step {
    flex: 1;
    padding: 0.75rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    transition: all var(--transition);
}
.tier-step span { display: block; font-weight: 600; font-size: 0.85rem; }
.tier-step small { color: var(--text-muted); font-size: 0.7rem; }
.tier-step.active {
    border-color: var(--primary);
    background: rgba(99,102,241,0.08);
}
.tier-step.active[data-tier="2"] { border-color: #fbbf24; background: rgba(251,191,36,0.1); }
.tier-step.active[data-tier="3"] { border-color: #a78bfa; background: rgba(167,139,250,0.1); }
.streak-stats-row {
    display: flex;
    gap: 1.5rem;
    margin: 1rem 0;
}
.streak-stats-row > div { text-align: center; }
.streak-stats-row strong { display: block; font-size: 1.25rem; }
.streak-stats-row small { color: var(--text-muted); font-size: 0.75rem; }
.streak-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.streak-avatar-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.streak-tier-glow {
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}
.streak-tier-glow.tier-1 { background: radial-gradient(circle, rgba(99,102,241,0.15), transparent 70%); }
.streak-tier-glow.tier-2 { background: radial-gradient(circle, rgba(251,191,36,0.25), transparent 70%); animation: pulse 2s ease-in-out infinite; }
.streak-tier-glow.tier-3 { background: radial-gradient(circle, rgba(167,139,250,0.35), transparent 70%); animation: pulse 1.5s ease-in-out infinite; }
.tier-label {
    margin-top: 0.75rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary);
    z-index: 1;
}
.mascot-collection { margin-top: 2.5rem; }
.mascot-collection h2 { margin-bottom: 1rem; }

/* Quiz — mascota flotante */
.quiz-mascot-float {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 50;
    padding: 0.35rem;
    background: rgba(255,255,255,0.92);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(8px);
    transition: transform var(--transition);
}
.quiz-mascot-float:hover { transform: scale(1.05); }

@media (max-width: 768px) {
    .profile-hero { flex-direction: column; }
    .chart-row { grid-template-columns: 80px 1fr 40px; }
    .avatar-picker { grid-template-columns: repeat(4, 1fr); }
    .ranking-row { grid-template-columns: 32px 40px 1fr; }
    .rank-stats { grid-column: 1 / -1; padding-left: 72px; }
    .podium-place { min-width: 100px; font-size: 0.85rem; }
    .nav-gami { display: none; }
    .streak-hero { grid-template-columns: 1fr; }
    .streak-avatar-stage { order: -1; }
    .avatar-3d-md { width: 160px; height: 180px; }
    .quiz-mascot-float { bottom: 0.75rem; right: 0.75rem; }
    .avatar-3d-sm { width: 72px; height: 72px; }
}

/* Historial de calificaciones */
.grades-section { padding: 2rem 0 3rem; }

.grades-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.grades-header h1 { font-size: 2rem; margin-bottom: 0.35rem; }

.grades-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.grades-layout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) 1fr;
    gap: 1.25rem;
    align-items: start;
}

.grades-sidebar,
.grades-preview {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.grades-sidebar { padding: 1.25rem; }

.grades-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.grades-sidebar-head h2 { font-size: 1.125rem; }

.grades-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.grades-list { max-height: 720px; }

.grades-item {
    width: 100%;
    text-align: left;
    background: transparent;
    font: inherit;
}

.grades-item.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.15);
}

.grades-preview { padding: 1.25rem; }

.grades-canvas-wrap {
    position: relative;
    margin-bottom: 1.25rem;
}

.report-canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: #fff;
}

.grades-empty-preview {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-muted);
    background: rgba(248, 250, 252, 0.92);
    border-radius: var(--radius-lg);
}

.grades-empty-preview.hidden { display: none; }

.grades-empty-icon { font-size: 2.5rem; }

.report-panel.hidden { display: none; }

.report-panel-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.report-panel-badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-dark);
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.report-certificate-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(139, 92, 246, 0.04));
}

.report-certificate-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.report-certificate-box strong {
    font-size: 1.1rem;
    color: var(--primary-dark);
    letter-spacing: 0.03em;
}

.report-certificate-box small {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: right;
}

.report-panel-grade {
    min-width: 110px;
    text-align: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.12));
}

.report-grade-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.report-grade-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.report-stats-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.report-stat {
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
}

.report-stat span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.report-stat strong {
    font-size: 0.95rem;
    color: var(--text);
}

.report-answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.report-answers-col h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.report-answers-col h3 span {
    color: var(--text-muted);
    font-weight: 600;
}

.report-answers-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-height: 360px;
    overflow-y: auto;
}

.report-answer-item {
    padding: 0.85rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: #fff;
}

.report-answer-item.correct {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.06);
}

.report-answer-item.wrong {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.05);
}

.report-answer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}

.report-answer-num {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-dark);
    font-size: 0.75rem;
    font-weight: 700;
}

.report-answer-status {
    font-size: 0.75rem;
    font-weight: 700;
}

.report-answer-item p {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.report-answer-item small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.report-answer-empty {
    padding: 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.dashboard-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.dashboard-card-head h2 { margin-bottom: 0; }

@media (max-width: 960px) {
    .grades-layout { grid-template-columns: 1fr; }
    .report-stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-answers-grid { grid-template-columns: 1fr; }
    .grades-header { flex-direction: column; }
}

