/* ═══════════════════════════════════════════════════
   CORAL QUIZ — Public Stylesheet
   Mobile-first, iframe-friendly
═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

:root {
  --cq-coral:       #FF6B5B;
  --cq-coral-deep:  #E8503F;
  --cq-coral-light: #FF8A7A;
  --cq-coral-pale:  #FFF0EE;
  --cq-cream:       #FDF8F4;
  --cq-cream-dark:  #F2E9E1;
  --cq-ink:         #1A1410;
  --cq-ink-soft:    #5C4A40;
  --cq-ink-muted:   #9C8880;
  --cq-green:       #2ECC8E;
  --cq-green-pale:  #E8FBF3;
  --cq-red:         #FF4D4D;
  --cq-red-pale:    #FFECEC;
  --cq-white:       #FFFFFF;
  --cq-radius:      16px;
  --cq-radius-sm:   10px;
  --cq-shadow:      0 4px 24px rgba(26,20,16,.10);
  --cq-shadow-lg:   0 12px 48px rgba(26,20,16,.14);
}

/* ── SHELL ── */
.coral-quiz-root {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--cq-ink);
  max-width: 600px;
  margin: 0 auto;
  padding: 0 0 32px;
}

.cq-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
}

.cq-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--cq-cream-dark);
  border-top-color: var(--cq-coral);
  border-radius: 50%;
  animation: cq-spin .7s linear infinite;
}

@keyframes cq-spin { to { transform: rotate(360deg); } }

/* ── AD UNIT — top of quiz ── */
.cq-ad-wrap {
  background: var(--cq-cream-dark);
  border-radius: var(--cq-radius-sm);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
}

.cq-ad-label {
  position: absolute;
  top: 5px; left: 8px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cq-ink-muted);
}

.cq-ad-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  opacity: .4;
  padding: 16px;
}

.cq-ad-placeholder span {
  font-size: 11px;
  color: var(--cq-ink-muted);
  font-weight: 500;
}

.cq-ad-refresh-overlay {
  position: absolute;
  inset: 0;
  background: var(--cq-cream-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.cq-ad-refresh-overlay.show { opacity: 1; }

/* ── CARD ── */
.cq-card {
  background: var(--cq-white);
  border-radius: var(--cq-radius);
  box-shadow: var(--cq-shadow-lg);
  overflow: hidden;
}

/* ── HEADER ── */
.cq-card-header {
  background: linear-gradient(135deg, var(--cq-coral) 0%, var(--cq-coral-light) 100%);
  padding: 22px 24px 20px;
  position: relative;
  overflow: hidden;
}

.cq-card-header::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 130px; height: 130px;
  background: rgba(255,255,255,.12);
  border-radius: 50%;
}

.cq-card-header::after {
  content: '';
  position: absolute;
  bottom: -28px; left: 16px;
  width: 70px; height: 70px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}

.cq-header-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.75);
  margin-bottom: 6px;
}

.cq-header-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(16px, 4vw, 20px);
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  position: relative;
  z-index: 1;
}

/* ── PROGRESS ── */
.cq-progress-wrap {
  padding: 14px 24px 0;
}

.cq-progress-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
}

.cq-progress-text { font-size: 11.5px; color: var(--cq-ink-muted); font-weight: 500; }
.cq-progress-pct  { font-size: 11.5px; color: var(--cq-coral);     font-weight: 600; }

.cq-progress-track {
  height: 5px;
  background: var(--cq-cream-dark);
  border-radius: 99px;
  overflow: hidden;
}

.cq-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cq-coral), var(--cq-coral-light));
  border-radius: 99px;
  transition: width .55s cubic-bezier(.4,0,.2,1);
}

/* ── QUESTION BODY ── */
.cq-body {
  padding: 20px 24px 24px;
}

.cq-q-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cq-coral);
  margin-bottom: 10px;
}

.cq-q-eyebrow::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  background: var(--cq-coral);
  border-radius: 50%;
}

.cq-question-text {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(16px, 3.8vw, 19px);
  font-weight: 600;
  line-height: 1.45;
  color: var(--cq-ink);
  margin-bottom: 20px;
}

/* ── TEXT ANSWERS ── */
.cq-answers-text {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.cq-answer-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--cq-cream);
  border: 2px solid transparent;
  border-radius: var(--cq-radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all .2s cubic-bezier(.4,0,.2,1);
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}

.cq-answer-btn:hover:not(:disabled) {
  border-color: var(--cq-coral-light);
  background: var(--cq-white);
  box-shadow: 0 2px 12px rgba(255,107,91,.12);
  transform: translateY(-1px);
}

.cq-answer-letter {
  width: 30px; height: 30px;
  min-width: 30px;
  border-radius: 7px;
  background: var(--cq-white);
  border: 2px solid var(--cq-cream-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--cq-ink-soft);
  transition: all .2s;
}

.cq-answer-label {
  font-size: 14px;
  font-weight: 400;
  color: var(--cq-ink);
  line-height: 1.4;
  transition: color .2s;
}

