/* Todas as cores vêm destas variáveis; para mudar o visual, começar aqui. */
:root {
  --bg: #f4f6f3; --surface: #ffffff; --text: #17201a; --muted: #5c6a61; --line: #dbe2dc;
  --brand: #0f5132; --brand-text: #ffffff; --accent: #ffd60a;
  --good: #146c43; --good-bg: #e3f4ea; --mid: #8a5a00; --mid-bg: #fdf0cf; --bad: #b42318; --bad-bg: #fde7e5;
  --radius: 14px; --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 6px 20px rgb(0 0 0 / .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1411; --surface: #17201b; --text: #e8eee9; --muted: #9fada4; --line: #2a372f;
    --brand: #3fb37a; --brand-text: #06150d;
    --good: #6fd39c; --good-bg: #12301f; --mid: #f0c25c; --mid-bg: #352a0d; --bad: #ff9b92; --bad-bg: #3a1714;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 .75rem; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
#app:focus { outline: none; }
.muted { color: var(--muted); } .small { font-size: .85rem; }

/* barra de topo */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.5rem; padding: .6rem max(1rem, calc(50% - 440px)); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 750; color: var(--text); text-decoration: none; }
.nav { display: flex; gap: .25rem; margin-left: auto; overflow-x: auto; }
.nav a { padding: .45rem .75rem; border-radius: 999px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 550; }
.nav a:hover { color: var(--text); }
.nav a[aria-current] { background: var(--brand); color: var(--brand-text); }

.page { max-width: 880px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.page.narrow { max-width: 520px; }
.page-head { margin-bottom: 1.25rem; }
.eyebrow { display: block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.section-title { margin-top: 2rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1rem; }
.empty, .loading { text-align: center; color: var(--muted); padding: 2rem 1rem; }

/* botões e formulários */
.btn { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: .5rem 1.1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.link { border: 0; background: none; text-decoration: underline; }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn:disabled, .btn[aria-disabled] { opacity: .45; cursor: default; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.form label { display: block; font-weight: 600; margin-bottom: .85rem; }
input:not([type=radio]):not([type=checkbox]) { display: block; width: 100%; min-height: 44px; margin-top: .3rem; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.form-msg { color: var(--bad); min-height: 1.2em; }
.form-msg[data-ok] { color: var(--good); }

/* entrar / criar conta */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 3rem; max-width: 940px; margin: 0 auto; padding: 2rem 1.25rem; }
.auth-intro h1 { font-size: 2.4rem; margin-top: 1rem; }
.auth-intro ul { padding-left: 1.1rem; color: var(--muted); }
.auth-card { padding: 1.5rem; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; padding: .25rem; margin-bottom: 1.25rem; background: var(--bg); border-radius: 12px; }
.tabs a { text-align: center; padding: .55rem; border-radius: 9px; font-weight: 650; text-decoration: none; color: var(--muted); }
.tabs a[aria-selected=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* início */
.resume { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; border-color: var(--accent); border-width: 2px; }
.resume p { margin: 0; }
.exam-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.exam-type { margin: 0; }
.exam-type-count { display: block; font-size: 3.5rem; font-weight: 800; line-height: 1; color: var(--brand); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 1.5rem 0 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.stat b { display: block; font-size: 1.8rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .85rem; }
.exam-list, .law-list, .hit-list { list-style: none; margin: 0; padding: 0; }
.exam-row { display: flex; align-items: center; gap: .9rem; padding: .75rem 1rem; margin-bottom: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.exam-row:hover { border-color: var(--brand); }
.exam-row-main, .exam-row-side { display: flex; flex-direction: column; }
.exam-row-side { margin-left: auto; text-align: right; }
.score-chip { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; font-weight: 800; font-size: 1.15rem; }
.good { --tone: var(--good); --tone-bg: var(--good-bg); }
.mid { --tone: var(--mid); --tone-bg: var(--mid-bg); }
.bad { --tone: var(--bad); --tone-bg: var(--bad-bg); }
.score-chip { background: var(--tone-bg); color: var(--tone); }

/* exame */
.runner-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.progress { height: 8px; margin: .6rem 0 1rem; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand); transition: width .25s; }
.question-num { font-size: .85rem; font-weight: 700; color: var(--muted); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 1rem; font-size: 1.12rem; font-weight: 650; }
.option { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem; margin-bottom: .55rem; border: 1px solid var(--line); border-radius: 12px; }
label.option { position: relative; cursor: pointer; }
label.option:hover { border-color: var(--brand); }
.option input { position: absolute; opacity: 0; }
.option-letter { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--bg); font-weight: 800; }
.option-text { flex: 1; min-width: 0; overflow-wrap: anywhere; padding-top: .15rem; }
.option:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.option:has(input:focus-visible) { outline: 3px solid var(--accent); }
.option input:checked + .option-letter { background: var(--brand); color: var(--brand-text); }
.runner-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.runner-actions .primary { margin-left: auto; }
.dots { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1.5rem 0 1rem; }
.dot { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; }
.dot.done { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
.dot[aria-current] { outline: 3px solid var(--accent); outline-offset: 1px; }

/* correção */
.score-card { text-align: center; background: var(--tone-bg); border-color: var(--tone); }
.score-big b { font-size: 4.5rem; line-height: 1; color: var(--tone); }
.score-big span { font-size: 1.3rem; color: var(--muted); }
.filter { display: block; margin: 1rem 0; font-weight: 600; }
.review { list-style: none; padding: 0; }
.review.only-wrong .review-item.ok { display: none; }
.review-item { border-left: 5px solid var(--good); }
.review-item.ko { border-left-color: var(--bad); }
.options { list-style: none; margin: 0; padding: 0; }
.options .option { flex-wrap: wrap; }
.option.right { background: var(--good-bg); border-color: var(--good); }
.option.wrong { background: var(--bad-bg); border-color: var(--bad); }
.option-tag { flex-basis: 100%; padding-left: 42px; font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.ref { margin: .75rem 0 0; font-size: .88rem; color: var(--muted); }

/* histórico */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; border-bottom: 1px solid var(--line); }
.chart-bar { flex: 1; max-width: 40px; height: max(3px, calc(var(--h) * 1%)); background: var(--tone); border-radius: 4px 4px 0 0; }

/* leis do jogo */
.search { display: flex; gap: .5rem; align-items: flex-end; margin-bottom: 1rem; }
.search input { margin: 0 !important; }
.law-list a, .hit-list a { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; margin-bottom: .4rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-decoration: none; }
.law-list a span:last-child { white-space: nowrap; }
.hit-list a { justify-content: flex-start; font-size: .92rem; }
.hit-list b { white-space: nowrap; color: var(--brand); }
.law-list a:hover, .hit-list a:hover { border-color: var(--brand); }
.reader-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.reader-bar.bottom { margin-top: .75rem; }
.reader-title { font-weight: 700; }
#jump input { display: inline-block !important; width: 5.5rem !important; }
.manual-page { display: block; width: 100%; max-width: 700px; margin: 0 auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #000; }

.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 10; max-width: calc(100% - 2rem); padding: .75rem 1.1rem; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 600; }

@media (max-width: 700px) {
  .auth { grid-template-columns: 1fr; align-content: start; gap: 1rem; }
  .auth-intro { text-align: center; }
  .auth-intro h1 { font-size: 1.9rem; }
  .auth-intro ul { display: none; }
  .nav { margin-left: 0; width: 100%; }
  .topbar { position: static; }
  .runner-actions .primary { margin-left: 0; width: 100%; }
  .runner-actions .btn:not(.primary) { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
