/* Mediciner — cores do logo (azul profundo → verde-água), estrutura suave inspirada no Notinhas. */

: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;
  --ok-soft: #b3e0d7;
  --bad: #e07b70;
  --bad-ink: #a3443c;
  --bad-mist: #fbe6e2;
  --bad-soft: #f2c4bd;

  --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-float: 0 12px 40px -12px rgba(18, 50, 74, 0.32);
  --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;
  --home-pad: 28px;
  --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;
    --ok-soft: #1f4f47;
    --bad: #ef8e84;
    --bad-ink: #f29a90;
    --bad-mist: #3a2123;
    --bad-soft: #5c3034;

    --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-float: 0 12px 40px -12px 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;
}
body.has-sheet { overflow: hidden; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }

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 e da bateria: uma faixa da cor do fundo cobre essa
   área (na questão, o cabeçalho fixo já faz isso) */
body::before { content: ''; position: fixed; top: 0; right: 0; left: 0; z-index: 30; height: env(safe-area-inset-top); background: var(--bg); pointer-events: none; }
body:has(.quiz-top)::before { display: none; }

/* ── Base de layout ───────────────────────────────────────────── */

.app {
  max-width: calc(var(--content-w) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}
.view { animation: view-in 0.24s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }

.title {
  margin: 0;
  font: italic 400 42px/1.06 var(--font-display);
  letter-spacing: -0.015em;
}
.eyebrow { margin: 0; color: var(--ink-soft); font: 500 15px/1.3 var(--font-sans); }
.micro { margin: 0; color: var(--ink-soft); font: 600 12px/1.2 var(--font-sans); text-transform: uppercase; letter-spacing: 0.16em; }

.card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: var(--shadow-card);
}
.card-title { margin: 0 0 12px; font: italic 400 24px/1.15 var(--font-display); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  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);
}
.chip-brand { border-color: transparent; background: var(--brand-mist); color: var(--brand-ink); }
.chip-ai { border-color: transparent; background: var(--grad-soft); color: var(--brand-ink); }

/* ── Botões ───────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 24px;
  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 { cursor: default; 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; }

.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;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn[aria-disabled="true"] { opacity: 0.35; pointer-events: none; box-shadow: none; }

/* ── Espera ───────────────────────────────────────────────────── */

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.pulse { display: block; flex: none; width: 52px; height: 20px; 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; } }
.btn .pulse { width: 42px; height: 16px; }
.btn .pulse-base { opacity: 0.3; }
.btn .pulse-beam { stroke: currentColor; }
.btn:disabled:has(.pulse) { opacity: 1; cursor: progress; }
.level-go .pulse { width: 36px; height: 14px; margin-right: 6px; }
.review-loading { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); }
@media (prefers-reduced-motion: reduce) { .pulse-beam { stroke-dasharray: none; } }

/* ── Entrada ──────────────────────────────────────────────────── */

