/* Questions: fixed header with Back and progress, then one question with full-width answer rows. */

.screen-quiz {
  display: flex;
  flex-direction: column;
}

.quiz-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(var(--safe-top) + 56px);
  padding: var(--safe-top) var(--gutter) 0 10px;
  background: var(--color-paper);
}

.quiz-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 14px 0 6px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
}

.quiz-back:active { background: var(--color-backdrop); }
.icon { display: inline-flex; }

.quiz-count {
  font-size: var(--step--1);
  color: var(--color-ink-soft);
  font-variant-numeric: tabular-nums;
}

.quiz-progress {
  position: sticky;
  top: calc(var(--safe-top) + 56px);
  z-index: 5;
  height: 2px;
  background: var(--color-line);
}

.quiz-bar {
  display: block;
  height: 100%;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.7s var(--ease-out);
}

.quiz-slot {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.question {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 36px;
}

.question-text {
  margin: 0 var(--gutter) 32px;
  font: var(--display-weight) clamp(1.875rem, 8.4vw, 2.25rem) / 1.12 var(--font-display);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

/* Answer rows */
.options {
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--color-line);
}

.options li { border-bottom: 1px solid var(--color-line); }

.option {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.option-face {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 16px var(--gutter);
  transition: background-color 0.15s;
}

/* Touch-down tint on the ink face only, so it never covers the brand-colour layer */
.option:active > .option-face { background: var(--color-backdrop); }

.option-label {
  font-size: var(--step-1);
  line-height: 1.35;
}

.option-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--color-ink-soft);
  border-radius: 50%;
}

.option-mark-multi { border-radius: 6px; }
.option-mark .icon-check { opacity: 0; }

/* The brand-colour layer: hidden until the answer is picked, then revealed from the tap point (motion.js). */
.option-fill {
  position: absolute;
  inset: 0;
  background: var(--color-brand);
  color: var(--color-on-brand);
  clip-path: circle(0 at 50% 50%);
  pointer-events: none;
}

.option[aria-pressed="true"] .option-fill { clip-path: circle(150% at 50% 50%); }
.option-fill .option-face { background: none; }

.option-fill .option-mark {
  background: var(--color-on-brand);
  border-color: var(--color-on-brand);
  color: var(--color-brand);
}

.option-fill .option-mark .icon-check { opacity: 1; }

.check-path {
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  transition: stroke-dashoffset 0.32s var(--ease-out) 0.12s;
}

.option[aria-pressed="true"] .option-fill .check-path { stroke-dashoffset: 0; }

.question-hint {
  margin-bottom: 12px;
  font-size: var(--step--1);
  color: var(--color-brand);
}

.question-hint:empty { display: none; }

.question-actions {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 16px var(--gutter) calc(var(--safe-bottom) + 16px);
  background: var(--color-paper);
}

@media (prefers-reduced-motion: reduce) {
  .quiz-bar, .check-path { transition: none; }
}

/* Wider screens: keep the question in a readable column */
@media (min-width: 768px) {
  .quiz-slot, .quiz-header { width: 100%; max-width: 720px; margin: 0 auto; }
  .question { padding: 72px 0 0; }
  .question-text { font-size: var(--step-5); line-height: 1.06; margin-bottom: 48px; }
  .question-actions { position: static; margin-top: 32px; padding: 0 var(--gutter) 48px; }
  .question-actions .button { width: auto; min-width: 240px; }
}
