/* ==========================================
   MathKids - Playful Colorful Theme
   ========================================== */

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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --bg: #fef3f7;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(99, 102, 241, 0.12);
    --shadow-lg: 0 20px 50px rgba(99, 102, 241, 0.2);
}

body {
    font-family: 'Comic Sans MS', 'Baloo 2', -apple-system, 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #fef3f7 0%, #e0e7ff 50%, #fef9c3 100%);
    min-height: 100vh;
    color: var(--text);
    line-height: 1.6;
}

h1, h2, h3 { font-weight: 800; line-height: 1.2; }

/* ========== Background decoration ========== */
.bg-decoration {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 0;
}
.float-emoji {
    position: absolute;
    font-size: 3rem;
    opacity: 0.25;
    animation: float 6s ease-in-out infinite;
}
.float-emoji:nth-child(2) { animation-delay: 1s; }
.float-emoji:nth-child(3) { animation-delay: 2s; }
.float-emoji:nth-child(4) { animation-delay: 3s; }
.float-emoji:nth-child(5) { animation-delay: 4s; }
.float-emoji:nth-child(6) { animation-delay: 5s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

/* ========== Welcome page ========== */
.welcome-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
}

.welcome-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
}

.welcome-card {
    background: white;
    border-radius: 28px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    animation: pop-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-in {
    from { opacity: 0; transform: scale(0.8) translateY(30px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.welcome-header {
    text-align: center;
    margin-bottom: 2rem;
}

.big-emoji {
    font-size: 5rem;
    display: inline-block;
    animation: bounce 2s ease infinite;
}

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

.welcome-header h1 {
    font-size: 2.2rem;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 0.5rem;
}

.tagline {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

.welcome-form .form-group {
    margin-bottom: 1.5rem;
}

.welcome-form label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.6rem;
    font-size: 1.05rem;
}

.welcome-form input[type="text"] {
    width: 100%;
    padding: 1rem 1.2rem;
    border: 3px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.1rem;
    transition: all 0.2s;
    font-family: inherit;
}

.welcome-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.grade-buttons, .lang-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
.lang-buttons { grid-template-columns: repeat(2, 1fr); }

.grade-btn, .lang-btn {
    cursor: pointer;
    position: relative;
}

.grade-btn input, .lang-btn input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.grade-btn span, .lang-btn span {
    display: block;
    padding: 1rem 0.5rem;
    background: #f3f4f6;
    border: 3px solid transparent;
    border-radius: var(--radius);
    text-align: center;
    font-weight: 700;
    transition: all 0.2s;
    font-size: 1rem;
}

.grade-btn span { font-size: 1.5rem; }
.grade-btn span br + * { font-size: 0.9rem; }

.grade-btn:hover span, .lang-btn:hover span {
    background: #e0e7ff;
    transform: translateY(-2px);
}

.grade-btn input:checked + span, .lang-btn input:checked + span {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-color: #4f46e5;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

/* ========== Buttons ========== */
.btn-primary, .btn-secondary, .btn-ghost, .btn-submit, .btn-ai {
    display: inline-block;
    padding: 0.9rem 1.8rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-family: inherit;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 3px solid var(--primary);
}

.btn-secondary:hover { background: #eef2ff; }

.btn-ghost {
    background: transparent;
    color: var(--text);
    padding: 0.5rem 1rem;
}

.btn-ghost:hover { background: rgba(0,0,0,0.05); }

.btn-submit {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    font-size: 1.2rem;
    padding: 1rem 2rem;
}

.btn-submit:hover { transform: translateY(-2px); }

.btn-ai {
    background: linear-gradient(135deg, #ec4899, #f59e0b);
    color: white;
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.4);
}

.btn-ai:hover { transform: translateY(-2px); }

.btn-large { width: 100%; padding: 1.2rem; font-size: 1.2rem; }

.btn-huge {
    padding: 2rem 3rem;
    font-size: 1.5rem;
    border-radius: 24px;
    display: inline-block;
    margin: 0.5rem;
}

.btn-danger {
    background: var(--danger);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
}

/* ========== Alerts ========== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-weight: 600;
}
.alert-error { background: #fee2e2; color: #991b1b; border-left: 5px solid #ef4444; }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 5px solid #f59e0b; }
.alert-success { background: #d1fae5; color: #065f46; border-left: 5px solid #10b981; }
.alert-info { background: #dbeafe; color: #1e40af; border-left: 5px solid #3b82f6; }

.admin-link {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.admin-link a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
}

.admin-link a:hover { color: var(--primary); }

/* ========== Topbar ========== */
.topbar {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.topbar-left, .topbar-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.avatar {
    font-size: 1.8rem;
    display: inline-block;
}

.badge {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

/* ========== Home page ========== */
.home-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

.welcome-banner {
    background: linear-gradient(135deg, #6366f1, #ec4899);
    color: white;
    padding: 2.5rem;
    border-radius: 24px;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.welcome-banner h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* ========== Stats grid ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
    border-top: 5px solid var(--primary);
}

.stat-card:hover { transform: translateY(-5px); }
.stat-blue { border-top-color: #3b82f6; }
.stat-green { border-top-color: #10b981; }
.stat-orange { border-top-color: #f59e0b; }
.stat-purple { border-top-color: #8b5cf6; }

.stat-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.stat-value { font-size: 2.2rem; font-weight: 900; color: var(--primary); }
.stat-label { color: var(--text-light); font-weight: 600; }

/* ========== Action center ========== */
.action-center {
    background: white;
    padding: 2.5rem;
    border-radius: 24px;
    text-align: center;
    box-shadow: var(--shadow);
}

.action-center h2 {
    margin-bottom: 1.5rem;
    color: var(--primary);
}

/* ========== Admin AI difficulty selector ========== */
.ai-diff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.8rem;
}

.ai-diff-option {
    cursor: pointer;
    position: relative;
}

.ai-diff-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ai-diff-content {
    padding: 1.2rem 1rem;
    background: #f9fafb;
    border: 3px solid var(--border);
    border-radius: 16px;
    text-align: center;
    transition: all 0.2s;
}

.ai-diff-option:hover .ai-diff-content {
    transform: translateY(-2px);
    background: #eef2ff;
}

.ai-diff-icon {
    font-size: 2.2rem;
    margin-bottom: 0.3rem;
}

.ai-diff-name {
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.ai-diff-desc {
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.4;
}

.ai-diff-option input:checked ~ .ai-diff-content {
    background: white;
    color: white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    transform: translateY(-3px);
}

.ai-diff-easy input:checked ~ .ai-diff-content {
    background: linear-gradient(135deg, #10b981, #34d399);
    border-color: #059669;
}
.ai-diff-normal input:checked ~ .ai-diff-content {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: #4f46e5;
}
.ai-diff-hard input:checked ~ .ai-diff-content {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    border-color: #d97706;
}
.ai-diff-superhard input:checked ~ .ai-diff-content {
    background: linear-gradient(135deg, #a855f7, #c026d3);
    border-color: #9333ea;
}
.ai-diff-expert input:checked ~ .ai-diff-content {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: #b91c1c;
}

.ai-diff-option input:checked ~ .ai-diff-content .ai-diff-desc {
    color: rgba(255,255,255,0.9);
}

.ai-diff-grade-badge {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    background: #d1fae5;
    color: #065f46;
}
.ai-diff-grade-warn {
    background: #fef3c7;
    color: #92400e;
}
.ai-diff-option input:checked ~ .ai-diff-content .ai-diff-grade-badge {
    background: rgba(255,255,255,0.25);
    color: white;
}

/* Session type badges */
.session-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 0.5rem;
    vertical-align: middle;
}
.badge-ai { background: linear-gradient(135deg, #ec4899, #f59e0b); color: white; }
.badge-retry { background: #dbeafe; color: #1e40af; }
.badge-seed { background: #f3f4f6; color: #6b7280; }

/* ========== Quiz timer ========== */
.quiz-timer {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 16px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary);
    transition: all 0.3s;
}

.timer-icon { font-size: 1.8rem; }

.timer-display {
    font-size: 2rem;
    font-weight: 900;
    font-family: 'Courier New', monospace;
    color: var(--primary);
    min-width: 80px;
    text-align: center;
}

.timer-label {
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.9rem;
}

.quiz-timer.timer-warning {
    border-top-color: var(--warning);
    background: #fffbeb;
}
.quiz-timer.timer-warning .timer-display {
    color: var(--warning);
}

.quiz-timer.timer-critical {
    border-top-color: var(--danger);
    background: #fee2e2;
    animation: pulse-red 1s infinite;
}
.quiz-timer.timer-critical .timer-display {
    color: var(--danger);
}

@keyframes pulse-red {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4); }
}

/* ========== Quiz page ========== */
.quiz-container {
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.progress-bar {
    background: rgba(255,255,255,0.7);
    height: 14px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.08);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 10px;
}

.progress-text {
    text-align: center;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.question-slide {
    display: none;
    background: white;
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    animation: slide-in 0.4s ease;
}

.question-slide.active { display: block; }

@keyframes slide-in {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.q-tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tag {
    background: #f3f4f6;
    color: var(--text);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.tag-strand { background: #dbeafe; color: #1e40af; }
.tag-diff { background: #fef3c7; color: #92400e; }
.tag-code { background: #e0e7ff; color: #3730a3; font-family: monospace; }
.tag-ok { background: #d1fae5; color: #065f46; }
.tag-bad { background: #fee2e2; color: #991b1b; }

.q-text {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text);
    line-height: 1.5;
}

.options { display: grid; gap: 0.8rem; margin-bottom: 1.5rem; }

.option-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem;
    background: #f9fafb;
    border: 3px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.05rem;
}

.option-label:hover {
    background: #eef2ff;
    border-color: var(--primary);
    transform: translateX(5px);
}

.option-label input { display: none; }

.option-label input:checked ~ .opt-letter {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-color: #4f46e5;
}

.option-label:has(input:checked) {
    background: #eef2ff;
    border-color: var(--primary);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.2);
}

.opt-letter {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: all 0.2s;
}

.opt-text { flex: 1; }

.nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
}

.nav-buttons > *:only-child { margin-left: auto; }

/* ========== Review/Results ========== */
.result-card {
    background: white;
    padding: 3rem 2rem;
    border-radius: 28px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.result-emoji {
    font-size: 5rem;
    animation: bounce 1.5s ease infinite;
}

.result-score {
    font-size: 4rem;
    font-weight: 900;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 1rem 0 0.5rem;
}

.result-percent {
    font-size: 1.5rem;
    color: var(--text-light);
    font-weight: 700;
}

.result-msg {
    font-size: 1.4rem;
    margin: 1rem 0 2rem;
    color: var(--primary);
    font-weight: 700;
}

.result-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
}

.review-item {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    margin-bottom: 1.2rem;
    box-shadow: var(--shadow);
    border-left: 6px solid var(--success);
}

.review-item.incorrect { border-left-color: var(--danger); }

.review-header {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
}

.q-num { font-weight: 900; color: var(--primary); font-size: 1.1rem; }

.options-review {
    display: grid;
    gap: 0.5rem;
    margin: 1rem 0;
}

.option-review {
    padding: 0.8rem 1rem;
    background: #f9fafb;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.option-review.opt-correct {
    background: #d1fae5;
    color: #065f46;
    font-weight: 700;
}

.option-review.opt-wrong {
    background: #fee2e2;
    color: #991b1b;
    text-decoration: line-through;
}

.explanation {
    background: #fef3c7;
    padding: 1rem 1.2rem;
    border-radius: 14px;
    margin-top: 1rem;
    border-left: 4px solid #f59e0b;
}

.explanation p { margin-top: 0.5rem; }

/* ========== Dashboard ========== */
.dashboard-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.dashboard-container h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

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

.chart-card {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.chart-card h3 { margin-bottom: 1rem; color: var(--primary); }
.chart-card canvas { max-height: 260px; }

.history-section {
    background: white;
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.history-section h2 { margin-bottom: 1.5rem; color: var(--primary); }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state p {
    color: var(--text-light);
    margin: 1rem 0 2rem;
    font-size: 1.1rem;
}

.history-list {
    display: grid;
    gap: 0.8rem;
}

.history-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 16px;
    transition: all 0.2s;
}

.history-item:hover {
    background: #eef2ff;
    transform: translateX(5px);
}

.history-date {
    text-align: center;
    background: white;
    border-radius: 12px;
    padding: 0.5rem 0.8rem;
    min-width: 60px;
}

.date-day { font-size: 1.5rem; font-weight: 900; color: var(--primary); }
.date-month { font-size: 0.8rem; color: var(--text-light); text-transform: uppercase; }

.history-main { flex: 1; }
.history-title { font-weight: 700; margin-bottom: 0.4rem; }

.history-score-bar {
    background: #e5e7eb;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.score-fill { height: 100%; border-radius: 4px; transition: width 0.6s; }
.score-green { background: linear-gradient(90deg, #10b981, #34d399); }
.score-orange { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.score-red { background: linear-gradient(90deg, #ef4444, #f87171); }

.history-score { text-align: center; }
.history-score strong { display: block; font-size: 1.3rem; color: var(--primary); }
.history-score small { color: var(--text-light); }

/* ========== Loading overlay ========== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-box {
    background: white;
    padding: 3rem 4rem;
    border-radius: 24px;
    text-align: center;
}

.spinner {
    font-size: 4rem;
    animation: spin 2s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

.loading-box p {
    margin-top: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

/* ========== Admin ========== */
.admin-body { background: #f3f4f6; }

.admin-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: #1f2937;
    color: white;
    padding: 1.5rem 1rem;
}

.admin-sidebar h2 {
    color: white;
    padding: 0 0.5rem 1rem;
    border-bottom: 1px solid #374151;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.admin-sidebar a {
    display: block;
    color: #d1d5db;
    padding: 0.8rem 1rem;
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 0.3rem;
    transition: all 0.2s;
    font-weight: 600;
}

.admin-sidebar a:hover, .admin-sidebar a.active {
    background: var(--primary);
    color: white;
}

.admin-main {
    padding: 2rem;
    overflow-x: auto;
}

.admin-main h1 {
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.admin-card {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.admin-card h2, .admin-card h3 {
    margin-bottom: 1rem;
    color: var(--text);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: #f9fafb;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    font-size: 0.8rem;
}

tr:hover { background: #f9fafb; }

.form-row {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row label { font-weight: 700; margin-bottom: 0.4rem; display: block; }

.form-row input, .form-row textarea, .form-row select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
}

.form-row input:focus, .form-row textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.status-active { color: var(--success); font-weight: 700; }
.status-inactive { color: var(--text-light); font-weight: 700; }

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .welcome-card { padding: 1.5rem; }
    .welcome-header h1 { font-size: 1.6rem; }
    .big-emoji { font-size: 4rem; }
    .topbar { padding: 1rem; }
    .home-container, .quiz-container, .dashboard-container { padding: 1rem; }
    .welcome-banner { padding: 1.5rem; }
    .welcome-banner h1 { font-size: 1.4rem; }
    .q-text { font-size: 1.15rem; }
    .result-score { font-size: 3rem; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { padding: 1rem; }
    .admin-main { padding: 1rem; }
    .history-item { grid-template-columns: auto 1fr auto; }
    .history-item > a { grid-column: 1 / -1; text-align: center; }
    .btn-huge { padding: 1.2rem 2rem; font-size: 1.2rem; display: block; }
}