.login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: calc(40px + env(safe-area-inset-top)) 0 calc(40px + env(safe-area-inset-bottom));
  text-align: center;
}
.logo {
  display: block;
  width: 104px;
  height: 104px;
  border-radius: 30px;
  background: #fff;
  box-shadow: 0 18px 44px -18px rgba(31, 107, 145, 0.55), 0 0 0 1px rgba(18, 50, 74, 0.05);
}
.wordmark {
  margin: 28px 0 0;
  padding: 0 6px 8px;
  font: italic 400 58px/1 var(--font-display);
  letter-spacing: -0.02em;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline { margin: 6px 0 0; color: var(--ink-soft); font-size: 16px; }
.login-form { width: 100%; max-width: 360px; margin-top: 44px; }
.login-form .micro { margin-bottom: 14px; }
.field {
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  font: 500 18px/1.2 var(--font-sans);
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field::placeholder { color: var(--ink-faint); }
.field:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 4px var(--brand-mist); }
.form-error { min-height: 22px; margin: 10px 0 12px; color: var(--bad-ink); font: 600 14px/1.4 var(--font-sans); }
.fine { margin: 16px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
.made { margin: 32px 0 0; color: var(--ink-soft); font-size: 14px; text-align: center; }

.heart {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  vertical-align: -0.14em;
  background: var(--grad-brand);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 20.6c-.3 0-.6-.1-.8-.3C6.3 16 3 13 3 9.1 3 6.3 5.2 4 8 4c1.6 0 3.1.8 4 2.1C12.9 4.8 14.4 4 16 4c2.8 0 5 2.3 5 5.1 0 3.9-3.3 6.9-8.2 11.2-.2.2-.5.3-.8.3z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 20.6c-.3 0-.6-.1-.8-.3C6.3 16 3 13 3 9.1 3 6.3 5.2 4 8 4c1.6 0 3.1.8 4 2.1C12.9 4.8 14.4 4 16 4c2.8 0 5 2.3 5 5.1 0 3.9-3.3 6.9-8.2 11.2-.2.2-.5.3-.8.3z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.eyebrow .heart { animation: beat 1.1s ease-in-out 0.35s both; }
@keyframes beat { 0%, 44%, 100% { transform: scale(1); } 18% { transform: scale(1.32); } 32% { transform: scale(1.08); } }

.who { display: grid; gap: 14px; width: 100%; max-width: 380px; margin-top: 28px; text-align: left; }
.who-name { margin: 0; font: italic 400 26px/1.15 var(--font-display); }
.who-meta { margin: 4px 0 16px; color: var(--ink-soft); font-size: 14px; }
.who-actions { display: grid; justify-items: center; gap: 2px; margin-top: 6px; }

/* ── Escolha da dificuldade ───────────────────────────────────── */

.home { padding: calc(var(--home-pad) + env(safe-area-inset-top)) 0 calc(40px + env(safe-area-inset-bottom)); }
.home-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.home-summary { margin: 12px 0 0; color: var(--ink-soft); font-size: 15px; }
.levels { display: grid; gap: 16px; margin-top: 28px; }

.level { display: block; padding: 24px 22px 18px; transition: transform 0.14s ease; }
.level:has(.level-link:active) { transform: scale(0.985); }
.level-link { color: inherit; }
.level-link::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.level-link:focus-visible { outline: none; }
.level:has(.level-link:focus-visible) { outline: 3px solid var(--brand-2); outline-offset: 2px; }
.level-rounds { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.level-rounds .chip svg.i, .round-switch .chip svg.i { width: 15px; height: 15px; stroke-width: 2.6; }
.level::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--level-grad); }
.level-facil { --level-grad: linear-gradient(90deg, #67bcb8, #2e919b); }
.level-medio { --level-grad: linear-gradient(90deg, #3e97b2, #2e919b); }
.level-dificil { --level-grad: linear-gradient(90deg, #1f6b91, #3e97b2); }
.level-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.level-name { margin: 0; font: italic 400 32px/1.05 var(--font-display); }
.level-desc { margin: 6px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.45; }
.score { display: flex; align-items: baseline; gap: 2px; white-space: nowrap; }
.score-num { font: 500 38px/1 var(--font-display); letter-spacing: -0.03em; }
.score-den { color: var(--ink-faint); font: 500 17px/1 var(--font-display); }
.dots { display: flex; gap: 5px; margin: 18px 0 14px; }
.dot { flex: 1; height: 6px; border-radius: 999px; background: var(--bg-deep); }
.dot.is-right { background: var(--ok); }
.dot.is-wrong { background: var(--bad); }
.level-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink-soft); font: 600 14px/1.3 var(--font-sans); }
.level-go { display: inline-flex; align-items: center; gap: 2px; color: var(--brand-ink); font-weight: 700; }
.level-go svg.i { width: 18px; height: 18px; }

.subjects { display: grid; gap: 16px; margin-top: 28px; }
.subject { display: block; padding: 24px 22px 18px; transition: transform 0.14s ease; }
.subject:active { transform: scale(0.985); }
.subject::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--grad-brand); }
.subject-levels { display: grid; gap: 9px; margin: 16px 0 14px; }
.subject-level { display: grid; grid-template-columns: 58px minmax(0, 1fr) 38px; align-items: center; gap: 10px; color: var(--ink-soft); font: 600 13px/1.2 var(--font-sans); }
.subject-level .dots { gap: 3px; margin: 0; }
.subject-level .dot { height: 6px; }
.subject-count { text-align: right; }
.back-link { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin-left: -6px; padding-right: 8px; color: var(--brand-ink); font: 700 15px/1 var(--font-sans); }
.home-top + .eyebrow { margin-bottom: 6px; }

/* ── Questão ──────────────────────────────────────────────────── */

.quiz-top {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0 calc(-1 * max(var(--gutter), env(safe-area-inset-left)));
  padding: calc(10px + env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 12px max(var(--gutter), env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 84%, 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: 3px; text-align: center; }
.quiz-title strong { font: 700 15px/1.2 var(--font-sans); }
.icon-spacer { width: 44px; height: 44px; flex: none; }

.progress { height: 5px; margin: 14px 0 12px; 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: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; }
.step {
  display: grid;
  place-items: center;
  justify-self: center;
  width: 100%;
  max-width: 34px;
  aspect-ratio: 1;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-soft);
  font: 700 12px/1 var(--font-sans);
  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) + 40px + env(safe-area-inset-bottom)); }
.quiz-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.stem p { margin: 0 0 14px; font-size: 17px; line-height: 1.65; text-wrap: pretty; }
.items { margin: 4px 0 16px; padding: 16px 18px 4px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--paper); }
.items p { margin: 0 0 12px; font-size: 16px; line-height: 1.6; text-wrap: pretty; }
.items .items-sep { margin: 2px 0 12px; color: var(--ink-soft); font: 700 13px/1 var(--font-sans); letter-spacing: 0.16em; text-align: center; }
.items .items-head { margin: 6px 0 8px; color: var(--ink-soft); font: 700 12px/1.3 var(--font-sans); letter-spacing: 0.14em; text-transform: uppercase; }
.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; }
.option {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  width: 100%;
  padding: 14px 16px 14px 14px;
  border: 1.5px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 6px 18px -14px rgba(18, 50, 74, 0.35);
  transition: border-color 0.15s, background-color 0.15s, transform 0.12s;
}
button.option:active { transform: scale(0.985); }
.letter {
  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);
}
.option-text { padding-top: 5px; font-size: 16px; line-height: 1.5; }
.option[aria-pressed="true"] { border-color: var(--brand-2); background: var(--brand-mist); }
.option[aria-pressed="true"] .letter { background: var(--grad-button); color: var(--on-brand); }
.option.is-right { border-color: var(--ok); background: var(--ok-mist); }
.option.is-right .letter { background: var(--ok); color: #fff; }
.option.is-wrong { border-color: var(--bad); background: var(--bad-mist); }
.option.is-wrong .letter { background: var(--bad); color: #fff; }
.option.is-muted { box-shadow: none; }
.option.is-muted .option-text, .option.is-muted .letter { opacity: 0.6; }
.option-tag { display: flex; align-items: center; gap: 4px; margin-top: 8px; font: 700 13px/1.2 var(--font-sans); }
.option.is-right .option-tag { color: var(--ok-ink); }
.option.is-wrong .option-tag { color: var(--bad-ink); }
.option-tag svg.i { width: 16px; height: 16px; stroke-width: 2.6; }

.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tool {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: 600 14px/1 var(--font-sans);
}
.tool svg.i { width: 18px; height: 18px; color: var(--brand-ink); }
.side-note { display: none; }

.hint { margin-top: 14px; padding: 16px 18px; border-radius: var(--radius-lg); background: var(--grad-soft); scroll-margin: 170px 0 calc(var(--bar-h) + 24px); }
.hint .micro { margin-bottom: 6px; color: var(--brand-ink); }
.hint p:last-child { margin: 0; line-height: 1.55; }

.feedback { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding: 16px 18px; border-radius: var(--radius-lg); scroll-margin-top: 170px; }
.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); }

.explain { margin-top: 16px; }
.explain p { margin: 0 0 12px; font-size: 16px; line-height: 1.62; text-wrap: pretty; }
.explain p strong { color: var(--brand-ink); }
.explain .btn-text { margin: 6px -8px 0; }

.quiz-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  padding: 18px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: linear-gradient(to top, var(--bg) 60%, color-mix(in srgb, var(--bg) 0%, transparent));
}
.quiz-bar-inner { display: flex; align-items: center; gap: 12px; max-width: 480px; margin: 0 auto; }
.quiz-bar .btn { flex: 1; }

/* ── Análise ──────────────────────────────────────────────────── */

