/* Banco SOI II · mundo visual do Mediciner: azul profundo → verde-água, Fraunces nos títulos, Manrope no texto.
   Assinatura: as marquinhas por questão (verde, vermelho, em branco) e a etiqueta da semana de APG (S3 · P2). */

:root {
  color-scheme: light dark;

  --bg: #f3f7f8;
  --bg-deep: #e8f0f2;
  --paper: #ffffff;
  --line: #dfe9ed;
  --line-soft: #ebf2f4;
  --ink: #12324a;
  --ink-soft: #4a6576;
  --ink-faint: #7890a0;

  --brand: #1f6b91;
  --brand-2: #3e97b2;
  --teal: #2e919b;
  --mint: #67bcb8;
  --brand-ink: #1b6189;
  --brand-mist: #e4f0f6;
  --brand-soft: #c5e0ec;
  --on-brand: #ffffff;

  --ok: #2a9d8f;
  --ok-ink: #1c6e62;
  --ok-mist: #dcf1ec;
  --bad: #e07b70;
  --bad-ink: #a3443c;
  --bad-mist: #fbe6e2;

  --grad-brand: linear-gradient(120deg, #1f6b91 0%, #2e919b 58%, #67bcb8 100%);
  --grad-button: linear-gradient(120deg, #1f6b91 0%, #23808f 100%);
  --grad-soft: linear-gradient(135deg, #e4f0f6 0%, #dff2ef 100%);

  --shadow-card: 0 10px 34px -16px rgba(18, 50, 74, 0.28);
  --shadow-option: 0 6px 18px -14px rgba(18, 50, 74, 0.35);
  --shadow-sheet: 0 -12px 48px -8px rgba(18, 50, 74, 0.2);
  --scrim: rgba(12, 30, 44, 0.32);

  --font-display: 'Fraunces', 'Times New Roman', serif;
  --font-sans: 'Manrope', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --radius-card: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --gutter: 24px;
  --content-w: 432px;
  --top-h: 136px;
  --bar-h: 76px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1a23;
    --bg-deep: #10222d;
    --paper: #122530;
    --line: #22404e;
    --line-soft: #1a3340;
    --ink: #e6f1f4;
    --ink-soft: #a3bac5;
    --ink-faint: #7b95a2;

    --brand: #4aa3bd;
    --brand-2: #5bb3c6;
    --teal: #53b3ae;
    --mint: #6fc4bd;
    --brand-ink: #8fcfe3;
    --brand-mist: #16303d;
    --brand-soft: #1f4a5c;
    --on-brand: #06202c;

    --ok: #5ec7b4;
    --ok-ink: #74d3c1;
    --ok-mist: #12342f;
    --bad: #ef8e84;
    --bad-ink: #f29a90;
    --bad-mist: #3a2123;

    --grad-brand: linear-gradient(120deg, #4aa3bd 0%, #53b3ae 58%, #86d4ca 100%);
    --grad-button: linear-gradient(120deg, #4aa3bd 0%, #6fc4bd 100%);
    --grad-soft: linear-gradient(135deg, #16303d 0%, #12342f 100%);

    --shadow-card: 0 10px 34px -16px rgba(0, 0, 0, 0.6);
    --shadow-option: 0 6px 18px -14px rgba(0, 0, 0, 0.7);
    --shadow-sheet: 0 -12px 48px -8px rgba(0, 0, 0, 0.55);
    --scrim: rgba(0, 0, 0, 0.5);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: lining-nums;
}
body.has-sheet { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }
::selection { background: var(--brand-soft); color: var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.noscript { padding: 40px 24px; text-align: center; }

svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* no app instalado no iPhone o conteúdo rola por baixo do relógio: uma faixa da cor do fundo cobre essa área */
body::before { content: ''; position: fixed; top: 0; right: 0; left: 0; z-index: 30; height: env(safe-area-inset-top, 0px); background: var(--bg); pointer-events: none; }
body:has(.quiz-top)::before { display: none; }

.app {
  max-width: calc(var(--content-w) + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.view { animation: view-in 0.24s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }

/* ── Peças comuns ─────────────────────────────────────────────── */

.title { margin: 0; font: italic 400 42px/1.06 var(--font-display); letter-spacing: -0.015em; text-wrap: balance; }
.title > span { display: block; }
.lead { margin: 12px 0 0; color: var(--ink-soft); font-size: 15px; line-height: 1.5; text-wrap: pretty; }
.card {
  position: relative;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: var(--shadow-card);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font: 600 13px/1.2 var(--font-sans);
  max-width: 100%;
}
.chip-brand { border-color: transparent; background: var(--brand-mist); color: var(--brand-ink); }
.chip svg.i { width: 15px; height: 15px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 700 16px/1.2 var(--font-sans);
  text-align: center;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; }
.btn-block { width: 100%; }
.btn-primary { background: var(--grad-button); color: var(--on-brand); box-shadow: 0 10px 24px -12px rgba(31, 107, 145, 0.7); }
.btn-secondary { border-color: var(--line); background: var(--paper); color: var(--ink); }
.btn-danger { background: var(--bad-ink); color: #fff; }
.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--brand-ink);
  font: 700 15px/1.2 var(--font-sans);
}
.btn-text svg.i { width: 18px; height: 18px; }
.btn-text.is-danger { color: var(--bad-ink); }
.count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--brand-mist);
  color: var(--brand-ink);
  font: 800 13px/1 var(--font-sans);
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-card);
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.icon-btn:active:not(:disabled) { transform: scale(0.94); }
.icon-btn:disabled { opacity: 0.35; box-shadow: none; }
.icon-btn[aria-pressed="true"] { border-color: transparent; background: var(--brand-mist); color: var(--brand-ink); }
.icon-btn[aria-pressed="true"] svg.i { fill: currentColor; }

/* marquinhas por questão: verde acertou, vermelho errou, em branco ainda não respondida */
.dots { display: flex; gap: 3px; }
.dot { flex: 1; min-width: 3px; height: 6px; border-radius: 999px; background: var(--bg-deep); }
.dot.is-right { background: var(--ok); }
.dot.is-wrong { background: var(--bad); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; color: var(--ink-soft); font: 600 13px/1.2 var(--font-sans); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--bg-deep); box-shadow: inset 0 0 0 1px var(--line); }
.legend .is-right { background: var(--ok); box-shadow: none; }
.legend .is-wrong { background: var(--bad); box-shadow: none; }

/* ── Carregando ───────────────────────────────────────────────── */

.boot { display: grid; place-content: center; justify-items: center; gap: 14px; min-height: 100dvh; color: var(--ink-soft); font: 600 15px/1.3 var(--font-sans); }
.pulse { display: block; flex: none; width: 84px; height: 32px; overflow: visible; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pulse-base { stroke: currentColor; stroke-width: 2; opacity: 0.16; }
.pulse-beam { stroke: url(#pulse-grad); stroke-width: 2.6; stroke-dasharray: 32 200; animation: pulse-sweep 1.3s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite; }
@keyframes pulse-sweep { from { stroke-dashoffset: 32; } to { stroke-dashoffset: -100; } }

/* ── Início ───────────────────────────────────────────────────── */

.home { display: grid; gap: 22px; padding: calc(28px + env(safe-area-inset-top, 0px)) 0 calc(40px + env(safe-area-inset-bottom, 0px)); }
.home-side, .home-main { display: grid; gap: 22px; align-content: start; min-width: 0; }

.resume {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px 18px 16px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--grad-soft);
  color: var(--ink);
  text-align: left;
  transition: transform 0.12s ease;
}
.resume:active { transform: scale(0.985); }
.resume strong { display: block; font: 700 16px/1.3 var(--font-sans); }
.resume span { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 14px; }
.resume > svg.i { width: 22px; height: 22px; color: var(--brand-ink); }

.filters { display: grid; gap: 12px; }
.filter-label { margin: 0 0 -4px; color: var(--ink-soft); font: 700 13px/1.2 var(--font-sans); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices-row {
  flex-wrap: nowrap;
  margin: 0 calc(-1 * max(var(--gutter), env(safe-area-inset-left, 0px)));
  padding: 2px max(var(--gutter), env(safe-area-inset-right, 0px)) 6px max(var(--gutter), env(safe-area-inset-left, 0px));
  overflow-x: auto;
  scrollbar-width: none;
  scroll-padding-inline: var(--gutter);
}
.choices-row::-webkit-scrollbar { display: none; }
.choice {
  display: inline-flex;
  flex: none;
  align-items: baseline;
  gap: 6px;
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: 600 14px/1.2 var(--font-sans);
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.choice small { color: var(--ink-soft); font: 600 12px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.choice[aria-pressed="true"] { border-color: transparent; background: var(--grad-button); color: var(--on-brand); }
.choice[aria-pressed="true"] small { color: inherit; opacity: 0.85; }
.choices-even { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.choices-even .choice { justify-content: center; padding-inline: 6px; flex-direction: column; align-items: center; gap: 2px; min-height: 50px; padding-block: 7px; }

.sim { overflow: hidden; padding: 24px 22px 20px; }
.sim::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--grad-brand); }
.sim-name { margin: 0; font: italic 400 32px/1.05 var(--font-display); }
.sim-desc { margin: 6px 0 18px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.45; }
.sim-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.sim-row .btn { padding: 0 12px; gap: 10px; }

.area-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 6px 4px 10px; }
.area-name { margin: 0; font: italic 400 27px/1.1 var(--font-display); }
.area-meta { color: var(--ink-soft); font: 600 13px/1.2 var(--font-sans); font-variant-numeric: tabular-nums; white-space: nowrap; }
.group { overflow: hidden; }
.topics { margin: 0; padding: 0; list-style: none; }
.topics li + li { border-top: 1px solid var(--line-soft); }
.topic {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 15px 14px 15px 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: background-color 0.15s ease;
}
.topic:active { background: var(--bg); }
.topic > svg.i { width: 18px; height: 18px; color: var(--ink-faint); }
.week {
  display: grid;
  place-items: center;
  align-content: center;
  width: 50px;
  height: 54px;
  border-radius: 15px;
  background: var(--brand-mist);
  color: var(--brand-ink);
}
.week b { font: italic 500 21px/1 var(--font-display); letter-spacing: -0.01em; }
.week span { margin-top: 3px; font: 800 11px/1 var(--font-sans); letter-spacing: 0.08em; }
.topic.is-done .week { background: var(--grad-button); color: var(--on-brand); }
.topic-main { display: grid; gap: 8px; min-width: 0; }
.topic-name { font: 700 15.5px/1.3 var(--font-sans); text-wrap: pretty; }
.topic-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--ink-soft); font: 600 13px/1.2 var(--font-sans); font-variant-numeric: tabular-nums; }
.topic-meta b { color: var(--ink); font-weight: 700; }

.tip { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 14px 8px 14px 16px; border: 1px dashed var(--line); border-radius: var(--radius-lg); color: var(--ink-soft); font-size: 14px; line-height: 1.45; }
.tip > svg.i { margin-top: 1px; color: var(--brand-ink); }
.tip b { color: var(--ink); }
.tip .btn-text { min-height: 36px; margin: -6px 0; color: var(--ink-soft); }
.foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; color: var(--ink-soft); font-size: 13.5px; }
.empty { margin: 0; padding: 22px; border: 1.5px dashed var(--line); border-radius: var(--radius-lg); color: var(--ink-soft); text-align: center; }

/* ── Questão ──────────────────────────────────────────────────── */

.quiz-top {
  position: sticky;
  top: 0;
  z-index: 10;
  margin-right: calc(-1 * max(var(--gutter), env(safe-area-inset-right, 0px)));
  margin-left: calc(-1 * max(var(--gutter), env(safe-area-inset-left, 0px)));
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px)) 12px max(var(--gutter), env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--bg) 97%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
}
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.quiz-head .icon-btn { box-shadow: none; }
.quiz-title { display: grid; justify-items: center; gap: 2px; min-width: 0; text-align: center; }
.quiz-title strong { font: 700 15px/1.2 var(--font-sans); font-variant-numeric: tabular-nums; }
.quiz-title span { max-width: 100%; overflow: hidden; color: var(--ink-soft); font: 600 13px/1.3 var(--font-sans); text-overflow: ellipsis; white-space: nowrap; }

.progress { height: 5px; margin: 12px 0 10px; border-radius: 999px; background: var(--bg-deep); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--grad-brand); transition: width 0.35s ease; }

.steps {
  display: flex;
  gap: 6px;
  margin: 0 calc(-1 * max(var(--gutter), env(safe-area-inset-left, 0px)));
  padding: 3px max(var(--gutter), env(safe-area-inset-right, 0px)) 3px max(var(--gutter), env(safe-area-inset-left, 0px));
  overflow-x: auto;
  scrollbar-width: none;
  scroll-padding-inline: 40%;
}
.steps::-webkit-scrollbar { display: none; }
.step {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-soft);
  font: 700 12px/1 var(--font-sans);
  font-variant-numeric: tabular-nums;
  transition: transform 0.12s ease;
}
.step:active { transform: scale(0.9); }
.step.is-right { border-color: transparent; background: var(--ok-mist); color: var(--ok-ink); }
.step.is-wrong { border-color: transparent; background: var(--bad-mist); color: var(--bad-ink); }
.step.is-current { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-mist); color: var(--brand-ink); }
.step.is-fresh { animation: pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4); }
@keyframes pop { 40% { transform: scale(1.18); } }

