:root {
  --ink: #1d2433;
  --muted: #5b6475;
  --line: #d9dde5;
  --paper: #ffffff;
  --bg: #f4f5f7;
  --accent: #2b5bd7;
  --accent-ink: #ffffff;
  --good: #1f7a45;
  --good-bg: #e8f5ed;
  --bad: #b3261e;
  --bad-bg: #fbeceb;
  --note-bg: #f7f3e8;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.wrap { max-width: 780px; margin: 0 auto; padding: 24px 16px 80px; }
header.top { margin-bottom: 20px; }
header.top h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 6px; }
header.top p { margin: 0; color: var(--muted); }
a { color: var(--accent); }

.section-title {
  font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 36px 0 12px; font-weight: 700;
}
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; margin: 0 0 16px;
}
.q-head { display: flex; gap: 10px; align-items: baseline; }
.q-num {
  flex: none; font-weight: 700; background: var(--ink); color: #fff;
  border-radius: 999px; min-width: 30px; height: 30px; display: inline-flex;
  align-items: center; justify-content: center; font-size: .9rem;
}
.q-text { margin: 0; }
.q-text p { margin: 0 0 8px; }
.figure { margin: 14px 0 4px; text-align: center; }
.figure svg { max-width: 100%; height: auto; }
.figure .note { font-size: .85rem; color: var(--muted); font-style: italic; margin-top: 4px; }

.passage {
  background: var(--note-bg); border-left: 4px solid #c9b98a; border-radius: 8px;
  padding: 16px 18px; margin: 0 0 16px; font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem; line-height: 1.7;
}
.passage .src { font-family: inherit; font-size: .85rem; color: var(--muted); margin-top: 8px; }

table.data { border-collapse: collapse; margin: 12px auto; font-size: .95rem; }
table.data th, table.data td { border: 1px solid var(--line); padding: 6px 14px; text-align: center; }
table.data th { background: #eef0f4; }
table.data caption { font-weight: 600; padding-bottom: 6px; }

.choices { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.choices label {
  display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; cursor: pointer; background: #fff;
}
.choices label:hover { border-color: #aab3c5; }
.choices input { margin-top: 5px; accent-color: var(--accent); }
.choices .letter { font-weight: 700; min-width: 1.2em; }
.choices label.picked { border-color: var(--accent); background: #eef3ff; }

.field { margin-top: 14px; }
.field label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 4px; }
.field input[type=text], .field textarea {
  width: 100%; font: inherit; padding: 9px 11px; border: 1px solid #b8bfcc;
  border-radius: 8px; background: #fff; color: var(--ink);
}
.field input.answer { max-width: 220px; }
.field textarea { min-height: 54px; resize: vertical; }
.hint { font-size: .85rem; color: var(--muted); margin-top: 3px; }

.submit-bar { margin-top: 28px; text-align: center; }
button.grade {
  font: inherit; font-weight: 700; font-size: 1.1rem; background: var(--accent);
  color: var(--accent-ink); border: 0; border-radius: 10px; padding: 14px 34px; cursor: pointer;
}
button.grade:disabled { opacity: .6; cursor: default; }
.status { margin-top: 10px; color: var(--muted); min-height: 1.4em; }

.score {
  display: none; text-align: center; background: var(--paper); border: 2px solid var(--ink);
  border-radius: 12px; padding: 18px; margin: 20px 0;
}
.score.show { display: block; }
.score .big { font-size: 2.2rem; font-weight: 800; line-height: 1.1; }

.card.right { border-color: var(--good); }
.card.wrong { border-color: var(--bad); }
.verdict { display: none; margin-top: 14px; border-radius: 10px; padding: 12px 14px; }
.verdict.show { display: block; }
.card.right .verdict { background: var(--good-bg); }
.card.wrong .verdict { background: var(--bad-bg); }
.verdict .tag { font-weight: 800; }
.card.right .verdict .tag { color: var(--good); }
.card.wrong .verdict .tag { color: var(--bad); }
.verdict p { margin: 6px 0 0; }
.verdict ul { margin: 6px 0 0; padding-left: 20px; }
.verdict details summary { cursor: pointer; font-weight: 600; margin-top: 6px; }

.lesson-list { list-style: none; padding: 0; margin: 0; }
.lesson-list li { margin: 0 0 10px; }
.lesson-list a {
  display: block; background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; text-decoration: none; color: var(--ink);
}
.lesson-list a:hover { border-color: var(--accent); }
.lesson-list .meta { color: var(--muted); font-size: .9rem; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .card { padding: 16px; }
}
