:root {
  color-scheme: light;
  --page: #f5f7f4;
  --surface: #ffffff;
  --surface-muted: #edf1ed;
  --ink: #18211e;
  --muted: #68736e;
  --line: #d8ded9;
  --success: #1f7154;
  --success-soft: #e8f4ee;
  --error: #bd4d49;
  --error-soft: #f9eceb;
  --gold: #b98a28;
  --sidebar: #1b2421;
  --sidebar-muted: #9eadA6;
  --focus: #327b62;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 34%, transparent);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 32px 28px 24px;
  color: #f4f7f5;
  background: var(--sidebar);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  color: inherit;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid #819089;
  border-radius: 6px;
  font-size: 14px;
}

.session-overview {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding-top: 88px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: var(--sidebar-muted);
}

.progress-ring {
  position: relative;
  display: grid;
  width: 112px;
  height: 112px;
  margin: 6px 0 42px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#78b99b var(--progress, 0%), #33403b 0);
  transition: background 260ms ease;
}

.progress-ring::before {
  position: absolute;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--sidebar);
  content: "";
}

.progress-ring span {
  position: relative;
  z-index: 1;
  font-size: 20px;
  font-weight: 700;
}

.session-stats {
  display: grid;
  gap: 18px;
  margin: 0;
}

.session-stats div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid #34413c;
}

.session-stats dt {
  color: var(--sidebar-muted);
  font-size: 13px;
}

.session-stats dd {
  margin: 0;
  color: #f8faf8;
  font-size: 15px;
  font-weight: 650;
}

.sidebar-footer {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  color: var(--sidebar-muted);
  font-size: 11px;
}

