:root {
  --bg: #F7F8FB;
  --surface: #FFFFFF;
  --text: #1A2233;
  --text-muted: #4B5670;
  --border: #E2E6EF;
  --accent: #2F7BEA;
  --accent-soft: #EAF1FD;
  --table-head: #0E1B3D;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1526;
    --surface: #151E33;
    --text: #EAEDF5;
    --text-muted: #A9B2C7;
    --border: #262F47;
    --accent: #5B9BF2;
    --accent-soft: #1B2A47;
    --table-head: #1B2A47;
  }
}

:root[data-theme="dark"] {
  --bg: #0E1526;
  --surface: #151E33;
  --text: #EAEDF5;
  --text-muted: #A9B2C7;
  --border: #262F47;
  --accent: #5B9BF2;
  --accent-soft: #1B2A47;
  --table-head: #1B2A47;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  font-size: 17px;
  padding: 0 0 4rem;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 0;
}

header.top {
  margin-bottom: 1.5rem;
}

h1 {
  font-size: 1.6rem;
  line-height: 1.3;
  margin: 0 0 0.4rem;
  color: var(--text);
}

.intro {
  color: var(--text-muted);
  font-size: 0.98rem;
  font-style: italic;
  margin: 0;
}

h2 {
  font-size: 1.15rem;
  margin: 2.2rem 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--accent);
  color: var(--text);
}

h3 {
  font-size: 1.02rem;
  margin: 1.4rem 0 0.4rem;
  color: var(--accent);
}

p { margin: 0.5rem 0; }

.rule {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin: 0.6rem 0;
}

.aid {
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  margin: 0.6rem 0;
  font-size: 0.96rem;
}

ul { padding-left: 1.3rem; margin: 0.5rem 0; }
li { margin: 0.35rem 0; }

.cluster {
  margin: 1.1rem 0;
}

.cluster-title {
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.term-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.55rem;
}

.term-name {
  font-weight: 700;
  color: var(--accent);
  display: block;
  margin-bottom: 0.15rem;
}

.term-def { color: var(--text); font-size: 0.96rem; }

.checklist { list-style: none; padding-left: 0; }
.checklist li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  margin-bottom: 0.5rem;
  font-size: 0.96rem;
}

footer.outro {
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.95rem;
}

b { color: var(--text); }

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.back-link:hover { text-decoration: underline; }

.quiz-progress {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 1.5rem 0 0.6rem;
}

.quiz-question {
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 1rem;
}

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.quiz-choice {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
}

.quiz-choice:active { transform: scale(0.99); }
.quiz-choice:disabled { cursor: default; }

.quiz-choice.correct {
  background: #E4F6E9;
  border-color: #34A853;
  color: #1E7B36;
}
.quiz-choice.incorrect {
  background: #FBE7E7;
  border-color: #E24444;
  color: #B3271E;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .quiz-choice.correct { background: #163420; border-color: #34A853; color: #7FE0A0; }
  :root:not([data-theme="light"]) .quiz-choice.incorrect { background: #3A1A1A; border-color: #E24444; color: #F29C97; }
}
:root[data-theme="dark"] .quiz-choice.correct { background: #163420; border-color: #34A853; color: #7FE0A0; }
:root[data-theme="dark"] .quiz-choice.incorrect { background: #3A1A1A; border-color: #E24444; color: #F29C97; }

.quiz-explain {
  display: none;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: var(--accent-soft);
  font-size: 0.95rem;
  line-height: 1.5;
}
.quiz-explain.show { display: block; }

.quiz-next {
  display: block;
  margin-top: 1.3rem;
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.quiz-next:disabled { opacity: 0.4; cursor: default; }

.quiz-score-line {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0.6rem 0 1.4rem;
}
