:root {
  --ink: #1E1E1E;
  --paper: #FFFDF6;
  --dot: #E4DFD2;
  --muted: #5B5650;
  --line: #CFC8B8;
  --azul: #4A7BF7;
  --amarelo: #FFD43B;
  --rosa: #FF8FAB;
  --verde: #51CF66;
  --hand: 'Caveat Brush', cursive;
  --body: 'Patrick Hand', 'Comic Sans MS', cursive;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1.4px, transparent 1.4px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 20px;
  overflow-x: hidden;
}

a { color: inherit; }
a:hover { color: #3A63D8; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px dashed #3A63D8; outline-offset: 6px; }

.hand { font-family: var(--hand); font-weight: 400; }
.muted { color: var(--muted); }

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 56px) 80px;
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 4vw, 48px);
}
.page.narrow { max-width: 1000px; }

/* ---------- Contorno estilo Excalidraw ---------- */
.sk {
  position: relative;
  display: flex;
  flex-direction: column;
  transform: rotate(var(--tilt, 0deg));
  text-decoration: none;
  color: var(--ink);
  border: 0;
  background: none;
  padding: 0;
}
.sk > .sk-fill, .sk > .sk-hatch {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
}
.sk > .sk-hatch {
  inset: 12px -12px -12px 12px;
  background: repeating-linear-gradient(-45deg, var(--h) 0 3px, transparent 3px 10px);
}
.sk > .sk-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.sk > .sk-body {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* sublinhado rabiscado */
.ul { position: relative; display: inline-block; }
.ul > svg {
  position: absolute;
  left: 2%;
  bottom: -14%;
  width: 96%;
  height: 22%;
  overflow: visible;
  pointer-events: none;
}

/* ---------- Início ---------- */
.home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 4vw, 48px);
  padding: 24px 16px 72px;
  text-align: center;
}
.home h1 {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
}
.home .big-word { font-size: clamp(64px, 12vw, 176px); line-height: .9; letter-spacing: .01em; }
.letters { display: flex; gap: clamp(10px, 2vw, 28px); margin-top: clamp(8px, 2vw, 24px); }
.letter {
  width: clamp(68px, 13vw, 190px);
  height: clamp(76px, 14.5vw, 210px);
  font-family: var(--hand);
  font-size: clamp(56px, 11vw, 160px);
  line-height: 1;
  transition: transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.letter > .sk-body { align-items: center; justify-content: center; }
.letter:hover { transform: rotate(0deg) translateY(-8px); }
.tagline { margin: 0; font-size: clamp(22px, 2.6vw, 34px); line-height: 1.2; color: #4A453F; }
.tagline .hand { color: var(--ink); }
.only-note {
  align-self: center;
  margin: -12px 0 0;
  padding: 6px 18px 8px;
  font-size: 20px;
  text-align: center;
  background: #FFF1B8;
  border: 2px dashed var(--ink);
  border-radius: 12px 8px 14px 10px;
  transform: rotate(-1deg);
}
.only-note b { font-weight: 400; font-family: var(--hand); font-size: 24px; }
.badge {
  position: absolute;
  top: -16px;
  right: 20px;
  padding: 2px 12px 4px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 6px 9px 7px 8px;
  font-family: var(--hand);
  font-size: 19px;
}
.outline-letter { color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  cursor: pointer;
  font-family: var(--hand);
  font-size: clamp(36px, 4vw, 48px);
  line-height: 1;
  transition: transform .15s ease;
}
.btn > .sk-body { padding: 14px 64px 18px; align-items: center; justify-content: center; }
.btn:hover { transform: translate(-3px, -3px) rotate(-1.5deg); color: var(--ink); }
.btn:active { transform: translate(4px, 4px); }

.navbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 6px 22px 8px;
  font-family: var(--hand);
  font-size: 26px;
  text-decoration: none;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px 14px 8px 12px;
  cursor: pointer;
  transition: transform .15s ease;
}
.navbtn:hover { transform: translate(-2px, -2px) rotate(-1deg); color: var(--ink); }
.navbtn.primary { background: var(--amarelo); border-width: 3px; border-radius: 12px 8px 14px 10px; box-shadow: 4px 4px 0 var(--ink); padding-inline: 28px; }
.navbtn.green { background: var(--verde); border-width: 3px; box-shadow: 4px 4px 0 var(--ink); }
.navbtn[disabled] { opacity: .4; cursor: default; transform: none; }
.navbtn.small { min-height: 44px; font-family: var(--body); font-size: 19px; padding: 4px 14px; border-width: 1.5px; }

.back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 22px;
  text-decoration: none;
}
.back svg, .arrow { width: 34px; height: 20px; overflow: visible; }

.title { margin: 0; font-family: var(--hand); font-weight: 400; font-size: clamp(48px, 6.5vw, 88px); line-height: 1; }
.title.center { align-self: center; text-align: center; }
.title .ul > svg { left: 0; width: 70%; height: 24%; bottom: -16%; }
.title.center .ul > svg { left: 30%; width: 40%; }