.results { display: grid; gap: 16px; padding: 12px 0 calc(48px + env(safe-area-inset-bottom)); }
.results-overview, .results-detail { display: grid; gap: 16px; }
.results .title { margin: 6px 0 4px; }
.score-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 20px; }
.ring { position: relative; width: 124px; height: 124px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--bg-deep); stroke-width: 11; }
.ring-value { fill: none; stroke: url(#ring-grad); stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(0.3, 0.8, 0.3, 1); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label .score-num { font-size: 36px; }
.verdict { margin: 0; font: italic 400 26px/1.1 var(--font-display); }
.verdict-sub { margin: 6px 0 12px; color: var(--ink-soft); font-size: 15px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; 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%; }
.legend .is-right { background: var(--ok); }
.legend .is-wrong { background: var(--bad); }

.areas { display: grid; gap: 14px; }
.area-row { display: grid; gap: 7px; }
.area-top { display: flex; justify-content: space-between; gap: 12px; font: 600 14px/1.3 var(--font-sans); }
.area-top span:last-child { color: var(--ink-soft); }
.bar { height: 10px; border-radius: 999px; background: var(--bg-deep); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--grad-brand); }

.review::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--grad-brand); }
.review-summary { margin: 0 0 14px; line-height: 1.55; }
.review-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.review-list li { display: grid; gap: 3px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--grad-soft); }
.review-list strong { color: var(--brand-ink); font-size: 15px; }
.review-list span { font-size: 15px; line-height: 1.5; }
.skeleton { height: 14px; margin: 10px 0; border-radius: 999px; background: linear-gradient(90deg, var(--bg-deep), var(--line-soft), var(--bg-deep)); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.skeleton.w-80 { width: 80%; }
.skeleton.w-60 { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.section-title { margin: 14px 0 -2px; font: italic 400 26px/1.1 var(--font-display); }
.miss { display: grid; gap: 10px; }
.miss-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.miss-num { color: var(--ink-soft); font: 700 13px/1 var(--font-sans); white-space: nowrap; }
.miss-line { margin: 0; font-size: 15px; line-height: 1.5; }
.miss-line .is-wrong { color: var(--bad-ink); font-weight: 700; }
.miss-line .is-right { color: var(--ok-ink); font-weight: 700; }
.miss-why { margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.55; }
.miss .btn-text { justify-self: start; margin-left: -8px; }
.good { display: flex; flex-wrap: wrap; gap: 8px; }
.good .chip { border-color: transparent; background: var(--ok-mist); color: var(--ok-ink); }

.results-actions { display: grid; gap: 10px; margin-top: 10px; }
.results-note { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.45; text-align: center; }
.gen-card { display: grid; gap: 12px; padding: 22px; }
.gen-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.gen-title { margin: 0; font: italic 400 22px/1.15 var(--font-display); }
.gen-pct { margin: 0; font: 500 32px/1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.gen-progress { height: 8px; border-radius: 999px; background: var(--bg-deep); overflow: hidden; }
.gen-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--grad-brand); transition: width 0.5s ease; }
/* antes da primeira questão ficar pronta, a barra mostra atividade em vez de 0% parado */
.gen-progress.is-waiting > span { width: 32% !important; animation: gen-wait 1.4s ease-in-out infinite; }
@keyframes gen-wait { from { transform: translateX(-100%); } to { transform: translateX(320%); } }
.gen-count { margin: 0; font: 600 14px/1.3 var(--font-sans); }
.gen-note { display: flex; align-items: center; gap: 12px; margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.gen-note .pulse { width: 44px; height: 18px; }
.round-switch { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.round-switch .chip[aria-current="page"] { border-color: transparent; background: var(--grad-button); color: var(--on-brand); }

/* ── 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));
  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);
}
.sheet:focus { outline: none; }
.sheet-chat { height: calc(100% - 16px - env(safe-area-inset-top)); }
.sheet-layer.is-instant .sheet, .sheet-layer.is-instant .scrim { animation: none; }
@keyframes rise { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
.grabber { width: 40px; height: 5px; margin: 10px auto 2px; border-radius: 999px; background: var(--line); }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 4px 12px 8px; }
.sheet-head .btn-text { justify-self: start; color: var(--ink-soft); }
.sheet-title { margin: 0; font: italic 400 22px/1.2 var(--font-display); text-align: center; }
.sheet-sub { margin: -2px 20px 10px; color: var(--ink-soft); font-size: 14px; text-align: center; }
.sheet-body { padding: 4px 24px calc(28px + env(safe-area-inset-bottom)); overflow-y: auto; }
.sheet-body p { margin: 0; line-height: 1.55; }
.sheet-actions { display: grid; gap: 10px; margin-top: 22px; }

.chat-log { display: flex; flex: 1; flex-direction: column; gap: 14px; padding: 14px 20px; overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--line-soft); }
.chat-intro { margin: 2px 0 0; color: var(--ink-soft); line-height: 1.5; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chat-chips .chip { min-height: 40px; color: var(--ink); cursor: pointer; }
.msg-user { align-self: flex-end; max-width: 86%; padding: 10px 15px; border-radius: 20px 20px 6px 20px; background: var(--grad-button); color: var(--on-brand); }
.msg-user p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-model { align-self: stretch; padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: 20px 20px 20px 6px; background: var(--paper); line-height: 1.58; overflow-wrap: anywhere; }
.msg-model p { margin: 0 0 8px; }
.msg-model ul, .msg-model ol { margin: 0 0 8px; padding-left: 20px; }
.msg-model li { margin: 3px 0; }
.msg-model > :last-child { margin-bottom: 0; }
.msg-model strong { color: var(--brand-ink); }
.chat-error { margin: 0; color: var(--bad-ink); font: 600 14px/1.4 var(--font-sans); }
.thinking { display: flex; padding: 2px 0; }
.thinking .pulse { width: 84px; height: 32px; }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)) 16px; border-top: 1px solid var(--line-soft); }
.sheet-layer.kb-open .composer { padding-bottom: 10px; }
.composer textarea {
  flex: 1;
  min-height: 48px;
  max-height: 132px;
  padding: 13px 16px;
  border: 1.5px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  font: 500 16px/1.35 var(--font-sans);
  overflow-y: hidden;
  resize: none;
}
.composer textarea:focus { outline: none; border-color: var(--brand-2); }
.send { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--grad-button); color: var(--on-brand); }
.send:disabled { opacity: 0.4; }


/* ── Rodadas com IA ───────────────────────────────────────────── */

.ai-home { margin-top: 26px; }
.ai-home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ai-home-title { display: inline-flex; align-items: center; gap: 8px; margin: 0; font: italic 400 24px/1.1 var(--font-display); }
.ai-home-title svg.i { width: 20px; height: 20px; color: var(--brand-ink); }
.ai-home-head .btn-text { margin-right: -8px; }
.ai-list { padding-top: 4px; padding-bottom: 4px; }
.ai-round { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 0; }
.ai-round + .ai-round { border-top: 1px solid var(--line-soft); }
.ai-round-main { display: grid; gap: 3px; }
.ai-round-title { font: 600 15px/1.3 var(--font-sans); }
.ai-round-meta { color: var(--ink-soft); font-size: 13px; line-height: 1.35; }
.ai-round-bar { display: block; height: 5px; margin-top: 5px; border-radius: 999px; background: var(--bg-deep); overflow: hidden; }
.ai-round-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--grad-brand); transition: width 0.5s ease; }
.ai-round-go { display: inline-flex; align-items: center; gap: 2px; color: var(--brand-ink); font: 700 14px/1 var(--font-sans); white-space: nowrap; }
.ai-round-go svg.i { width: 18px; height: 18px; }
.ai-round > .pulse { width: 40px; height: 16px; color: var(--brand-ink); }
.ai-rounds .section-title { margin: 30px 0 12px; }
.ai-empty-cta { margin-top: 24px; }
.ai-tag { display: inline-flex; align-items: center; gap: 4px; justify-self: start; max-width: 100%; margin: 2px 0 1px; padding: 3px 9px; border-radius: 999px; background: var(--brand-mist); color: var(--brand-ink); font: 600 12px/1.25 var(--font-sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-tag svg.i { flex: none; width: 13px; height: 13px; stroke-width: 2.4; }
/* numa caixa flex, as reticências precisam estar no próprio texto */
.ai-tag-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.results > .ai-tag { margin: -2px 0 4px; font-size: 13px; }
.ai-create { width: 100%; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
.ai-create .ai-round-title { display: inline-flex; align-items: center; gap: 6px; color: var(--brand-ink); }
.ai-create .ai-round-title svg.i { width: 18px; height: 18px; stroke-width: 2.4; }
.ai-create-cta { margin-top: 20px; }
.results-custom { justify-self: center; font-size: 14px; }
.results-redo { justify-self: center; gap: 6px; margin-top: 4px; font-size: 14px; }
.results-redo svg.i { width: 17px; height: 17px; }

/* tentativas de uma rodada refeita: uma barra por vez, a atual em destaque */
.attempts-summary { margin: -4px 0 16px; color: var(--ink-soft); font-size: 15px; }
.attempts-bars { display: flex; align-items: flex-end; gap: 14px; }
.attempt { display: grid; flex: 1; justify-items: center; gap: 6px; max-width: 76px; }
.attempt-score { font: 500 22px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.attempt-score small { color: var(--ink-faint); font: 600 12px/1 var(--font-sans); }
.attempt-bar { position: relative; width: 100%; height: 76px; overflow: hidden; border-radius: 14px; background: var(--bg-deep); }
.attempt-bar > span { position: absolute; right: 0; bottom: 0; left: 0; background: var(--brand-soft); transform-origin: 50% 100%; }
.attempt.is-current .attempt-bar > span { background: linear-gradient(to top, var(--brand), var(--teal) 62%, var(--mint)); }
.view .attempt-bar > span { animation: attempt-grow 0.7s cubic-bezier(0.3, 0.8, 0.3, 1) both; }
.view .attempt.is-current .attempt-bar > span { animation-delay: 0.15s; }
@keyframes attempt-grow { from { transform: scaleY(0); } }
.attempt-label { color: var(--ink-soft); font: 600 13px/1.2 var(--font-sans); }
.attempt.is-current .attempt-label { color: var(--ink); }
.study-cta { margin-top: 16px; }

/* painel "Nova rodada" */
.create-form { display: grid; gap: 22px; }
.mode-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 10px; padding: 14px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-md); background: var(--paper); color: var(--ink); text-align: left; transition: border-color 0.15s ease, background 0.15s ease; }
.mode svg.i { width: 20px; height: 20px; margin-top: 1px; color: var(--brand-ink); }
.mode strong { display: block; font: 700 15px/1.2 var(--font-sans); }
.mode small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 12.5px; line-height: 1.3; }
.mode[aria-checked="true"] { border-color: var(--brand-2); background: var(--brand-mist); }
.create-field { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.create-field legend, .create-label { margin: 0 0 10px; padding: 0; font: 700 15px/1.2 var(--font-sans); }
.create-field legend span { color: var(--ink-soft); font-weight: 500; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices-even { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice { min-height: 42px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font: 600 14px/1.2 var(--font-sans); transition: background 0.15s ease, color 0.15s ease; }
.choice[aria-pressed="true"] { border-color: transparent; background: var(--grad-button); color: var(--on-brand); }
.topic-area { margin: 6px 0 -2px; color: var(--ink-soft); font: 600 13px/1.2 var(--font-sans); }
.disclosure { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 12px 14px 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); color: var(--ink); text-align: left; }
.disclosure-label { display: inline-flex; align-items: baseline; gap: 6px; font: 700 15px/1.2 var(--font-sans); }
.disclosure-label small { color: var(--ink-soft); font: 500 13px/1.2 var(--font-sans); }
.disclosure-value { overflow: hidden; color: var(--ink-soft); font: 500 14px/1.3 var(--font-sans); text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.disclosure-value.is-set { color: var(--brand-ink); font-weight: 600; }
.disclosure svg.i { width: 18px; height: 18px; color: var(--ink-soft); transition: transform 0.2s ease; }
.disclosure[aria-expanded="true"] svg.i { transform: rotate(180deg); }
.disclosure-body { display: grid; gap: 10px; padding-top: 4px; animation: fade-in 0.18s ease-out; }
.create-hint { margin: 0; color: var(--ink-soft); font-size: 13.5px; line-height: 1.5; }
.create-hint .btn-text { min-height: 0; padding: 0; font-size: 13.5px; }
.create-detail { display: grid; gap: 8px; margin-top: 4px; color: var(--ink-soft); font: 600 13.5px/1.3 var(--font-sans); }
.sheet-create .weak-list { margin: -6px 0 0; }
.sheet-create .weak-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 0; }
.create-form [data-topic] { min-height: 36px; padding: 7px 12px; font-size: 13.5px; }
.sheet-create .form-error:empty { display: none; }
.create-note { margin: -12px 0 0; color: var(--ink-soft); font-size: 12.5px; text-align: center; }

.gen-check { display: grid; place-items: center; min-width: 36px; height: 36px; padding: 0 8px; border-radius: 999px; background: var(--ok-mist); color: var(--ok-ink); font: 700 14px/1 var(--font-sans); }
.gen-check svg.i { width: 20px; height: 20px; stroke-width: 2.6; }

/* ── Perfil ───────────────────────────────────────────────────── */

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--grad-button);
  color: var(--on-brand);
  font: italic 400 22px/1 var(--font-display);
  box-shadow: var(--shadow-card);
}
.avatar-link { display: block; flex: none; border-radius: 50%; transition: transform 0.12s ease; }
.avatar-link:active { transform: scale(0.94); }
.avatar-lg { width: 116px; height: 116px; font-size: 54px; box-shadow: var(--shadow-float); }
.who-head { display: flex; align-items: center; gap: 12px; }
.who-head .avatar { width: 48px; height: 48px; }

.profile-head { display: grid; justify-items: center; gap: 10px; margin: 0 0 26px; text-align: center; }
/* a foto inteira é o rótulo do seletor de arquivo: o toque abre câmera ou galeria no celular e o explorador no computador */
.profile-photo { position: relative; display: block; border-radius: 50%; cursor: pointer; transition: transform 0.12s ease; }
.profile-photo:active { transform: scale(0.97); }
.profile-photo:has(.file-input:focus-visible) { outline: 3px solid var(--brand-2); outline-offset: 4px; }
.photo-edit { position: absolute; right: -2px; bottom: 2px; display: grid; place-items: center; width: 38px; height: 38px; border: 3px solid var(--bg); border-radius: 50%; background: var(--grad-button); color: var(--on-brand); box-shadow: var(--shadow-card); }
.photo-edit svg.i { width: 19px; height: 19px; }
.photo-busy { position: absolute; inset: 0; display: none; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--paper) 72%, transparent); }
.profile-photo.is-busy .photo-busy { display: grid; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.btn-text.is-danger { color: var(--bad-ink); }

.profile .section-title { margin: 34px 0 14px; }
.profile-stack { display: grid; gap: 16px; margin-top: 22px; }
.profile-subjects { display: grid; gap: 12px; }
.profile-subject { display: grid; gap: 9px; padding: 18px 20px; transition: transform 0.14s ease; }
.profile-subject:active { transform: scale(0.985); }
.profile-meta { margin: 0; color: var(--ink-soft); font-size: 13px; }
.evolution { padding-top: 8px; padding-bottom: 8px; }
.evolution-row { display: grid; gap: 3px; padding: 12px 0; font: 600 14px/1.35 var(--font-sans); }
.evolution-row span:last-child { color: var(--ink-soft); font-weight: 500; }
.evolution-row strong { color: var(--brand-ink); }
.evolution-row + .evolution-row { border-top: 1px solid var(--line-soft); }
.weak-slot { display: contents; }
.weak-list { margin: 0; padding: 0; list-style: none; }
.weak-list a { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 12px 0; }
.weak-list li + li { border-top: 1px solid var(--line-soft); }
.weak-list svg.i { width: 18px; height: 18px; color: var(--ink-faint); }
.weak-topic { font: 600 15px/1.3 var(--font-sans); }
.weak-meta { color: var(--ink-soft); font-size: 13px; white-space: nowrap; }
.card > .weak-list:first-child { margin: -12px 0; }
.round-scores { display: flex; flex-wrap: wrap; gap: 6px; }
.profile-actions { display: grid; justify-items: center; gap: 4px; margin-top: 34px; }
.profile-cta { margin-top: 28px; }

/* ── Aviso ────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 70;
  width: max-content;
  max-width: calc(100% - 40px);
  padding: 13px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font: 600 14px/1.35 var(--font-sans);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
body:has(.quiz-bar) .toast { bottom: calc(var(--bar-h) + 20px + env(safe-area-inset-bottom)); }

/* ── Desempenho ────────────────────────────────────────────────── */

/* com três dígitos, o total do anel fica embaixo do número */
.ring-label.is-stacked .score { display: grid; justify-items: center; gap: 5px; }
.ring-label.is-stacked .score-num { font-size: 33px; }
.ring-label.is-stacked.is-long .score-num { font-size: 26px; }
.ring-label.is-stacked .score-den { font: 600 12px/1 var(--font-sans); letter-spacing: 0.01em; }

.score-card.is-tappable { transition: transform 0.14s ease; }
.score-card.is-tappable:active { transform: scale(0.985); }
.card-hit { position: absolute; inset: 0; z-index: 1; width: 100%; border: 0; border-radius: inherit; background: none; }
.card-hit:focus-visible { outline-offset: -4px; }

/* faixa do cartão do perfil: traçado dos últimos 7 dias */
.pulse-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 2px -22px -22px;
  padding: 13px 16px 14px 20px;
  border-top: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--brand-mist) 50%, var(--paper));
}
.pulse-row > svg.i { width: 18px; height: 18px; color: var(--ink-faint); }
.mini-trace { display: block; width: 96px; height: 34px; }
.pulse-text { display: grid; gap: 3px; min-width: 0; margin: 0; }
.pulse-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--ink-soft); font: 600 13.5px/1.2 var(--font-sans); }
.pulse-main strong { color: var(--ink); font: 500 19px/1 var(--font-display); letter-spacing: -0.02em; }
.pulse-sub { color: var(--ink-faint); font: 500 12.5px/1.2 var(--font-sans); }