.quiz { padding: 8px 0 calc(var(--bar-h) + 44px + env(safe-area-inset-bottom, 0px)); }
.quiz.enter-next { animation: enter-next 0.22s cubic-bezier(0.2, 0.8, 0.25, 1) both; }
.quiz.enter-prev { animation: enter-prev 0.22s cubic-bezier(0.2, 0.8, 0.25, 1) both; }
@keyframes enter-next { from { opacity: 0.3; transform: translateX(24px); } }
@keyframes enter-prev { from { opacity: 0.3; transform: translateX(-24px); } }
.q-left, .q-right { min-width: 0; }
.quiz-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.lvl { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.lvl i { width: 3px; border-radius: 1px; background: currentColor; }
.lvl i:nth-child(1) { height: 5px; } .lvl i:nth-child(2) { height: 8px; } .lvl i:nth-child(3) { height: 11px; }
.lvl i.off { opacity: 0.25; }
.stem p { margin: 0 0 14px; font-size: 17px; line-height: 1.65; text-wrap: pretty; }
.stem p.li { margin: -4px 0 10px; padding-left: 26px; text-indent: -26px; }
.stem p.li b { display: inline-block; min-width: 26px; text-indent: 0; color: var(--brand-ink); font-weight: 800; }

/* tabela no padrão das provas: linhas horizontais, sem verticais */
.tbl-wrap { margin: 2px 0 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: var(--paper); }
.tbl { min-width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 10px 14px; text-align: left; white-space: nowrap; }
.tbl thead th { border-bottom: 1.5px solid var(--line); color: var(--ink-soft); font: 700 13px/1.3 var(--font-sans); }
.tbl tbody tr + tr td, .tbl tbody tr + tr th { border-top: 1px solid var(--line-soft); }
.tbl tbody th { font-weight: 600; }

/* figuras das questões: esquemas em traço, com as letras em caixinhas como na prova */
.fig { margin: 2px 0 18px; padding: 14px 10px 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--paper); }
.fig svg { display: block; width: 100%; max-width: 460px; height: auto; margin: 0 auto; overflow: visible; }
.fig svg * { vector-effect: non-scaling-stroke; }
.fg-ln, .fg-lead { fill: none; stroke: var(--ink-soft); stroke-width: 1.4; }
.fg-ln { stroke-width: 1.8; }
.fg-lb rect { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.fg-lb text, .fg-or { fill: var(--ink); font: 800 13px var(--font-sans); text-anchor: middle; dominant-baseline: central; }
.fg-or { fill: var(--ink-soft); font-weight: 700; font-size: 11.5px; letter-spacing: 0.04em; }
.fg-act { fill: none; stroke: var(--teal); stroke-width: 2.6; stroke-linecap: round; }
.fg-my { fill: none; stroke: var(--brand); stroke-width: 7; stroke-linecap: round; }
.fg-head { fill: none; stroke: var(--brand); stroke-width: 1.6; stroke-linecap: round; }
.fg-z { fill: none; stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; }
.fg-m { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-dasharray: 4 3; }
.fg-white { fill: var(--bg); stroke: var(--ink-soft); stroke-width: 1.6; }
.fg-gray { fill: color-mix(in srgb, var(--ink) 22%, var(--bg)); stroke: var(--ink-soft); stroke-width: 1.2; }
.fg-gap { fill: none; stroke: var(--ink-soft); stroke-width: 1.4; }
.fg-fis { fill: var(--paper); stroke: var(--ink-soft); stroke-width: 1.4; }
.fg-canal { fill: var(--paper); stroke: var(--ink); stroke-width: 1.4; }
.fg-root { fill: none; stroke: var(--brand); stroke-width: 5; stroke-linecap: round; }
.fg-gang { fill: var(--brand-mist); stroke: var(--brand); stroke-width: 2; }
.fg-tub { fill: none; stroke: var(--brand); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.fg-thin { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round; }
.fg-cd { fill: none; stroke: var(--teal); stroke-width: 10; stroke-linecap: round; }
.fg-caps { fill: var(--paper); stroke: var(--ink-soft); stroke-width: 2; }
.fg-glom circle { fill: color-mix(in srgb, var(--bad) 30%, var(--paper)); stroke: var(--bad); stroke-width: 1.4; }
.fg-art { fill: none; stroke: var(--bad); stroke-width: 3; stroke-linecap: round; }

.command { margin: 6px 0 16px; font: italic 400 23px/1.3 var(--font-display); letter-spacing: -0.01em; text-wrap: balance; }

.options { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.option-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  border: 1.5px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-option);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  width: 100%;
  min-height: 62px;
  padding: 14px 4px 14px 14px;
  border: 0;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.option:active:not([aria-disabled="true"]) .letter { transform: scale(0.93); }
.letter {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-deep);
  color: var(--ink-soft);
  font: 700 15px/1 var(--font-sans);
  transition: transform 0.1s ease, background-color 0.15s ease, color 0.15s ease;
}
.option-body { display: grid; gap: 8px; min-width: 0; padding-top: 5px; }
.option-text { font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.cut {
  display: grid;
  place-items: center;
  align-self: start;
  width: 48px;
  height: 62px;
  padding: 0;
  border: 0;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  background: transparent;
  color: var(--ink-faint);
}
.cut[aria-pressed="true"] { color: var(--brand-ink); }
.status { display: grid; place-items: center; align-self: start; width: 48px; height: 62px; }
.status svg.i { width: 22px; height: 22px; stroke-width: 2.6; }

.option-row.is-selected { border-color: var(--brand-2); background: var(--brand-mist); }
.option-row.is-selected .letter { background: var(--grad-button); color: var(--on-brand); }

/* riscada: continua legível, com o texto cortado e um traço na letra */
.option-row.is-cut { border-style: dashed; border-color: var(--line); background: transparent; box-shadow: none; }
.option-row.is-cut .option-text { color: var(--ink-faint); text-decoration: line-through; text-decoration-thickness: 1.5px; text-decoration-color: color-mix(in srgb, var(--ink) 50%, transparent); }
.option-row.is-cut .letter { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink-faint); }
.option-row.is-cut .letter::after { content: ''; position: absolute; left: 6px; right: 6px; top: 50%; height: 1.75px; background: currentColor; transform: rotate(-45deg); }

.option-row.is-answered .option { cursor: default; }
.option-row.is-right { border-color: var(--ok); background: var(--ok-mist); }
.option-row.is-right .letter { background: var(--ok); color: #fff; box-shadow: none; }
.option-row.is-right .status { color: var(--ok-ink); }
.option-row.is-wrong { border-color: var(--bad); background: var(--bad-mist); }
.option-row.is-wrong .letter { background: var(--bad); color: #fff; box-shadow: none; }
.option-row.is-wrong .status { color: var(--bad-ink); }
.option-row.is-muted { box-shadow: none; }
.option-row.is-muted .letter { opacity: 0.7; }
.option-row.is-answered.is-cut { border-style: dashed; }
.option-row.is-right.is-cut { border-style: solid; }
.option-row.is-right .option-text { color: var(--ink); text-decoration: none; }
.option-tag { display: flex; align-items: center; gap: 5px; font: 700 13px/1.2 var(--font-sans); }
.option-row.is-right .option-tag { color: var(--ok-ink); }
.option-row.is-wrong .option-tag { color: var(--bad-ink); }
.option-row.is-muted .option-tag { color: var(--ink-soft); }
.option-tag svg.i { width: 15px; height: 15px; stroke-width: 2.4; }
.why { margin: 0; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink-soft); font-size: 15px; line-height: 1.55; text-wrap: pretty; }
.option-row.is-right .why, .option-row.is-wrong .why { color: var(--ink); }
.fresh .why, .fresh .option-tag { animation: why-in 0.3s cubic-bezier(0.2, 0.8, 0.25, 1) both; }
@keyframes why-in { from { opacity: 0; transform: translateY(-4px); } }

.cut-hint { display: flex; align-items: center; gap: 8px; margin: 14px 2px 0; color: var(--ink-soft); font-size: 14px; line-height: 1.4; }
.cut-hint svg.i { width: 16px; height: 16px; color: var(--ink-faint); }

.feedback { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 16px 18px; border-radius: var(--radius-lg); scroll-margin-top: calc(var(--top-h) + 12px); }
.feedback:focus { outline: none; }
.feedback.is-right { background: var(--ok-mist); color: var(--ok-ink); }
.feedback.is-wrong { background: var(--bad-mist); color: var(--bad-ink); }
.feedback-icon { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%; color: #fff; }
.feedback.is-right .feedback-icon { background: var(--ok); }
.feedback.is-wrong .feedback-icon { background: var(--bad); }
.feedback-icon svg.i { stroke-width: 2.6; }
.feedback-title { margin: 0; font: italic 400 22px/1.15 var(--font-display); }
.feedback-sub { margin: 2px 0 0; font: 600 14px/1.35 var(--font-sans); }
.fresh-fb { animation: why-in 0.3s ease both; }

.summary { margin-top: 16px; padding: 20px 20px 18px; }
.summary-title { margin: 0 0 8px; font: italic 400 22px/1.2 var(--font-display); }
.summary p { margin: 0; font-size: 16px; line-height: 1.6; text-wrap: pretty; }
.summary-meta { display: grid; gap: 4px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); color: var(--ink-soft); font-size: 13.5px; line-height: 1.45; }
.summary-meta b { color: var(--ink); font-weight: 700; }

.quiz-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(to top, var(--bg) 62%, color-mix(in srgb, var(--bg) 0%, transparent));
  pointer-events: none;
}
.quiz-bar-inner { display: flex; align-items: center; gap: 12px; max-width: 480px; margin: 0 auto; pointer-events: auto; }
.quiz-bar .btn { flex: 1; }

/* ── Resultado ────────────────────────────────────────────────── */

.results { display: grid; gap: 22px; padding: calc(28px + env(safe-area-inset-top, 0px)) 0 calc(44px + env(safe-area-inset-bottom, 0px)); }
.results-side, .results-main { display: grid; gap: 18px; align-content: start; min-width: 0; }
.results-head .lead { margin-top: 8px; }
.score { display: flex; align-items: baseline; gap: 10px; }
.score-num { font: 500 88px/0.9 var(--font-display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.score-den { color: var(--ink-soft); font: italic 400 26px/1 var(--font-display); }
.score-line { margin: 8px 0 0; color: var(--ink-soft); font: 600 15px/1.4 var(--font-sans); }
.score-line b { color: var(--ink); }
.levels { display: grid; gap: 12px; padding: 20px 22px; }
.level-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) 44px; align-items: center; gap: 12px; color: var(--ink-soft); font: 600 14px/1.2 var(--font-sans); font-variant-numeric: tabular-nums; }
.level-row b { color: var(--ink); text-align: right; }
.sec-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 8px 2px 0; font: italic 400 24px/1.2 var(--font-display); }
.sec-title small { color: var(--ink-soft); font: 600 13px/1.2 var(--font-sans); }
.grid-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.grid-steps .step { width: 100%; height: auto; aspect-ratio: 1; max-width: 52px; justify-self: center; font-size: 14px; }
.results-actions { display: grid; gap: 10px; }
.results-actions .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Painéis ──────────────────────────────────────────────────── */

