:root {
  --ink: #14213D;
  --ink-2: #2B3A5C;
  --muted: #5B6477;
  --paper: #F3F5F9;
  --sheet: #FFFFFF;
  --rule: #DCE2EC;
  --margin: #E7B9B9;
  --pen: #C62828;
  --pen-soft: #FCE8E8;
  --amber: #A86A12;
  --amber-soft: #FDF1DC;
  --ok: #2E7D32;
  --ok-soft: #E6F2E7;
  --line: #CDD4E0;
  --radius-sm: 6px;
  --radius: 10px;
  --ui: "Barlow", system-ui, sans-serif;
  --display: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}
main { outline: none; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .4em; letter-spacing: .005em; }
h1 { font-size: clamp(30px, 5vw, 44px); }
h2 { font-size: 26px; }
h3 { font-size: 20px; }
p { margin: 0 0 .8em; }
a { color: var(--ink-2); }
:focus-visible { outline: 3px solid #3D6BD8; outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 24px;
  background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--display); font-size: 20px; font-weight: 700; }
.brand svg { width: 28px; height: 28px; fill: #fff; }
.brand svg .tick { stroke: var(--ink); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a, .linklike { color: #D9E1F2; text-decoration: none; font: inherit; font-weight: 500; background: none; border: 0; cursor: pointer; padding: 6px 0; }
.nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -2px 0 #fff; }
.nav .nav-cta { background: #fff; color: var(--ink); padding: 7px 14px; border-radius: var(--radius-sm); box-shadow: none; }
.nav .nav-cta[aria-current="page"] { color: var(--ink); box-shadow: 0 0 0 2px #9fb4e0; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 32px 24px 64px; }
.narrow { max-width: 760px; }

/* ---------- botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 17px var(--ui); padding: 12px 20px; border-radius: var(--radius-sm);
  border: 2px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: #E6EAF2; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.small { padding: 7px 12px; font-size: 15px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

label { display: block; font-weight: 600; margin: 0 0 6px; }
.hint { color: var(--muted); font-size: 15px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; font: 400 17px var(--ui); color: var(--ink);
  padding: 11px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--ink-2); outline: none; box-shadow: 0 0 0 3px #D5DEF3; }
.field { margin-bottom: 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 5px; width: 18px; height: 18px; }
.error-msg { color: var(--pen); font-weight: 600; margin: 8px 0 0; }

.panel { background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 24px; }
.panel + .panel { margin-top: 20px; }

/* ---------- tela de entrada ---------- */
.auth { display: grid; grid-template-columns: 1.1fr .9fr; min-height: 100vh; }
.auth-side { background: var(--ink); color: #fff; padding: 56px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth-side .brand { font-size: 22px; }
.auth-side h1 { font-size: clamp(34px, 4.2vw, 52px); max-width: 14ch; }
.auth-side p { color: #C9D3E8; max-width: 46ch; font-size: 18px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form .box { width: 100%; max-width: 400px; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--rule); margin-bottom: 24px; }
.tabs button { font: 600 17px var(--ui); background: none; border: 0; padding: 10px 14px; color: var(--muted); cursor: pointer; margin-bottom: -2px; border-bottom: 3px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }

/* a folha de resposta: o elemento central do produto */
.sheet {
  background: var(--sheet); color: var(--ink); border-radius: var(--radius-sm);
  font-family: var(--serif); font-size: 16px;
  box-shadow: 0 1px 0 var(--rule), 0 18px 40px -24px rgba(20,33,61,.45);
  overflow: hidden;
}
.sheet-head { font-family: var(--ui); font-weight: 600; font-size: 14px; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 8px; }
.sheet ol { list-style: none; margin: 0; padding: 0; counter-reset: l; }
.sheet li { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; min-height: 34px; border-bottom: 1px solid var(--rule); }
.sheet li .n { font-family: var(--ui); font-size: 13px; color: var(--muted); text-align: center; border-right: 2px solid var(--margin); align-self: stretch; display: flex; align-items: center; justify-content: center; }
.sheet li .t { padding: 5px 12px; line-height: 1.35; }
.sheet li .t.indent { padding-left: 34px; }
.sheet li .note { font-family: var(--ui); font-size: 12px; font-weight: 700; padding: 2px 8px; margin-right: 8px; border-radius: 999px; }
.sheet li.has-err .note { background: var(--pen-soft); color: var(--pen); }
.sheet li.has-prov .note { background: var(--amber-soft); color: var(--amber); }
.sheet li.empty .t { color: transparent; }
.sheet mark { background: none; color: inherit; text-decoration: underline wavy var(--pen); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.sheet mark.prov { text-decoration-color: var(--amber); }
.sheet .doubt { background: var(--amber-soft); border-bottom: 2px solid var(--amber); padding: 0 3px; border-radius: 3px; font-family: var(--ui); font-weight: 600; }
.sheet .doubt.ok { background: var(--ok-soft); border-color: var(--ok); }
.auth-side .sheet { max-width: 520px; transform: rotate(-1.2deg); }
.auth-side .sheet .sheet-head { color: #5B6477; }

/* ---------- painel ---------- */
.greet { margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--rule); }
.chart .corte { stroke: var(--ok); stroke-dasharray: 5 4; stroke-width: 1.5; }
.chart .serie { fill: none; stroke: var(--ink); stroke-width: 2.5; }
.chart .dot { fill: var(--ink); }
.chart text { font: 12px var(--ui); fill: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--rule); padding: 12px 0; }
.list li:first-child { border-top: 0; }
.tag { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #E6EAF2; color: var(--ink-2); }
.tag.ativa { background: var(--pen-soft); color: var(--pen); }
.tag.em-queda { background: var(--amber-soft); color: var(--amber); }
.tag.dominada { background: var(--ok-soft); color: var(--ok); }
.essay-link { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; text-decoration: none; color: inherit; }
.essay-link:hover .tema { text-decoration: underline; }
.essay-link .tema { font-weight: 600; }
.essay-link .meta { color: var(--muted); font-size: 15px; }
.essay-link .nota { font-family: var(--display); font-size: 26px; font-weight: 700; grid-row: span 2; align-self: center; }
.empty-state { text-align: left; padding: 8px 0; }

/* ---------- nova correção ---------- */
.steps { display: flex; gap: 0; margin: 0 0 28px; padding: 0; list-style: none; border-bottom: 2px solid var(--rule); }
.steps li { flex: 1; padding: 10px 4px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; font-size: 15px; }
.steps li b { font-family: var(--display); font-size: 18px; margin-right: 6px; }
.steps li[aria-current="step"] { color: var(--ink); border-bottom-color: var(--ink); }
.steps li.done { color: var(--ink-2); }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: #fff; cursor: pointer; font-weight: 600; }
.choice small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; margin-top: 2px; }
.choice input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); background: #F5F7FC; }
.choice input:focus-visible + span { outline: 3px solid #3D6BD8; outline-offset: 2px; }
.quesito-row { display: grid; grid-template-columns: 28px 1fr 110px 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.quesito-row .qn { font-family: var(--display); font-weight: 700; font-size: 20px; text-align: center; }
.icon-btn { width: 40px; height: 40px; border: 1.5px solid var(--line); background: #fff; border-radius: var(--radius-sm); cursor: pointer; font-size: 20px; color: var(--muted); }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; background: #fff; text-align: center; }
.drop.over { border-color: var(--ink); background: #F5F7FC; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.thumbs img { height: 110px; border-radius: var(--radius-sm); border: 1px solid var(--rule); }
.tips { margin: 16px 0 0; padding-left: 20px; color: var(--muted); font-size: 15px; }
.working { display: flex; gap: 16px; align-items: center; padding: 28px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--rule); border-top-color: var(--ink); animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.doubt-card { border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; background: #fff; }
.doubt-card.answered { border-color: var(--ok); }
.doubt-card .opts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.opt { font: 600 16px var(--ui); padding: 7px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: #fff; cursor: pointer; }
.opt[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.conf-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; align-items: start; }
.grid-sheet { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.grid-sheet .sheet { font-size: 15px; }
.callout { border-left: 4px solid var(--amber); background: var(--amber-soft); padding: 12px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 16px; }
.callout.danger { border-color: var(--pen); background: var(--pen-soft); }
.callout.ok { border-color: var(--ok); background: var(--ok-soft); }

/* ---------- resultado ---------- */
.result-head { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: end; margin-bottom: 24px; }
.score { font-family: var(--display); font-weight: 700; line-height: .9; }
.score .big { font-size: clamp(64px, 11vw, 104px); }
.score .of { font-size: 26px; color: var(--muted); }
.ruler { position: relative; height: 56px; margin: 8px 0 6px; }
.ruler .track { position: absolute; left: 0; right: 0; top: 22px; height: 12px; border-radius: 6px; background: #E3E8F1; }
.ruler .band { position: absolute; top: 22px; height: 12px; border-radius: 6px; background: #9FB0D1; }
.ruler .mark { position: absolute; top: 14px; width: 4px; height: 28px; margin-left: -2px; background: var(--ink); border-radius: 2px; }
.ruler .corte { position: absolute; top: 4px; bottom: 4px; width: 0; border-left: 2px dashed var(--ok); }
.ruler .corte span { position: absolute; top: -2px; left: 6px; font-size: 13px; font-weight: 600; color: var(--ok); white-space: nowrap; }
.ruler-scale { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.verdict { font-size: 19px; }
.verdict b { font-weight: 700; }
.q-card { border-top: 1px solid var(--rule); padding: 18px 0; display: grid; grid-template-columns: 1fr 150px; gap: 8px 24px; }
.q-card:first-of-type { border-top: 0; }
.q-card .pts { text-align: right; }
.q-card .pts b { font-family: var(--display); font-size: 28px; display: block; }
.q-card .pts span { color: var(--muted); font-size: 14px; }
.q-card dl { margin: 6px 0 0; display: grid; gap: 8px; }
.q-card dt { font-weight: 700; font-size: 15px; }
.q-card dd { margin: 0; }
.meter { height: 6px; background: #E3E8F1; border-radius: 3px; margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ink); }
.err-item { border-top: 1px solid var(--rule); padding: 12px 0; }
.err-item:first-child { border-top: 0; }
.err-item .trecho { font-family: var(--serif); }
.err-item .fix { color: var(--ok); font-weight: 600; }
.steps-next { padding-left: 22px; margin: 0; }
.steps-next li { margin-bottom: 10px; }
.disclaimer { color: var(--muted); font-size: 15px; margin-top: 12px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--radius-sm); font-weight: 500; max-width: calc(100% - 32px); z-index: 50; }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 32px 20px; }
  .auth-side .sheet { display: none; }
  .grid-2, .conf-grid, .grid-sheet { grid-template-columns: 1fr; }
  .conf-grid aside { order: -1; }
  .result-head { grid-template-columns: 1fr; gap: 8px; }
  .q-card { grid-template-columns: 1fr; }
  .q-card .pts { text-align: left; }
  .topbar { padding: 10px 16px; }
  .brand span { display: none; }
  .wrap { padding: 24px 16px 48px; }
  .steps li { font-size: 13px; }
  .steps li .lbl { display: none; }
  .quesito-row { grid-template-columns: 22px 1fr 84px 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
}
@media print {
  .topbar, .no-print, .toast { display: none !important; }
  body { background: #fff; font-size: 13px; }
  .panel { border: 0; padding: 0; }
  .wrap { padding: 0; }
}
