:root {
  --navy: #0a2647;
  --navy-light: #16407a;
  --red: #c8102e;
  --red-soft: #fdeceb;
  --ink: #182233;
  --muted: #5b6474;
  --line: #e3e2dc;
  --bg: #f8f7f3;
  --panel: #ffffff;
  --green: #1f9d55;
  --green-soft: #e6f5ec;
  --amber: #d98a00;
  --amber-soft: #fff4dc;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(10, 38, 71, 0.06), 0 1px 3px rgba(10, 38, 71, 0.08);
  --shadow-md: 0 12px 28px rgba(10, 38, 71, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  font-weight: 800;
  font-size: 18px;
  text-decoration: none;
}

.brand img { display: block; }

.topbar-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.topbar-link:hover { color: var(--navy); }

main {
  width: min(1120px, 100% - 32px);
  margin: 0 auto;
  padding: 32px 0 64px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.eyebrow {
  color: var(--red);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(22, 64, 122, 0.35); outline-offset: 2px; }

.btn-primary { background: var(--navy); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--navy-light); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #a80d26; }
.btn-ghost { background: var(--panel); color: var(--navy); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--navy); }
.btn-whatsapp { background: var(--green); color: #fff; }
.btn-whatsapp:hover { background: #17864a; }

/* Intro */
.intro {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: start;
}

.intro-copy h1 {
  margin-top: 10px;
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.12;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.lead {
  margin-top: 16px;
  color: var(--muted);
  font-size: 17px;
  max-width: 52ch;
}

.facts {
  display: flex;
  gap: 12px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.facts li {
  flex: 1;
  padding: 14px 12px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.facts strong { display: block; font-size: 28px; color: var(--red); line-height: 1.1; }
.facts span { font-size: 13px; color: var(--muted); font-weight: 600; }

.test-kinds {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.test-kinds li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.test-kinds b { min-width: 72px; color: var(--navy); }
.test-kinds span { color: var(--muted); font-size: 14px; }

.form-card { padding: 28px; }
.form-card h2 { font-size: 22px; color: var(--navy); }
.hint { margin-top: 6px; color: var(--muted); font-size: 14px; }

.field { display: block; margin-top: 18px; }
.field > span { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 700; }

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid #cfcdc4;
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.field input.invalid,
.field select.invalid { border-color: var(--red); background: var(--red-soft); }

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.consent input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; accent-color: var(--navy); }

.form-error {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--red-soft);
  color: #9c0d24;
  font-size: 14px;
  font-weight: 600;
}

#startBtn { width: 100%; margin-top: 20px; min-height: 52px; font-size: 16px; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Exam */
.exam-bar {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 2fr auto;
  align-items: center;
  gap: 24px;
  padding: 14px 22px;
}

.label { display: block; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.exam-who strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-text { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.progress-track { height: 8px; border-radius: 999px; background: #ebe9e1; overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 999px; background: var(--green); transition: width 0.25s ease; }

.timer {
  min-width: 108px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: var(--green-soft);
  color: #146c3b;
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.timer.warn { background: var(--amber-soft); color: #8a5a00; }
.timer.danger { background: var(--red-soft); color: var(--red); animation: pulse 1s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: 0.55; } }

.exam-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.question-card { padding: 28px; }

.question-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-badge { padding: 4px 12px; border-radius: 999px; background: var(--red-soft); color: var(--red); font-size: 12.5px; font-weight: 800; }
.counter { color: var(--muted); font-size: 14px; font-weight: 600; }

.question-text {
  margin-top: 18px;
  font-size: 20px;
  line-height: 1.55;
  font-weight: 600;
  white-space: pre-line;
}

.options { display: grid; gap: 10px; margin-top: 22px; }

.option {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.option:hover { border-color: #b8c4d8; background: #fafbfd; }
.option input { position: absolute; opacity: 0; pointer-events: none; }

.option-letter {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #eef0f5;
  color: var(--navy);
  font-weight: 800;
}

.option.selected { border-color: var(--navy); background: #eef3fb; }
.option.selected .option-letter { background: var(--navy); color: #fff; }
.option:has(input:focus-visible) { outline: 3px solid rgba(22, 64, 122, 0.35); outline-offset: 2px; }

.question-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-top: 26px;
}

.btn-ghost[aria-pressed="true"] { background: var(--amber-soft); border-color: var(--amber); color: #8a5a00; }

.keys-hint { margin-top: 14px; color: var(--muted); font-size: 12.5px; }

.nav-card { padding: 22px; position: sticky; top: 84px; }
.nav-card h3 { font-size: 16px; color: var(--navy); }

.number-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 14px; }

.num {
  aspect-ratio: 1;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.num.answered { background: var(--green); border-color: var(--green); color: #fff; }
.num.marked { background: var(--amber); border-color: var(--amber); color: #fff; }
.num.current { box-shadow: 0 0 0 3px rgba(10, 38, 71, 0.35); border-color: var(--navy); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 16px 0 20px; padding: 0; list-style: none; font-size: 12.5px; color: var(--muted); }
.dot { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 4px; vertical-align: -1px; border: 2px solid var(--line); }
.dot-answered { background: var(--green); border-color: var(--green); }
.dot-marked { background: var(--amber); border-color: var(--amber); }
.dot-empty { background: #fff; }
.nav-card .btn { width: 100%; }

/* Result */
.result { display: grid; gap: 20px; }

.result-hero {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 32px;
}

.score-gauge {
  --pct: 0;
  position: relative;
  flex-shrink: 0;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--pct) * 1%), #ebe9e1 0);
  display: grid;
  place-items: center;
}

.score-gauge::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--panel);
}

.score-gauge span { position: relative; font-size: 34px; font-weight: 800; color: var(--navy); }

.result-copy h2 { margin-top: 6px; font-size: 28px; color: var(--navy); }
.result-copy p:last-child { margin-top: 8px; color: var(--muted); max-width: 60ch; }

.section-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.section-result { padding: 20px; }
.section-result h3 { font-size: 15px; color: var(--navy); }
.section-result strong { display: block; margin-top: 6px; font-size: 26px; }
.section-result .bar { height: 8px; margin-top: 10px; border-radius: 999px; background: #ebe9e1; overflow: hidden; }
.section-result .bar i { display: block; height: 100%; background: var(--navy); border-radius: 999px; }
.section-result small { display: block; margin-top: 8px; color: var(--muted); }

.cta-card { padding: 28px; }
.cta-card h3 { font-size: 20px; color: var(--navy); }
.cta-card > p { margin-top: 8px; color: var(--muted); }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.disclaimer { margin-top: 16px; font-size: 12.5px; color: var(--muted); }

.review-card { padding: 28px; }
.review-card h3 { font-size: 20px; color: var(--navy); }
.review-list { display: grid; gap: 10px; margin-top: 16px; }

.review-item { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.review-item summary { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; font-weight: 600; list-style: none; }
.review-item summary::-webkit-details-marker { display: none; }
.review-item summary::after { content: "+"; margin-left: auto; color: var(--muted); font-size: 20px; }
.review-item[open] summary::after { content: "\2212"; }

.verdict { flex-shrink: 0; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.verdict.ok { background: var(--green-soft); color: #146c3b; }
.verdict.bad { background: var(--red-soft); color: var(--red); }
.verdict.skip { background: #eee; color: #555; }
.verdict.scale { background: #e8eefb; color: var(--navy); }

.review-body { padding: 0 16px 16px; font-size: 15px; }
.review-body p { margin-top: 8px; }
.review-body .yours { color: var(--muted); }
.review-body .explain { padding: 10px 14px; border-radius: var(--radius-sm); background: #f4f6fb; }

/* Dialog */
.dialog {
  width: min(92vw, 420px);
  padding: 24px;
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  color: var(--ink);
}

.dialog::backdrop { background: rgba(5, 10, 20, 0.55); }
.dialog h3 { color: var(--navy); }
.dialog p { margin-top: 8px; color: var(--muted); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 20px; }

@media (max-width: 860px) {
  main { padding: 20px 0 48px; }
  .topbar { padding: 10px 16px; }
  .topbar-link { font-size: 13px; }
  .intro { grid-template-columns: 1fr; gap: 28px; }
  .form-card { padding: 22px; }
  .exam-bar { grid-template-columns: 1fr auto; gap: 12px 16px; padding: 14px 16px; }
  .exam-progress { grid-column: 1 / -1; order: 3; }
  .exam-grid { grid-template-columns: 1fr; }
  .nav-card { position: static; }
  .number-grid { grid-template-columns: repeat(10, 1fr); gap: 6px; }
  .question-card { padding: 20px; }
  .question-text { font-size: 18px; }
  .question-actions .btn { flex: 1 1 calc(50% - 10px); }
  #markBtn { order: 3; flex-basis: 100%; }
  .result-hero { flex-direction: column; text-align: center; padding: 24px; gap: 20px; }
  .section-results { grid-template-columns: 1fr; }
  .cta-actions .btn { flex: 1 1 100%; }
}

@media (max-width: 380px) {
  .number-grid { grid-template-columns: repeat(5, 1fr); }
  .brand span { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