/* ---------- Cartões de modo ---------- */
.modes { display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; gap: clamp(28px, 3vw, 44px); padding-top: 16px; }
.mode {
  flex: 1 1 320px;
  max-width: 400px;
  transition: transform .2s cubic-bezier(.3, 1.6, .5, 1);
}
.mode > .sk-body { padding: 40px 32px 32px; gap: 20px; }
a.mode:hover { transform: translate(-4px, -6px) rotate(-.6deg); color: var(--ink); }
.mode-head { display: flex; align-items: center; gap: 16px; }
.mode-head svg { flex: none; width: 60px; height: 60px; overflow: visible; }
.mode-name { font-family: var(--hand); font-size: 40px; line-height: 1; }
.mode-desc { font-size: 21px; line-height: 1.35; }
.mode-cta { margin-top: auto; padding-top: 8px; display: inline-flex; align-items: center; gap: 10px; font-family: var(--hand); font-size: 28px; }
.mode.soon { min-height: 320px; color: #6B655C; text-align: center; }
.mode.soon > .sk-body { align-items: center; justify-content: center; gap: 14px; }

.sticker {
  position: absolute;
  top: -18px;
  left: 24px;
  padding: 4px 14px 6px;
  border: 2.5px solid var(--ink);
  border-radius: 8px 5px 9px 6px;
  font-family: var(--hand);
  font-size: 22px;
}

.chips { display: flex; flex-wrap: wrap; gap: 10px; font-size: 18px; }
.chip { padding: 4px 12px; border: 1.5px solid var(--ink); border-radius: 14px 10px 12px 16px; }

.rows { display: flex; flex-direction: column; gap: 10px; font-size: 19px; }
.rows > div { display: flex; justify-content: space-between; gap: 12px; }
.rows > div + div { padding-top: 10px; border-top: 2px dashed var(--line); }
.rows b { font-weight: 400; font-family: var(--hand); font-size: 22px; }

/* ---------- Personalizar ---------- */
.split { display: flex; flex-wrap: wrap; align-items: flex-start; gap: clamp(32px, 4vw, 56px); }
.split > .grow { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 40px; }
.split > .side { flex: 1 1 300px; }
.step { display: flex; flex-direction: column; gap: 16px; }
.step h2 { margin: 0; display: flex; align-items: center; gap: 12px; font-family: var(--hand); font-weight: 400; font-size: 34px; }
.num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; font-size: 24px;
  border: 2.5px solid var(--ink); border-radius: 50% 45% 52% 48%;
}
.pills { display: flex; flex-wrap: wrap; gap: 14px; }
.pill {
  min-height: 52px;
  min-width: 76px;
  padding: 8px 20px 10px;
  font-size: 22px;
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 14px 10px 16px 12px;
  cursor: pointer;
  transition: transform .15s ease;
}
.pill.num-pill { font-family: var(--hand); font-size: 28px; }
.pill:hover { transform: translateY(-2px) rotate(-1deg); }
.pill.on { border-width: 3px; box-shadow: 4px 4px 0 var(--ink); }
.summary > .sk-body { padding: 36px 30px 30px; gap: 20px; }
.summary .rows { font-size: 21px; }
.disabled-note {
  display: flex; align-items: center; justify-content: center; min-height: 60px;
  color: var(--muted); border: 2px dashed #8C857A; border-radius: 12px 8px 14px 10px; text-align: center; padding: 8px;
}
.wide { width: 100%; font-size: 34px; }

