:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5b6270;
  --border: #e2e5ea;
  --accent: #2856d6;
  --accent-soft: #eaf0fe;
  --current: #b54708;
  --current-soft: #fff6ed;
  --expected: #067647;
  --expected-soft: #ecfdf3;
  --error: #c0262d;
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1a1d23;
    --text: #eceef2;
    --muted: #a0a7b4;
    --border: #2c313a;
    --accent: #7c9cff;
    --accent-soft: #222b45;
    --current: #f7a35c;
    --current-soft: #2d2117;
    --expected: #4fd18b;
    --expected-soft: #15291f;
    --error: #ff7a80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
main.wide { max-width: 1040px; }

a { color: var(--accent); }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 4px 0 12px; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 2px 0 0; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 4px; color: var(--muted); }
p { margin: 0 0 8px; }

.eyebrow { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 0; }
.intro { margin-bottom: 24px; }
.muted { color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.module-title { font-size: 1.4rem; margin: 32px 0 12px; }

.progress { margin-top: 16px; }
.progress .bar { height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.progress .bar span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.progress p { font-size: .9rem; color: var(--muted); margin-top: 6px; }

.question header { margin-bottom: 16px; }

.states { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
.state { border-radius: 8px; padding: 12px 14px; }
.state p { margin: 0; }
.state.current { background: var(--current-soft); }
.state.current h3 { color: var(--current); }
.state.expected { background: var(--expected-soft); }
.state.expected h3 { color: var(--expected); }

.scenarios { margin-bottom: 16px; }
.scenario { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-top: 8px; }
.scenario .case { font-weight: 600; }
.compare { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.compare p { margin: 4px 0 0; }
.tag { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.tag.before { background: var(--current-soft); color: var(--current); }
.tag.after { background: var(--expected-soft); color: var(--expected); }

fieldset { border: 0; padding: 0; margin: 0 0 12px; }
legend { font-weight: 700; margin-bottom: 8px; }

.option {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; margin-bottom: 6px;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option input { margin-top: 4px; accent-color: var(--accent); }

.badge {
  font-style: normal; font-size: .7rem; font-weight: 700;
  padding: 1px 7px; border-radius: 99px; margin-left: 4px;
  background: var(--expected-soft); color: var(--expected); white-space: nowrap;
}

input[type=text], input[type=password], input:not([type]), textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.other { margin-top: 4px; }

.note { display: block; font-size: .9rem; color: var(--muted); }
.note textarea { margin-top: 4px; resize: vertical; }

.status { font-size: .85rem; color: var(--expected); min-height: 1.3em; margin: 8px 0 0; }
.status.error, .error { color: var(--error); }

.login label { display: block; font-weight: 600; margin-bottom: 14px; }
.login input { margin-top: 4px; font-weight: 400; }

button {
  font: inherit; font-weight: 600; color: #fff; background: var(--accent);
  border: 0; border-radius: 8px; padding: 10px 20px; cursor: pointer;
}

.done { text-align: center; color: var(--muted); margin-top: 24px; }

.tally { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 4px; }
.tally .n { display: inline-block; min-width: 2em; font-weight: 700; color: var(--accent); }
.tally .zero { color: var(--muted); }
.tally .zero .n { color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px; border-top: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.result { overflow-x: auto; }

@media (max-width: 640px) {
  .states, .compare { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
}
