/* ============================================================
   captcha-joke — fake Cloudflare interstitial
   ============================================================ */

:root {
  --ink: #232323;
  --muted: #6b7280;
  --line: #e3e6ea;
  --line-strong: #c9ced4;
  --cf-orange: #f6821f;
  --cf-orange-soft: #fbad41;
  --blue: #1a73e8;
  --green: #16a34a;
  --red: #d93025;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

/* `display:flex` on .payoff / .video-caption would otherwise beat the
   `hidden` attribute and leak the video before "verification". */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: #fff;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 56px;
}

.page {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

/* ── Header / brand ─────────────────────────────────────────── */

/* fades the whole interstitial out once "verification" succeeds */
.wrap {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.wrap.is-out {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

.cf-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  justify-content: center;
  margin-bottom: 22px;
  opacity: 0.95;
}

.cf-cloud {
  width: 42px;
  height: 26px;
  display: block;
}

.cf-wordmark {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: #1d1d1d;
}

.cf-title {
  font-size: 21px;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: -0.2px;
  margin: 0 0 6px;
  text-align: center;
}

.cf-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 22px;
  text-align: center;
}

.cf-footnote {
  margin: 18px 0 0;
  font-size: 11.5px;
  color: #8a9099;
  text-align: center;
}

.cf-footnote strong {
  color: #6b7280;
  font-weight: 600;
}

.cf-footnote .sep {
  margin: 0 6px;
  opacity: 0.6;
}

#ray-id {
  font-family: var(--mono);
  font-size: 11px;
}

/* ── Turnstile widget ───────────────────────────────────────── */

.turnstile {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  overflow: hidden;
  text-align: left;
  transition: max-width 0.25s ease;
}

.turnstile.is-wide {
  max-width: 420px;
}

.ts-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 65px;
  padding: 10px 14px;
}