/* Selected */
.cq-answer-btn.cq-selected {
  border-color: var(--cq-coral);
  background: var(--cq-coral-pale);
  box-shadow: 0 0 0 3px rgba(255,107,91,.1);
  transform: translateY(-1px);
}

.cq-answer-btn.cq-selected .cq-answer-letter {
  background: var(--cq-coral);
  border-color: var(--cq-coral);
  color: #fff;
}

/* Correct */
.cq-answer-btn.cq-correct {
  border-color: var(--cq-green);
  background: var(--cq-green-pale);
  box-shadow: 0 0 0 3px rgba(46,204,142,.1);
  pointer-events: none;
}

.cq-answer-btn.cq-correct .cq-answer-letter {
  background: var(--cq-green);
  border-color: var(--cq-green);
  color: #fff;
}

/* Wrong */
.cq-answer-btn.cq-wrong {
  border-color: var(--cq-red);
  background: var(--cq-red-pale);
  box-shadow: 0 0 0 3px rgba(255,77,77,.1);
  pointer-events: none;
}

.cq-answer-btn.cq-wrong .cq-answer-letter {
  background: var(--cq-red);
  border-color: var(--cq-red);
  color: #fff;
}

.cq-answer-btn:disabled:not(.cq-correct):not(.cq-wrong):not(.cq-selected) {
  opacity: .5;
  pointer-events: none;
}

/* ── IMAGE ANSWERS ── */
.cq-answers-image {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* image-text variant: slightly taller label area */
.cq-answers-image-text .cq-answer-img-label {
  padding: 9px 10px;
  font-size: 13px;
}

.cq-img-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--cq-cream-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cq-ink-muted);
  font-size: 11px;
}

.cq-answer-img-btn {
  border: 2px solid var(--cq-cream-dark);
  border-radius: var(--cq-radius-sm);
  background: var(--cq-cream);
  cursor: pointer;
  overflow: hidden;
  text-align: center;
  transition: all .2s cubic-bezier(.4,0,.2,1);
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.cq-answer-img-btn:hover:not(:disabled) {
  border-color: var(--cq-coral-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255,107,91,.15);
}

.cq-answer-img-btn img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

.cq-answer-img-label {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--cq-ink-soft);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cq-answer-img-letter {
  width: 22px; height: 22px;
  min-width: 22px;
  border-radius: 5px;
  background: var(--cq-white);
  border: 1.5px solid var(--cq-cream-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  color: var(--cq-ink-soft);
  transition: all .2s;
}

/* Image selected */
.cq-answer-img-btn.cq-selected {
  border-color: var(--cq-coral);
  box-shadow: 0 0 0 3px rgba(255,107,91,.15);
}

.cq-answer-img-btn.cq-selected .cq-answer-img-letter {
  background: var(--cq-coral); border-color: var(--cq-coral); color: #fff;
}

/* Image correct */
.cq-answer-img-btn.cq-correct {
  border-color: var(--cq-green);
  box-shadow: 0 0 0 3px rgba(46,204,142,.15);
  pointer-events: none;
}

.cq-answer-img-btn.cq-correct .cq-answer-img-letter {
  background: var(--cq-green); border-color: var(--cq-green); color: #fff;
}

.cq-answer-img-btn.cq-correct::after {
  content: '✓';
  position: absolute;
  top: 8px; right: 8px;
  width: 26px; height: 26px;
  background: var(--cq-green);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  line-height: 26px;
}

/* Image wrong */
.cq-answer-img-btn.cq-wrong {
  border-color: var(--cq-red);
  box-shadow: 0 0 0 3px rgba(255,77,77,.15);
  pointer-events: none;
}

.cq-answer-img-btn.cq-wrong .cq-answer-img-letter {
  background: var(--cq-red); border-color: var(--cq-red); color: #fff;
}

.cq-answer-img-btn:disabled:not(.cq-correct):not(.cq-wrong):not(.cq-selected) {
  opacity: .5;
  pointer-events: none;
}

/* ── FEEDBACK ── */
.cq-feedback {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--cq-radius-sm);
  font-size: 13.5px;
  line-height: 1.5;
  display: none;
  animation: cq-fadein .3s ease both;
}

@keyframes cq-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cq-feedback.correct {
  background: var(--cq-green-pale);
  border-left: 3px solid var(--cq-green);
  display: block;
}

.cq-feedback.wrong {
  background: var(--cq-red-pale);
  border-left: 3px solid var(--cq-red);
  display: block;
}

.cq-feedback-heading {
  font-weight: 700;
  margin-bottom: 3px;
}

.cq-feedback.correct .cq-feedback-heading { color: #1A8C5F; }
.cq-feedback.wrong   .cq-feedback-heading { color: #C03030; }

.cq-feedback-body { color: var(--cq-ink-soft); }

/* ── NEXT BUTTON ── */
.cq-btn-next {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  margin-top: 18px;
  background: linear-gradient(135deg, var(--cq-coral) 0%, var(--cq-coral-deep) 100%);
  color: #fff;
  border: none;
  border-radius: var(--cq-radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .25s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 4px 18px rgba(255,107,91,.35);
  letter-spacing: .02em;
  display: none;
}

.cq-btn-next.visible { display: flex; }
.cq-btn-next:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(255,107,91,.45); }
.cq-btn-next:active { transform: translateY(0); }

.cq-btn-next svg { transition: transform .2s; }
.cq-btn-next:hover svg { transform: translateX(3px); }

/* ── RESULTS ── */
.cq-results {
  padding: 32px 24px 28px;
  text-align: center;
}

.cq-results-hero {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cq-coral), var(--cq-coral-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  margin: 0 auto 18px;
  box-shadow: 0 12px 32px rgba(255,107,91,.35);
  animation: cq-pop .5s cubic-bezier(.175,.885,.32,1.275) both;
}

@keyframes cq-pop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.cq-results-score {
  font-family: 'Playfair Display', serif;
  font-size: 54px;
  font-weight: 700;
  color: var(--cq-coral);
  line-height: 1;
  animation: cq-rise .6s ease both .15s;
}

.cq-results-total {
  font-size: 14px;
  color: var(--cq-ink-muted);
  margin-bottom: 14px;
  animation: cq-rise .6s ease both .25s;
  opacity: 0;
  animation-fill-mode: forwards;
}

.cq-results-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--cq-ink);
  margin-bottom: 8px;
  animation: cq-rise .6s ease both .35s;
  opacity: 0;
  animation-fill-mode: forwards;
}

.cq-results-desc {
  font-size: 14px;
  color: var(--cq-ink-soft);
  line-height: 1.65;
  max-width: 380px;
  margin: 0 auto 24px;
  animation: cq-rise .6s ease both .42s;
  opacity: 0;
  animation-fill-mode: forwards;
}

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

/* Score bar */
.cq-score-bar-wrap {
  background: var(--cq-cream-dark);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 24px;
  animation: cq-rise .6s ease both .48s;
  opacity: 0;
  animation-fill-mode: forwards;
}

.cq-score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cq-coral), var(--cq-coral-light));
  border-radius: 99px;
  width: 0;
  transition: width 1s cubic-bezier(.4,0,.2,1) .7s;
}

