:root {
  --bg: #f7f8f6;
  --panel: #ffffff;
  --ink: #17201d;
  --muted: #68736f;
  --line: #dfe5e0;
  --teal: #0f766e;
  --teal-dark: #0a4f49;
  --amber: #c47a18;
  --good: #0f7b45;
  --bad: #b42318;
  --shadow: 0 18px 48px rgba(23, 32, 29, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 118, 110, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 44px 44px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.shell,
.exam-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar,
.exam-top {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

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

.brand small,
.source,
.question-meta,
.review-item p,
.exam-card p,
.hero p,
.study-band p,
.score-panel p {
  color: var(--muted);
}

.source {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 14px;
}

.hero {
  min-height: calc(100vh - 180px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 44px;
  align-items: center;
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(42px, 6vw, 74px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero p {
  max-width: 570px;
  margin: 24px 0 0;
  font-size: 19px;
  line-height: 1.6;
}

.exam-card,
.question-panel,
.feedback-panel,
.score-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.exam-card {
  padding: 28px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.card-head h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.card-head span,
.result-pill {
  align-self: flex-start;
  border-radius: 999px;
  padding: 7px 10px;
  background: #e5f4f1;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 28px 0;
}

.stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

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

.stats strong {
  font-size: 26px;
}

.stats small {
  color: var(--muted);
}

.primary,
.ghost,
.mode-option,
.option {
  min-height: 46px;
  border-radius: 8px;
  cursor: pointer;
}

.primary {
  width: 100%;
  border: 0;
  background: var(--teal);
  color: white;
  font-weight: 800;
}

.primary:hover {
  background: var(--teal-dark);
}

.primary:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.ghost:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.ghost {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 0 14px;
}

.study-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
  margin: 0 0 42px;
}

.study-band div {
  background: rgba(255, 255, 255, 0.82);
  padding: 24px;
}

.study-band h3 {
  margin: 0 0 8px;
}

.study-band p {
  margin: 0;
  line-height: 1.55;
}

.mode-dialog {
  width: min(560px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.mode-dialog::backdrop {
  background: rgba(23, 32, 29, 0.32);
}

.mode-dialog form {
  padding: 24px;
}

.mode-dialog h2,
.mode-dialog p {
  margin: 0 0 14px;
}

.mode-dialog p {
  color: var(--muted);
}

.mode-option {
  width: 100%;
  display: block;
  text-align: left;
  border: 1px solid var(--line);
  background: white;
  padding: 16px;
  margin-top: 12px;
}

.mode-option strong,
.mode-option span {
  display: block;
}

.mode-option span {
  margin-top: 6px;
  color: var(--muted);
}

.exam-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.exam-top {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(247, 248, 246, 0.88);
  backdrop-filter: blur(16px);
}

.progress-wrap {
  width: min(560px, 46vw);
}

.progress-wrap span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce6e2;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.timer {
  min-width: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px 12px;
  text-align: center;
}

.question-panel,
.feedback-panel {
  align-self: center;
  width: min(900px, 100%);
  margin: 24px auto 60px;
  padding: clamp(22px, 4vw, 42px);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 800;
}

.question-panel h1,
.feedback-panel h1 {
  margin: 0 0 28px;
  font-size: clamp(25px, 3vw, 40px);
  line-height: 1.16;
  letter-spacing: 0;
}

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

.option {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  padding: 14px;
  text-align: left;
}

.option b {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef3f0;
  color: var(--ink);
}

.option:hover,
.option.is-selected {
  border-color: var(--teal);
  background: #f0faf7;
}

.option:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.option.is-selected:disabled {
  opacity: 1;
}

.option:disabled:hover {
  border-color: var(--line);
  background: white;
}

.option.is-selected:disabled:hover {
  border-color: var(--teal);
  background: #f0faf7;
}

.submit {
  margin-top: 18px;
}

.question-actions {
  display: grid;
  grid-template-columns: minmax(130px, 0.35fr) 1fr;
  gap: 12px;
  margin-top: 18px;
}

.inline-feedback {
  border-radius: 8px;
  margin-top: 18px;
  padding: 16px;
}

.inline-feedback p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.inline-feedback.ok {
  border: 1px solid rgba(15, 123, 69, 0.28);
  background: #edf9f1;
  color: #16472e;
}

.inline-feedback.bad {
  border: 1px solid rgba(180, 35, 24, 0.24);
  background: #fff2ef;
  color: #6f2018;
}

.feedback-panel.ok {
  border-color: rgba(15, 123, 69, 0.35);
}

.feedback-panel.bad {
  border-color: rgba(180, 35, 24, 0.35);
}

.explanation {
  border-left: 4px solid var(--amber);
  background: #fff8ed;
  padding: 16px;
  margin: 20px 0;
}

.explanation p {
  margin: 8px 0 0;
  color: #5f4a2c;
  line-height: 1.55;
}

.result-shell {
  padding-bottom: 56px;
}

.score-panel {
  padding: 34px;
  text-align: center;
}

.score-panel span {
  color: var(--teal-dark);
  font-weight: 900;
}

.score-panel h1 {
  margin: 10px 0;
  font-size: clamp(70px, 11vw, 132px);
  line-height: 0.95;
}

.score-panel .primary {
  max-width: 260px;
}

.review-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.review-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 18px;
}

.review-item strong {
  line-height: 1.35;
}

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

.review-item span {
  align-self: start;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
}

.review-item.ok span {
  background: #e9f8ef;
  color: var(--good);
}

.review-item.bad span {
  background: #fff0ee;
  color: var(--bad);
}

@media (max-width: 760px) {
  .shell,
  .exam-shell {
    width: min(100% - 22px, 1180px);
  }

  .topbar,
  .exam-top {
    min-height: 74px;
  }

  .hero,
  .study-band {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding: 28px 0 34px;
    gap: 24px;
  }

  .hero h1 {
    font-size: 42px;
  }

  .source {
    display: none;
  }

  .exam-top {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
  }

  .progress-wrap {
    width: 100%;
  }

  .progress-wrap span {
    font-size: 12px;
  }

  .timer {
    min-width: 72px;
    padding: 9px 8px;
  }

  .question-meta {
    display: grid;
  }

  .review-item {
    grid-template-columns: 1fr;
  }

  .question-actions {
    grid-template-columns: 1fr;
  }
}
