:root {
  --bg: #f1f5f9; --surface: #ffffff; --text: #0f172a; --muted: #475569; --border: #cbd5e1;
  --primary: #1e40af; --primary-text: #ffffff; --ok: #15803d; --ok-bg: #dcfce7;
  --bad: #b91c1c; --bad-bg: #fee2e2; --warn: #b45309; --warn-bg: #fef3c7;
  --yes: #15803d; --no: #b91c1c; --wave: #1e40af;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --surface: #162033; --text: #f1f5f9; --muted: #94a3b8; --border: #334155;
    --primary: #60a5fa; --primary-text: #0b1220; --ok: #4ade80; --ok-bg: #14301f;
    --bad: #f87171; --bad-bg: #3a1717; --warn: #fbbf24; --warn-bg: #3a2c0b;
    --yes: #16a34a; --no: #dc2626; --wave: #60a5fa; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --surface: #162033; --text: #f1f5f9; --muted: #94a3b8; --border: #334155;
  --primary: #60a5fa; --primary-text: #0b1220; --ok: #4ade80; --ok-bg: #14301f;
  --bad: #f87171; --bad-bg: #3a1717; --warn: #fbbf24; --warn-bg: #3a2c0b;
  --yes: #16a34a; --no: #dc2626; --wave: #60a5fa; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; min-height: 100dvh;
}
.app { max-width: 640px; margin: 0 auto; padding: 16px; padding-bottom: 40px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
header.top h1 { font-size: 1.35rem; margin: 0; }
[hidden] { display: none !important; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 1.05rem; margin: 0 0 8px; }
.muted { color: var(--muted); font-size: .92rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
button, .btn, select, input, textarea { font: inherit; }
button, .btn {
  min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button:focus-visible, .btn:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 3px solid var(--primary); outline-offset: 2px;
}
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); font-weight: 700; }
button.danger { color: var(--bad); border-color: var(--bad); }
button.small { min-height: 40px; padding: 6px 12px; font-size: .92rem; }
.big-start { width: 100%; min-height: 84px; font-size: 1.6rem; border-radius: 20px; }
select, input[type=text], textarea {
  width: 100%; min-height: 48px; padding: 8px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
textarea { min-height: 180px; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; background: var(--bg); border: 1px solid var(--border); }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.status-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
progress { width: 100%; height: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; }
.stat-big { font-size: 2rem; font-weight: 800; }
table.stats { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.stats th, table.stats td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); }
table.stats td:not(:first-child), table.stats th:not(:first-child) { text-align: right; }

/* estudo */
.study-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.tema { font-weight: 700; color: var(--primary); }
.enunciado { font-size: 1.55rem; line-height: 1.4; font-weight: 600; margin: 8px 0 14px; }
.mic-box { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.waves { display: flex; align-items: center; gap: 4px; height: 44px; min-width: 96px; }
.waves span { display: block; width: 8px; height: 6px; border-radius: 4px; background: var(--wave); transition: height .08s linear; opacity: .9; }
.waves.off span { background: var(--border); height: 6px !important; }
.timer { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; margin-left: auto; }
.partial { min-height: 1.6em; color: var(--muted); font-style: italic; margin-bottom: 12px; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.answers button { min-height: 96px; font-size: 1.8rem; font-weight: 800; border-radius: 18px; color: #fff; border: 0; }
.answers .yes { background: var(--yes); }
.answers .no { background: var(--no); }
.answers .repeat { grid-column: 1 / -1; min-height: 64px; font-size: 1.15rem; background: var(--surface); color: var(--text); border: 2px solid var(--border); }

.verdict { border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); }
.verdict.bad { background: var(--bad-bg); color: var(--bad); }
.verdict.warn { background: var(--warn-bg); color: var(--warn); }
.verdict h2 { margin: 0 0 4px; font-size: 1.7rem; }
.explicacao { font-size: 1.2rem; }

.toast { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 600px; margin: 0 auto; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; z-index: 20; }
.qlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.qitem { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface); }
.qitem .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.errors { color: var(--bad); margin: 8px 0 0; padding-left: 20px; }
pre.example { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px; overflow: auto; font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .waves span { transition: none; } }