/* Review list */
.cq-review {
  text-align: left;
  margin-bottom: 28px;
  animation: cq-rise .6s ease both .55s;
  opacity: 0;
  animation-fill-mode: forwards;
}

.cq-review-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cq-ink-muted);
  margin-bottom: 10px;
}

.cq-review-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--cq-cream-dark);
  font-size: 13.5px;
}

.cq-review-item:last-child { border-bottom: none; }

.cq-review-icon {
  width: 22px; height: 22px;
  min-width: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  margin-top: 1px;
}

.cq-review-icon.correct { background: var(--cq-green-pale); color: var(--cq-green); }
.cq-review-icon.wrong   { background: var(--cq-red-pale);   color: var(--cq-red); }

.cq-review-q { color: var(--cq-ink); font-weight: 500; margin-bottom: 2px; }
.cq-review-a { color: var(--cq-ink-muted); font-size: 12.5px; }

/* Share + Retry */
.cq-results-actions {
  display: flex;
  gap: 10px;
  animation: cq-rise .6s ease both .62s;
  opacity: 0;
  animation-fill-mode: forwards;
}

.cq-btn-share {
  flex: 1;
  padding: 13px;
  background: linear-gradient(135deg, var(--cq-coral) 0%, var(--cq-coral-deep) 100%);
  color: #fff;
  border: none;
  border-radius: var(--cq-radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  gap: 7px;
  transition: all .2s;
  box-shadow: 0 4px 14px rgba(255,107,91,.3);
}

.cq-btn-share:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(255,107,91,.4); }

.cq-btn-retry {
  flex: 1;
  padding: 13px;
  background: var(--cq-cream-dark);
  color: var(--cq-ink-soft);
  border: none;
  border-radius: var(--cq-radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  gap: 7px;
  transition: all .2s;
}

.cq-btn-retry:hover { background: var(--cq-coral-pale); color: var(--cq-coral-deep); }

/* ── TOAST ── */
.cq-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--cq-ink);
  color: #fff;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: all .3s;
  pointer-events: none;
  z-index: 99999;
  white-space: nowrap;
}

.cq-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── TRANSITIONS ── */
.cq-screen-enter {
  animation: cq-fadein .35s cubic-bezier(.4,0,.2,1) both;
}

.cq-screen-exit {
  animation: cq-fadeout .25s cubic-bezier(.4,0,.2,1) both;
}

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

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .coral-quiz-root { padding: 0 0 24px; }
  .cq-card-header  { padding: 18px 18px 16px; }
  .cq-body         { padding: 16px 18px 20px; }
  .cq-answers-image { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cq-results      { padding: 24px 18px 22px; }
}