.sheet-layer { position: fixed; top: 0; right: 0; left: 0; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end; height: 100dvh; }
.scrim { position: absolute; inset: 0; background: var(--scrim); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade-in 0.2s ease-out; touch-action: none; }
.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: calc(100% - 16px - env(safe-area-inset-top, 0px));
  margin: 0 auto;
  border-radius: 28px 28px 0 0;
  background: var(--bg);
  box-shadow: var(--shadow-sheet);
  animation: rise 0.32s cubic-bezier(0.2, 0.9, 0.25, 1);
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.25, 1);
}
.sheet.is-dragging { transition: none; }
.sheet:focus { outline: none; }
@keyframes rise { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
.grab-zone { touch-action: none; }
.grabber { width: 40px; height: 5px; margin: 10px auto 2px; border-radius: 999px; background: var(--line); }
.sheet-head { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 8px; padding: 4px 12px 6px; }
.sheet-head .icon-btn { box-shadow: none; }
.sheet-title { grid-column: 2; margin: 0; font: italic 400 23px/1.2 var(--font-display); text-align: center; }
.sheet-body { padding: 4px 22px calc(24px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; overscroll-behavior: contain; }
.sheet-body > p { margin: 0 0 16px; color: var(--ink-soft); font-size: 15px; line-height: 1.5; text-align: center; text-wrap: pretty; }
.sheet-actions { display: grid; gap: 10px; margin-top: 18px; }
.sheet-actions.row { grid-template-columns: 1fr 1fr; }

.rs-group + .rs-group { margin-top: 16px; }
.rs-area { margin: 0 4px 8px; color: var(--ink-soft); font: 700 13px/1.2 var(--font-sans); }
.rs-list { overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--paper); }
.rs-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.rs-item + .rs-item { border-top: 1px solid var(--line-soft); }
.rs-item:disabled { opacity: 0.45; }
.radio { display: grid; place-items: center; width: 22px; height: 22px; border: 2px solid var(--line); border-radius: 50%; }
.rs-item[aria-checked="true"] { background: var(--bad-mist); }
.rs-item[aria-checked="true"] .radio { border-color: var(--bad-ink); }
.rs-item[aria-checked="true"] .radio::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--bad-ink); }
.rs-name { display: block; font: 700 15px/1.3 var(--font-sans); }
.rs-meta { display: block; margin-top: 1px; color: var(--ink-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.rs-all { margin-top: 16px; }
.sheet-sticky { position: sticky; bottom: calc(-24px - env(safe-area-inset-bottom, 0px)); margin: 18px -22px calc(-24px - env(safe-area-inset-bottom, 0px)); padding: 12px 22px calc(16px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line-soft); background: var(--bg); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 104px);
  z-index: 60;
  max-width: calc(100% - 40px);
  padding: 12px 18px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--bg);
  font: 600 15px/1.35 var(--font-sans);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── iPad em pé ───────────────────────────────────────────────── */

@media (min-width: 744px) {
  :root { --gutter: 40px; --content-w: 680px; --bar-h: 84px; --top-h: 148px; }

  .title { font-size: 56px; }
  .lead { font-size: 17px; }
  .home { gap: 26px; padding-top: calc(56px + env(safe-area-inset-top, 0px)); }
  .home-side, .home-main { gap: 26px; }
  .choices-even .choice { min-height: 54px; font-size: 15px; }
  .sim { padding: 28px 30px 24px; }
  .sim-name { font-size: 38px; }
  .sim-desc { font-size: 16px; }
  .area-name { font-size: 30px; }
  .topic { grid-template-columns: 56px minmax(0, 1fr) 18px; gap: 18px; padding: 18px 20px 18px 22px; }
  .week { width: 56px; height: 60px; border-radius: 17px; }
  .week b { font-size: 23px; }
  .topic-name { font-size: 17px; }
  .topic-meta { font-size: 14px; }
  .dot { height: 7px; }
  .dots { gap: 4px; }

  .quiz-top { padding-top: calc(14px + env(safe-area-inset-top, 0px)); padding-bottom: 14px; }
  .quiz-title strong { font-size: 16px; }
  .quiz-title span { font-size: 14px; }
  .step { width: 40px; height: 40px; font-size: 14px; }
  .steps { gap: 8px; }

  .quiz { padding-top: 14px; }
  .quiz-chips { margin: 12px 0 20px; }
  .chip { padding: 6px 14px; font-size: 14px; }
  .stem p, .stem ol { margin-bottom: 16px; font-size: 19px; line-height: 1.7; }
  .tbl { font-size: 16px; }
  .command { margin: 10px 0 20px; font-size: 28px; }
  .options { gap: 12px; }
  .option-row { grid-template-columns: minmax(0, 1fr) 56px; }
  .option { grid-template-columns: 40px minmax(0, 1fr); gap: 16px; min-height: 70px; padding: 16px 4px 16px 16px; }
  .letter { width: 40px; height: 40px; font-size: 16px; }
  .option-body { padding-top: 7px; }
  .option-text { font-size: 18px; }
  .cut, .status { width: 56px; height: 70px; }
  .why { font-size: 16.5px; }
  .feedback-title { font-size: 25px; }
  .feedback-sub { font-size: 15px; }
  .summary { padding: 24px 26px 22px; }
  .summary-title { font-size: 25px; }
  .summary p { font-size: 17px; }

  .quiz-bar { padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); }
  .quiz-bar-inner { max-width: 520px; gap: 16px; }
  .quiz-bar .icon-btn { width: 52px; height: 52px; }
  .quiz-bar .btn { min-height: 56px; font-size: 17px; }

  .results { gap: 22px; padding-top: calc(56px + env(safe-area-inset-top, 0px)); }
  .score-num { font-size: 112px; }
  .results-actions { justify-self: center; width: 100%; max-width: 520px; }

  /* painéis viram janelas centralizadas, como no iPadOS */
  .sheet-layer { justify-content: center; padding: 24px; }
  .sheet { max-width: 540px; max-height: 100%; border-radius: 28px; animation-name: sheet-in; }
  .grabber { display: none; }
  .sheet-head { padding-top: 14px; }
  .sheet-body { padding-bottom: 24px; }
  .sheet-sticky { bottom: -24px; margin-bottom: -24px; padding-bottom: 18px; border-radius: 0 0 28px 28px; }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px) scale(0.98); } }

