:root {
  --vert: #0f8d46;
  --vert-fonce: #0b6d36;
  --jaune: #f4d942;
  --bleu: #2d72d9;
  --rouge: #d84646;
  --noir: #242a32;
  --blanc: #ffffff;
  --texte: #1c232d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Gill Sans", "Century Gothic", sans-serif;
  color: var(--texte);
  background:
    radial-gradient(circle at 20% 20%, #f7fbe9 0%, #ecf5d5 35%, #e9f1d0 100%);
}

.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
}

.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

#captcha-screen {
  padding: 1rem;
}

.captcha-card {
  position: relative;
  width: min(350px, 92vw);
  padding: 0.9rem 0.8rem 0.7rem;
  border: 1px solid #aeb89d;
  border-radius: 10px;
  background: #f8f9f3;
  box-shadow: 0 10px 25px rgba(36, 42, 50, 0.1);
  overflow: hidden;
}

.captcha-question {
  margin: 0;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.35;
}

.pencil-palette {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.10rem;
  margin-top: 1.9rem;
  padding-top: 1.1rem;
}

.pencil {
  position: relative;
  width: 30px;
  height: 96px;
  border: 0;
  border-radius: 0 0 8px 8px;
  background: var(--pencil-color);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.pencil::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -18px;
  margin: 0 auto;
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-bottom: 18px solid #ead0a7;
}

.pencil::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -20px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2f2f2f;
}

.pencil.selected {
  transform: translateY(-13px);
  box-shadow: 0 10px 18px rgba(17, 21, 27, 0.26);
}

.pencil:focus-visible {
  outline: 3px solid #273445;
  outline-offset: 2px;
}

