:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #0f172a;
    --accent: #14b8a6;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
    --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 32rem),
        radial-gradient(circle at bottom right, rgba(20, 184, 166, 0.12), transparent 30rem),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a { color: inherit; }
.app-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 56px; }

.home-wrap, .quiz-page, .result-page, .admin-page { width: 100%; }
.hero-card, .topbar-card, .form-card, .participant-card, .question-card, .submit-card, .result-hero, .review-card, .table-card, .summary-card {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    border-radius: var(--radius);
}

.hero-card { padding: clamp(28px, 6vw, 64px); text-align: center; margin-top: 28px; }
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.10);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.02em;
}

h1 { margin: 18px 0 12px; font-size: clamp(32px, 6vw, 56px); line-height: 1.02; letter-spacing: -0.05em; }
h2 { margin: 0 0 10px; font-size: clamp(22px, 4vw, 30px); letter-spacing: -0.03em; }
p { line-height: 1.7; }
.hero-text { max-width: 720px; margin: 0 auto 28px; color: var(--muted); font-size: 17px; }
.hero-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.hero-actions.center { justify-content: center; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 20px;
    border-radius: 14px;
    border: 0;
    font-weight: 800;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-ghost { background: #eff6ff; color: var(--primary-dark); }
.btn.small { min-height: 40px; padding: 9px 14px; font-size: 14px; }
.btn.full { width: 100%; }

.stats-grid, .summary-grid, .result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 34px; }
.stat-card, .summary-card, .result-stats div {
    padding: 18px;
    border-radius: 20px;
    background: #f8fafc;
    border: 1px solid var(--line);
}
.stat-card strong, .summary-card strong, .result-stats strong { display: block; font-size: 30px; letter-spacing: -0.04em; }
.stat-card span, .summary-card span, .result-stats span, .summary-card small { color: var(--muted); font-size: 14px; }

.topbar-card { padding: 24px; margin-bottom: 18px; display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.topbar-card h1 { font-size: clamp(28px, 5vw, 44px); margin-bottom: 6px; }
.topbar-card p { margin: 0; color: var(--muted); }
.back-link { text-decoration: none; font-weight: 800; color: var(--primary-dark); padding: 10px 12px; border-radius: 12px; background: #eff6ff; }

.compact-card { max-width: 560px; margin: 24px auto; padding: 28px; }
.muted { color: var(--muted); }
.start-form { display: grid; gap: 16px; margin-top: 22px; }
label span { display: block; margin-bottom: 8px; font-weight: 800; font-size: 14px; }
input[type="text"], select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    font: inherit;
    outline: none;
    background: #fff;
}
input[type="text"]:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12); }
.alert { padding: 14px 16px; border-radius: 16px; margin: 16px 0; font-weight: 700; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.participant-card { padding: 18px 22px; margin-bottom: 18px; display: grid; grid-template-columns: 1fr minmax(240px, 360px); gap: 18px; align-items: center; position: sticky; top: 12px; z-index: 10; }
.participant-card span { color: var(--muted); font-size: 13px; font-weight: 700; }
.participant-card strong { display: block; font-size: 20px; margin: 3px 0; }
.participant-card small { color: var(--muted); }
.progress-wrap span { display: block; font-weight: 800; margin-bottom: 8px; text-align: right; }
.progress-bar { height: 12px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
#progressFill { width: 0%; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; transition: width 0.25s ease; }

.question-form { display: grid; gap: 18px; }
.question-card { padding: 24px; transition: border-color 0.2s ease, transform 0.2s ease; }
.question-card.answered { border-color: rgba(22, 163, 74, 0.45); }
.question-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.number-pill, .materi-chip, .status-chip {
    display: inline-flex;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}
.number-pill { background: #eff6ff; color: var(--primary-dark); }
.materi-chip { background: #ecfeff; color: #0e7490; }
.status-chip { background: #f1f5f9; color: var(--secondary); margin-left: auto; }
.question-text { margin: 0 0 16px; font-size: 17px; font-weight: 650; }
.options-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.option-tile {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.option-tile:hover { transform: translateY(-1px); border-color: rgba(37, 99, 235, 0.55); }
.option-tile input { position: absolute; opacity: 0; pointer-events: none; }
.option-letter {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #f1f5f9;
    color: var(--secondary);
    font-weight: 900;
}
.option-text { color: #334155; line-height: 1.55; }
.option-tile:has(input:checked) { border-color: var(--primary); background: #eff6ff; }
.option-tile:has(input:checked) .option-letter { background: var(--primary); color: #fff; }
.submit-card { padding: 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 6px; }
.submit-card p { margin: 0; color: var(--muted); }

.result-hero { padding: 34px; text-align: center; }
.result-hero h1 { font-size: clamp(30px, 5vw, 48px); }
.result-hero.excellent { border-color: rgba(22, 163, 74, 0.35); }
.result-hero.good { border-color: rgba(245, 158, 11, 0.45); }
.result-hero.needs-work { border-color: rgba(220, 38, 38, 0.35); }
.score-circle {
    width: 160px;
    height: 160px;
    margin: 24px auto;
    border-radius: 50%;
    background: linear-gradient(145deg, #eff6ff, #ffffff);
    border: 10px solid rgba(37, 99, 235, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.score-circle strong { font-size: 38px; letter-spacing: -0.06em; }
.score-circle span { color: var(--muted); font-weight: 800; }
.review-section { margin-top: 24px; display: grid; gap: 14px; }
.review-card { padding: 20px; box-shadow: none; }
.review-card.correct { border-color: rgba(22, 163, 74, 0.35); }
.review-card.wrong { border-color: rgba(220, 38, 38, 0.35); }
.review-card.correct .status-chip { background: #dcfce7; color: #166534; }
.review-card.wrong .status-chip { background: #fee2e2; color: #991b1b; }
.answer-line { margin: 8px 0 0; color: #334155; }

.summary-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: 0 0 18px; }
.table-card { padding: 22px; overflow: hidden; }
.table-actions { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 16px; }
.filter-form { min-width: 220px; }
.responsive-table { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 850px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
th { background: #f8fafc; color: #334155; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: #f8fafc; }
.table-link { color: var(--primary-dark); font-weight: 800; text-decoration: none; }
.empty-cell { text-align: center; color: var(--muted); padding: 32px; }
.note { margin: 16px 0 0; font-size: 13px; color: var(--muted); }

@media (max-width: 760px) {
    .app-shell { width: min(100% - 20px, 1120px); padding-top: 18px; }
    .topbar-card, .participant-card, .submit-card { grid-template-columns: 1fr; display: grid; }
    .participant-card { position: static; }
    .progress-wrap span { text-align: left; }
    .options-grid, .stats-grid, .result-stats { grid-template-columns: 1fr; }
    .hero-card, .question-card, .result-hero, .table-card { padding: 20px; }
    .submit-card { justify-items: stretch; }
    .submit-card .btn { width: 100%; }
}
