:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1b2430;
  --muted: #647084;
  --line: #dbe1ea;
  --accent: #1b5e5a;
  --accent-2: #0757a8;
  --good: #137333;
  --bad: #b3261e;
  --warn: #8a4b08;
  --surface: #eef4f9;
  --shadow: 0 16px 34px rgba(27, 36, 48, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 76px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.brand:hover,
.button:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 850;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 13px;
}

.toplinks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
}

.shell {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 34px 20px 56px;
}

.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 880px;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.05;
}

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

.lead {
  max-width: 820px;
  color: var(--muted);
  font-size: 20px;
}

.settings {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 140px 140px;
  gap: 12px;
  margin-top: 8px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: white;
  font: inherit;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

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

.button:disabled {
  cursor: default;
  opacity: 0.55;
}

.status {
  min-height: 24px;
  color: var(--muted);
}

.quiz-panel {
  display: grid;
  gap: 18px;
}

.quiz-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
}

.quiz-head h2 {
  margin-bottom: 0;
}

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

.scorebox span,
.scorebox strong {
  display: grid;
  place-items: center;
  min-width: 56px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 850;
}

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface);
}

.meter span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-2);
  transition: width 0.2s linear;
}

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

.question-prompt {
  font-size: 24px;
  font-weight: 760;
  line-height: 1.25;
}

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

.option {
  width: 100%;
  justify-content: flex-start;
  min-height: 54px;
  padding: 12px 14px;
  text-align: left;
}

.option.correct {
  border-color: rgba(19, 115, 51, 0.4);
  background: #e9f5ee;
}

.option.wrong {
  border-color: rgba(179, 38, 30, 0.4);
  background: #fceceb;
}

.feedback {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.feedback.correct {
  border-color: rgba(19, 115, 51, 0.35);
  background: #edf7f1;
}

.feedback.wrong {
  border-color: rgba(179, 38, 30, 0.35);
  background: #fff1f0;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.summary {
  display: grid;
  gap: 22px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.summary-stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.summary-stat strong {
  display: block;
  font-size: 26px;
}

.summary-stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.review-list {
  display: grid;
  gap: 12px;
}

.review-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.review-item h4 {
  margin: 0 0 8px;
}

.review-item p {
  color: var(--muted);
}

@media (max-width: 780px) {
  .topbar,
  .quiz-head {
    display: grid;
  }

  .settings {
    grid-template-columns: 1fr;
  }
}
