/* 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%);
  --blob-a: #d3e7f1;
  --blob-b: #d2eee8;

  --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%);
    --blob-a: #103447;
    --blob-b: #0e3a37;

    --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; }

/* ── Fundo ─────────────────────────────────────────────────────── */

.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob { position: absolute; width: 90vmax; height: 90vmax; border-radius: 50%; }
.blob-a { top: -45vmax; left: -35vmax; background: radial-gradient(circle, var(--blob-a) 0%, transparent 68%); animation: drift-a 26s ease-in-out infinite; }
.blob-b { bottom: -50vmax; right: -40vmax; background: radial-gradient(circle, var(--blob-b) 0%, transparent 68%); animation: drift-b 32s ease-in-out infinite; }
.grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.85' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0.07 0 0 0 0 0.2 0 0 0 0 0.29 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes drift-a { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(8vmax, 6vmax) scale(1.08); } }
@keyframes drift-b { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-6vmax, -8vmax) scale(0.95); } }

/* ── 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:active { transform: scale(0.985); }
.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; }

/* ── 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 .source { margin: 14px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.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-progress { height: 6px; border-radius: 999px; background: var(--bg-deep); overflow: hidden; }
.gen-progress > span { display: block; height: 100%; background: var(--grad-brand); transition: width 0.4s ease; }
.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; }

.menu-scrim { position: fixed; inset: 0; z-index: 55; }
.menu {
  position: fixed;
  top: calc(var(--home-pad) + 52px + env(safe-area-inset-top));
  right: max(var(--gutter), calc((100vw - var(--content-w)) / 2));
  z-index: 60;
  min-width: 232px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-float);
  animation: menu-in 0.16s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
.menu-who { margin: 0; padding: 14px 18px 12px; border-bottom: 1px solid var(--line-soft); color: var(--ink-soft); font-size: 13px; }
.menu-who strong { display: block; color: var(--ink); font: italic 400 21px/1.2 var(--font-display); }
.menu button { display: block; width: 100%; padding: 15px 18px; border: 0; background: none; font: 600 15px/1.2 var(--font-sans); text-align: left; }
.menu button + button { border-top: 1px solid var(--line-soft); }
.menu .is-danger { color: var(--bad-ink); }

/* ── 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)); }

/* ── 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; }
  .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; }
  .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)); }
  .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;
  }
}
