/* Dermato Expert Challenge — borne tablette paysage (référence 1280×800) */

:root {
  --mtc-blue: #19449c;
  --mtc-blue-dark: #0f2f70;
  --mtc-green: #199332;
  --dp-ink: #2f3d47;
  --dp-red: #e61d47;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --line: #d9e1ec;
  --muted: #5d6b78;
  --ok: #199332;
  --ok-bg: #e7f6ea;
  --ko: #d4163c;
  --ko-bg: #fdebef;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(25, 68, 156, 0.10), 0 2px 6px rgba(25, 68, 156, 0.06);
  --footer-h: 92px;
  --font: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--dp-ink);
  font-family: var(--font);
  font-size: 22px;
  line-height: 1.35;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
}

input, select, textarea { -webkit-user-select: text; user-select: text; font: inherit; color: inherit; }

#app {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr var(--footer-h);
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(25, 68, 156, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(25, 147, 50, 0.08), transparent 60%),
    var(--bg);
}

#screens { position: relative; overflow: hidden; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 48px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
}
.screen.active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s;
}
.screen-scroll { justify-content: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.screen-scroll::-webkit-scrollbar { display: none; }

h1, h2 { margin: 0; color: var(--mtc-blue); letter-spacing: -0.01em; }
h1 { font-size: 46px; line-height: 1.15; font-weight: 800; }
h2 { font-size: 34px; font-weight: 750; }

/* ---------- Footer logos (visibles sur tous les écrans) ---------- */
.brand-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.brand-bar img { height: 46px; width: auto; }
.brand-bar img[alt='Crescina'] { height: 30px; }
.brand-bar .sep { width: 1px; height: 44px; background: var(--line); }

/* ---------- Boutons ---------- */
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0 32px;
  min-height: 64px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--mtc-blue); color: #fff; box-shadow: 0 8px 20px rgba(25, 68, 156, 0.28); }
.btn-primary:active { background: var(--mtc-blue-dark); }
.btn-ghost { background: transparent; color: var(--mtc-blue); border: 2px solid var(--mtc-blue); }
.btn-danger { background: var(--ko); color: #fff; }
.btn-lg { min-height: 72px; font-size: 24px; padding: 0 40px; }
.btn-xl { min-height: 84px; font-size: 28px; padding: 0 64px; }

/* ---------- 1. Accueil ---------- */
#s-accueil { cursor: pointer; }
.accueil-center { display: flex; flex-direction: column; align-items: center; gap: 44px; z-index: 1; }
.logo-mtc-xl { width: min(640px, 60vw); height: auto; }
.partenaires { display: flex; gap: 28px; align-items: center; }
.partenaires img { height: 72px; width: auto; }
.partenaire-placeholder {
  display: grid; place-items: center;
  height: 72px; min-width: 190px; padding: 0 20px;
  border: 2px dashed var(--line); border-radius: 16px;
  color: var(--muted); font-weight: 700; letter-spacing: 0.06em;
}
.tap-hint {
  display: flex; align-items: center; gap: 16px;
  margin: 12px 0 0; padding: 18px 36px;
  border-radius: 999px; background: var(--mtc-blue); color: #fff;
  font-size: 26px; font-weight: 700;
  box-shadow: 0 10px 24px rgba(25, 68, 156, 0.3);
  animation: pulse 2.2s ease-in-out infinite;
}
.tap-dot { width: 14px; height: 14px; border-radius: 50%; background: #fff; animation: blink 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes blink { 50% { opacity: 0.25; } }

.accueil-deco { position: absolute; inset: 0; pointer-events: none; }
.accueil-deco img {
  position: absolute; height: 240px; width: auto; opacity: 0.95;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.12));
  animation: float 6s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-14px) rotate(var(--r, 0deg)); } }

/* ---------- 2. Bienvenue ---------- */
.card-hero {
  max-width: 980px;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  text-align: center;
  padding: 56px 64px;
  background: var(--surface);
  border-radius: 32px;
  box-shadow: var(--shadow);
}
.logo-mtc-md { height: 64px; width: auto; margin-bottom: 8px; }
.lead { margin: 8px 0 0; font-size: 34px; font-weight: 650; }
.lead-sub { margin: 0 0 18px; font-size: 28px; color: var(--muted); }

