/* Sondage ESGI, theme Halloween. Personnage repris du defi (tete ronde, deux yeux, corps arrondi). */
:root {
  --nuit: #0d0718; --nuit2: #1a0f2e; --violet: #4b2a7a; --violet2: #2a1846;
  --orange: #ff8a1f; --orange2: #ffb347; --vert: #8dff6b; --encre: #f4ecff; --doux: #b9a7d6;
  --rouge: #ff5e7a; --carte: rgba(30, 16, 52, .88); --ligne: #4a3270;
  --etage: 27px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; hyphens: none; -webkit-hyphens: none; }
body {
  font-family: "Segoe UI", system-ui, Arial, sans-serif; color: var(--encre);
  background: radial-gradient(900px 600px at 80% 0%, #3a1d5e 0, transparent 60%),
              radial-gradient(900px 500px at 0% 100%, #3b1a0c 0, transparent 55%), var(--nuit);
  overflow-x: hidden;
}
.cache { display: none !important; }

/* ===== le ciel : lune, etoiles, chauves-souris, fantomes ===== */
.ciel { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.lune { position: absolute; top: 40px; right: 8vw; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff8d6 0, #ffe9a3 45%, #f2c86b 100%); box-shadow: 0 0 60px 18px rgba(255, 220, 140, .35); }
.lune::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: rgba(200, 160, 80, .35); top: 30px; left: 58px; box-shadow: -26px 34px 0 6px rgba(200,160,80,.25); }
.etoiles { position: absolute; inset: 0; background-image:
  radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 28% 8%, #fff 50%, transparent 51%),
  radial-gradient(1.5px 1.5px at 44% 22%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 63% 12%, #fff 50%, transparent 51%),
  radial-gradient(1.2px 1.2px at 77% 30%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 91% 8%, #fff 50%, transparent 51%),
  radial-gradient(1.3px 1.3px at 6% 42%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 55% 40%, #fff 50%, transparent 51%);
  animation: scintille 4s ease-in-out infinite alternate; opacity: .8; }
@keyframes scintille { to { opacity: .35; } }
.chauve { position: absolute; width: 46px; height: 18px; }
.chauve::before, .chauve::after { content: ""; position: absolute; top: 0; width: 24px; height: 14px; background: #120a1f;
  border-radius: 100% 0 60% 0; animation: aile .28s ease-in-out infinite alternate; }
.chauve::before { left: 0; transform-origin: right center; }
.chauve::after { right: 0; transform: scaleX(-1); transform-origin: left center; }
@keyframes aile { from { transform: rotate(18deg); } to { transform: rotate(-18deg); } }
.chauve.c1 { top: 14%; animation: vol 18s linear infinite; }
.chauve.c2 { top: 26%; animation: vol 24s linear infinite 6s; transform: scale(.7); }
.chauve.c3 { top: 9%; animation: vol 30s linear infinite 12s; transform: scale(.55); }
@keyframes vol { 0% { left: -60px; margin-top: 0; } 25% { margin-top: 30px; } 50% { margin-top: -10px; } 75% { margin-top: 25px; } 100% { left: 105vw; margin-top: 0; } }
.fantome { position: absolute; width: 54px; height: 66px; background: rgba(240, 235, 255, .16); border-radius: 27px 27px 6px 6px;
  animation: flotte 7s ease-in-out infinite; }
.fantome::before { content: ""; position: absolute; top: 20px; left: 14px; width: 7px; height: 9px; border-radius: 50%; background: rgba(13,7,24,.7); box-shadow: 18px 0 0 rgba(13,7,24,.7); }
.fantome.f1 { left: 4vw; top: 55%; } .fantome.f2 { right: 4vw; top: 62%; animation-delay: -3s; transform: scale(.8); }
@keyframes flotte { 50% { transform: translateY(-26px); opacity: .55; } }

/* ===== la page ===== */
.page { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 22px 16px 30px; }
.kicker { color: var(--orange2); text-transform: uppercase; letter-spacing: 3px; font-weight: 700; font-size: 13px; }
h1 { margin: 6px 0 4px; font-size: clamp(28px, 4.4vw, 48px); text-shadow: 0 0 18px rgba(255, 138, 31, .45); }
.sous { color: var(--doux); margin: 0 0 18px; max-width: 760px; }
.scene { display: grid; grid-template-columns: minmax(230px, 300px) 1fr; gap: 28px; align-items: start; }
footer { color: var(--doux); font-size: 13px; margin-top: 22px; text-align: center; }

/* ===== la tour ===== */
.col-tour { position: sticky; top: 12px; padding-top: 86px; display: flex; flex-direction: column; align-items: center; }
.tour { position: relative; width: 210px; background: linear-gradient(90deg, #22143a, #31204f 50%, #22143a);
  border: 3px solid #120a1f; border-bottom: none; border-radius: 6px 6px 0 0; padding-bottom: 54px; box-shadow: 0 0 40px rgba(120, 60, 200, .35); }
.toit { position: absolute; left: -16px; right: -16px; top: -72px; height: 74px; background: linear-gradient(180deg, #5b3a8f, #2a1846); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.drapeau { position: absolute; left: 50%; top: -22px; width: 3px; height: 30px; background: #120a1f; }
.drapeau::after { content: ""; position: absolute; left: 3px; top: 0; width: 22px; height: 14px; background: var(--orange); clip-path: polygon(0 0, 100% 50%, 0 100%); animation: flotteDrapeau 1.4s ease-in-out infinite alternate; }
@keyframes flotteDrapeau { to { transform: skewY(8deg); } }
#etages { display: flex; flex-direction: column-reverse; }
.etage { height: var(--etage); border-top: 2px solid rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: space-around; position: relative; }
.etage .fen { width: 18px; height: 20px; border-radius: 9px 9px 2px 2px; background: #140b24; box-shadow: inset 0 0 0 2px #0b0614; transition: background .6s, box-shadow .6s; }
.etage.fait .fen { background: var(--orange2); box-shadow: 0 0 10px rgba(255, 179, 71, .8), inset 0 0 0 2px #0b0614; }
.etage.ici .fen { background: var(--vert); box-shadow: 0 0 12px rgba(141, 255, 107, .8), inset 0 0 0 2px #0b0614; animation: clignote 1.2s ease-in-out infinite alternate; }
@keyframes clignote { to { opacity: .55; } }
.etage .num { position: absolute; left: -30px; font-size: 12px; color: var(--doux); width: 24px; text-align: right; }
.porte { position: absolute; bottom: 0; left: 50%; width: 46px; height: 50px; margin-left: -23px; background: #120a1f; border-radius: 23px 23px 0 0; }
.citrouilles { display: flex; gap: 10px; align-items: flex-end; margin-top: -2px; }
.citrouille { width: 44px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, var(--orange2), var(--orange) 60%, #c25a00);
  position: relative; box-shadow: 0 0 18px rgba(255, 138, 31, .55); }
.citrouille::before { content: ""; position: absolute; top: -7px; left: 19px; width: 6px; height: 9px; background: #3d6b1f; border-radius: 2px; }
.citrouille::after { content: ""; position: absolute; top: 12px; left: 10px; width: 24px; height: 10px; background: #2a1300;
  clip-path: polygon(0 0, 22% 0, 11% 45%, 40% 45%, 50% 0, 60% 45%, 89% 45%, 78% 0, 100% 0, 85% 100%, 15% 100%); animation: lueur 2s ease-in-out infinite alternate; }
@keyframes lueur { to { background: #5a2a00; } }
.citrouille.petite { transform: scale(.75); }
.compteur { margin-top: 10px; color: var(--orange2); font-weight: 700; }

/* le personnage du defi, chapeau de sorciere en plus */
.perso { position: absolute; left: 50%; bottom: 4px; width: 40px; margin-left: -20px; display: flex; flex-direction: column; align-items: center;
  transition: bottom 1.1s cubic-bezier(.3, 1.4, .5, 1); z-index: 3; }
.perso .tete { width: 30px; height: 30px; border-radius: 50%; background: #4cc2ff; position: relative; border: 2px solid rgba(0, 0, 0, .35);
  box-shadow: 0 0 12px rgba(76, 194, 255, .7); animation: dandine 2.6s ease-in-out infinite; }
.perso .tete::before, .perso .tete::after { content: ""; position: absolute; top: 11px; width: 5px; height: 5px; border-radius: 50%; background: #10151c; }
.perso .tete::before { left: 7px; } .perso .tete::after { right: 7px; }
.perso .corps { width: 20px; height: 14px; background: #4cc2ff; border-radius: 4px 4px 2px 2px; margin-top: -1px; }
.perso .chapeau { width: 34px; height: 22px; position: relative; margin-bottom: -6px; z-index: 2; }
.perso .chapeau::before { content: ""; position: absolute; left: 9px; bottom: 4px; width: 16px; height: 20px; background: #1b0f2c; clip-path: polygon(45% 0, 100% 100%, 0 100%); transform: rotate(-8deg); }
.perso .chapeau::after { content: ""; position: absolute; left: 0; bottom: 0; width: 34px; height: 6px; border-radius: 50%; background: #1b0f2c; box-shadow: 0 -3px 0 -1px var(--orange); }
.perso .nom { font-size: 11px; font-weight: 700; color: var(--encre); background: rgba(0, 0, 0, .5); padding: 1px 6px; border-radius: 8px; margin-top: 2px; white-space: nowrap; }
.perso.saute .tete { animation: saut .6s ease; }
@keyframes dandine { 50% { transform: rotate(6deg); } }
@keyframes saut { 40% { transform: translateY(-14px) scale(1.1); } }

/* ===== la carte ===== */
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: 18px; padding: 22px 24px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
  animation: apparait .5s ease; backdrop-filter: blur(3px); }
@keyframes apparait { from { opacity: 0; transform: translateY(14px); } }
.carte h2 { margin: 2px 0 12px; font-size: clamp(20px, 2.4vw, 27px); }
.theme { color: var(--orange2); text-transform: uppercase; letter-spacing: 2px; font-size: 12px; font-weight: 700; }
.aide { color: var(--doux); margin: 0 0 14px; }
label { display: block; margin: 10px 0; color: var(--doux); font-size: 14px; }
input[type=text], input[type=email], input:not([type]), input[inputmode], textarea {
  display: block; width: 100%; margin-top: 5px; padding: 11px 13px; font: inherit; font-size: 17px; color: var(--encre);
  background: #12091f; border: 1px solid var(--ligne); border-radius: 10px; }
input:focus, textarea:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
textarea { min-height: 110px; resize: vertical; }
button { font: inherit; font-size: 16px; padding: 11px 20px; border-radius: 11px; cursor: pointer; margin: 12px 8px 0 0; border: 1px solid var(--ligne); }
button.pri { background: linear-gradient(90deg, var(--orange), var(--orange2)); color: #1f0d00; font-weight: 800; border: none; box-shadow: 0 4px 18px rgba(255, 138, 31, .35); }
button.sec { background: #22143a; color: var(--encre); }
button:disabled { opacity: .5; cursor: default; }
.msg { margin-top: 12px; min-height: 1.3em; }
.msg.err { color: var(--rouge); } .msg.ok { color: var(--vert); }

/* types de questions */
.pct-val { font-size: 46px; font-weight: 800; color: var(--orange2); text-align: center; text-shadow: 0 0 16px rgba(255, 138, 31, .5); }
input[type=range] { width: 100%; accent-color: var(--orange); height: 30px; }
.pct-bornes { display: flex; justify-content: space-between; color: var(--doux); font-size: 13px; }
.choix { display: flex; flex-direction: column; gap: 9px; }
.choix button { margin: 0; text-align: left; background: #1d1133; color: var(--encre); padding: 13px 16px; }
.choix button.pris { border-color: var(--orange); background: rgba(255, 138, 31, .16); box-shadow: 0 0 0 1px var(--orange); }
.echelle { width: 100%; border-collapse: collapse; }
.echelle td, .echelle th { padding: 8px 4px; border-bottom: 1px solid var(--ligne); text-align: center; font-size: 14px; }
.echelle td:first-child { text-align: left; font-size: 15px; }
.echelle th { color: var(--doux); font-weight: 600; }
.echelle input { accent-color: var(--orange); width: 20px; height: 20px; }

/* fin : citrouilles qui tombent */
.pluie { position: fixed; top: -40px; width: 30px; height: 24px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, var(--orange2), var(--orange) 60%, #c25a00);
  z-index: 5; pointer-events: none; animation: tombe 3.2s linear forwards; }
@keyframes tombe { to { transform: translateY(110vh) rotate(540deg); } }

@media (max-width: 760px) {
  .scene { grid-template-columns: 1fr; }
  .col-tour { position: static; transform: scale(.82); transform-origin: top center; margin-bottom: -40px; }
  .lune { width: 70px; height: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  .chauve, .fantome, .etoiles, .perso .tete, .etage.ici .fen, .citrouille::after, .drapeau::after { animation: none !important; }
  .perso { transition: none; }
}
