:root {
  color-scheme: light;
  --page: #f4f6fa;
  --surface: #fff;
  --text: #313e51;
  --muted: #626c7f;
  --shadow: rgb(143 160 193 / 14%);
  --pattern-mobile: url("../../assets/images/pattern-background-mobile-light.svg");
  --pattern-tablet: url("../../assets/images/pattern-background-tablet-light.svg");
  --pattern-desktop: url("../../assets/images/pattern-background-desktop-light.svg");
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    color-scheme: dark;
    --page: #313e51;
    --surface: #3b4d66;
    --text: #fff;
    --muted: #abc1e1;
    --shadow: rgb(49 62 81 / 14%);
    --pattern-mobile: url("../../assets/images/pattern-background-mobile-dark.svg");
    --pattern-tablet: url("../../assets/images/pattern-background-tablet-dark.svg");
    --pattern-desktop: url("../../assets/images/pattern-background-desktop-dark.svg");
  }
}
:root[data-theme=dark] {
  color-scheme: dark;
  --page: #313e51;
  --surface: #3b4d66;
  --text: #fff;
  --muted: #abc1e1;
  --shadow: rgb(49 62 81 / 14%);
  --pattern-mobile: url("../../assets/images/pattern-background-mobile-dark.svg");
  --pattern-tablet: url("../../assets/images/pattern-background-tablet-dark.svg");
  --pattern-desktop: url("../../assets/images/pattern-background-desktop-dark.svg");
}

