/* ============================================================
   Treino de Decidibilidade — estilos
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #f5f6fb;
  --bg-glow-1: rgba(99, 102, 241, 0.13);
  --bg-glow-2: rgba(6, 182, 212, 0.10);
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --surface-3: #eef0f8;
  --text: #12172b;
  --text-soft: #3c4560;
  --muted: #6b7490;
  --line: #e4e7f1;
  --line-strong: #cfd5e6;
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-ink: #ffffff;
  --primary-soft: #eef0ff;
  --primary-line: #d8dcff;
  --green: #0d9468;
  --green-soft: #e8f8f1;
  --green-line: #b8e8d4;
  --red: #d92d4b;
  --red-soft: #fdecef;
  --red-line: #f6c9d2;
  --amber: #a85b06;
  --amber-soft: #fff6e8;
  --amber-line: #f4d9ae;
  --code-bg: rgba(18, 23, 43, 0.06);
  --shadow-sm: 0 1px 2px rgba(18, 23, 43, 0.04), 0 6px 18px rgba(18, 23, 43, 0.04);
  --shadow: 0 2px 4px rgba(18, 23, 43, 0.03), 0 18px 46px rgba(18, 23, 43, 0.07);
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e18;
  --bg-glow-1: rgba(99, 102, 241, 0.16);
  --bg-glow-2: rgba(6, 182, 212, 0.09);
  --surface: #121728;
  --surface-2: #171d31;
  --surface-3: #1d243b;
  --text: #eef1fb;
  --text-soft: #c4cbdf;
  --muted: #929bb6;
  --line: #262e47;
  --line-strong: #36405e;
  --primary: #8b86ff;
  --primary-2: #a78bfa;
  --primary-ink: #0b0e18;
  --primary-soft: #1d1c3d;
  --primary-line: #323065;
  --green: #3ddba4;
  --green-soft: #102a23;
  --green-line: #1d5142;
  --red: #ff7188;
  --red-soft: #2d1620;
  --red-line: #5c2634;
  --amber: #f0b45b;
  --amber-soft: #2a2113;
  --amber-line: #4f3c1c;
  --code-bg: rgba(255, 255, 255, 0.08);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2), 0 6px 18px rgba(0, 0, 0, 0.18);
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 18px 46px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(700px 440px at 6% -8%, var(--bg-glow-1), transparent 70%),
    radial-gradient(620px 420px at 100% 0%, var(--bg-glow-2), transparent 72%);
}

::selection {
  background: var(--primary);
  color: var(--primary-ink);
}

a { color: var(--primary); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.muted { color: var(--muted); }
.mono {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 5px;
}

/* ------------------------------ Header ------------------------------ */

.topbar {
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mark {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(145deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 850;
  font-size: 1.02rem;
  letter-spacing: -0.03em;
  box-shadow: 0 10px 24px -8px rgba(79, 70, 229, 0.7);
}

.brand-text h1 {
  margin: 0;
  font-size: clamp(1.22rem, 2.1vw, 1.5rem);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.brand-text p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  max-width: 60ch;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

/* ------------------------------ Buttons ------------------------------ */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--primary);
  color: var(--primary-ink);
  font: inherit;
  font-size: 0.91rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -8px rgba(79, 70, 229, 0.55);
}

.btn:active { transform: translateY(0); }

.btn.ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
  box-shadow: none;
}

.btn.ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn.small {
  padding: 8px 13px;
  font-size: 0.83rem;
  border-radius: 10px;
}

.btn.full { width: 100%; }

.btn:disabled {
  opacity: 1;
  border-color: var(--line);
  background: var(--surface-3);
  color: var(--muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.icon-btn {
  appearance: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text-soft);
  font: inherit;
  font-size: 1.05rem;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.icon-sun { display: none; }
html[data-theme="dark"] .icon-sun { display: inline; }
html[data-theme="dark"] .icon-moon { display: none; }

/* ------------------------------ Tabs ------------------------------ */

.tabs {
  max-width: 1160px;
  margin: 22px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
}

.tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: -1px;
  padding: 12px 16px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 23px;
  height: 21px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.69rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.tab-panel[hidden] { display: none; }

/* ------------------------------ Quiz layout ------------------------------ */

.layout {
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 24px 70px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.panel-head > span:last-child {
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 8px;
  margin: 12px 0 16px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}

.bar > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width 300ms ease;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.stat {
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  text-align: center;
}

.stat strong {
  display: block;
  font-size: 1.12rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 600;
}

.stat.good strong { color: var(--green); }
.stat.bad strong { color: var(--red); }

.panel-title {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--text-soft);
  font: inherit;
  font-size: 0.79rem;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.chip:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.chip.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-ink);
}

.chip .n {
  opacity: 0.65;
  font-size: 0.71rem;
  font-variant-numeric: tabular-nums;
}

.chip.is-active .n { opacity: 0.85; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 17px 0 13px;
  color: var(--text-soft);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.switch-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  border-radius: 99px;
  background: var(--line-strong);
  transition: background 170ms ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.24);
  transition: transform 170ms ease;
}

