:root {
  color-scheme: light;
  --ink: #17233c;
  --muted: #748099;
  --line: #e4e9f1;
  --surface: #ffffff;
  --page: #f5f7fb;
  --blue: #3569e8;
  --blue-dark: #2453c6;
  --green: #17895f;
  --red: #c64955;
  --shadow: 0 18px 55px rgba(32, 52, 94, 0.09);
  font-family: "DM Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 82% 4%, rgba(81, 119, 226, 0.09), transparent 30rem),
    var(--page);
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(53, 105, 232, 0.36);
  outline-offset: 3px;
}

.page {
  width: min(100% - 48px, 1060px);
  margin: 0 auto;
  padding-bottom: 64px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  border-bottom: 1px solid rgba(222, 228, 238, 0.85);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #5584f2, #315bd2);
  box-shadow: 0 7px 16px rgba(53, 105, 232, 0.24);
  font-family: "Manrope", sans-serif;
  font-size: 22px;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-family: "Manrope", sans-serif;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 0.03em;
}

.brand strong span {
  color: var(--blue);
}

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.header-tag {
  padding: 8px 11px;
  border: 1px solid #e1e7f2;
  border-radius: 999px;
  color: #64728e;
  background: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.view {
  animation: enter 240ms ease-out;
}

.setup-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 430px);
  align-items: center;
  gap: clamp(36px, 7vw, 88px);
  max-width: 940px;
  min-height: 650px;
  margin: 0 auto;
}

.intro {
  padding: 32px 0;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: "Manrope", "Segoe UI", sans-serif;
}

.intro h1 {
  margin: 0;
  font-size: clamp(34px, 4.5vw, 49px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.045em;
}

.intro h1 span {
  color: #8290aa;
}

.intro-copy {
  max-width: 390px;
  margin: 21px 0 0;
  color: #758199;
  font-size: 15px;
  line-height: 1.8;
}

.setup-panel {
  padding: 31px;
  border: 1px solid rgba(226, 231, 240, 0.9);
  border-radius: 19px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 27px;
}

.panel-heading .eyebrow {
  margin-bottom: 7px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.025em;
}

.question-count {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: 7px;
  color: #3c65c5;
  background: #edf2ff;
  font-size: 10px;
  font-weight: 700;
}

.field-label {
  display: block;
  margin-bottom: 9px;
  color: #34415b;
  font-size: 12px;
  font-weight: 700;
}

.select-control {
  width: 100%;
  min-height: 49px;
  padding: 0 14px;
  border: 1px solid #dfe5ef;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  font-size: 14px;
}

.select-control:disabled {
  color: #a4acbb;
  background: #f8f9fb;
}

.setup-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 17px 0 22px;
  color: #748099;
  font-size: 11px;
  line-height: 1.6;
}

.note-icon {
  display: grid;
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid #aebfe8;
  border-radius: 50%;
  color: #5676ca;
  font-family: Georgia, serif;
  font-size: 11px;
  font-weight: 700;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 47px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-primary {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 7px 15px rgba(53, 105, 232, 0.2);
}

.button-primary:hover:not(:disabled) {
  background: var(--blue-dark);
}

.button-secondary {
  border-color: #e0e6f0;
  color: #46536b;
  background: #fff;
}

.button-secondary:hover:not(:disabled) {
  border-color: #bdc9df;
  background: #f8faff;
}

.button-wide {
  width: 100%;
}

.page-footnote {
  grid-column: 1 / -1;
  margin: -53px 0 0;
  color: #97a0b2;
  font-size: 10px;
  text-align: center;
}

.page-footnote code {
  color: #69758b;
}

.notice {
  margin: 0 0 16px;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}

.notice-error {
  border: 1px solid #f1d0d2;
  color: #99464d;
  background: #fff6f6;
}

.file-loader {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 21px;
  padding: 13px;
  border: 1px dashed #b9c7e4;
  border-radius: 10px;
  color: #37445e;
  background: #f8faff;
  cursor: pointer;
}

.file-loader[hidden] {
  display: none;
}

.file-loader input {
  width: 145px;
  margin-left: auto;
  color: #53617b;
  font-size: 10px;
}

.file-loader strong,
.file-loader small {
  display: block;
}

.file-loader strong {
  margin-bottom: 4px;
  font-size: 11px;
}

.file-loader small {
  color: var(--muted);
  font-size: 10px;
}

.file-icon {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  color: var(--blue);
  background: #eaf0ff;
  font-size: 19px;
  font-weight: 700;
}

.quiz-view,
.results-view {
  max-width: 810px;
  margin: 0 auto;
  padding-top: 38px;
}

.quiz-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 17px;
}

.text-button {
  padding: 5px 0;
  border: 0;
  color: #748099;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
}

.text-button:hover {
  color: var(--blue);
}

.quiz-position {
  color: #67748c;
  font-size: 12px;
  font-weight: 700;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eaf3;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4b7cef, #76a0ff);
  transition: width 180ms ease;
}

