:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #f8fafb;
  --ink: #15202b;
  --muted: #627181;
  --line: #dce2e8;
  --brand: #c81e32;
  --brand-dark: #9f1425;
  --brand-soft: #fff0f2;
  --navy: #17324d;
  --green: #16825d;
  --green-soft: #e9f8f2;
  --red: #c52b3e;
  --red-soft: #fff0f2;
  --amber: #b66a09;
  --shadow: 0 16px 50px rgba(20, 35, 50, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 90% 0%, rgba(200, 30, 50, 0.07), transparent 24rem),
    var(--bg);
  color: var(--ink);
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  line-height: 1.6;
}

button {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(220, 226, 232, 0.9);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  border-radius: 12px;
  background: var(--brand);
  color: white;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.25;
}

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

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.header-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22, 130, 93, 0.12);
}

#app {
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 138px);
  margin: 0 auto;
  padding: 46px 0 64px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(2.3rem, 5vw, 4.6rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

h2 {
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.lead {
  max-width: 690px;
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 1.05rem;
}

.start-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 24px;
  align-items: start;
}

.hero-panel,
.info-panel,
.question-card,
.question-nav,
.score-card,
.result-summary,
.review-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 5vw, 58px);
}

.hero-panel::after {
  position: absolute;
  right: -90px;
  bottom: -150px;
  width: 330px;
  height: 330px;
  border: 52px solid var(--brand-soft);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.hero-panel > * {
  position: relative;
  z-index: 1;
}

.exam-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
}

.exam-facts li {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 700;
}

.button {
  display: inline-flex;
  min-height: 48px;
  padding: 0 20px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
.answer-option:focus-within,
.nav-number:focus-visible,
.filter-button:focus-visible {
  outline: 3px solid rgba(200, 30, 50, 0.2);
  outline-offset: 2px;
}

.button-primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 10px 24px rgba(200, 30, 50, 0.22);
}

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

.button-dark {
  background: var(--navy);
  color: white;
}

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

.info-panel {
  padding: 25px;
}

.info-panel h2 {
  margin-bottom: 6px;
  font-size: 1.06rem;
}

.info-panel > p {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.82rem;
}

.topic-list {
  display: grid;
  gap: 13px;
}

.topic-row {
  display: grid;
  grid-template-columns: 9px 1fr auto;
  gap: 11px;
  align-items: center;
  font-size: 0.82rem;
}

.topic-swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--topic-color, var(--brand));
}

.topic-row strong {
  color: var(--navy);
  font-size: 0.78rem;
}

.quiz-topline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.quiz-topline h1 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
}

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

.exam-timer {
  min-width: 74px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #eef3f7;
  color: var(--navy);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
}

.exam-timer.timer-warning {
  background: #fff4e5;
  color: var(--amber);
}

.exam-timer.timer-critical {
  background: var(--red-soft);
  color: var(--red);
}

.progress-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.progress-track {
  height: 7px;
  margin-bottom: 25px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e8ec;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #e15563);
  transition: width 0.25s ease;
}

.quiz-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.question-nav {
  position: sticky;
  top: 96px;
  padding: 21px;
}

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

.nav-heading strong {
  font-size: 0.88rem;
}