/* ---------- 3. Formulaire ---------- */
#s-form { padding-top: 18px; padding-bottom: 20px; }
.logo-mtc-sm { height: 48px; width: auto; flex: none; }
.form {
  width: 100%; max-width: 1100px;
  margin-top: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: var(--surface);
  border-radius: 28px;
  padding: 20px 40px 24px;
  box-shadow: var(--shadow);
}
.form h2 { font-size: 28px; }
.form-grid { width: 100%; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px 24px; }
.field { grid-column: span 3; display: flex; flex-direction: column; gap: 4px; }
.field:has(select) { grid-column: span 2; }
.field > span { font-size: 18px; font-weight: 700; color: var(--muted); }
.field input, .field select {
  height: 62px;
  padding: 0 18px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fbfcfe;
  font-size: 22px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--mtc-blue) 50%), linear-gradient(135deg, var(--mtc-blue) 50%, transparent 50%);
  background-position: calc(100% - 26px) 27px, calc(100% - 18px) 27px;
  background-size: 8px 8px;
  background-repeat: no-repeat;
  padding-right: 48px;
}
.field input:focus, .field select:focus { border-color: var(--mtc-blue); box-shadow: 0 0 0 4px rgba(25, 68, 156, 0.14); }
.field em, .consent-error { min-height: 20px; font-size: 16px; font-style: normal; font-weight: 600; color: var(--ko); }
.field.invalid input, .field.invalid select { border-color: var(--ko); background: var(--ko-bg); }

.consent { display: flex; align-items: flex-start; gap: 16px; width: 100%; cursor: pointer; }
.consent input { position: absolute; opacity: 0; pointer-events: none; }
.consent .box {
  flex: none; width: 40px; height: 40px; margin-top: 2px;
  border: 3px solid var(--mtc-blue); border-radius: 10px; background: #fff;
  display: grid; place-items: center;
}
.consent input:checked + .box { background: var(--mtc-blue); }
.consent input:checked + .box::after { content: ''; width: 10px; height: 20px; border: solid #fff; border-width: 0 4px 4px 0; transform: translateY(-3px) rotate(45deg); }
.consent-text { font-size: 17px; line-height: 1.4; color: var(--muted); }
.consent-error { align-self: flex-start; margin-left: 56px; }
.form-alert {
  width: 100%; margin: 0; padding: 16px 22px;
  border-radius: 14px; background: var(--ko-bg); color: var(--ko);
  font-weight: 750; text-align: center; font-size: 24px;
}

/* ---------- 4. Choix ---------- */
.choix-titre { margin-bottom: 40px; min-height: 46px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; width: 100%; max-width: 1180px; }
.cat-card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 32px;
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 4px solid transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 24px 16px 22px;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, opacity 0.3s ease, box-shadow 0.18s ease;
}
.cat-card::before {
  content: ''; position: absolute; inset: auto 0 0 0; height: 44%;
  background: var(--c); opacity: 0.14;
}
.cat-card img { position: relative; height: 62%; width: auto; max-width: 90%; object-fit: contain; filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.12)); }
.cat-card .cat-label {
  position: relative;
  padding: 10px 18px; border-radius: 999px;
  background: var(--c); color: #fff;
  font-weight: 800; font-size: 22px; letter-spacing: 0.04em;
}
.cat-card .cat-num { position: absolute; top: 16px; left: 20px; font-weight: 800; color: var(--c); font-size: 20px; }
.cat-card.hot { transform: translateY(-10px) scale(1.04); border-color: var(--c); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16); }
.cards.done .cat-card:not(.chosen) { opacity: 0.25; transform: scale(0.94); }
.cat-card.chosen { transform: translateY(-14px) scale(1.08); border-color: var(--c); animation: chosen 0.6s ease; }
@keyframes chosen { 40% { transform: translateY(-14px) scale(1.14); } }

