:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5d6b76;
  --line: #d8e1e8;
  --paper: #fbfcfd;
  --panel: #ffffff;
  --accent: #14746f;
  --accent-2: #b84a62;
  --good: #176b3a;
  --bad: #9a2c2c;
  --warn: #8a5c00;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
}

button, input, select, textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 42px);
  background: rgba(251, 252, 253, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: grid;
  gap: 2px;
  color: inherit;
  text-decoration: none;
}

.brand span {
  color: var(--muted);
  font-size: 0.78rem;
}

.brand strong {
  font-size: 1rem;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

nav a, .chip, button, .ghost-link {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

button.primary, .chip.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 42px);
}

.hero {
  display: grid;
  gap: 18px;
  padding: 14px 0 28px;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  letter-spacing: 0;
}

.lead {
  max-width: 700px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel, .item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: clamp(16px, 3vw, 24px);
}

.item-card {
  display: grid;
  gap: 10px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form-row {
  display: grid;
  gap: 8px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 8px;
}

label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
}

.question {
  display: grid;
  gap: 18px;
}

.stem {
  min-height: 136px;
  display: grid;
  align-content: center;
  gap: 8px;
  font-size: clamp(1.28rem, 3vw, 2rem);
  line-height: 1.45;
}

.marker {
  padding: 2px 8px;
  border-radius: 6px;
  background: #dcefeb;
  color: #0a544e;
  font-weight: 750;
}

.blank {
  display: inline-block;
  min-width: 9ch;
  border-bottom: 3px solid var(--accent);
  transform: translateY(-2px);
}

.options {
  display: grid;
  gap: 12px;
}

.option {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  width: 100%;
  text-align: left;
}

.badge {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #eef3f6;
  color: var(--muted);
  font-weight: 750;
}

.option.correct {
  border-color: var(--good);
  background: #eef8f1;
}

.option.wrong {
  border-color: var(--bad);
  background: #fff0f0;
}

.feedback {
  border-left: 4px solid var(--accent);
  padding: 12px 14px;
  background: #f1f8f7;
}

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: #e9eef2;
}

.meter > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.statline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
}

.statline strong {
  color: var(--ink);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

textarea {
  width: 100%;
  min-height: 170px;
  resize: vertical;
}

.notice {
  color: var(--muted);
  line-height: 1.65;
}

.danger {
  color: var(--bad);
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    justify-content: flex-start;
  }

  .grid.two, .grid.three {
    grid-template-columns: 1fr;
  }

  main {
    padding-inline: 14px;
  }
}