/* the checkbox */
.ts-check {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 2px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.ts-check:hover {
  border-color: var(--cf-orange);
}

.ts-check:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.ts-label {
  flex: 1 1 auto;
  font-size: 14px;
  color: var(--ink);
}

.ts-brand {
  flex: 0 0 auto;
  /* colle la marque au bord droit quel que soit l'état : sans ça, une
     ligne de statut courte la laisse glisser vers la gauche */
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.ts-brand svg {
  width: 30px;
  height: 19px;
  display: block;
}

.ts-brand span {
  font-size: 9.5px;
  font-weight: 600;
  color: #7b8189;
  letter-spacing: 0.1px;
}

/* spinner in place of the checkbox */
.ts-spinner {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(246, 130, 31, 0.25);
  border-top-color: var(--cf-orange);
  animation: spin 0.7s linear infinite;
}

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

.ts-status {
  /* même rôle que .ts-label : occupe la place restante pour que la
     marque reste ancrée à droite pendant que le texte défile */
  flex: 1 1 auto;
  font-size: 13.5px;
  color: #3c4147;
  font-variant-numeric: tabular-nums;
}

/* Les lignes du spinner n'ont pas toutes la même longueur : on réserve
   deux lignes de haut pour que la boîte ne change jamais de taille
   pendant la vérification. */
.turnstile.is-verifying .ts-row {
  min-height: 65px;
}

.turnstile.is-verifying .ts-status {
  display: flex;
  align-items: center;
  min-height: 2.9em;
}

/* success / failure glyphs */
.ts-glyph {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
}

.ts-glyph svg {
  width: 28px;
  height: 28px;
}

.ts-glyph.ok {
  animation: pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ── Boutons ────────────────────────────────────────────────── */

.btn-primary {
  appearance: none;
  border: 0;
  border-radius: 4px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 20px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: #1666d0;
}

.btn-primary:focus-visible {
  outline: 2px solid #0b57d0;
  outline-offset: 2px;
}

/* L'examen : "Qui a dit ça ?" */

.quiz {
  padding: 14px 14px 12px;
}

.quiz-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.quiz-step {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.quiz-bar {
  flex: 1 1 auto;
  height: 4px;
  border-radius: 999px;
  background: #eceff3;
  overflow: hidden;
}

.quiz-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--cf-orange);
  transition: width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.quiz-prompt {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 7px;
}

.quiz-quote {
  margin: 0 0 14px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cf-orange);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #fbfbfc;
  font-size: 15px;
  line-height: 1.45;
  color: #1f2328;
  text-wrap: balance;
}

.quiz-answers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.quiz-btn {
  appearance: none;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 11px 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease,
    box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.quiz-btn:hover:not(:disabled) {
  border-color: var(--cf-orange);
  background: #fffaf5;
}

.quiz-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.quiz-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.quiz-btn:disabled {
  cursor: default;
}

.quiz-btn.is-wrong {
  border-color: #f0c4c0;
  background: #fdf3f2;
  color: #a5231b;
  text-decoration: line-through;
  opacity: 0.75;
}

.quiz-btn.is-right {
  border-color: var(--green);
  background: #f1fbf4;
  color: #15803d;
  font-weight: 600;
}

/* après deux échecs, on surligne la bonne réponse : personne ne reste coincé */
.quiz-btn.is-hint {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(26, 115, 232, 0.35);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    background: #fff;
  }
  50% {
    background: #eef4fe;
  }
}

.quiz-slot:empty {
  display: none;
}

/* ── Le verdict du QI ───────────────────────────────────────── */

.verdict {
  padding: 13px 14px 14px;
  border-top: 1px solid #f6d9d6;
  background: #fdf3f2;
  text-align: center;
}

.verdict-iq {
  font-size: 13px;
  color: #8a2b22;
  letter-spacing: 0.2px;
}

.verdict-iq strong {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  vertical-align: -3px;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

.verdict-line {
  margin: 6px auto 0;
  max-width: 330px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #a5231b;
}

.verdict-hint {
  margin: 10px auto 0;
  max-width: 330px;
  font-size: 12px;
  color: #3c4147;
  background: #fff;
  border: 1px solid #f0d5d2;
  border-radius: 6px;
  padding: 7px 10px;
}

.verdict-retry {
  margin-top: 12px;
}

/* texte du succès dans le widget */
.pass-iq {
  display: inline-block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
  color: #15803d;
}

.success-sub {
  color: #6b7280;
  font-size: 12.5px;
}

/* l'aveu de la blague — sur l'écran de succès, pas sous la vidéo */
.ts-reveal {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
  color: #5b616a;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

/* pas encore de lien vidéo configuré */
.video-missing {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  color: #cfd3d8;
  font-size: 13px;
  line-height: 1.5;
}

.video-missing code {
  font-family: var(--mono);
  font-size: 12px;
  color: #f0b429;
}

.video-frame.is-empty {
  padding-top: 30%;
  background: #16181c;
}

/* snark message under the widget */
.ts-note {
  padding: 9px 14px;
  font-size: 12.5px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
  color: #4b5158;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.ts-note.bad {
  background: #fdf3f2;
  color: #a5231b;
  border-top-color: #f6d9d6;
}

.ts-note.good {
  background: #f1fbf4;
  color: #15803d;
  border-top-color: #cdeed7;
}

.ts-note .dot {
  flex: 0 0 auto;
  font-size: 13px;
  line-height: 1.35;
}

.shake {
  animation: shake 0.36s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  80% {
    transform: translateX(3px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-5px);
  }
  40%,
  60% {
    transform: translateX(5px);
  }
}

/* ── Payoff ─────────────────────────────────────────────────── */

.payoff {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── La vidéo seule, une fois "vérifié" ─────────────────────── */

body.is-payoff {
  padding: 0;
}

body.is-payoff .page {
  max-width: 960px;
  gap: 0;
}

body.is-payoff .payoff {
  gap: 0;
}

/* bord à bord sur téléphone, arrondi sur grand écran */
@media (max-width: 699px) {
  body.is-payoff .video-frame {
    border-radius: 0;
    box-shadow: none;
  }
}

@media (min-width: 700px) {
  body.is-payoff {
    padding: 40px 20px 56px;
  }
}

/* ── Small screens ──────────────────────────────────────────── */

@media (max-width: 420px) {
  body {
    padding: 22px 14px 40px;
  }
  .cf-title {
    font-size: 18px;
  }
  .turnstile.is-wide {
    max-width: 100%;
  }
  .quiz-quote {
    font-size: 14px;
    padding: 11px 12px;
  }
}

/* ── Respect reduced motion ─────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