.question-card {
  margin-top: 25px;
  padding: clamp(22px, 4vw, 35px);
  border: 1px solid rgba(226, 231, 240, 0.9);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.type-badge {
  padding: 5px 8px;
  border-radius: 6px;
  color: #536eb2;
  background: #eff3ff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.question-prompt {
  margin: 0 0 13px;
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: clamp(18px, 2.5vw, 22px);
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: -0.02em;
  white-space: pre-line;
}

.answer-hint {
  margin: 0 0 22px;
  color: #8993a6;
  font-size: 11px;
}

.question-images {
  display: grid;
  gap: 12px;
  margin: 19px 0;
}

.question-image {
  display: block;
  max-width: 100%;
  max-height: 560px;
  margin: 0 auto;
  border: 1px solid #e5eaf1;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
}

.answer-list {
  display: grid;
  gap: 10px;
}

.answer-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 52px;
  padding: 14px 15px;
  border: 1px solid #e3e8f0;
  border-radius: 10px;
  color: #34415a;
  background: #fff;
  font-size: 13px;
  line-height: 1.55;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.answer-option:hover {
  border-color: #b7c8f2;
  background: #fbfcff;
}

.answer-option:has(input:checked) {
  border-color: #7093ec;
  background: #f4f7ff;
}

.answer-option input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--blue);
}

.answer-option img {
  width: min(100%, 240px);
  max-height: 150px;
  margin: 8px 0 0;
  border-radius: 6px;
  object-fit: contain;
}

.option-content {
  min-width: 0;
}

.matching-list {
  display: grid;
  gap: 12px;
}

.match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.9fr);
  align-items: center;
  gap: 15px;
  padding: 12px 14px;
  border: 1px solid #e5eaf2;
  border-radius: 10px;
  background: #fcfdff;
}

.match-item {
  color: #34415a;
  font-size: 12px;
  line-height: 1.55;
}

.match-select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  color: #34415a;
  background: #fff;
  font-size: 12px;
}

.quiz-navigation {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 0;
}

.results-header {
  padding: 35px;
  border: 1px solid rgba(226, 231, 240, 0.9);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}

.results-header .eyebrow {
  margin-bottom: 8px;
}

.results-header h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.results-summary {
  margin: 9px 0 24px;
  color: var(--muted);
  font-size: 13px;
}

.score-card {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  padding: 12px 18px 12px 12px;
  border: 1px solid #e7ebf3;
  border-radius: 14px;
  background: #fbfcff;
  text-align: left;
}

.score-ring {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 4px solid #dfe8ff;
  border-top-color: var(--blue);
  border-right-color: var(--blue);
  border-radius: 50%;
}

.score-ring strong {
  font-family: "Manrope", sans-serif;
  font-size: 14px;
}

.score-card > div:last-child strong,
.score-card > div:last-child span {
  display: block;
}

.score-card > div:last-child strong {
  font-size: 15px;
}

.score-card > div:last-child span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.review-heading {
  margin: 34px 0 15px;
}

.review-heading h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.review-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.review-list {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.review-item {
  padding: 17px 19px;
  border: 1px solid #e5eaf2;
  border-radius: 11px;
  background: #fff;
}

.review-item.is-correct {
  border-left: 3px solid #52a982;
}

.review-item.is-incorrect {
  border-left: 3px solid #d76b73;
}

.review-status {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.is-incorrect .review-status {
  color: var(--red);
}

.review-question {
  margin: 0 0 12px;
  color: #303e58;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  white-space: pre-line;
}

.review-answer {
  margin: 7px 0 0;
  color: #68758c;
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-line;
}

.review-answer strong {
  color: #45536d;
}

.review-explanation {
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  color: #626f86;
  background: #f5f7fb;
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-line;
}

.review-explanation strong {
  display: block;
  margin-bottom: 4px;
  color: #3c4b65;
}

[hidden] {
  display: none !important;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .page {
    width: min(100% - 32px, 600px);
  }

  .setup-view {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 18px;
    min-height: auto;
    padding: 45px 0 0;
  }

  .intro {
    padding: 0 2px;
  }

  .intro h1 {
    font-size: clamp(34px, 9vw, 45px);
  }

  .intro-copy {
    margin-top: 13px;
    font-size: 13px;
  }

  .setup-panel {
    padding: 23px;
  }

  .page-footnote {
    margin: 0;
    padding-top: 16px;
  }

  .quiz-view,
  .results-view {
    padding-top: 24px;
  }

  .question-card {
    margin-top: 18px;
    padding: 21px 17px;
  }

  .match-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .match-select {
    min-height: 44px;
  }

  .results-header {
    padding: 25px 16px;
  }

  .file-loader {
    flex-wrap: wrap;
  }

  .file-loader input {
    width: 100%;
    margin-left: 42px;
  }
}

@media (max-width: 420px) {
  .page {
    width: min(100% - 24px, 380px);
  }

  .site-header {
    min-height: 72px;
  }

  .brand-mark {
    width: 37px;
    height: 37px;
  }

  .header-tag {
    padding: 7px 8px;
    font-size: 8px;
  }

  .setup-panel {
    padding: 19px;
  }

  .panel-heading h2 {
    font-size: 17px;
  }

  .question-count {
    max-width: 95px;
    white-space: nowrap;
  }

  .quiz-navigation .button {
    min-height: 44px;
    padding: 0 12px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