.switch-row input:checked + .switch { background: var(--primary); }
.switch-row input:checked + .switch::after { transform: translateX(16px); }
.switch-row input:focus-visible + .switch {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.hints p {
  margin: 0 0 7px;
  color: var(--text-soft);
  font-size: 0.8rem;
}

.hints p:last-child { margin-bottom: 0; }
.hints .sep { color: var(--line-strong); margin: 0 2px; }
.small-note { font-size: 0.75rem !important; line-height: 1.5; }

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 23px;
  height: 23px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
}

/* ------------------------------ Card ------------------------------ */

.stage { min-width: 0; scroll-margin-top: 18px; }

.card {
  position: relative;
  overflow: hidden;
  padding: 28px 30px 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: fade-up 240ms ease both;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), #06b6d4);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.71rem;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: 0.015em;
}

.pill.ghost-pill {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
}

.counter {
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-top: 4px;
}

.statement-label {
  margin: 26px 0 8px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.statement {
  margin: 0 0 24px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-2);
  color: var(--text);
  font-size: clamp(1.12rem, 1.55vw, 1.35rem);
  font-weight: 620;
  line-height: 1.48;
  letter-spacing: -0.015em;
}

.statement sup {
  font-size: 0.68em;
  line-height: 0;
}

.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.answer-btn {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 78px;
  padding: 15px 17px;
  border: 2px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 170ms ease, background 170ms ease, transform 170ms ease, box-shadow 170ms ease, opacity 170ms ease;
}

.answer-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.answer-btn.v:hover:not(:disabled) { border-color: var(--green); }
.answer-btn.f:hover:not(:disabled) { border-color: var(--red); }

.answer-btn:disabled { cursor: default; }

.keycap {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 850;
  transition: background 170ms ease, color 170ms ease, border-color 170ms ease;
}

.answer-btn.v .keycap {
  border-color: var(--green-line);
  background: var(--green-soft);
  color: var(--green);
}

.answer-btn.f .keycap {
  border-color: var(--red-line);
  background: var(--red-soft);
  color: var(--red);
}

.answer-btn strong {
  display: block;
  font-size: 0.97rem;
  font-weight: 750;
  line-height: 1.25;
}

.answer-btn small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.35;
}

.answer-btn.is-dim { opacity: 0.42; }

.answer-btn.is-correct {
  border-color: var(--green);
  background: var(--green-soft);
}

.answer-btn.is-correct .keycap {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.answer-btn.is-wrong {
  border-color: var(--red);
  background: var(--red-soft);
}

.answer-btn.is-wrong .keycap {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

/* ------------------------------ Feedback ------------------------------ */

.feedback {
  margin-top: 22px;
  padding: 19px 21px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-2);
  animation: fade-up 220ms ease both;
}

.feedback.correct {
  border-color: var(--green-line);
  background: var(--green-soft);
}

.feedback.incorrect {
  border-color: var(--red-line);
  background: var(--red-soft);
}

.feedback-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 11px;
}

.verdict-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 0.98rem;
  font-weight: 850;
}

.feedback.incorrect .verdict-icon { background: var(--red); }

.feedback-head strong {
  display: block;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.3;
}

.feedback-head p {
  margin: 2px 0 0;
  color: var(--text-soft);
  font-size: 0.87rem;
}

.feedback-head b { color: var(--text); }

.why {
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.66;
}

.why p { margin: 0.55em 0; }
.why p:first-child { margin-top: 0; }
.why p:last-child { margin-bottom: 0; }
.why strong { color: var(--text); }
.why em { font-style: italic; }
.why ul, .why ol { margin: 0.55em 0; padding-left: 1.25em; }
.why li { margin: 0.25em 0; }

.why code, .why .mono {
  font-family: var(--mono);
  font-size: 0.87em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--code-bg);
  white-space: nowrap;
}

.why .note {
  margin: 13px 0 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.86rem;
  line-height: 1.6;
}

.note {
  margin: 13px 0 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.62;
}

.note strong { color: var(--text); }

.tip {
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.tip strong { color: var(--amber); }

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.footer-hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.next-btn { margin-left: auto; }

/* ------------------------------ Results ------------------------------ */

.results {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: fade-up 240ms ease both;
}

.result-head {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
}

.ring {
  --ring-color: var(--primary);
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 138px;
  height: 138px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), var(--line) 0);
}