.captcha-feedback {
  min-height: 1.1rem;
  margin-top: 0.7rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.captcha-feedback .ok {
  color: var(--vert-fonce);
}

.captcha-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.captcha-overlay.active {
  opacity: 1;
}

.captcha-overlay.success {
  background: rgba(15, 141, 70, 0.18);
}

.captcha-overlay.success::after {
  content: "✓";
  color: #117239;
  font-size: 2rem;
  font-weight: 900;
}

.captcha-overlay.fail {
  background: rgba(47, 11, 11, 0.35);
}

.captcha-overlay.fail::after {
  content: "Accès refusé";
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

.strike-scene {
  display: none;
  position: relative;
  width: 120px;
  height: 110px;
}

.captcha-overlay.fail .strike-scene {
  display: block;
}

.lightning {
  position: absolute;
  top: 6px;
  left: 52px;
  width: 28px;
  height: 68px;
  background: linear-gradient(180deg, #fff79a 0%, #ffd336 100%);
  clip-path: polygon(47% 0, 100% 0, 63% 42%, 97% 42%, 14% 100%, 39% 55%, 6% 55%);
  filter: drop-shadow(0 0 9px #ffe568);
  animation: bolt-drop 0.75s ease-in-out infinite;
}

.person {
  position: absolute;
  left: 46px;
  bottom: 4px;
  width: 32px;
  height: 62px;
  transform-origin: 50% 80%;
  animation: shock 0.25s linear infinite;
}

.person .head {
  position: absolute;
  left: 9px;
  top: 0;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffe7c9;
  border: 1px solid #2d2420;
}

.person .torso {
  position: absolute;
  left: 14px;
  top: 14px;
  width: 3px;
  height: 25px;
  background: #101827;
}

.person .arm,
.person .leg {
  position: absolute;
  background: #101827;
  width: 3px;
  border-radius: 3px;
}

.person .arm-left {
  left: 8px;
  top: 20px;
  height: 14px;
  transform: rotate(58deg);
}

.person .arm-right {
  left: 20px;
  top: 20px;
  height: 14px;
  transform: rotate(-58deg);
}

.person .leg-left {
  left: 11px;
  top: 36px;
  height: 19px;
  transform: rotate(28deg);
}

.person .leg-right {
  left: 18px;
  top: 36px;
  height: 19px;
  transform: rotate(-28deg);
}

@keyframes bolt-drop {
  0% {
    transform: translateY(-6px) scaleY(0.9);
    opacity: 0.65;
  }
  30% {
    transform: translateY(2px) scaleY(1.06);
    opacity: 1;
  }
  100% {
    transform: translateY(-6px) scaleY(0.9);
    opacity: 0.65;
  }
}

@keyframes shock {
  0% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-8deg);
  }
  50% {
    transform: rotate(6deg);
  }
  75% {
    transform: rotate(-6deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

#home-screen {
  padding: 2.1rem 1.1rem;
    background:
    linear-gradient(180deg, #edf5dd 0%, #edf5dd 45%, #e8f2d6 100%);
  /* background:
    repeating-linear-gradient(
      135deg,
      #0e7f3f 0,
      #0e7f3f 18px,
      #edd941 18px,
      #edd941 36px
    ); */
 
}

.home-shell {
  width: min(980px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.home-header h1 {
  margin: 0;
  text-align: center;
  color: #18220f;
  font-size: clamp(1.55rem, 3.6vw, 2.5rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  padding: 1rem 1.2rem;
  border-radius: 16px;
  border: 2px solid rgba(26, 35, 15, 0.18);
   background:
    linear-gradient(180deg, #edf5dd 0%, #edf5dd 45%, #e8f2d6 100%);
  box-shadow: 0 12px 22px rgba(32, 41, 16, 0.15);
}

.quiz-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
}

.quiz-choice {
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  min-height: 280px;
  padding: 1.3rem 1.1rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.5rem;
  color: #fefefe;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quiz-choice:first-child {
  background:
    linear-gradient(160deg, #0b7840 0%, #23a459 45%, #41c470 100%);
  box-shadow: 0 14px 30px rgba(20, 95, 52, 0.26);
}

.quiz-choice:last-child {
  background:
    linear-gradient(160deg, #1e3a8a 0%, #266ac7 50%, #3e95ef 100%);
  box-shadow: 0 14px 30px rgba(24, 63, 138, 0.26);
}

.quiz-choice:hover,
.quiz-choice:focus-visible {
  transform: translateY(-4px);
}

.quiz-choice.is-loading {
  cursor: progress;
  transform: none;
}

.quiz-choice.is-loading:hover,
.quiz-choice.is-loading:focus-visible {
  transform: none;
}

.quiz-choice-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  flex-direction: column;
  background: rgba(245, 249, 239, 0.52);
}

.quiz-choice.is-loading .quiz-choice-loading {
  display: flex;
}

.quiz-choice-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(20, 42, 24, 0.28);
  border-top-color: #14703a;
  border-radius: 50%;
  animation: quiz-choice-spin 0.7s linear infinite;
}

.quiz-choice-loading-label {
  font-size: 0.9rem;
  font-weight: 800;
  color: #173520;
}

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

.choice-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 900;
}

.choice-subtitle {
  font-size: 1rem;
  line-height: 1.35;
  opacity: 0.92;
}

#quiz-screen,
#solution-screen,
#score-screen {
  padding: 1.2rem;
}

#quiz-screen {
  background:
    linear-gradient(180deg, #f8fbf2 0%, #ecf4e0 100%);
}

#solution-screen {
  background:
    linear-gradient(180deg, #f6faf4 0%, #ebf3e2 100%);
}

.quiz-shell,
.solution-shell {
  width: min(980px, 95vw);
  min-height: 88vh;
  display: grid;
  gap: 1rem;
  align-content: start;
}

.quiz-progress,
.solution-progress {
  text-align: center;
  font-weight: 800;
  font-size: clamp(1rem, 2.6vw, 1.35rem);
}

.quiz-topbar,
.solution-actions {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
}

.quiz-topbar > .quiz-progress,
.solution-actions > .solution-progress {
  grid-column: 2;
  justify-self: center;
}

.quiz-topbar > .back-quiz-btn,
.solution-actions > .back-quiz-btn {
  grid-column: 1;
  justify-self: start;
}

.solution-actions > .next-question-btn {
  grid-column: 3;
  justify-self: end;
}

.question-block,
.solution-block {
  background: #ffffff;
  border: 1px solid #dde4d6;
  border-radius: 16px;
  box-shadow: 0 9px 20px rgba(28, 35, 45, 0.08);
  padding: 1.1rem;
  display: grid;
  gap: 0.8rem;
  justify-items: center;
}

.question-text,
.solution-text {
  margin: 0;
  width: 100%;
  font-size: clamp(1.12rem, 2.3vw, 1.55rem);
  line-height: 1.38;
  text-align: center;
}

.solution-text {
  white-space: pre-line;
}

.solution-status {
  margin: 0;
  width: 100%;
  text-align: center;
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  font-weight: 900;
}

.solution-status.ok {
  color: #168441;
}

.solution-status.ko {
  color: #bf1f2d;
}

.solution-final-action {
  width: 100%;
  display: none;
  justify-content: center;
}

.solution-final-action.visible {
  display: flex;
}

.question-img,
.solution-img {
  max-width: min(460px, 100%);
  max-height: 220px;
  border-radius: 12px;
  display: none;
}

.question-img.visible,
.solution-img.visible {
  display: block;
}

.quiz-options {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.quiz-options[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quiz-options[data-count="3"] .option-card:last-child {
  grid-column: 1 / -1;
  width: min(420px, 100%);
  justify-self: center;
}

.quiz-options[data-count="1"] {
  grid-template-columns: 1fr;
}

.option-card {
  border: 2px solid #d7dfcf;
  border-radius: 14px;
  background: #ffffff;
  min-height: 114px;
  padding: 0.85rem;
  display: grid;
  gap: 0.65rem;
  align-content: center;
  justify-items: center;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.option-card:hover,
.option-card:focus-visible {
  border-color: #7fa552;
  transform: translateY(-2px);
  box-shadow: 0 8px 14px rgba(39, 66, 28, 0.12);
}

.option-text {
  font-size: clamp(1rem, 2vw, 1.2rem);
  text-align: center;
  font-weight: 700;
  line-height: 1.28;
}

.option-img {
  max-width: 170px;
  max-height: 90px;
}

.next-question-btn,
.back-home-btn,
.back-quiz-btn,
.solution-final-btn {
  justify-self: end;
  border: 0;
  border-radius: 11px;
  background: #1f8f47;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  padding: 0.8rem 1.15rem;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease;
}

.quiz-back-btn {
  justify-self: start;
}

.next-question-btn:hover,
.next-question-btn:focus-visible,
.solution-final-btn:hover,
.solution-final-btn:focus-visible,
.back-home-btn:hover,
.back-home-btn:focus-visible,
.back-quiz-btn:hover,
.back-quiz-btn:focus-visible {
  background: #176d36;
  transform: translateY(-2px);
}

#score-screen {
  background:
    radial-gradient(circle at 50% 20%, #f7fce7 0%, #edf5da 42%, #e3efcd 100%);
}

.score-card {
  width: min(460px, 92vw);
  padding: 1.5rem 1.2rem;
  border-radius: 18px;
  border: 1px solid #cfdabf;
  background: #fff;
  box-shadow: 0 13px 28px rgba(30, 42, 20, 0.12);
  text-align: center;
  display: grid;
  gap: 1rem;
}

.score-title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 900;
}

.score-value {
  margin: 0;
  font-size: 2rem;
  font-weight: 900;
}

.score-value--good {
  color: #166836;
}

.score-value--mid {
  color: #c96d00;
}

.score-value--bad {
  color: #c7382f;
}

.score-message {
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.45;
  color: #2e5133;
}

.back-home-btn {
  justify-self: center;
}

@media (max-width: 860px) {
  .quiz-choices {
    grid-template-columns: 1fr;
  }

  .quiz-choice {
    min-height: 190px;
  }
}

@media (max-width: 620px) {
  .quiz-options {
    grid-template-columns: 1fr;
  }

  .quiz-options[data-count="2"],
  .quiz-options[data-count="3"] {
    grid-template-columns: 1fr;
  }

  .quiz-options[data-count="3"] .option-card:last-child {
    width: 100%;
  }

  .back-home-btn {
    width: 100%;
  }

  .quiz-topbar,
  .solution-actions {
    gap: 0.45rem;
  }

  .quiz-topbar > .back-quiz-btn,
  .solution-actions > .back-quiz-btn,
  .solution-actions > .next-question-btn {
    font-size: 0.9rem;
    padding: 0.65rem 0.75rem;
  }
}
