/* Quizzes: the list's first-page extras (Mystery Car, Top players, Past mystery cars tile), one quiz, and playing
   it: a question at a time, each answer marked at once, then the score and every answer. */

/* Space above the footer, as on the brand pages (the play page has no ad to end on). */
.quiz-page {
  padding-bottom: 56px;
}

@media (min-width: 768px) {
  .quiz-page {
    padding-bottom: 72px;
  }
}

/* The list's top row: the Mystery Car card beside the leaderboard from 1024px, stacked on mobile. */
.qz-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

@media (min-width: 1024px) {
  .qz-top {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    align-items: stretch;
  }
}

.qz-mystery {
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
}

@media (min-width: 768px) {
  .qz-mystery {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  }
}

.qz-mystery__media {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background-color: var(--surface-2);
}

@media (min-width: 768px) {
  .qz-mystery__media {
    aspect-ratio: auto;
    min-height: 100%;
  }
}

.qz-mystery__media .card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 100%;
}

.qz-mystery__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 20px 22px;
}

.qz-mystery__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  line-height: 1.2;
}

.qz-mystery__hint {
  margin: 0;
  color: var(--text-muted);
}

.qz-mystery__go {
  margin: 10px 0 0;
  color: var(--link);
  font-weight: 600;
}

.qz-board {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
}

.qz-board__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-size: 1.125rem;
}

.qz-board__title .icon {
  width: 20px;
  height: 20px;
  color: var(--premium);
}

.qz-board__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.qz-board__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
  border-top: 1px solid var(--border);
}

.qz-board__list .qz-board__row:first-child {
  border-top: 0;
}


.qz-board__rank {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--surface-2);
  color: var(--text-muted);
  font-size: .8125rem;
  font-weight: 700;
}

.qz-board__row.is-top .qz-board__rank {
  background-color: var(--accent);
  color: #fff;
}

.qz-board__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qz-board__score {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.qz-board__all {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.qz-board__all:hover {
  text-decoration: underline;
}

/* The whole top 10, in a small window over the page. */
.qz-dialog {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  color: var(--text);
}

.qz-dialog::backdrop {
  background-color: rgba(0, 0, 0, .55);
}

.qz-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.qz-dialog__head .qz-board__title {
  margin: 0;
}

.qz-board__note,
.qz-note {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: .875rem;
}

.qz-board__note a,
.qz-note a,
.qz-feedback a,
.qz-review a {
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
}

.qz-board__note a:hover,
.qz-note a:hover,
.qz-feedback a:hover,
.qz-review a:hover {
  text-decoration: underline;
}

/* Past mystery cars: the last tile of page 1. It takes whatever columns the last row has left, so no row ends in an
   empty space (the grid has 2 columns on mobile, 3 from 768px, 4 from 1024px). */
.qz-past {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.qz-past__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qz-past__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  line-height: 1.3;
}

.qz-past__cars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.qz-past__cars img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: 50% 100%;
  border-radius: var(--radius);
  background-color: var(--surface-2);
}

.qz-past__cars span {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: .8125rem;
  line-height: 1.3;
}

.qz-past__cars b {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.qz-past:nth-child(odd) {
  grid-column: span 2;
}

@media (min-width: 768px) {
  .qz-past:nth-child(3n + 1) {
    grid-column: span 3;
  }

  .qz-past:nth-child(3n + 2) {
    grid-column: span 2;
  }

  .qz-past:nth-child(3n) {
    grid-column: span 1;
  }
}

@media (min-width: 1024px) {
  .qz-past:nth-child(4n + 1) {
    grid-column: span 4;
  }

  .qz-past:nth-child(4n + 2) {
    grid-column: span 3;
  }

  .qz-past:nth-child(4n + 3) {
    grid-column: span 2;
  }

  .qz-past:nth-child(4n) {
    grid-column: span 1;
  }
}

/* One quiz: the cover beside the text from 1024px, on top on mobile. */
.qz-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  margin-top: 8px;
}

@media (min-width: 1024px) {
  .qz-intro {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: center;
    gap: 40px;
  }
}

.qz-intro__media,
.qz-q__media {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  background-color: var(--surface-2);
}

.qz-intro__media img,
.qz-q__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 100%;
}

.qz-intro__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qz-intro__body .feature__label {
  margin: 0;
}

.qz-intro__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.25rem);
  line-height: 1.2;
}

.qz-intro__text {
  font-size: 1.0625rem;
  line-height: 1.65;
}

.qz-intro__text > :first-child {
  margin-top: 0;
}

.qz-intro__text > :last-child {
  margin-bottom: 0;
}

.qz-intro__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

@media (max-width: 767px) {
  .qz-intro__actions .pill-primary {
    flex: 1;
  }
}

.qz-intro + .qz-note,
.qz-intro__body .qz-note {
  margin-top: 0;
}

