*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; font-family: var(--font-body); color: var(--text); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.page-glow { background-image: var(--glow); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; }
p { margin: 0 0 12px; }
small { display: block; color: var(--muted); font-size: 13px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
.dot-danger { background: var(--danger); width: 6px; height: 6px; margin-right: 6px; }

/* Top bar & brand */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 68px; padding: 0 20px; border-bottom: 1px solid var(--border); }
.topbar-center { justify-content: center; border-bottom: 0; }
.topbar-nav { display: flex; align-items: center; gap: 22px; font-size: 15px; font-weight: 500; }
.topbar-nav a { color: var(--text-soft); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text) !important; font-family: var(--font-display); font-size: 18px; font-weight: 800; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; }
.brand-sub { color: var(--muted); font-weight: 600; }
.narrow { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; }
.footer { display: flex; justify-content: space-between; gap: 16px; padding: 18px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }

/* Hero (home) */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px; padding: 56px 20px 40px; }
.pill { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px 7px 9px; font-size: 13px; font-weight: 600; color: var(--text-soft); }
.display { font-size: clamp(34px, 6vw, 66px); line-height: 1.06; letter-spacing: -0.03em; max-width: 900px; text-wrap: pretty; }
.lead { font-size: 18px; color: var(--muted); max-width: 640px; }
.meta { font-size: 13px; font-weight: 500; color: var(--muted); }
.inline-form { display: flex; flex-direction: column; width: 100%; max-width: 740px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.inline-field { display: flex; align-items: center; gap: 12px; padding: 0 16px; color: var(--muted); min-height: 60px; flex-grow: 1; }
.inline-field input { flex-grow: 1; min-width: 0; background: transparent; border: 0; color: var(--text); font: inherit; font-size: 16px; outline: none; }
.inline-quiz { display: flex; align-items: center; padding: 0 16px; min-height: 52px; font-size: 15px; font-weight: 500; color: var(--text); border-top: 1px solid var(--border); }
.inline-form .btn { border-radius: 0; min-height: 56px; }
@media (min-width: 760px) {
  .inline-form { flex-direction: row; align-items: stretch; }
  .inline-quiz { border-top: 0; border-left: 1px solid var(--border); white-space: nowrap; }
}
.steps { list-style: none; margin: 0; padding: 20px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 28px; border-top: 1px solid var(--border); font-size: 14px; color: var(--text-soft); }
.steps li { display: flex; align-items: center; gap: 12px; }
.step-n { font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--accent); }
.pillars { display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--border); }
.pillar { display: flex; flex-direction: column; gap: 6px; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.pillar-n { font-family: var(--font-display); font-size: 13px; font-weight: 800; color: var(--accent); }
.pillar h3 { font-size: 16px; font-weight: 700; }
.pillar p { color: var(--muted); font-size: 13px; margin: 0; }
@media (min-width: 900px) {
  .topbar { padding: 0 64px; height: 76px; }
  .hero { padding: 78px 64px 40px; }
  .pillars { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pillar { padding: 26px 32px; border-bottom: 0; border-right: 1px solid var(--border); }
  .pillar:last-child { border-right: 0; }
  .footer { padding: 18px 64px; }
}

/* Cards & forms */
.card { display: flex; flex-direction: column; gap: 16px; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-danger { border-top: 4px solid var(--danger); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 24px; }
.card-meta { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.section-title { font-size: 20px; margin-top: 8px; }
.eyebrow-sm { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0 0 4px; }
.eyebrow-sm.warn { color: var(--danger); }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: var(--control-h); padding: 10px 14px; font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.input::placeholder { color: var(--muted); }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
select.input option { background: var(--surface); color: var(--text); }
textarea.input { min-height: 96px; resize: vertical; }
.field-error { color: var(--danger); font-size: 13px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); font-size: 14px; color: var(--text-soft); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--accent); }
.check.has-error { border-left-color: var(--danger); }
.rules h2 { font-size: 18px; margin-bottom: 8px; }
.rules ol { margin: 0; padding-left: 20px; font-size: 14px; color: var(--text-soft); display: flex; flex-direction: column; gap: 6px; }
.alert { padding: 12px 14px; border-radius: var(--radius); font-size: 14px; }
.alert-danger { background: var(--danger-soft); color: #FF8A8E; border-left: 3px solid var(--danger); }
.alert-warning { background: var(--warn-soft); color: #FFC66B; border-left: 3px solid var(--warn); }
.alert-ok { background: var(--ok-soft); color: #6FDDA0; border-left: 3px solid var(--ok); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: var(--control-h); padding: 0 22px; font: inherit; font-size: 15px; font-weight: 700; border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; text-decoration: none; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.btn-lg { min-height: var(--control-h-lg); font-size: 16px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-ink) !important; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; color: var(--text) !important; border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--accent); }
.btn-outline-accent { background: transparent; color: var(--text) !important; border-color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff !important; }
.btn-sm { min-height: var(--touch); padding: 0 14px; font-size: 14px; }
.admin-shell .btn-sm { min-height: 38px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Quiz list (home, several quizzes) */
.quiz-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 640px; }
.quiz-list-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text) !important; text-align: left; }
.quiz-list-item:hover { border-color: var(--accent); }
.quiz-list-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Quiz screen */
.quiz-body { background: var(--bg); }
#quiz { display: flex; flex-direction: column; min-height: 100vh; }
.quiz-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: max(16px, env(safe-area-inset-top)) 20px 14px; display: flex; flex-direction: column; gap: 12px; }
.quiz-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.quiz-title { font-size: 20px; }
.timer { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; font-family: var(--font-display); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer svg { color: var(--accent); }
.timer.is-low { border-color: var(--danger); color: var(--danger); }
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 6px; background: var(--accent); border-radius: 3px; transition: width 0.3s; }
.quiz-meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 12px; font-weight: 700; color: var(--text); border: 1px solid var(--accent); border-radius: 999px; }
.badge.is-warn { background: var(--danger); border-color: var(--danger); color: #fff; }
.quiz-stage { display: flex; flex-direction: column; gap: 20px; padding: 22px 20px 0; flex-grow: 1; max-width: 640px; width: 100%; margin: 0 auto; user-select: none; -webkit-user-select: none; }
.question { font-size: 21px; line-height: 1.32; font-weight: 700; text-wrap: pretty; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option { position: relative; display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; font-size: 16px; }
.option input { position: absolute; opacity: 0; width: 0; height: 0; }
.option-key { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--border-strong); color: var(--muted); font-weight: 700; font-size: 13px; flex-shrink: 0; }
.option.is-selected { background: var(--surface-2); border-color: var(--accent); color: #fff; font-weight: 600; }
.option.is-selected .option-key { background: var(--accent); color: #fff; border-color: var(--accent); }
.option:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.quiz-footer { position: sticky; bottom: 0; margin: 0 -20px; padding: 14px 20px max(24px, env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.hint { display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); margin: 0; }
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(14, 17, 22, 0.86); }
.overlay .card { width: 100%; max-width: 440px; box-shadow: var(--shadow); }
dialog.modal { width: min(92vw, 440px); padding: 28px 24px 24px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-top: 4px solid var(--danger); border-radius: var(--radius-lg); }
dialog.modal::backdrop { background: rgba(14, 17, 22, 0.82); }

/* Result (participant) */
.result { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; }
.result-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--accent); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.result-title { font-size: 28px; }
.score-card { width: 100%; align-items: center; gap: 8px; border-radius: var(--radius-xl); padding: 28px 24px 26px; }
.score-label { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.score-row { display: flex; align-items: baseline; gap: 6px; }
.score-value { font-family: var(--font-display); font-size: 84px; line-height: 1; font-weight: 800; letter-spacing: -0.04em; color: #fff; }
.score-of { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--muted); }
.meter { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter-lg { height: 8px; width: 100%; margin-top: 10px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 8px 10px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid var(--surface-3); vertical-align: middle; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* Admin shell — top navigation */
.admin-shell { display: flex; flex-direction: column; min-height: 100vh; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.admin-nav { display: flex; align-items: center; gap: 2px; height: 64px; overflow-x: auto; }
.nav-item { display: flex; align-items: center; gap: 8px; height: 64px; padding: 0 14px; color: var(--muted) !important; font-size: 14px; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav-item.is-active { color: #fff !important; font-weight: 700; border-bottom-color: var(--accent); }
.nav-item .count { font-size: 11px; font-weight: 700; color: #fff; background: var(--danger); border-radius: 999px; padding: 2px 7px; }
.admin-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--border); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.admin-main { padding: 24px 20px 40px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-title { font-size: 26px; letter-spacing: -0.02em; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters .input, .filters select { min-height: 38px; width: auto; font-size: 13px; background: var(--surface); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.kpi.is-accent { box-shadow: inset 0 3px 0 var(--danger); }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-value { font-family: var(--font-display); font-size: 36px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.kpi-delta { font-size: 12px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.pagination { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-shell form.inline-form { display: inline; border: 0; background: none; box-shadow: none; width: auto; max-width: none; overflow: visible; }
.tag { display: inline-block; padding: 2px 8px; font-size: 12px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text-soft); }
.tag-ok { background: var(--ok-soft); color: #6FDDA0; border-color: transparent; }
.tag-bad { background: var(--danger-soft); color: #FF8A8E; border-color: transparent; }
.tag-warn { background: var(--warn-soft); color: #FFC66B; border-color: transparent; }
.option-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.timeline li { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--surface-3); }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.review { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.review li { padding: 10px 12px; background: var(--bg); border-left: 3px solid var(--ok); border-radius: 0 var(--radius) var(--radius) 0; }
.review li.is-wrong { border-left-color: var(--danger); }
.review-q { font-weight: 600; }
@media (min-width: 1000px) {
  .admin-top { padding: 0 40px; }
  .admin-main { padding: 24px 40px 40px; }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1.6fr 1fr; }
}
