/* ── Quiz container ──────────────────────────────────────── */
.ays-quiz-container {
  max-width: 720px;
  margin: 32px auto;
  background: #fff;
  border: 1px solid #E9E8EF;
  border-radius: 10px;
  overflow: hidden;
  color: #3a3d43;
}

/* ── Start page ──────────────────────────────────────────── */
.ays-quiz-start-page {
  padding: 40px 32px;
  text-align: center;
}

.ays-quiz-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: .02em;
  color: #161B2A;
}

.ays-quiz-cover-image {
  margin: 0 0 20px;
}

.ays-quiz-cover-image figure {
  margin: 0 auto;
  width: 100%;
  max-width: calc(320px * 16 / 9);
}

.ays-quiz-cover-image__frame {
  aspect-ratio: 16 / 9;
  max-height: 320px;
  background: #f0f0f0;
  border-radius: 8px;
  overflow: hidden;
}

.ays-quiz-cover-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.ays-quiz-cover-image figure > figcaption,
.ays-quiz-cover-image__caption {
  display: block;
  width: 100%;
  font-size: 12px;
  color: #757575;
  padding: 6px 0 0;
  line-height: 1.4;
  text-align: center;
}

.ays-quiz-desc {
  font-size: 14px;
  color: #6b6f76;
  margin: 0 0 24px;
  line-height: 1.6;
}