/* Playing: a top line, a progress bar of ten segments, then the photo beside the question from 1024px. */
.qz-play {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.qz-play[hidden],
.qz-result[hidden],
.qz-first[hidden] {
  display: none;
}

.qz-play__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.qz-play__quiz {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: .875rem;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qz-play__quiz:hover {
  color: var(--link);
}

.qz-play__count {
  flex: none;
  font-size: .9375rem;
  font-weight: 600;
}

.qz-progress {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.qz-progress li {
  height: 6px;
  border-radius: 3px;
  background-color: var(--surface-2);
}

.qz-progress .is-done {
  background-color: var(--text-muted);
}

.qz-progress .is-right {
  background-color: var(--success);
}

.qz-progress .is-wrong {
  background-color: var(--danger);
}

.qz-progress .is-now {
  background-color: var(--accent);
}

.qz-first {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  background-color: var(--accent-soft);
  font-size: .9375rem;
}

.qz-first .icon {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--premium);
}

.qz-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

@media (min-width: 1024px) {
  .qz-stage {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: start;
    gap: 36px;
  }
}

.qz-q {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qz-q__set {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.qz-q__text {
  float: left;
  width: 100%;
  margin: 0 0 14px;
  padding: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 1rem + 1vw, 1.625rem);
  font-weight: 700;
  line-height: 1.3;
}

.qz-q__text p {
  margin: 0;
}

.qz-options {
  display: grid;
  clear: both;
  gap: 10px;
}

@media (min-width: 768px) and (max-width: 1023px) {
  .qz-options {
    grid-template-columns: 1fr 1fr;
  }
}

.qz-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--control-border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  font-size: 1rem;
  cursor: pointer;
}

.qz-option:hover {
  border-color: var(--link);
}

.qz-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.qz-option__text p {
  margin: 0;
}

.qz-option__key {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: var(--surface-2);
  color: var(--text-muted);
  font-size: .8125rem;
  font-weight: 700;
}

.qz-option__mark {
  flex: none;
  width: 20px;
  height: 20px;
  margin-left: auto;
}

.qz-option:has(input:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.qz-option:has(input:checked) {
  border-color: var(--accent);
  background-color: var(--accent-soft);
}

.qz-option:has(input:checked) .qz-option__key {
  background-color: var(--accent);
  color: #fff;
}

.qz-options.is-locked .qz-option {
  cursor: default;
}

.qz-options.is-locked .qz-option:hover {
  border-color: var(--control-border);
}

.qz-options .qz-option.is-right,
.qz-options.is-locked .qz-option.is-right:hover {
  border-color: var(--success);
  background-color: var(--success-soft);
}

.qz-options .qz-option.is-right .qz-option__key {
  background-color: var(--success);
  color: #fff;
}

.qz-option.is-right .qz-option__mark {
  color: var(--success);
}

.qz-options .qz-option.is-wrong,
.qz-options.is-locked .qz-option.is-wrong:hover {
  border-color: var(--danger);
  background-color: var(--danger-soft);
}

.qz-options .qz-option.is-wrong .qz-option__key {
  background-color: var(--danger);
  color: #fff;
}

.qz-option.is-wrong .qz-option__mark {
  color: var(--danger);
}

.qz-feedback {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}

.qz-feedback:empty {
  display: none;
}

.qz-feedback .is-right {
  color: var(--success);
}

.qz-feedback .is-wrong {
  color: var(--danger);
}

.qz-q .pill-primary {
  align-self: flex-start;
}

@media (max-width: 767px) {
  .qz-q .pill-primary {
    align-self: stretch;
  }
}

/* The score card and every answer. */
.qz-result {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 760px;
  margin-top: 8px;
}

.qz-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  text-align: center;
}

.qz-score .feature__label {
  margin: 0;
}

.qz-score__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(2.25rem, 1.6rem + 2.5vw, 3rem);
  line-height: 1.1;
}

.qz-score__line {
  margin: 0;
  color: var(--text-muted);
}

.qz-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 520px;
  margin: 10px 0 4px;
}

.qz-stats div {
  padding: 12px 8px;
  border-radius: var(--radius);
  background-color: var(--surface-2);
}

.qz-stats dt {
  color: var(--text-muted);
  font-size: .8125rem;
}

.qz-stats dd {
  margin: 2px 0 0;
  font-size: 1.375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.qz-score__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.qz-review__list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.qz-review__item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
}

.qz-review__item img {
  display: block;
  width: 96px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  background-color: var(--surface-2);
}

.qz-review__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text-muted);
  font-size: .8125rem;
  font-weight: 600;
}

.qz-review__head .icon {
  width: 16px;
  height: 16px;
}

.qz-review__item.is-right .qz-review__head .icon {
  color: var(--success);
}

.qz-review__item.is-wrong .qz-review__head .icon {
  color: var(--danger);
}

.qz-review__q {
  margin: 4px 0 8px;
  font-weight: 600;
  line-height: 1.4;
}

.qz-review__q p {
  margin: 0;
}

.qz-review__a {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: .9375rem;
  line-height: 1.5;
}

.qz-review__a .is-right {
  color: var(--success);
  font-weight: 600;
}

.qz-review__a .is-wrong {
  color: var(--danger);
  font-weight: 600;
  text-decoration: line-through;
}

.qz-review__more {
  margin-top: 6px;
}