/* ---------- 5. Quiz ---------- */
#s-quiz { justify-content: flex-start; padding-top: 28px; }
.quiz-head { width: 100%; max-width: 1180px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.chip { padding: 10px 22px; border-radius: 999px; background: var(--c, var(--mtc-blue)); color: #fff; font-weight: 800; letter-spacing: 0.04em; }
.steps { display: flex; gap: 12px; align-items: center; }
.steps span { width: 56px; height: 12px; border-radius: 999px; background: var(--line); transition: background 0.3s ease; }
.steps span.cur { background: var(--mtc-blue); }
.steps span.ok { background: var(--ok); }
.steps span.ko { background: var(--ko); }

.quiz-body { width: 100%; max-width: 1180px; flex: 1; min-height: 0; display: grid; grid-template-columns: 1.35fr 1fr; gap: 32px; }
.quiz-main { display: flex; flex-direction: column; gap: 22px; }
.question { font-size: 32px; line-height: 1.25; color: var(--dp-ink); font-weight: 750; }
.answers { display: flex; flex-direction: column; gap: 16px; }
.answer {
  display: flex; align-items: center; gap: 18px;
  min-height: 84px; padding: 14px 22px;
  text-align: left;
  border: 3px solid var(--line); border-radius: 20px;
  background: var(--surface);
  font: inherit; font-size: 24px; font-weight: 650; color: var(--dp-ink);
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(25, 68, 156, 0.05);
  transition: transform 0.12s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.3s ease;
}
.answer:active { transform: scale(0.985); }
.answer .letter {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: #eef3fb; color: var(--mtc-blue); font-weight: 800;
}
.answers.locked .answer { pointer-events: none; }
.answers.locked .answer:not(.correct):not(.wrong) { opacity: 0.45; }
.answer.correct { border-color: var(--ok); background: var(--ok-bg); }
.answer.correct .letter { background: var(--ok); color: #fff; }
.answer.wrong { border-color: var(--ko); background: var(--ko-bg); animation: shake 0.4s ease; }
.answer.wrong .letter { background: var(--ko); color: #fff; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

.quiz-side {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: var(--surface);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 24px;
  min-height: 0;
  overflow: hidden;
}
.packshots { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; }
.packshots img {
  max-height: 100%; max-width: calc(100% / var(--n, 1)); width: auto; object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.14));
}
.packshots.reveal img { animation: pop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.packshots.reveal img:nth-child(2) { animation-delay: 0.08s; }
.packshots.reveal img:nth-child(3) { animation-delay: 0.16s; }
@keyframes pop { from { opacity: 0; transform: translateY(30px) scale(0.7); } }

.feedback { width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; animation: pop 0.4s ease both; }
.feedback-title { margin: 0; font-size: 30px; font-weight: 850; }
.feedback.ok .feedback-title { color: var(--ok); }
.feedback.ko .feedback-title { color: var(--ko); }
.feedback-text { margin: 0 0 10px; font-size: 19px; color: var(--muted); }

/* ---------- 6. Bravo ---------- */
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.bravo { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.bravo-kicker { margin: 0; font-size: 64px; line-height: 1; animation: pop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.bravo h1 { font-size: 64px; color: var(--mtc-blue); animation: pop 0.6s 0.1s ease both; }
.score {
  margin-top: 8px;
  width: 150px; height: 150px; border-radius: 50%;
  display: grid; place-items: center; grid-auto-flow: column; align-content: center;
  background: var(--mtc-green); color: #fff;
  font-size: 68px; font-weight: 850;
  box-shadow: 0 14px 30px rgba(25, 147, 50, 0.35);
  animation: pop 0.6s 0.25s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.score small { font-size: 32px; opacity: 0.85; align-self: end; margin-bottom: 36px; }
.score-label { margin: 0; color: var(--muted); font-size: 18px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; }
.bravo-lines { margin: 8px 0 12px; }
.bravo-lines p { margin: 4px 0; font-size: 28px; font-weight: 600; }
.bravo-lines p:last-child { color: var(--mtc-green); font-weight: 800; }
.countdown { width: 360px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 12px; }
.countdown span { display: block; height: 100%; width: 100%; background: var(--mtc-blue); transform-origin: left; }

/* ---------- Admin ---------- */
.pin, .admin { width: 100%; max-width: 900px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.pin-dots { display: flex; gap: 18px; height: 28px; }
.pin-dots span { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--mtc-blue); }
.pin-dots span.on { background: var(--mtc-blue); }
.pin-dots.err { animation: shake 0.4s ease; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 96px); gap: 14px; }
.pin-pad button { height: 80px; border-radius: 20px; border: 2px solid var(--line); background: var(--surface); font: inherit; font-size: 32px; font-weight: 700; color: var(--dp-ink); }
.pin-pad button:active { background: #eef3fb; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; width: 100%; }
.stats > div { background: var(--surface); border-radius: 20px; padding: 18px; text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stats strong { font-size: 44px; color: var(--mtc-blue); }
.stats span { color: var(--muted); font-size: 18px; }
.stats-cats { grid-template-columns: repeat(4, 1fr); }
.stats-cats strong { font-size: 32px; }
.admin-msg { min-height: 30px; margin: 0; font-weight: 700; text-align: center; }
.admin-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; }

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

/* Petits écrans (test sur ordinateur / téléphone) */
@media (max-width: 900px) {
  html, body { font-size: 18px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .cat-card { aspect-ratio: 4 / 3; }
  .quiz-body { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field, .field:has(select) { grid-column: auto; }
  .screen { padding: 20px 16px; }
}

/* Formulaire : tient dans 1280×800 sans défilement (hors clavier) */
.form { gap: 10px; }
.field input, .field select { height: 58px; }
.field select { background-position: calc(100% - 26px) 25px, calc(100% - 18px) 25px; }
.field em { min-height: 18px; }
.consent-error:empty { display: none; }
.form .btn-xl { min-height: 72px; margin-top: 4px; }

[hidden] { display: none !important; }

/* Avant la réponse : pas de packshot (il donnerait la réponse), un « ? » aux couleurs de la catégorie */
.mystery {
  width: 220px; height: 220px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--c, var(--mtc-blue)) 12%, white);
  color: var(--c, var(--mtc-blue));
  font-size: 130px; font-weight: 850;
  animation: pulse 2.4s ease-in-out infinite;
}

.confetti { z-index: 0; }
.bravo { z-index: 1; }
.bravo h1, .bravo-lines p { text-shadow: 0 0 12px var(--bg), 0 0 4px var(--bg); }
.score { display: flex; align-items: baseline; justify-content: center; gap: 2px; padding-top: 6px; }
.score small { align-self: auto; margin: 0; }
.bravo .btn-ghost { background: #fff; }