.main-content {
  width: min(100%, 1180px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 64px 72px;
}

.topbar {
  display: flex;
  min-height: 120px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.topbar .eyebrow {
  margin-bottom: 5px;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0;
}

.text-button {
  padding: 8px 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.text-button:hover {
  color: var(--ink);
}

.start-view {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  min-height: calc(100vh - 120px);
  align-items: center;
  gap: 88px;
  padding: 72px 0 96px;
}

.start-copy {
  max-width: 650px;
}

.start-index {
  margin: 0 0 30px;
  color: var(--success);
  font-size: 13px;
  font-weight: 750;
}

.start-copy h2 {
  max-width: 560px;
  margin: 0;
  font-size: 64px;
  font-weight: 620;
  line-height: 1.08;
  letter-spacing: 0;
}

.rule-line {
  display: flex;
  gap: 0;
  margin: 42px 0;
  color: var(--muted);
  font-size: 14px;
}

.rule-line span + span::before {
  margin: 0 16px;
  color: var(--line);
  content: "/";
}

.primary-button {
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  color: #ffffff;
  background: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.primary-button:hover {
  background: #2b3733;
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(0);
}

.primary-button.compact {
  min-width: 98px;
  min-height: 42px;
  padding: 0 18px;
}

.start-visual {
  align-self: center;
  padding: 30px 0;
}

.number-block {
  color: var(--ink);
  font-size: 132px;
  font-weight: 620;
  line-height: 1;
}

.score-track {
  position: relative;
  height: 8px;
  margin-top: 28px;
  overflow: hidden;
  border-radius: 4px;
  background: #dfe4df;
}

.track-pass {
  display: block;
  width: 88%;
  height: 100%;
  background: var(--success);
}

.track-marker {
  position: absolute;
  top: -4px;
  left: calc(88% - 1px);
  width: 2px;
  height: 16px;
  background: var(--gold);
}

.track-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.quiz-view {
  padding: 34px 0 72px;
}

.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.question-progress {
  display: grid;
  grid-template-columns: repeat(25, 1fr);
  gap: 5px;
  height: 5px;
  margin: 16px 0 54px;
}

.progress-cell {
  min-width: 0;
  border-radius: 3px;
  background: var(--line);
  transition: background 180ms ease;
}

.progress-cell.current,
.progress-cell.correct {
  background: var(--success);
}

.progress-cell.wrong {
  background: var(--error);
}

.question-stage {
  max-width: 840px;
}

.question-stage > h2 {
  max-width: 780px;
  margin: 0 0 34px;
  font-size: 34px;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.question-media {
  display: flex;
  min-height: 180px;
  max-height: 320px;
  margin: -6px 0 32px;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}

.question-media img {
  display: block;
  width: auto;
  max-width: min(100%, 300px);
  max-height: 290px;
  object-fit: contain;
}

.answer-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.answer-option {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  min-height: 68px;
  align-items: center;
  gap: 14px;
  padding: 12px 10px 12px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition:
    color 140ms ease,
    background 140ms ease;
}

.answer-option:hover:not(:disabled) {
  background: #eef2ee;
}

.answer-option:disabled {
  cursor: default;
}

.option-key {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.option-text {
  min-width: 0;
  font-size: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.option-state {
  min-width: 72px;
  color: inherit;
  font-size: 12px;
  font-weight: 750;
  text-align: right;
}

.answer-option.correct {
  color: var(--success);
  background: var(--success-soft);
}

.answer-option.wrong {
  color: var(--error);
  background: var(--error-soft);
}

.feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-top: 28px;
  padding: 22px 0;
  border-top: 2px solid var(--error);
}

.feedback-label {
  margin: 0 0 5px;
  color: var(--error);
  font-size: 11px;
  font-weight: 800;
}

.feedback p:last-child {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
}

.result-view {
  padding: 70px 0 88px;
}

.result-summary {
  max-width: 720px;
  padding-bottom: 64px;
}

.result-score {
  margin: 8px 0 16px;
  font-size: 120px;
  font-weight: 620;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.result-summary h2 {
  margin: 0 0 10px;
  font-size: 30px;
  font-weight: 650;
}

.result-summary > p:not(.eyebrow) {
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 15px;
}

.mistake-review {
  max-width: 840px;
  padding-top: 36px;
  border-top: 1px solid var(--line);
}

.review-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.review-heading span {
  color: var(--muted);
  font-size: 12px;
}

.mistake-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.mistake-row > span {
  color: var(--error);
  font-size: 12px;
  font-weight: 750;
}

.mistake-row p {
  margin: 0;
  line-height: 1.45;
}

.mistake-row .mistake-question {
  margin-bottom: 7px;
  font-size: 15px;
  font-weight: 650;
}

.mistake-row .mistake-answer {
  color: var(--success);
  font-size: 13px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: 0;
    padding: 18px 24px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .session-overview {
    display: none;
  }

  .sidebar-footer {
    gap: 16px;
  }

  .main-content {
    padding: 0 34px 64px;
  }

  .topbar {
    min-height: 92px;
  }

  .start-view {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 54px;
    padding: 64px 0 88px;
  }

  .start-copy h2 {
    font-size: 52px;
  }

  .question-stage > h2 {
    font-size: 30px;
  }

  .result-score {
    font-size: 96px;
  }

  .start-visual {
    max-width: 420px;
  }
}

@media (max-width: 600px) {
  .sidebar {
    padding: 15px 18px;
  }

  .brand {
    font-size: 14px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .sidebar-footer span:last-child {
    display: none;
  }

  .main-content {
    padding: 0 20px 48px;
  }

  .topbar {
    min-height: 82px;
  }

  .topbar h1 {
    font-size: 16px;
  }

  .start-view {
    gap: 36px;
    padding: 50px 0 60px;
  }

  .start-copy h2 {
    font-size: 40px;
  }

  .rule-line {
    flex-direction: column;
    gap: 8px;
    margin: 30px 0 34px;
  }

  .rule-line span + span::before {
    display: none;
  }

  .number-block {
    font-size: 96px;
  }

  .quiz-view {
    padding-top: 26px;
  }

  .question-progress {
    gap: 3px;
    margin-bottom: 38px;
  }

  .question-stage > h2 {
    margin-bottom: 26px;
    font-size: 25px;
  }

  .result-score {
    font-size: 78px;
  }

  .question-media {
    min-height: 140px;
    max-height: 240px;
    margin-bottom: 24px;
  }

  .question-media img {
    max-width: min(100%, 250px);
    max-height: 220px;
  }

  .answer-option {
    grid-template-columns: 34px minmax(0, 1fr);
    min-height: 64px;
    gap: 8px;
    padding-right: 6px;
  }

  .option-state {
    grid-column: 2;
    min-width: 0;
    margin-top: -3px;
    text-align: left;
  }

  .feedback {
    align-items: flex-start;
    flex-direction: column;
  }

  .feedback .primary-button {
    width: 100%;
  }

  .result-view {
    padding-top: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