/* ---------- Prova ---------- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; }
.timer { display: inline-flex; }
.timer > .sk-body { flex-direction: row; align-items: center; gap: 12px; padding: 10px 22px 12px; }
.timer svg.clock { width: 32px; height: 32px; overflow: visible; }
.timer .t { font-family: var(--hand); font-size: 36px; line-height: 1; font-variant-numeric: tabular-nums; }

.qcard > .sk-body { padding: clamp(24px, 3vw, 40px); gap: 22px; }
.qhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.tag {
  align-self: flex-start;
  padding: 3px 14px 5px;
  border: 2px solid var(--ink);
  border-radius: 10px 6px 12px 8px;
  transform: rotate(-2deg);
  font-family: var(--hand);
  font-size: 22px;
}
.enunciado { margin: 0; font-size: clamp(21px, 1.9vw, 25px); line-height: 1.45; white-space: pre-line; }

.alts { display: flex; flex-direction: column; gap: 12px; }
.alt {
  display: flex; align-items: center; gap: 16px;
  width: 100%; min-height: 60px; padding: 8px 16px;
  text-align: left; font-size: 21px;
  background: #fff; border: 1.5px solid var(--ink); border-radius: 14px 10px 16px 12px;
  cursor: pointer; transition: transform .12s ease;
}
.alt:hover { transform: translateX(4px); }
.alt .bub {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; font-family: var(--hand); font-size: 24px;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 50% 46% 52% 48%;
}
.alt .txt { flex: 1 1 auto; }
.alt .lbl { flex: none; font-family: var(--hand); font-size: 22px; }
.alt.sel { background: #FFF6CC; border-width: 3px; }
.alt.sel .bub, .alt.bad .bub { background: var(--ink); color: #fff; }
.alt.ok { background: #D3F5D9; border-width: 3px; }
.alt.ok .bub { background: var(--verde); }
.alt.bad { background: #FFE0E8; border-width: 3px; }
.alt.dim { opacity: .55; }
.alts.locked .alt { cursor: default; }
.alts.locked .alt:hover { transform: none; }

.qnav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 8px; }
.qnav.end { justify-content: flex-end; }

.answers { display: flex; flex-direction: column; gap: 16px; }
.cells { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.cell {
  position: relative; height: 48px;
  font-family: var(--hand); font-size: 22px;
  background: #fff; border: 1.5px solid var(--ink);
  cursor: pointer; transition: transform .12s ease;
}
.cell:hover { transform: rotate(-4deg); }
.cell.ans { background: var(--azul); color: #fff; }
.cell.cur { background: var(--amarelo); color: var(--ink); border-width: 3px; }
.cell .dot { position: absolute; top: -6px; right: -6px; width: 14px; height: 14px; background: var(--rosa); border: 2px solid var(--ink); border-radius: 50%; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 17px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; height: 14px; border: 1.5px solid var(--ink); border-radius: 4px; }

.feedback { display: flex; flex-direction: column; gap: 8px; padding: 18px 22px; border: 2.5px solid var(--ink); border-radius: 12px 16px 10px 14px; transform: rotate(-.4deg); }
.feedback .hand { font-size: 34px; line-height: 1; }

/* ---------- Infinito ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 14px; }
.stat { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px 8px; border: 2px solid var(--ink); font-size: 19px; }
.stat b { font-weight: 400; font-family: var(--hand); font-size: 32px; line-height: 1; }

/* ---------- Resultado ---------- */
.score > .sk-body { align-items: center; justify-content: center; gap: 6px; padding: 36px 28px; }
.score .big { font-family: var(--hand); font-size: 120px; line-height: .9; }
.score .big small { font-size: 56px; }
.bars > .sk-body { padding: 32px 30px; gap: 22px; }
.bar { position: relative; display: block; height: 26px; }
.bar > span { position: absolute; top: 3px; bottom: 3px; left: 2px; border-radius: 6px 3px 5px 4px; }
.bar > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* ---------- Correção ---------- */
.review { display: flex; flex-direction: column; gap: 32px; }
.review .qcard > .sk-body { gap: 16px; }

/* ======================================================================
   Acréscimos ao desenho original, para o que o banco real traz e o
   protótipo não previa: figuras recortadas das provas, alternativas que
   são imagens, a procedência de cada questão e a espera do carregamento.
   ====================================================================== */

/* ---------- Figuras ---------- */
.figuras { display: flex; flex-direction: column; gap: 14px; margin: 4px 0; }
.figura {
  align-self: flex-start;
  max-width: 100%;
  padding: 10px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 14px 10px 16px 12px;
  transform: rotate(-.35deg);
}
.figura img { display: block; max-width: 100%; height: auto; }
.alt .txt .figura { margin: 2px 0; padding: 6px; border-width: 1.5px; transform: none; }
.alt .txt img { display: block; max-width: 100%; height: auto; }

/* ---------- Procedência e etiquetas extras ---------- */
.fonte {
  font-size: 17px;
  color: var(--muted);
  padding-top: 10px;
  border-top: 2px dashed var(--line);
}
.tag.ppl { background: var(--rosa); transform: rotate(1.5deg); }
.tag.ano { background: #fff; }

/* ---------- Carregando ---------- */
.carregando {
  min-height: 70vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  text-align: center;
}
.carregando .hand { font-size: clamp(40px, 6vw, 64px); line-height: 1; }
.carregando .lapis { width: 120px; height: 40px; overflow: visible; }
.carregando .lapis path { stroke-dasharray: 260; stroke-dashoffset: 260; animation: risca 1.5s ease-in-out infinite; }
@keyframes risca { to { stroke-dashoffset: -260; } }

.erro { max-width: 560px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; gap: 14px; }

/* ---------- Filtros extras do personalizar ---------- */
.pill.mini { min-height: 44px; min-width: 0; padding: 4px 14px 6px; font-size: 18px; }
.sub { font-size: 18px; color: var(--muted); margin: -4px 0 0; }

/* ---------- Correção: rolagem longa ---------- */
.review-nav {
  position: sticky; bottom: 16px; align-self: center;
  display: flex; gap: 10px; padding: 8px;
  background: var(--paper); border: 2px solid var(--ink);
  border-radius: 14px 10px 16px 12px; box-shadow: 4px 4px 0 var(--ink);
}

/* ---------- Telas estreitas ---------- */
@media (max-width: 720px) {
  body { font-size: 19px; }
  .cells { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .btn > .sk-body { padding: 12px 36px 16px; }
  .split > .side { flex-basis: 100%; }
  .alt { font-size: 19px; }
}