.nav-heading span {
  color: var(--muted);
  font-size: 0.72rem;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.nav-number {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
}

.nav-number.answered {
  border-color: rgba(200, 30, 50, 0.22);
  background: var(--brand-soft);
  color: var(--brand);
}

.nav-number.current {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.nav-legend {
  display: flex;
  gap: 16px;
  margin-top: 17px;
  color: var(--muted);
  font-size: 0.68rem;
}

.nav-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: #e4e8ec;
}

.legend-dot.done {
  background: var(--brand);
}

.question-card {
  min-height: 540px;
  padding: clamp(24px, 4vw, 42px);
}

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

.badge {
  display: inline-flex;
  padding: 6px 10px;
  align-items: center;
  border-radius: 7px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 700;
}

.badge-topic {
  background: var(--brand-soft);
  color: var(--brand);
}

.question-title {
  margin-bottom: 13px;
  color: var(--navy);
  font-size: clamp(1.2rem, 2vw, 1.55rem);
}

.question-prompt {
  margin-bottom: 27px;
  color: #2c3a47;
  font-size: 0.95rem;
}

.question-prompt p,
.formatted-text p {
  margin-bottom: 12px;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #edf1f4;
  color: #8e1d2d;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.86em;
}

pre {
  margin: 14px 0;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid #263d52;
  border-radius: 11px;
  background: #142638;
  color: #e7edf2;
  font: 0.8rem/1.65 "JetBrains Mono", monospace;
}

pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

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

.answer-option {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 13px;
  padding: 15px 16px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}

.answer-option:hover {
  border-color: #bdc7d0;
  background: #fbfcfd;
  transform: translateX(2px);
}

.answer-option.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.answer-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.answer-letter {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.selected .answer-letter {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.answer-text {
  padding-top: 4px;
  color: #344351;
  font-size: 0.88rem;
}

.question-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
}

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

.mobile-counter {
  display: none;
  margin-bottom: 16px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.results-head {
  margin-bottom: 24px;
  text-align: center;
}

.results-head h1 {
  max-width: none;
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.results-head p {
  color: var(--muted);
}

.results-grid {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.score-card {
  position: sticky;
  top: 96px;
  padding: 28px;
  text-align: center;
}

.score-ring {
  display: grid;
  width: 176px;
  height: 176px;
  margin: 2px auto 20px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, white 79%, transparent 80% 100%),
    conic-gradient(var(--score-color) calc(var(--score) * 1%), #e5e9ed 0);
}

.score-ring strong {
  display: block;
  font-size: 2.65rem;
  line-height: 1;
}

.score-ring span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.result-state {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.result-state.pass {
  background: var(--green-soft);
  color: var(--green);
}

.result-state.fail {
  background: var(--red-soft);
  color: var(--red);
}

.score-detail {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.82rem;
}

.score-card .button {
  width: 100%;
}

.result-summary {
  padding: 25px;
}

.summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 20px;
}

.summary-top h2 {
  margin: 0;
  font-size: 1.2rem;
}

.filters {
  display: flex;
  gap: 7px;
}

.filter-button {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
}

.filter-button.active {
  border-color: var(--navy);
  background: var(--navy);
  color: white;
}

.category-results {
  display: grid;
  gap: 12px;
}

.category-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px 52px;
  gap: 12px;
  align-items: center;
  font-size: 0.75rem;
}

.category-result strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6eaed;
}

.mini-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--topic-color);
}

.category-result em {
  color: var(--muted);
  font-style: normal;
  font-weight: 700;
  text-align: right;
}

.review-list {
  display: grid;
  gap: 15px;
  margin-top: 24px;
}

.review-card {
  padding: 24px;
}

.review-card.correct {
  border-left: 4px solid var(--green);
}

.review-card.incorrect {
  border-left: 4px solid var(--red);
}

.review-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.review-status .is-correct {
  color: var(--green);
}

.review-status .is-incorrect {
  color: var(--red);
}

.review-card h3 {
  margin-bottom: 7px;
  color: var(--navy);
  font-size: 1rem;
}

.review-prompt {
  margin-bottom: 14px;
  font-size: 0.84rem;
}

.review-answer {
  margin: 7px 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--surface-muted);
  font-size: 0.79rem;
}

.review-answer.correct-answer {
  background: var(--green-soft);
  color: #126747;
}

.review-answer.wrong-answer {
  background: var(--red-soft);
  color: #982033;
}

.explanation {
  margin: 13px 0 0;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(15, 29, 42, 0.55);
  backdrop-filter: blur(4px);
}

.dialog-backdrop[hidden] {
  display: none;
}

.dialog {
  width: min(430px, 100%);
  padding: 30px;
  border-radius: 18px;
  background: white;
  box-shadow: 0 26px 80px rgba(5, 15, 25, 0.3);
  text-align: center;
}

.dialog-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.3rem;
  font-weight: 800;
}

.dialog h2 {
  margin-bottom: 8px;
}

.dialog p {
  color: var(--muted);
  font-size: 0.86rem;
}

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

.site-footer {
  display: flex;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 19px 0 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
}

.empty-state {
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .start-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .quiz-layout {
    grid-template-columns: 1fr;
  }

  .question-nav {
    position: static;
    display: none;
  }

  .mobile-counter {
    display: flex;
    justify-content: space-between;
  }

  .score-card {
    position: static;
  }
}

@media (max-width: 620px) {
  .quiz-topline {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .quiz-status {
    width: 100%;
    justify-content: space-between;
  }

  .site-header {
    min-height: 64px;
    padding-right: 16px;
    padding-left: 16px;
  }

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

  .brand small,
  .header-meta span:not(.status-dot) {
    display: none;
  }

  #app {
    width: min(100% - 24px, 1180px);
    padding-top: 26px;
  }

  .hero-panel,
  .info-panel,
  .question-card,
  .score-card,
  .result-summary,
  .review-card {
    border-radius: 14px;
  }

  .question-card {
    min-height: auto;
    padding: 20px;
  }

  .answer-option {
    grid-template-columns: 32px 1fr;
    padding: 13px;
  }

  .answer-letter {
    width: 30px;
    height: 30px;
  }

  .question-actions,
  .summary-top {
    align-items: stretch;
    flex-direction: column;
  }

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

  .question-actions > .button,
  .actions-right .button {
    padding: 0 12px;
  }

  .filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .category-result {
    grid-template-columns: minmax(0, 1fr) 55px;
  }

  .mini-track {
    display: none;
  }

  .site-footer {
    align-items: center;
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }
}
