:root {
  color-scheme: light;
  --bg: #eef3f1;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --ink: #17211d;
  --muted: #64716b;
  --line: #d7e1dd;
  --accent: #17745b;
  --accent-dark: #0f5947;
  --accent-soft: #dff3ec;
  --danger: #b83232;
  --danger-soft: #fde9e9;
  --success: #17745b;
  --success-soft: #e3f5ee;
  --shadow: 0 18px 45px rgba(23, 33, 29, 0.09);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(23, 116, 91, 0.1), transparent 34rem),
    var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

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

.hidden {
  display: none !important;
}

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

.setup-screen {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(340px, 1.15fr);
  gap: 22px;
  align-content: center;
}

.top-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-mark {
  display: block;
  color: var(--ink);
  font-weight: 900;
}

.top-bar small {
  color: var(--muted);
  font-weight: 750;
}

.profile-screen {
  max-width: 720px;
  margin: 8vh auto 0;
  padding: 28px;
}

.profile-screen h1 {
  font-size: clamp(2.2rem, 6vw, 4.6rem);
}

.profile-copy {
  color: var(--muted);
  line-height: 1.6;
}

.profile-form {
  display: grid;
  grid-template-columns: 1fr 0.45fr;
  gap: 16px;
  margin-top: 22px;
}

.profile-form .wide,
.profile-form .form-error,
.profile-form .primary-button {
  grid-column: 1 / -1;
}

.form-error {
  min-height: 22px;
  margin: 0;
  color: var(--danger);
  font-weight: 800;
}

.profile-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 180px;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.profile-chip:hover {
  border-color: var(--accent);
}

.profile-chip span {
  color: var(--muted);
  font-size: 0.84rem;
}

.history-head h2 {
  margin-bottom: 4px;
}

.hero-copy {
  align-self: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.6rem, 7vw, 5.6rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-copy p:not(.eyebrow) {
  max-width: 640px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.setup-panel {
  display: grid;
  grid-template-columns: 1fr 0.85fr;
  gap: 16px;
  align-self: center;
  padding: 22px;
}

.control-block {
  display: grid;
  gap: 8px;
}

.control-block.wide,
.availability,
.setup-panel .primary-button {
  grid-column: 1 / -1;
}

.history-panel {
  grid-column: 1 / -1;
  padding: 18px;
}

.history-head {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.history-item span,
.empty-history {
  display: block;
  margin: 0;
  color: var(--muted);
}

label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

select,
input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.availability {
  display: grid;
  gap: 4px;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.4;
}

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

.primary-button,
.secondary-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

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

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.secondary-button {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.stats-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat {
  min-height: 92px;
  padding: 16px;
}

.stat strong {
  display: block;
  margin-bottom: 4px;
  font-size: 2rem;
}

.stat span,
.progress-panel p {
  color: var(--muted);
  line-height: 1.5;
}

.exam-screen {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px;
}

.progress-panel {
  align-self: start;
  padding: 20px;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 800;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  background: #e7eeeb;
  border-radius: 999px;
}

#progress-bar {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

.quiz-panel {
  min-height: 560px;
  padding: 28px;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.question-meta span {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent-dark);
  font-size: 0.83rem;
  font-weight: 800;
}

#question-text {
  margin-bottom: 22px;
  font-size: clamp(1.3rem, 2.6vw, 2rem);
  line-height: 1.3;
}

.statement-number {
  display: inline-block;
  min-width: 28px;
  margin-top: 8px;
  color: var(--accent-dark);
  font-weight: 900;
}

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

.answer-button {
  width: 100%;
  min-height: 62px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  line-height: 1.4;
}

.answer-button span {
  display: inline-grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-dark);
  font-weight: 900;
}

.answer-button:hover,
.answer-button.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.answer-button.selected span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.quiz-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.result-screen {
  padding: 28px;
}

.result-screen h2 {
  margin-bottom: 12px;
  font-size: clamp(1.7rem, 4vw, 3rem);
}

.result-screen > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.6;
}

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

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

.review-item.compact {
  padding: 12px 14px;
}

.review-item.correct {
  border-color: rgba(23, 116, 91, 0.35);
  background: var(--success-soft);
}

.review-item.incorrect {
  border-color: rgba(184, 50, 50, 0.35);
  background: var(--danger-soft);
}

.review-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.review-head span {
  font-weight: 900;
}

.review-item.correct .review-head span {
  color: var(--success);
}

.review-item.incorrect .review-head span {
  color: var(--danger);
}

.review-item p {
  margin-bottom: 12px;
  line-height: 1.5;
}

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

.answer-summary {
  color: var(--muted);
}

.review-item dl {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0 0 12px;
}

.review-item dt {
  color: var(--muted);
  font-weight: 800;
}

.review-item dd {
  margin: 0;
}

.explanation {
  color: var(--muted);
}

@media (max-width: 880px) {
  .setup-screen,
  .exam-screen,
  .stats-row {
    grid-template-columns: 1fr;
  }

  .setup-screen {
    align-content: start;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1160px);
    padding: 18px 0;
  }

  .setup-panel,
  .quiz-panel,
  .result-screen {
    padding: 18px;
  }

  .setup-panel {
    grid-template-columns: 1fr;
  }

  .profile-form {
    grid-template-columns: 1fr;
  }

  .history-head,
  .history-item {
    align-items: stretch;
    flex-direction: column;
  }

  .top-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-chip {
    align-items: flex-start;
    width: 100%;
  }

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