/* ── iPad deitado ─────────────────────────────────────────────── */

@media (min-width: 1100px) {
  :root { --content-w: 1080px; --side-w: 400px; --col-gap: 48px; --top-h: 84px; }

  .home { grid-template-columns: var(--side-w) minmax(0, 1fr); column-gap: var(--col-gap); align-items: start; padding-top: calc(48px + env(safe-area-inset-top, 0px)); }
  .home-main { padding-top: 6px; }
  .title { font-size: 46px; }
  .choices-row { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; }
  .topic:hover { background: var(--bg); }

  /* cabeçalho da questão numa linha só, para sobrar altura */
  .quiz-top {
    display: grid;
    grid-template-columns: auto minmax(150px, auto) minmax(0, 1fr) auto;
    grid-template-areas: "close title steps fav" "progress progress progress progress";
    align-items: center;
    column-gap: 20px;
    padding-bottom: 0;
  }
  .quiz-head { display: contents; }
  .quiz-head > :first-child { grid-area: close; }
  .quiz-head > :last-child { grid-area: fav; }
  .quiz-title { grid-area: title; justify-items: start; max-width: 260px; text-align: left; }
  .steps { grid-area: steps; margin: 0; padding: 3px 4px; scroll-padding-inline: 30%; }
  .progress { grid-area: progress; margin: 14px 0 0; }

  /* enunciado fixo à esquerda; alternativas, comentários e resumo à direita */
  .quiz { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--col-gap); align-items: start; padding-top: 26px; }
  .q-left {
    position: sticky;
    top: calc(var(--top-h) + 26px + env(safe-area-inset-top, 0px));
    max-height: calc(100dvh - var(--top-h) - 26px - env(safe-area-inset-top, 0px) - var(--bar-h) - env(safe-area-inset-bottom, 0px) - 24px);
    margin: 0 -14px;
    padding: 0 14px 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .q-left > .quiz-chips { margin-top: 0; }
  .stem p, .stem ol { font-size: 18.5px; }
  .command { font-size: 26px; }
  .option-text { font-size: 17px; }
  .why { font-size: 16px; }
  .feedback { scroll-margin-top: calc(var(--top-h) + 30px); }

  .quiz-bar-inner { max-width: var(--content-w); padding-left: calc(50% + var(--col-gap) / 2); }
  .quiz-bar .btn { flex: 1 1 auto; }

  .results {
    grid-template-columns: 400px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "side main" "actions main";
    column-gap: var(--col-gap);
    align-items: start;
    padding-top: calc(48px + env(safe-area-inset-top, 0px));
  }
  .results-side { grid-area: side; }
  .results-main { grid-area: main; }
  .results-actions { grid-area: actions; max-width: none; }
  .sec-title { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .pulse-beam { stroke-dasharray: none; }
}