.ays-quiz-start-actions {
  margin-top: 8px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.ays-quiz-btn {
  display: inline-block;
  padding: 12px 32px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.ays-quiz-btn--start,
.ays-quiz-btn--finish {
  background: #4e65ff;
  color: #fff;
}
.ays-quiz-btn--start:hover,
.ays-quiz-btn--finish:hover {
  background: #3346cc;
}

.ays-quiz-btn--next {
  background: #4e65ff;
  color: #fff;
}
.ays-quiz-btn--next:hover {
  background: #3346cc;
}

.ays-quiz-btn--prev {
  background: #f0f0f0;
  color: #3a3d43;
  margin-right: 8px;
}
.ays-quiz-btn--prev:hover {
  background: #e5e5e5;
  color: #161B2A;
}

.ays-quiz-btn--restart {
  background: #f0f0f0;
  color: #3a3d43;
  margin-top: 16px;
}
.ays-quiz-btn--restart:hover {
  background: #e5e5e5;
  color: #161B2A;
}

/* ── Question step ───────────────────────────────────────── */
.ays-quiz-step {
  padding: 32px 32px 0;
}

@keyframes aysQuizIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ays-quiz-step--in {
  animation: aysQuizIn 0.28s ease forwards;
}

.ays-quiz-step--out {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.ays-quiz-progress {
  font-size: 12px;
  color: #757575;
  margin-bottom: 16px;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.ays-quiz-question-image {
  text-align: center;
  margin-bottom: 16px;
}

.ays-quiz-question-image figure {
  margin: 0 auto;
  width: 100%;
  max-width: calc(300px * 16 / 9);
}

.ays-quiz-question-image__frame {
  aspect-ratio: 16 / 9;
  max-height: 300px;
  background: #f0f0f0;
  border-radius: 8px;
  overflow: hidden;
}

.ays-quiz-question-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ays-quiz-question-image figure > figcaption,
.ays-quiz-question-image__caption {
  display: block;
  width: 100%;
  font-size: 12px;
  color: #757575;
  margin-top: 6px;
  padding: 0;
  line-height: 1.4;
  text-align: center;
}

.ays-quiz-question {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 20px;
  line-height: 1.5;
  color: #161B2A;
  text-align: center;
}

/* ── Answer options ──────────────────────────────────────── */
.ays-quiz-answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ays-quiz-answer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #E9E8EF;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  box-sizing: border-box;
}

.ays-quiz-answer input[type="radio"],
.ays-quiz-answer input[type="checkbox"] {
  flex-shrink: 0;
  margin: 0;
}

.ays-quiz-answer:hover {
  border-color: #4e65ff;
  background: #eef1ff;
}

.ays-quiz-answer input[type="radio"],
.ays-quiz-answer input[type="checkbox"] {
  accent-color: #4e65ff;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.ays-quiz-answer__text {
  font-size: 14px;
  color: #3a3d43;
  line-height: 1.4;
}

/* Selected state */
.ays-quiz-answer.is-selected {
  border-color: #4e65ff;
  background: #eef1ff;
}
.ays-quiz-answer.is-selected .ays-quiz-answer__text {
  color: #161B2A;
}

/* Text input */
.ays-quiz-text-input {
  width: 100%;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #E9E8EF;
  border-radius: 8px;
  color: #161B2A;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color .15s;
}
.ays-quiz-text-input:focus {
  outline: none;
  border-color: #4e65ff;
}

/* Validation error flash */
.ays-quiz-answers--error .ays-quiz-answer,
.ays-quiz-answers--error .ays-quiz-text-input {
  border-color: #f72140;
  animation: aysQuizShake .4s ease;
}
@keyframes aysQuizShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ── Navigation ──────────────────────────────────────────── */
.ays-quiz-nav {
  padding: 24px 32px 32px;
  text-align: center;
}

/* ── Result page ─────────────────────────────────────────── */
.ays-quiz-result {
  padding: 40px 32px;
  text-align: center;
}

/* Side-by-side score summary */
.ays-quiz-result__scores {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  margin-bottom: 24px;
}

.ays-quiz-result__score-block {
  flex: 1;
  padding: 20px 16px;
  background: #f8f8f8;
  border-radius: 10px;
}

.ays-quiz-result__score-divider {
  width: 1px;
  background: #E9E8EF;
  margin: 8px 16px;
  flex-shrink: 0;
}

.ays-quiz-result__score-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #757575;
  margin-bottom: 10px;
}

.score-number {
  display: block;
  font-size: 48px;
  font-weight: 800;
  color: #4e65ff;
  line-height: 1;
}

.score-number--avg {
  color: #757575;
}

.badge-pass {
  display: inline-block;
  background: #169313;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  vertical-align: middle;
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-fail {
  display: inline-block;
  background: #f72140;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  vertical-align: middle;
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.ays-quiz-result__interval {
  font-size: 20px;
  font-weight: 700;
  color: #b8720a;
  margin-bottom: 16px;
  min-height: 0;
}

.ays-quiz-result__message {
  font-size: 15px;
  color: #3a3d43;
  margin-bottom: 12px;
  line-height: 1.6;
}

.ays-quiz-result__text {
  font-size: 14px;
  color: #6b6f76;
  line-height: 1.6;
}

/* ── Answer breakdown ────────────────────────────────────── */
.ays-quiz-result__breakdown {
  margin-top: 28px;
  text-align: left;
}

.ays-quiz-breakdown__title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #757575;
  margin-bottom: 14px;
  text-align: center;
}

.ays-bd-item {
  border-top: 1px solid #E9E8EF;
  padding: 14px 0;
}

.ays-bd-question {
  font-size: 14px;
  font-weight: 600;
  color: #161B2A;
  margin-bottom: 10px;
  line-height: 1.4;
}

.ays-bd-question__num {
  color: #757575;
  font-weight: 400;
  margin-right: 4px;
}

.ays-bd-skipped {
  font-size: 11px;
  font-weight: 400;
  color: #999;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-left: 6px;
}

.ays-bd-image {
  margin-bottom: 10px;
}

.ays-bd-image figure {
  margin: 0;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: 200px;
  background: #f0f0f0;
}

.ays-bd-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ays-bd-image__caption {
  display: block;
  width: 100%;
  font-size: 11px;
  color: #757575;
  padding: 5px 0 0;
  text-align: center;
}

.ays-bd-answers {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ays-bd-answer {
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 6px;
  line-height: 1.4;
}

.ays-bd-answer--correct {
  background: rgba(22, 147, 19, .08);
  color: #169313;
  border: 1px solid rgba(22, 147, 19, .25);
}

.ays-bd-answer--wrong {
  background: rgba(247, 33, 64, .06);
  color: #c0392b;
  border: 1px solid rgba(247, 33, 64, .2);
}

.ays-bd-answer--missed {
  background: rgba(22, 147, 19, .04);
  color: #999;
  border: 1px dashed rgba(22, 147, 19, .2);
}

/* ── Loading state ───────────────────────────────────────── */
.ays-quiz-btn--finish.is-loading {
  opacity: .6;
  pointer-events: none;
  cursor: not-allowed;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .ays-quiz-start-page,
  .ays-quiz-step,
  .ays-quiz-nav,
  .ays-quiz-result {
    padding-left: 16px;
    padding-right: 16px;
  }

  .score-number {
    font-size: 36px;
  }

  .ays-quiz-title {
    font-size: 18px;
  }
}