.grid-minor { fill: none; stroke: var(--brand); stroke-opacity: 0.1; stroke-width: 0.6; }
.grid-major { fill: none; stroke: var(--brand); stroke-opacity: 0.16; stroke-width: 0.8; }
.mini-line { fill: none; stroke: url(#mini-grad); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mini-head { fill: var(--mint); stroke: var(--paper); stroke-width: 1.6; }
.mini-flat { fill: none; stroke: var(--ink-faint); stroke-opacity: 0.5; stroke-width: 1.5; stroke-dasharray: 3 4; }

.delta { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: var(--bg-deep); color: var(--ink-soft); font: 700 12px/1.35 var(--font-sans); font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.is-up { background: var(--ok-mist); color: var(--ok-ink); }
.delta.is-down { background: var(--bad-mist); color: var(--bad-ink); }

/* painel */
.sheet-perf .sheet-body { padding-top: 6px; }
.perf { display: grid; gap: 30px; }
.perf-periods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 999px; background: var(--bg-deep); }
.perf-period { min-height: 38px; border: 0; border-radius: 999px; background: none; color: var(--ink-soft); font: 700 14px/1 var(--font-sans); transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.perf-period[aria-checked="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 4px 14px -6px rgba(18, 50, 74, 0.4); }
@media (prefers-color-scheme: dark) { .perf-period[aria-checked="true"] { background: var(--brand-soft); } }
.perf-headline { margin-top: -6px; }
.perf-figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0; }
.perf-num { font: 500 58px/0.95 var(--font-display); letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.perf-unit { color: var(--ink-soft); font: 600 15px/1.2 var(--font-sans); }
.perf-figure .delta { align-self: center; }
.perf-sub { margin: 10px 0 0; color: var(--ink-soft); font-size: 14.5px; line-height: 1.45; }
.perf-sub + .perf-sub { margin-top: 2px; }
.perf-empty { margin: 0; color: var(--ink-soft); line-height: 1.5; }
.perf-title { margin: 0 0 12px; font: italic 400 22px/1.15 var(--font-display); }
.perf-note { margin: -6px 0 8px; color: var(--ink-faint); font-size: 13px; }

.trace { padding: 12px 12px 10px; border: 1px solid var(--line-soft); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow-card); }
.trace-plot { border-radius: 14px; cursor: crosshair; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.trace-plot:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 4px; }
.trace-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.trace-mid { stroke: var(--brand); stroke-opacity: 0.28; stroke-width: 0.8; stroke-dasharray: 3 3; }
.trace-axis { fill: var(--ink-faint); font-family: var(--font-sans); font-weight: 700; }
.trace-bar { fill: var(--brand-soft); transform: scaleY(0); transform-box: fill-box; transform-origin: 50% 100%; transition: transform 0.5s cubic-bezier(0.3, 0.8, 0.3, 1) calc(var(--i) * 12ms), fill 0.15s ease; }
.trace-bar.is-selected { fill: var(--teal); }
.trace-line { fill: none; stroke: url(#trace-grad); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; stroke-dashoffset: 1; opacity: 0; transition: stroke-dashoffset 1.1s cubic-bezier(0.45, 0.05, 0.25, 1); }
.trace-dot { fill: var(--paper); stroke: var(--teal); stroke-width: 1.6; opacity: 0; transition: opacity 0.3s ease 0.8s; }
.trace-head { fill: var(--mint); stroke: var(--paper); stroke-width: 2; opacity: 0; transition: opacity 0.2s ease 1.05s; }
.trace-ping { fill: var(--mint); opacity: 0; transform-box: fill-box; transform-origin: center; }
.trace-guide { visibility: hidden; stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 2 3; }
.trace-sel { visibility: hidden; fill: var(--paper); stroke: var(--brand); stroke-width: 2.4; }
.has-selection .trace-guide, .has-selection .trace-sel { visibility: visible; }
.trace-empty { fill: var(--ink-faint); font-family: var(--font-sans); font-weight: 600; }
.trace.is-drawn .trace-bar { transform: scaleY(1); }
.trace.is-drawn .trace-line { stroke-dashoffset: 0; opacity: 1; }
.trace.is-drawn .trace-dot, .trace.is-drawn .trace-head { opacity: 1; }
.trace.is-drawn .trace-ping { animation: trace-ping 1.5s ease-out 1.15s 2; }
@keyframes trace-ping { from { opacity: 0.5; transform: scale(1); } to { opacity: 0; transform: scale(3.4); } }
.trace-dates { display: flex; justify-content: space-between; margin: 6px 9% 0 1%; color: var(--ink-faint); font: 600 11.5px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.trace-readout { min-height: 20px; margin: 12px 2px 0; color: var(--ink-soft); font: 500 14px/1.45 var(--font-sans); }
.trace-readout strong { color: var(--ink); font-weight: 700; }

.perf-subjects { display: grid; gap: 2px; margin: 0 -14px; }
.perf-subject { display: grid; gap: 8px; width: 100%; padding: 12px 14px; border: 1px solid transparent; border-radius: 18px; background: none; color: var(--ink); text-align: left; transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.25s ease; }
.perf-subject[aria-pressed="true"] { border-color: var(--line-soft); background: var(--paper); box-shadow: var(--shadow-card); }
.perf-subject.is-dim { opacity: 0.42; }
.perf-subject-top { display: flex; justify-content: space-between; gap: 12px; font: 700 15px/1.2 var(--font-sans); }
.perf-subject-pct { font-variant-numeric: tabular-nums; }
.perf-subject .bar > span { transition: width 0.75s cubic-bezier(0.3, 0.8, 0.3, 1); }
.perf-subject-meta { color: var(--ink-faint); font: 500 12.5px/1.2 var(--font-sans); }

.perf-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.perf-level { display: grid; justify-items: center; gap: 7px; text-align: center; }
.perf-level-pct { font: 500 24px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.perf-level.is-empty .perf-level-pct { color: var(--ink-faint); }
.perf-level-bar { position: relative; width: 100%; max-width: 72px; height: 88px; overflow: hidden; border-radius: 16px; background: var(--bg-deep); }
.perf-level-bar > span { position: absolute; right: 0; bottom: 0; left: 0; background: linear-gradient(to top, var(--brand), var(--teal) 62%, var(--mint)); transition: height 0.75s cubic-bezier(0.3, 0.8, 0.3, 1); }
.perf-level-name { font: 700 14px/1.2 var(--font-sans); }
.perf-level-meta { margin-top: -4px; color: var(--ink-faint); font-size: 12.5px; }

/* ── Guia rápido do primeiro acesso ────────────────────────────── */

.sheet.sheet-guide { height: calc(100% - 12px - env(safe-area-inset-top)); overflow: hidden; }

.guide-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; min-height: 52px; padding: 14px 20px 0 24px; }
.guide-progress { display: flex; gap: 6px; }
.guide-progress i { flex: 1; height: 4px; overflow: hidden; border-radius: 999px; background: var(--line); }
.guide-progress i.is-done { background: var(--brand); }
.guide-progress i.is-current { background: linear-gradient(90deg, var(--brand), var(--teal)); }
.guide-skip { color: var(--ink-soft); font-size: 15px; }

/* palco com papel de eletrocardiograma: a miniatura do site faz a demonstração aqui */
.guide-stage {
  display: grid;
  flex: 1;
  place-items: center;
  min-height: 0;
  margin: 16px 18px 0;
  padding: 22px 18px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 26px;
  background-color: var(--bg-deep);
  background-image:
    linear-gradient(color-mix(in srgb, var(--brand) 13%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--brand) 13%, transparent) 1px, transparent 1px),
    linear-gradient(color-mix(in srgb, var(--brand) 6%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--brand) 6%, transparent) 1px, transparent 1px);
  background-position: -1px -1px;
  background-size: 60px 60px, 60px 60px, 12px 12px, 12px 12px;
}
.guide-stage > * { width: 100%; max-width: 330px; }
/* em celulares altos a miniatura cresce um pouco para ocupar o palco */
.guide-stage { container-type: size; }
@container (min-height: 400px) { .guide-stage > * { zoom: 1.12; } }

.guide-copy { padding: 22px 26px 0; }
.guide-title { margin: 0; font: italic 400 30px/1.08 var(--font-display); letter-spacing: -0.01em; }
.guide-text { min-height: 4.5em; margin: 10px 0 0; color: var(--ink-soft); font-size: 16px; line-height: 1.5; }
.guide-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); }
/* com Voltar, o botão principal fica mais largo (cabe "Começar a estudar") */
.guide-actions:has(.btn-secondary) { grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr); }

/* entrada de cada etapa (acompanha o toque em Próximo ou Voltar) */
.sheet-guide[data-dir] .guide-copy, .sheet-guide[data-dir] .guide-stage > * { animation: guide-enter 0.38s cubic-bezier(0.2, 0.9, 0.25, 1) both; }
.sheet-guide[data-dir="back"] .guide-copy, .sheet-guide[data-dir="back"] .guide-stage > * { animation-name: guide-enter-back; }
@keyframes guide-enter { from { opacity: 0; transform: translateX(22px); } }
@keyframes guide-enter-back { from { opacity: 0; transform: translateX(-22px); } }

/* 1. marquinhas que se preenchem como numa rodada */
.guide-subject { padding: 22px 20px 16px; box-shadow: var(--shadow-float); }
.guide-subject .level-name { font-size: 30px; }
.is-playing .guide-subject .dot { animation: guide-dot 0.3s ease-out backwards; animation-delay: calc(0.25s + var(--i) * 42ms); }
@keyframes guide-dot { from { background: var(--bg-deep); transform: scaleY(0.3); } }

/* 2. questão: dica, alternativa marcada e correta */
.guide-question { display: grid; gap: 10px; }
.guide-stem { margin: 0 2px 4px; font-size: 15px; font-weight: 600; line-height: 1.45; }
.guide-question .option { padding: 12px 14px 12px 12px; }
.guide-question .option-text { font-size: 14px; }
.guide-question .tools { margin-top: 4px; }
.guide-question .tool { min-height: 36px; padding: 0 13px; font-size: 13px; }
.guide-pick { border-color: var(--ok); background: var(--ok-mist); }
.guide-pick .letter { background: var(--ok); color: #fff; }
.guide-pick .option-tag { color: var(--ok-ink); }
.is-playing .guide-hint { animation: guide-glow 1s ease-in-out 0.2s; }
.is-playing .guide-pick { animation: guide-pick 1.7s ease both; }
.is-playing .guide-pick .letter { animation: guide-pick-letter 1.7s ease both; }
.is-playing .guide-pick .option-tag { animation: guide-rise 0.35s ease 1.2s backwards; }
@keyframes guide-glow { 50% { border-color: var(--brand-2); box-shadow: 0 0 0 5px var(--brand-mist); } }
@keyframes guide-pick { 0%, 45% { border-color: var(--line-soft); background: var(--paper); } 55%, 68% { border-color: var(--brand-2); background: var(--brand-mist); } }
@keyframes guide-pick-letter { 0%, 45% { background: var(--bg-deep); color: var(--ink); } 55%, 68% { background: var(--brand); color: var(--on-brand); } }

/* 3. monitor: pergunta, digitando, resposta */
.guide-chat { display: grid; gap: 12px; }
.guide-chat .msg-user { justify-self: end; }
.guide-chat .msg-model { font-size: 14px; box-shadow: var(--shadow-card); }
.guide-chat .msg-model p { margin: 0; }
.guide-typing { display: none; }
.is-playing .guide-bubble-1 { animation: guide-rise 0.35s ease 0.2s backwards; }
.is-playing .guide-typing { display: flex; grid-area: 2 / 1; align-self: start; gap: 5px; width: fit-content; padding: 13px 16px; border: 1px solid var(--line-soft); border-radius: 20px 20px 20px 6px; background: var(--paper); animation: guide-typing 1.3s ease 0.55s both; }
.guide-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); animation: guide-dots 0.9s ease-in-out infinite; }
.guide-typing i:nth-child(2) { animation-delay: 0.15s; }
.guide-typing i:nth-child(3) { animation-delay: 0.3s; }
.is-playing .guide-bubble-2 { grid-area: 2 / 1; animation: guide-rise 0.4s ease 1.75s backwards; }
@keyframes guide-typing { 0% { opacity: 0; } 12%, 85% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
@keyframes guide-dots { 50% { opacity: 0.35; transform: translateY(-2px); } }

/* 4. rodada nova sendo criada, com refazer e treinar erros */
@property --guide-pct { syntax: '<integer>'; inherits: true; initial-value: 100; }
.guide-rounds { display: grid; gap: 14px; }
.guide-gen { padding: 20px; box-shadow: var(--shadow-float); }
.guide-gen .gen-title { display: flex; align-items: center; gap: 8px; font-size: 20px; }
.guide-gen .gen-title svg.i { color: var(--brand-ink); }
.guide-gen .gen-count { color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.guide-pct::after { content: counter(pct) '%'; counter-reset: pct var(--guide-pct); }
.guide-bar { width: calc(var(--guide-pct) * 1%); transition: none; }
.is-playing .guide-gen { animation: guide-count 1.9s cubic-bezier(0.3, 0.7, 0.3, 1) 0.2s both; }
@keyframes guide-count { from { --guide-pct: 0; } to { --guide-pct: 100; } }
.guide-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.guide-chips .chip { padding: 7px 13px; font-size: 13px; }
.guide-chips svg.i { width: 16px; height: 16px; }
.is-playing .guide-chips .chip { animation: guide-rise 0.35s ease backwards; }
.is-playing .guide-chips .chip:first-child { animation-delay: 2s; }
.is-playing .guide-chips .chip:last-child { animation-delay: 2.15s; }

/* 5. evolução: traçado de monitor que se desenha */
.guide-trace { padding: 18px 16px 12px; box-shadow: var(--shadow-float); }
.guide-trace-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 0 4px 10px; color: var(--ink-soft); font: 600 14px/1.2 var(--font-sans); }
.guide-trace-num { color: var(--ink); font: 500 34px/1 var(--font-display); letter-spacing: -0.03em; }
.guide-trace-top .delta { align-self: center; }
.guide-trace svg { display: block; width: 100%; height: auto; }
.guide-line { fill: none; stroke: url(#guide-grad); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; }
.guide-point { fill: var(--paper); stroke: var(--teal); stroke-width: 1.6; }
.guide-head { fill: var(--mint); stroke: var(--paper); stroke-width: 2; }
.is-playing .guide-line { animation: guide-draw 1.3s cubic-bezier(0.45, 0.05, 0.25, 1) 0.25s backwards; }
.is-playing .guide-point { animation: guide-fade 0.25s ease backwards; animation-delay: calc(0.35s + var(--i) * 140ms); }
.is-playing .guide-head { animation: guide-fade 0.2s ease 1.5s backwards, guide-ping 1.2s ease-out 1.7s 2; transform-box: fill-box; transform-origin: center; }
@keyframes guide-draw { from { stroke-dashoffset: 1; } }
@keyframes guide-ping { 50% { transform: scale(1.5); } }

@keyframes guide-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes guide-fade { from { opacity: 0; } }

/* no iPad e no computador, janela no centro */
@media (min-width: 744px) {
  .sheet.sheet-guide { max-width: 460px; height: min(100%, 800px); }
  .guide-top { padding-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .guide-stage *, .sheet-guide[data-dir] .guide-copy { animation: none !important; }
  .guide-typing { display: none !important; }
}

/* painel de desempenho no iPad em pé: número e período lado a lado, gráfico inteiro, matérias e níveis em colunas */
@media (min-width: 744px) {
  .sheet.sheet-perf { max-width: 720px; }
  .perf {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr);
    grid-template-areas: "headline periods" "chart chart" "subjects levels";
    align-items: start;
    column-gap: 36px;
    row-gap: 30px;
  }
  .perf-headline { grid-area: headline; margin-top: 0; }
  .perf-periods { grid-area: periods; }
  .perf-chart { grid-area: chart; }
  .perf-by-subject { grid-area: subjects; }
  .perf-by-level { grid-area: levels; }
  .perf-levels { gap: 10px; }
  .perf-level-bar { height: 132px; }
}

/* no computador e no iPad deitado: janela larga, gráfico à esquerda e o resto à direita, sem precisar rolar */
@media (min-width: 1100px) {
  .sheet.sheet-perf { max-width: 1060px; }
  .sheet-perf .sheet-head { padding: 18px 28px 6px; }
  .sheet-perf .sheet-body { padding: 10px 36px 34px; }
  .perf {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    grid-template-areas: "headline periods" "chart subjects" "chart levels";
    column-gap: 48px;
    row-gap: 26px;
  }
  .perf-num { font-size: 68px; }
  .perf-chart { align-self: start; }
  .perf-level-bar { height: 96px; }
  .perf-subject:hover:not([aria-pressed="true"]) { background: var(--bg-deep); }
  .perf-period:hover:not([aria-checked="true"]) { color: var(--ink); }
}

/* iPad deitado (1180 x 820) e notebooks baixos: matérias em duas colunas e tudo um pouco mais compacto, sem rolar */
@media (min-width: 1100px) and (max-height: 900px) {
  .sheet-perf .sheet-head { padding-top: 12px; }
  .sheet-perf .sheet-body { padding-top: 4px; padding-bottom: 24px; }
  .perf { row-gap: 20px; }
  .perf-num { font-size: 56px; }
  .perf-sub { margin-top: 6px; }
  .perf-title { margin-bottom: 8px; }
  .perf-subjects { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 6px; }
  .perf-level-bar { height: 76px; }
}

/* ── iPad em pé ───────────────────────────────────────────────── */

@media (min-width: 744px) {
  :root { --gutter: 40px; --content-w: 680px; --home-pad: 56px; --bar-h: 84px; }

  .title { font-size: 56px; }
  .eyebrow { font-size: 17px; }
  .card { padding: 26px; }
  .pulse-row { margin: 4px -26px -26px; padding: 15px 20px 16px 26px; }
  .card-title { font-size: 27px; }
  .chip { padding: 6px 14px; font-size: 14px; }

  .logo { width: 120px; height: 120px; border-radius: 34px; }
  .wordmark { font-size: 72px; }
  .tagline { font-size: 18px; }
  .login-form { max-width: 400px; }

  .home-summary { font-size: 17px; }
  .levels { gap: 20px; margin-top: 36px; }
  .subjects { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 36px; }
  .profile-subjects { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .avatar-link .avatar { width: 52px; height: 52px; font-size: 26px; }
  .subject { padding: 30px 30px 22px; }
  .subject-level { font-size: 14px; }
  .level { padding: 30px 30px 22px; }
  .level-name { font-size: 38px; }
  .level-desc { font-size: 16px; }
  .score-num { font-size: 46px; }
  .score-den { font-size: 20px; }
  .dots { gap: 6px; margin: 22px 0 16px; }
  .dot { height: 8px; }
  .level-foot { font-size: 15px; }

  .quiz-top { padding-top: calc(14px + env(safe-area-inset-top)); padding-bottom: 14px; }
  .quiz-title strong { font-size: 16px; }
  .steps { gap: 8px; }
  .step { max-width: 42px; font-size: 14px; }

  .quiz { padding-top: 14px; }
  .quiz-chips { margin: 12px 0 20px; }
  .stem p { margin-bottom: 16px; font-size: 19px; line-height: 1.7; }
  .items { padding: 20px 24px 6px; }
  .items p { margin-bottom: 14px; font-size: 18px; }
  .command { margin: 10px 0 20px; font-size: 28px; }
  .options { gap: 12px; }
  .option { grid-template-columns: 40px 1fr; gap: 16px; padding: 16px 20px 16px 16px; }
  .letter { width: 40px; height: 40px; font-size: 16px; }
  .option-text { padding-top: 7px; font-size: 18px; }
  .tool { min-height: 46px; padding: 0 20px; font-size: 15px; }
  .hint p:last-child, .explain p { font-size: 17px; }
  .feedback-title { font-size: 25px; }
  .feedback-sub { font-size: 15px; }

  .quiz-bar { padding-right: max(var(--gutter), env(safe-area-inset-right)); padding-left: max(var(--gutter), env(safe-area-inset-left)); }
  .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, .results-detail { gap: 20px; }
  .results-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .miss-line, .miss-why, .review-list span { font-size: 16px; }
  .results-actions { justify-self: center; width: 100%; max-width: 480px; }

  /* 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; }
  .sheet-chat { max-width: 640px; height: min(100%, 880px); }
  .grabber { display: none; }
  .sheet-head { padding-top: 14px; }
  .sheet-body { padding-bottom: 28px; }
  .composer { padding-bottom: 12px; }
  .toast { font-size: 15px; }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px) scale(0.98); } }

/* ── iPad deitado e telas largas ─────────────────────────────── */

@media (min-width: 1100px) {
  :root { --content-w: 1080px; --side-w: 430px; --col-gap: 48px; --top-h: 77px; }

  .levels { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* perfil numa coluna centralizada: em tela larga, cartões esticados ficam difíceis de ler */
  .profile { max-width: 760px; margin-inline: auto; }
  .level { display: flex; flex-direction: column; }
  .level-head { display: grid; flex: 1; grid-template-columns: minmax(0, 1fr) auto; align-content: start; align-items: baseline; column-gap: 12px; }
  .level-head > div { display: contents; }
  .level-name { grid-area: 1 / 1; font-size: 34px; }
  .level-head .score { grid-area: 1 / 2; margin: 0; }
  .level-desc { grid-area: 2 / 1 / 3 / 3; }

  /* cabeçalho da questão numa linha só, para sobrar altura */
  .quiz-top.is-quiz {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "close title steps chat" "progress progress progress progress";
    align-items: center;
    column-gap: 20px;
    padding-bottom: 0;
  }
  .is-quiz .quiz-head { display: contents; }
  .is-quiz .quiz-head > :first-child { grid-area: close; }
  .is-quiz .quiz-head > :last-child { grid-area: chat; }
  .is-quiz .quiz-title { grid-area: title; justify-items: start; min-width: 130px; text-align: left; }
  .is-quiz .steps { grid-area: steps; grid-template-columns: repeat(10, 40px); gap: 6px; justify-content: start; }
  .is-quiz .step { max-width: none; }
  .is-quiz .progress { grid-area: progress; margin: 14px 0 0; }

  /* enunciado à esquerda; dica e gabarito fixos à direita */
  .quiz { display: grid; grid-template-columns: minmax(0, 1fr) var(--side-w); column-gap: var(--col-gap); align-items: start; padding-top: 28px; }
  .quiz-main > .quiz-chips { margin-top: 0; }
  .quiz-side {
    position: sticky;
    top: calc(var(--top-h) + 28px + env(safe-area-inset-top));
    max-height: calc(100dvh - var(--top-h) - 28px - env(safe-area-inset-top) - var(--bar-h) - env(safe-area-inset-bottom));
    margin: 0 -20px;
    padding: 0 20px 28px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .quiz-side > :first-child { margin-top: 0; }
  .side-note { display: block; margin: 16px 0 0; padding: 22px 24px; border: 1.5px dashed var(--line); border-radius: var(--radius-lg); color: var(--ink-soft); font-size: 15px; line-height: 1.5; }
  .hint, .feedback { scroll-margin: 0; }

  .quiz-bar-inner { max-width: var(--content-w); padding-right: calc(var(--side-w) + var(--col-gap)); justify-content: center; }
  .quiz-bar .btn { flex: 0 1 340px; }

  .results {
    grid-template-columns: 380px minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "title title" "overview detail" "actions detail";
    column-gap: var(--col-gap);
    align-items: start;
  }
  .results > .title { grid-area: title; }
  .results-overview { grid-area: overview; grid-template-columns: minmax(0, 1fr); }
  .results-detail { grid-area: detail; }
  .results-actions { grid-area: actions; max-width: none; margin-top: 4px; }

  /* monitor vira painel lateral: dá para ler o enunciado enquanto conversa */
  .sheet-layer:has(> .sheet-chat) { left: auto; width: 420px; padding: 0; }
  .sheet-layer:has(> .sheet-chat) .scrim { display: none; }
  .sheet-chat {
    max-width: none;
    height: 100%;
    padding-top: env(safe-area-inset-top);
    border-left: 1px solid var(--line-soft);
    border-radius: 28px 0 0 28px;
    box-shadow: -16px 0 48px -20px rgba(18, 50, 74, 0.3);
    animation-name: drawer-in;
  }
  body.has-sheet:has(.sheet-chat) { overflow: visible; }
  body.has-sheet:has(.sheet-chat) .quiz-side { visibility: hidden; }
}
@keyframes drawer-in { from { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