.ring::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--surface);
}

.ring.good { --ring-color: var(--green); }
.ring.warn { --ring-color: var(--amber); }
.ring.bad { --ring-color: var(--red); }

.ring-inner {
  position: relative;
  text-align: center;
}

.ring-inner strong {
  display: block;
  color: var(--text);
  font-size: 1.75rem;
  line-height: 1;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.ring-inner span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.result-copy { min-width: 0; flex: 1; }

.kicker {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.result-copy h2 {
  margin: 0 0 5px;
  font-size: clamp(1.5rem, 2.9vw, 2rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.result-copy p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  max-width: 52ch;
}

.breakdown {
  display: grid;
  gap: 9px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.breakdown-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
}

.breakdown-label { color: var(--text-soft); font-weight: 650; }
.breakdown-bar {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.breakdown-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}
.breakdown-value {
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.mistakes { margin-top: 26px; }

.mistakes-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.mistakes-head h3 {
  margin: 0;
  font-size: 0.98rem;
  letter-spacing: -0.015em;
}

.mistakes-head span {
  color: var(--muted);
  font-size: 0.78rem;
}

.mistake {
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  overflow: hidden;
}

.mistake summary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  list-style: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.mistake summary::-webkit-details-marker { display: none; }
.mistake summary::after {
  content: "+";
  margin-left: auto;
  color: var(--muted);
  font-weight: 800;
  flex: 0 0 auto;
}
.mistake[open] summary::after { content: "−"; }

.mistake-q {
  flex: 1;
  min-width: 0;
  line-height: 1.45;
}

.mistake-q strong { color: var(--text); }

.mistake-q small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.mistake .why {
  padding: 0 14px 14px;
  font-size: 0.87rem;
}

.mistake .why p:first-child { margin-top: 0; }

.perfect-box {
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid var(--green-line);
  border-radius: 13px;
  background: var(--green-soft);
  color: var(--text-soft);
  font-size: 0.88rem;
}

.result-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* ------------------------------ Gabarito ------------------------------ */

.doc {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 24px 80px;
}

.doc-hero {
  position: relative;
  overflow: hidden;
  padding: 30px 32px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.doc-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), #06b6d4);
}

.doc-hero h2 {
  margin: 0 0 9px;
  font-size: clamp(1.55rem, 3.2vw, 2.05rem);
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.lead {
  max-width: 64ch;
  margin: 0;
  color: var(--text-soft);
  font-size: 0.96rem;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.hierarchy-box {
  margin-top: 17px;
  padding: 19px 22px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.hierarchy-title {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hierarchy {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.hier {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border: 1px solid;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.2;
}

.hier sub { font-size: 0.68em; }

.hier.lreg { border-color: var(--green-line); background: var(--green-soft); color: var(--green); }
.hier.llc { border-color: var(--primary-line); background: var(--primary-soft); color: var(--primary); }
.hier.lsc { border-color: var(--amber-line); background: var(--amber-soft); color: var(--amber); }
.hier.lr { border-color: var(--line-strong); background: var(--surface-2); color: var(--text-soft); }
.hier.lre { border-color: var(--red-line); background: var(--red-soft); color: var(--red); }
.hier.lna { border-color: var(--line-strong); background: var(--surface-3); color: var(--muted); }

.hier-sep {
  color: var(--text-soft);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.footnote {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.doc-note {
  margin-top: 17px;
  padding: 15px 17px;
  border: 1px solid var(--primary-line);
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.65;
}

.doc-note strong { color: var(--text); }

.warn-note {
  border-color: var(--amber-line);
  background: var(--amber-soft);
}

.ref-section {
  margin-top: 20px;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.ref-divider {
  margin: 32px 2px 2px;
}

.ref-divider h2 {
  margin: 0 0 4px;
  font-size: 1.22rem;
  letter-spacing: -0.025em;
}

.ref-divider p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.ref-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.6rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  vertical-align: middle;
}

.ref-section > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 4px;
  font-size: 1.13rem;
  letter-spacing: -0.02em;
}

.ref-section > h3 {
  margin: 24px 0 9px;
  font-size: 0.97rem;
  letter-spacing: -0.01em;
}

.ref-sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.83rem;
}

.ref-section p {
  margin: 0.62em 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.7;
}

.ref-section p strong { color: var(--text); }

.ref-section ul, .ref-section ol {
  margin: 0.6em 0;
  padding-left: 1.3em;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.68;
}

.ref-section li { margin: 0.3em 0; }

.ref-section code, .ref-section .mono {
  font-family: var(--mono);
  font-size: 0.87em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--code-bg);
  white-space: nowrap;
}

.ref-section .equation {
  margin: 12px 0;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.7;
  overflow-x: auto;
}

.warn {
  margin: 14px 0;
  padding: 13px 15px;
  border: 1px solid var(--amber-line);
  border-left: 4px solid var(--amber);
  border-radius: 10px;
  background: var(--amber-soft);
  color: var(--text-soft);
  font-size: 0.87rem;
  line-height: 1.65;
}

.warn strong { color: var(--text); }

.qa {
  margin: 7px 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  overflow: hidden;
}

.qa summary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  list-style: none;
  cursor: pointer;
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.5;
}

.qa summary::-webkit-details-marker { display: none; }

.qa summary::after {
  content: "+";
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted);
  font-weight: 850;
}

.qa[open] summary::after { content: "−"; }

.qa-label {
  flex: 0 0 auto;
  color: var(--text);
  font-weight: 750;
  white-space: nowrap;
}

.qa-statement { flex: 1; min-width: 0; }

.qa-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.qa-body .why {
  padding-top: 13px;
  font-size: 0.87rem;
}

.badge {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid;
  border-radius: 7px;
  font-size: 0.71rem;
  font-weight: 850;
  line-height: 1;
}

.badge.v {
  border-color: var(--green-line);
  background: var(--green-soft);
  color: var(--green);
}

.badge.f {
  border-color: var(--red-line);
  background: var(--red-soft);
  color: var(--red);
}

.table-wrap {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 690px;
  border-collapse: collapse;
  font-size: 0.8rem;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}

th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

tr:last-child td { border-bottom: 0; }

td { color: var(--text-soft); }
td strong { color: var(--text); }

tr.row-highlight td { background: var(--surface-2); }

.small-table-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.6;
}

.site-footer {
  max-width: 1160px;
  margin: 0 auto;
  padding: 22px 24px 42px;
  border-top: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 0.8rem;
}

.site-footer p { margin: 3px 0; }
.site-footer .muted { font-size: 0.76rem; }

.empty-state {
  padding: 40px 30px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  text-align: center;
  color: var(--muted);
}

/* ------------------------------ Animations ------------------------------ */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------ Responsive ------------------------------ */

@media (max-width: 940px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 22px 18px 56px;
  }

  .stage { order: -1; }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .sidebar .hints { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .topbar {
    padding: 20px 16px 0;
    align-items: flex-start;
  }

  .brand { gap: 11px; }
  .mark { width: 45px; height: 45px; border-radius: 13px; font-size: 0.92rem; }
  .brand-text p { font-size: 0.78rem; }
  .pdf-link { display: none; }

  .tabs { padding: 0 16px; margin-top: 16px; }
  .tab { padding: 11px 12px 13px; font-size: 0.84rem; }

  .layout { padding: 16px 14px 48px; }

  .card {
    padding: 21px 17px 19px;
    border-radius: 18px;
  }

  .statement {
    padding: 16px 16px;
    font-size: 1.08rem;
    margin-bottom: 18px;
  }

  .answer-grid { grid-template-columns: 1fr; }
  .answer-btn { min-height: 70px; padding: 13px 14px; }
  .keycap { width: 38px; height: 38px; }

  .feedback { padding: 16px 15px; }
  .card-footer { align-items: flex-start; }
  .next-btn { width: 100%; }

  .results { padding: 21px 17px; border-radius: 18px; }
  .ring { width: 112px; height: 112px; }
  .ring-inner strong { font-size: 1.4rem; }
  .result-head { gap: 18px; }

  .breakdown-row { grid-template-columns: 88px minmax(0, 1fr) 46px; }

  .sidebar { grid-template-columns: 1fr; }
  .sidebar .hints { grid-column: auto; }

  .doc { padding: 20px 14px 60px; }
  .doc-hero { padding: 23px 19px; border-radius: 18px; }
  .ref-section { padding: 19px 17px; border-radius: 15px; }
  .hierarchy-box { padding: 16px 17px; }
  .hierarchy { gap: 6px; }
  .hier { padding: 5px 9px; font-size: 0.76rem; }

  .site-footer { padding: 18px 16px 34px; }
}

@media (max-width: 400px) {
  .brand-text h1 { font-size: 1.08rem; }
  .brand-text p { display: none; }
  .counter { font-size: 0.72rem; }
  .stat span { font-size: 0.62rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ------------------------------ Print ------------------------------ */

@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --text-soft: #222; --muted: #555; --line: #ddd; }
  body { background: #fff; }
  .bg-orbs, .top-actions, .tabs, .sidebar, .site-footer, .hero-actions, .result-actions { display: none !important; }
  .layout, .doc { display: block; max-width: none; padding: 0; }
  .card, .results, .doc-hero, .ref-section { box-shadow: none; border-color: #ccc; }
  .stage { width: 100%; }
  a { color: #000; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