@font-face {
  font-family: "Rubik";
  src: url("../../assets/fonts/Rubik-VariableFont_wght.ttf") format("truetype");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Rubik";
  src: url("../../assets/fonts/Rubik-Italic-VariableFont_wght.ttf") format("truetype");
  font-weight: 300 900;
  font-style: italic;
  font-display: swap;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

[hidden] {
  display: none !important;
}

img,
svg {
  display: block;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1 {
  font-size: inherit;
  font-weight: inherit;
}

fieldset {
  min-width: 0;
  padding: 0;
  border: 0;
}

ul {
  padding: 0;
  list-style: "";
}

body {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: "Rubik", sans-serif;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
  background: var(--page) var(--pattern-mobile) no-repeat left top/100% auto;
}
@media (min-width: 48em) {
  body {
    background-image: var(--pattern-tablet);
    background-size: auto;
  }
}
@media (min-width: 64em) {
  body {
    background-image: var(--pattern-desktop);
    background-position: center;
    background-size: cover;
  }
}

:focus-visible {
  outline: 3px solid #a729f5;
  outline-offset: 3px;
}

[tabindex="-1"]:focus {
  outline: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.header {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 40px;
  box-sizing: content-box;
  padding: 16px 24px;
}
@media (min-width: 48em) {
  .header {
    min-height: 56px;
    padding: 40px 64px 0;
  }
}
@media (min-width: 48em) and (max-width: 63.999em) {
  .header:has(.header__subject[hidden]) {
    min-height: 40px;
  }
}
@media (min-width: 64em) {
  .header {
    width: min(100% - 128px, 1160px);
    margin-inline: auto;
    padding: 83px 0 0;
  }
}

.subject {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 1.125rem;
  line-height: 1;
}
@media (min-width: 48em) {
  .subject {
    gap: 24px;
    font-size: 1.75rem;
  }
}

.subject__icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
}
.subject__icon img {
  width: 28px;
  height: 28px;
}
@media (min-width: 48em) {
  .subject__icon {
    width: 56px;
    height: 56px;
    border-radius: 8px;
  }
  .subject__icon img {
    width: 40px;
    height: 40px;
  }
}
[data-subject=HTML] .subject__icon {
  background-color: #fff5ed;
}
[data-subject=CSS] .subject__icon {
  background-color: #e0fdef;
}
[data-subject=JavaScript] .subject__icon {
  background-color: #ebf0ff;
}
[data-subject=Accessibility] .subject__icon {
  background-color: #f6e7ff;
}

.theme {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--muted);
}
@media (min-width: 48em) {
  .theme {
    gap: 16px;
  }
}

.theme__icon {
  width: 16px;
  height: 16px;
}
@media (min-width: 48em) {
  .theme__icon {
    width: 24px;
    height: 24px;
  }
}

.theme__switch {
  --knob: 12px;
  flex-shrink: 0;
  appearance: none;
  position: relative;
  width: 32px;
  height: 20px;
  border-radius: 999px;
  background-color: #a729f5;
  cursor: pointer;
}
.theme__switch::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: var(--knob);
  height: var(--knob);
  border-radius: 50%;
  background-color: #fff;
}
.theme__switch:checked::before {
  translate: 12px;
}
@media (min-width: 48em) {
  .theme__switch {
    --knob: 20px;
    width: 48px;
    height: 28px;
  }
  .theme__switch:checked::before {
    translate: 20px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .theme__switch::before {
    transition: translate 0.2s ease;
  }
}

.quiz {
  width: min(100% - 48px, 640px);
  margin: 32px auto 0;
}
@media (min-width: 48em) {
  .quiz {
    width: min(100% - 128px, 640px);
    margin-top: 49px;
  }
}
@media (min-width: 64em) {
  .quiz {
    width: min(100% - 128px, 1160px);
    margin-top: 85px;
  }
}

.screen {
  display: grid;
  gap: 40px;
}
@media (min-width: 48em) {
  .screen {
    gap: 64px;
  }
}
@media (min-width: 64em) {
  .screen {
    grid-template-columns: minmax(0, 465fr) minmax(0, 564fr);
    align-items: start;
    column-gap: min(128px, 9vw);
    row-gap: 32px;
  }
}

.screen__intro {
  display: flex;
  flex-direction: column;
}

.screen__hint {
  font-size: 0.875rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
}
@media (min-width: 48em) {
  .screen__hint {
    font-size: 1.25rem;
  }
}

.menu__title {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: min(2.5rem, 11vw);
  font-weight: 300;
  line-height: 1;
}
@media (min-width: 48em) {
  .menu__title {
    font-size: 4rem;
  }
}

.menu__name {
  font-weight: 500;
}

.menu .screen__hint {
  margin-top: 16px;
}
@media (min-width: 64em) {
  .menu .screen__hint {
    margin-top: 48px;
  }
}

@media (min-width: 64em) {
  .screen > :not(.screen__intro),
  .question__answers > * {
    grid-column: 2;
  }
}

.choices {
  display: grid;
  gap: 16px;
}
@media (min-width: 48em) {
  .choices {
    gap: 24px;
  }
}
@media (min-width: 64em) {
  .choices {
    gap: 16px;
  }
}

.choice {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 13px;
  border: 3px solid transparent;
  border-radius: 12px;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1;
  text-align: left;
  color: var(--text);
  background-color: var(--surface);
  box-shadow: 0 16px 40px var(--shadow);
}
@media (min-width: 48em) {
  .choice {
    gap: 32px;
    border-radius: 24px;
    font-size: 1.75rem;
  }
}
@media (min-width: 64em) {
  .choice {
    padding: 21px;
  }
}

.choice__text {
  flex: 1;
  min-width: 0;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.choice__badge {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  color: #626c7f;
  background-color: #f4f6fa;
}
@media (min-width: 48em) {
  .choice__badge {
    width: 56px;
    height: 56px;
    border-radius: 8px;
  }
}

.option {
  position: relative;
  cursor: pointer;
}

.option__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option:has(:focus-visible) {
  outline: 3px solid #a729f5;
  outline-offset: 3px;
}

.subject-button:hover,
.question:not([data-answered]) .option:hover,
.option:has(:checked) {
  border-color: #a729f5;
}

.question:not([data-answered]) .option:hover .choice__badge,
.option:has(:checked) .choice__badge {
  color: #fff;
  background-color: #a729f5;
}

.option:not([data-result]) .option__result {
  display: none;
}

.option__result {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: no-repeat center/contain;
}
@media (min-width: 48em) {
  .option__result {
    width: 40px;
    height: 40px;
  }
}

.option[data-result=correct] {
  border-color: #2fd887;
}
.option[data-result=correct] .choice__badge {
  color: #fff;
  background-color: #2fd887;
}

.option[data-result=incorrect] {
  border-color: #ee5454;
}
.option[data-result=incorrect] .choice__badge {
  color: #fff;
  background-color: #ee5454;
}

.option[data-result=correct] .option__result,
.option[data-result=answer] .option__result {
  background-image: url("../../assets/images/icon-correct.svg");
}

.option[data-result=incorrect] .option__result {
  background-image: url("../../assets/images/icon-incorrect.svg");
}

.question[data-answered] .option {
  cursor: default;
}

.button {
  width: 100%;
  padding: 19px 16px;
  border: 0;
  border-radius: 12px;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1;
  color: #fff;
  background-color: #a729f5;
  box-shadow: 0 16px 40px rgba(143, 160, 193, 0.14);
}
.button:hover {
  background-color: #d394fa;
}
@media (min-width: 48em) {
  .button {
    padding: 32px;
    border-radius: 24px;
    font-size: 1.75rem;
  }
}

.error {
  display: flex;
  justify-content: center;
  font-size: 1.125rem;
  line-height: 1;
  text-align: center;
  color: #ee5454;
}
@media (min-width: 48em) {
  .error {
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.5;
  }
}

.error__message {
  display: flex;
  align-items: center;
  gap: 8px;
}
.error__message::before {
  content: "";
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: url("../../assets/images/icon-error.svg") no-repeat center/contain;
}
@media (min-width: 48em) {
  .error__message::before {
    width: 40px;
    height: 40px;
  }
}

.question {
  gap: 16px;
}
@media (min-width: 48em) {
  .question {
    gap: 32px;
  }
}
@media (min-width: 64em) {
  .question {
    align-items: stretch;
    column-gap: min(128px, 9vw);
  }
}

.question__answers {
  display: contents;
}

.question .choices {
  margin-top: 24px;
}
@media (min-width: 48em) {
  .question .choices {
    margin-top: 8px;
  }
}
@media (min-width: 64em) {
  .question .choices {
    margin-top: 0;
    align-self: start;
  }
}

@media (min-width: 64em) {
  .question .button,
  .question .error {
    align-self: start;
  }
}

.question__text {
  margin-top: 16px;
  font-size: 1.25rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
@media (min-width: 48em) {
  .question__text {
    margin-top: 24px;
    font-size: 2.25rem;
  }
}

.question__progress {
  appearance: none;
  width: 100%;
  height: 16px;
  margin-top: 24px;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  background-color: var(--surface);
}
.question__progress::-webkit-progress-bar {
  border-radius: 999px;
  background-color: transparent;
}
.question__progress::-webkit-progress-value {
  border-radius: 104px;
  background-color: #a729f5;
}
.question__progress::-moz-progress-bar {
  border-radius: 104px;
  background-color: #a729f5;
}
@media (min-width: 48em) {
  .question__progress {
    margin-top: 40px;
  }
}
@media (min-width: 64em) {
  .question__progress {
    margin-top: auto;
  }
}

.score__title {
  gap: 8px;
  font-size: min(2.5rem, 11vw);
  font-weight: 300;
  line-height: 1;
}
@media (min-width: 48em) {
  .score__title {
    font-size: 4rem;
  }
}

.score__scored {
  font-weight: 500;
}

.score__result {
  display: grid;
  gap: 12px;
}
@media (min-width: 48em) {
  .score__result {
    gap: 32px;
  }
}

.score__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px;
  border-radius: 12px;
  background-color: var(--surface);
  box-shadow: 0 16px 40px var(--shadow);
}
@media (min-width: 48em) {
  .score__card {
    gap: 40px;
    padding: 48px;
    border-radius: 24px;
  }
}

.score__total {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.score__number {
  font-size: 5.5rem;
  line-height: 1;
}
@media (min-width: 48em) {
  .score__number {
    font-size: 9rem;
  }
}

.score__out-of {
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
}
@media (min-width: 48em) {
  .score__out-of {
    font-size: 1.5rem;
  }
}

.attribution {
  flex: 1 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 32px 16px 16px;
  font-size: 0.6875rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  color: var(--muted);
}
.attribution a {
  color: var(--text);
  text-underline-offset: 2px;
}
.attribution a:hover {
  color: #a729f5;
}
