/* Identidade visual da ER Soluções Web (ersolucoesweb.com.br): roxo #400873, Space Grotesk + Inter + JetBrains Mono. */
@font-face { font-family: "Inter"; src: url(fonts/inter.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url(fonts/space-grotesk.woff2) format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(fonts/jetbrains-mono.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --brand: #400873;
  --brand-2: #6D28D9;
  --bg: #FAF9FD;
  --surface: #ffffff;
  --surface-2: #F3EFFA;
  --text: #1A0B33;
  --body: #4B4462;
  --muted: #5B5470;
  --border: #E6DDF5;
  --accent: #5B21B6;
  --accent-hover: #400873;
  --accent-soft: #F1EAFD;
  --on-accent: #ffffff;
  --ok: #15803d;
  --ok-soft: #e3f5e9;
  --bad: #c2362f;
  --bad-soft: #fbe7e5;
  --warn: #a35f00;
  --warn-soft: #fdf1dc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(64, 8, 115, .05), 0 8px 24px rgba(64, 8, 115, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #120821;
    --surface: #1b0f2e;
    --surface-2: #26173d;
    --text: #F3EEFC;
    --body: #CFC6E2;
    --muted: #A99FC2;
    --border: #35244f;
    --accent: #C4B5FD;
    --accent-hover: #DDD6FE;
    --accent-soft: #2e1a4f;
    --on-accent: #1A0B33;
    --ok: #4cc785;
    --ok-soft: #13301f;
    --bad: #ff7b72;
    --bad-soft: #3a1716;
    --warn: #f0b24a;
    --warn-soft: #36270d;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font: 16px/1.6 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
button { font: inherit; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); color: var(--text); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 5vw, 2.6rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
code { font-family: var(--mono); font-size: .9em; background: var(--accent-soft); color: var(--accent); padding: 1px 5px; border-radius: 5px; }
:focus-visible { outline: 3px solid #22C55E; outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ---------- Faixa e topo (como em ersolucoesweb.com.br) ---------- */
.announce {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px;
  padding: 7px 16px; background: #400873; color: #fff; font-size: .85rem; font-weight: 500; text-align: center;
}
.announce a { color: #fff; background: rgba(255, 255, 255, .14); padding: 2px 12px; border-radius: 999px; font-weight: 600; }
.announce a:hover { color: #fff; background: rgba(255, 255, 255, .24); text-decoration: none; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  box-shadow: 0 4px 6px -1px rgba(26, 11, 51, .08), 0 2px 4px -2px rgba(26, 11, 51, .06);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--brand); min-width: 0; }
.brand:hover { text-decoration: none; color: var(--brand); }
.brand img { width: 40px; height: 40px; border-radius: 6px; flex: none; }
.brand-text { display: grid; min-width: 0; line-height: 1.15; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.15rem; color: var(--brand); }
.brand-book { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: flex; gap: 4px; flex: none; }
.topnav a { padding: 8px 12px; border-radius: 6px; color: var(--text); font-weight: 500; font-size: .95rem; }
.topnav a:hover { color: var(--brand); background: var(--accent-soft); text-decoration: none; }
.topnav a.active { background: var(--brand); color: #fff; }
.progress-strip { height: 3px; background: var(--surface-2); }
#progress-strip-fill { height: 100%; width: 0; background: linear-gradient(90deg, #400873, #6D28D9); transition: width .4s; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-name, :root:not([data-theme="light"]) .brand { color: #F3EEFC; }
  :root:not([data-theme="light"]) .topnav a.active { background: var(--accent); color: var(--on-accent); }
}

main { width: 100%; max-width: 880px; margin: 0 auto; padding: 32px 16px 48px; flex: 1; outline: none; }

/* ---------- Componentes ---------- */
.eyebrow {
  display: inline-block; margin-bottom: 12px; padding: 5px 12px; border-radius: 999px;
  font: 500 .8rem/1.4 var(--mono); background: var(--accent-soft); color: var(--brand-2);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .eyebrow { color: var(--accent); } }
.lead { font-size: 1.08rem; color: var(--body); margin: 0 0 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600;
  transition: background-color .15s, border-color .15s, transform .15s;
}
.btn:hover { border-color: var(--brand-2); color: var(--text); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #5a1199; color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: inherit; }
.link.danger { color: var(--bad); }

.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > div { height: 100%; background: linear-gradient(90deg, #400873, #6D28D9); border-radius: 99px; transition: width .4s; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bar > div { background: var(--accent); } }

/* ---------- Home ---------- */
.hero { display: grid; gap: 14px; margin-bottom: 28px; }
.hero h1 { margin: 0; }
.hero .eyebrow { justify-self: start; margin: 0; }
.hero .lead { margin: 0; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font: 700 1.45rem var(--display); color: var(--brand); }
.stat span { color: var(--muted); font-size: .82rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stat b { color: var(--accent); } }
.how { font-size: .92rem; }
.how ol { margin: 6px 0 0; padding-left: 20px; }

.part { margin-top: 32px; }
.part-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.part-head h2 { margin: 0; }
.part-head h2 a { color: var(--text); }
.part-head h2 a:hover { color: var(--brand-2); }
.topic-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.topic-link {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  color: var(--body); transition: border-color .15s, transform .15s, box-shadow .15s;
}
.topic-link:hover { border-color: var(--brand-2); color: var(--body); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.exam-link { grid-template-columns: 1fr auto; }
.topic-num { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); font: 700 .9rem var(--display); color: var(--brand); }
.topic-link.done .topic-num { background: var(--ok-soft); color: var(--ok); }
.topic-link.started .topic-num { background: var(--warn-soft); color: var(--warn); }
.topic-title { font-weight: 600; color: var(--text); }
.topic-sub { color: var(--muted); font-size: .84rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .topic-num { color: var(--accent); } }

/* ---------- Tópico ---------- */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.figure { margin: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.figure img { display: block; width: 100%; height: auto; }
.figure figcaption { color: #5B5470; font-size: .85rem; padding: 8px 4px 0; }
.summary { margin: 0; padding: 0; list-style: none; }
.summary li { position: relative; padding: 7px 0 7px 22px; border-bottom: 1px dashed var(--border); }
.summary li:last-child { border-bottom: 0; }
.summary li::before { content: ""; position: absolute; left: 4px; top: 16px; width: 8px; height: 8px; border-radius: 2px; background: var(--brand-2); }
.summary strong, .q-text strong { color: var(--text); }
.qa { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.qa + .qa { margin-top: 8px; }
.qa summary { cursor: pointer; padding: 10px 14px; font-weight: 600; color: var(--text); list-style: none; display: flex; gap: 8px; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::before { content: "?"; flex: none; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--accent-soft); color: var(--brand-2); font-size: .8rem; }
.qa[open] summary::before { content: "✓"; background: var(--ok-soft); color: var(--ok); }
.qa .answer { padding: 0 14px 12px 44px; color: var(--body); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 32px 0 12px; }
.section-title h2 { margin: 0; }

/* ---------- Questões ---------- */
.question { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.question + .question { margin-top: 12px; }
.q-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.q-num { flex: none; font: 700 1rem var(--display); color: var(--brand-2); }
.q-text { font-weight: 600; color: var(--text); white-space: pre-line; }
.options { display: grid; gap: 8px; }
.option {
  display: flex; gap: 10px; align-items: flex-start; text-align: left; width: 100%;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--body); cursor: pointer;
}
.option:hover:not(:disabled) { border-color: var(--brand-2); }
.option:disabled { cursor: default; }
.option .letter { flex: none; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font-weight: 700; font-size: .8rem; background: var(--surface-2); color: var(--brand); }
.option.selected { border-color: var(--brand-2); background: var(--accent-soft); }
.option.selected .letter { background: var(--brand); color: #fff; }
.option.correct { border-color: var(--ok); background: var(--ok-soft); }
.option.correct .letter { background: var(--ok); color: #fff; }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.wrong .letter { background: var(--bad); color: #fff; }
.explain { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: .92rem; }
.explain b { display: block; margin-bottom: 2px; color: var(--text); }
.result { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.result .score { font: 700 1.8rem var(--display); color: var(--text); }

.essay textarea { width: 100%; min-height: 90px; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; resize: vertical; }
.model-answer { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--ok); background: var(--ok-soft); border-radius: 6px; white-space: pre-line; }

.pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 32px; }
.pager .btn { max-width: 48%; }
.pager .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Provas / Certificado ---------- */
.exam-list { display: grid; gap: 12px; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checklist li { display: flex; gap: 8px; align-items: center; }
.field { display: grid; gap: 6px; }
.field input { padding: 10px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; }
.cert-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; overflow: hidden; }
.cert-wrap svg { display: block; width: 100%; height: auto; }

/* ---------- Progresso e rodapé (mesmas informações de ersolucoesweb.com.br) ---------- */
.progress-tools {
  width: 100%; max-width: 880px; margin: 0 auto; padding: 14px 16px 28px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; color: var(--muted); font-size: .85rem;
}
.progress-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.footer { padding: 56px 16px 28px; background: #F3EFFA; border-top: 1px solid #E6DDF5; color: #4B4462; }
.footer-inner { max-width: 1240px; margin: 0 auto; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 32px; margin-bottom: 36px; }
.footer p { margin: 0 0 10px; font-size: .94rem; line-height: 1.6; }
.footer h2 { margin: 0 0 14px; font: 700 1.05rem var(--display); color: #1A0B33; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: .94rem; }
.footer a { color: #4B4462; }
.footer a:hover { color: #400873; }
.footer-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.footer-brand img { width: 44px; height: 44px; border-radius: 10px; }
.footer-brand span { font: 700 1.12rem var(--display); color: #1A0B33; }
.contact li { display: flex; align-items: center; gap: 8px; }
.ico { width: 16px; height: 16px; flex: none; color: #400873; }
.footer-bottom { padding-top: 22px; border-top: 1px solid #E0D6F0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.footer-bottom p { margin: 0; font-size: .875rem; color: #5B5470; }
.social { display: flex; gap: 10px; }
.social a { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; background: #fff; border: 1px solid #E0D6F0; color: #400873; }
.social a:hover { border-color: #400873; }
.social .ico { width: 20px; height: 20px; }
.footer-note { margin-top: 18px !important; font-size: .8rem !important; color: #6b6382; }
.noscript { text-align: center; padding: 8px; background: var(--warn-soft); color: var(--warn); margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: .9rem; z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; padding: 8px 12px; }
  .topnav { width: 100%; justify-content: space-between; }
  .topnav a { flex: 1; text-align: center; padding: 7px 6px; font-size: .9rem; }
  .hero-stats { grid-template-columns: 1fr 1fr 1fr; }
  .stat b { font-size: 1.15rem; }
  .topic-link { grid-template-columns: 38px 1fr; }
  .topic-link .pill { grid-column: 2; justify-self: start; }
  .exam-link { grid-template-columns: 1fr; }
  .exam-link .pill { grid-column: 1; }
  .topic-num { width: 38px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) { .topic-link, .btn { transition: none; } .topic-link:hover { transform: none; } }

@media print {
  body * { visibility: hidden; }
  .printable, .printable * { visibility: visible; }
  .printable { position: absolute; inset: 0; border: 0; padding: 0; }
  @page { size: A4 landscape; margin: 0; }
}
