/* ===========================================================
   LE DÉTECTEUR — salle d'interrogatoire, film noir
   =========================================================== */
body.detecteur {
  --theme: #d98c2b;
  --theme-2: #ffc46b;
  --ambre: #ffc46b;
  --rouge: #e5484d;
  --vert: #3ec97a;
  --papier: #efe6d2;
  --encre: #1b1410;
  --panneau: rgba(22, 16, 12, 0.92);
  --machine: 'Special Elite', 'Courier New', monospace;
  background: #0d0a08;
}

/* ---------- Décor : murs sombres, lampe suspendue ---------- */
.salle-fond {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60vmax 50vmax at 50% -8%, rgba(255, 196, 107, 0.22), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 90px),
    linear-gradient(180deg, #17110c 0%, #0d0a08 70%);
}
.lampe { position: absolute; left: 50%; top: 0; width: 2px; height: 9vh; background: #3a2c20; transform-origin: 50% 0; animation: lampe 7s ease-in-out infinite alternate; }
.lampe i { position: absolute; left: 50%; top: 100%; width: 70px; height: 34px; transform: translateX(-50%); border-radius: 60px 60px 6px 6px; background: linear-gradient(180deg, #4a3a2a, #241a12); box-shadow: 0 14px 40px 6px rgba(255, 196, 107, 0.35); }
.lampe i::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 22px; height: 10px; transform: translateX(-50%); border-radius: 50%; background: #fff3d4; box-shadow: 0 0 22px 6px rgba(255, 220, 150, 0.8); }
@keyframes lampe { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }

/* Boutons principaux couleur ambre */
.detecteur .btn.primary { background: linear-gradient(180deg, #ffc46b, #d98c2b); color: #1b1410; box-shadow: 0 6px 20px rgba(217, 140, 43, 0.35); border-color: transparent; }
.detecteur .btn.primary:disabled { opacity: 0.45; }

/* ---------- Réglages ---------- */
.dossier { margin: 0; font-family: var(--machine); font-size: 0.8rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ambre); opacity: 0.8; }
.titre-det { font-family: var(--serif); font-weight: 700; font-size: clamp(3rem, 15vw, 4.4rem); line-height: 1; margin: 10px 0 6px; color: #f6eadb; }
.titre-det em { color: var(--ambre); text-shadow: 0 0 30px rgba(255, 196, 107, 0.5); }

/* ---------- Jeu ---------- */
.jeu-det { gap: 10px; }
.info-tour { font-family: var(--machine); font-size: 0.95rem; letter-spacing: 0.08em; color: var(--ambre); text-align: center; }

.salle {
  --sh: clamp(84px, 17dvh, 136px);
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  height: var(--sh);
  padding: 0 4px;
}
.siege { --c: var(--p0); position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; height: 100%; justify-content: flex-end; }
.siege.p1 { --c: var(--p1); }
.siege .perso { height: calc(var(--sh) * 0.64); width: calc(var(--sh) * 0.64 * 100 / 130); flex: none; }
.siege .nom { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; font-size: 0.82rem; color: var(--c); }
.siege .pts { position: absolute; top: 34%; right: 4%; min-width: 30px; height: 30px; padding: 0 6px; display: grid; place-items: center; border-radius: 10px; background: rgba(0, 0, 0, 0.55); border: 1px solid var(--c); font-family: var(--machine); font-size: 1.1rem; color: #fff; }
.siege .role { font-family: var(--machine); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: #a8998a; }
.siege.suspect .role { color: var(--ambre); }
.siege.suspect::before { content: ''; position: absolute; left: 50%; bottom: 10px; width: 120%; height: 80%; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(255, 196, 107, 0.28), transparent); z-index: -1; }
.table { width: clamp(40px, 14vw, 70px); height: 14px; margin-bottom: 18px; border-radius: 4px; background: linear-gradient(180deg, #4a3626, #2a1d14); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5); }
.salle.serre .siege.suspect::before { background: radial-gradient(closest-side, rgba(229, 72, 77, 0.35), transparent); }

.phase {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 22px;
  background: var(--panneau);
  border: 1px solid rgba(255, 196, 107, 0.22);
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.8);
}
.phase[hidden] { display: none !important; }
.phase.entree { animation: entree 0.35s ease; }
@keyframes entree { from { opacity: 0; transform: translateY(10px); } }
.phase-titre { margin: 0; font-family: var(--serif); font-size: clamp(1.6rem, 7vw, 2.1rem); line-height: 1.1; text-align: center; color: #f6eadb; }
.phase-texte { margin: 0; text-align: center; color: #d8ccbf; line-height: 1.45; }
#ph-passe { justify-content: center; }
.etiquette-det { align-self: center; margin: 0; padding: 4px 12px; border-radius: 999px; background: rgba(229, 72, 77, 0.18); border: 1px solid var(--rouge); color: #ffb3b5; font: 700 0.72rem var(--sans); letter-spacing: 0.1em; text-transform: uppercase; }

/* Fiche de police */
.fiche { position: relative; padding: 14px 14px 16px; border-radius: 6px; background: var(--papier); color: var(--encre); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45); transform: rotate(-0.6deg); }
.fiche::before { content: ''; position: absolute; top: -8px; left: 50%; width: 46px; height: 16px; transform: translateX(-50%) rotate(2deg); background: rgba(255, 255, 255, 0.45); border: 1px solid rgba(0, 0, 0, 0.08); }
.fiche-tete { display: block; font-family: var(--machine); font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: #8a2b25; margin-bottom: 6px; }
.fiche-question { margin: 0; font-family: var(--machine); font-size: clamp(1.1rem, 4.8vw, 1.35rem); line-height: 1.35; }

/* Mission secrète : appui long */
.revele {
  position: relative;
  min-height: 92px;
  display: grid;
  place-items: center;
  padding: 14px;
  border-radius: 18px;
  border: 2px dashed rgba(255, 196, 107, 0.55);
  background: rgba(0, 0, 0, 0.45);
  color: #f6eadb;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
.revele-cache { font-weight: 700; font-size: 0.95rem; line-height: 1.35; text-align: center; color: var(--ambre); }
.revele .mission { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 16px; font-family: var(--machine); font-size: clamp(1.5rem, 7vw, 2rem); letter-spacing: 0.04em; text-transform: none; opacity: 0; }
.revele .mission.mensonge { background: #2a0d0e; color: #ff8b8f; }
.revele .mission.verite { background: #0c2416; color: #7ff0ae; }
.revele.vu .mission { opacity: 1; }
.revele.vu .revele-cache { opacity: 0; }
.conseil { margin: 0; font-size: 0.85rem; color: #b9ab9c; line-height: 1.4; text-align: center; }

/* Détecteur */
.i-question { margin: 0; font-family: var(--machine); font-size: clamp(1.05rem, 4.6vw, 1.3rem); line-height: 1.35; text-align: center; color: #f6eadb; }
.machine { display: grid; grid-template-columns: 1fr 88px; gap: 10px; align-items: stretch; flex: none; }
.papier {
  position: relative;
  height: clamp(80px, 15dvh, 120px);
  border-radius: 8px;
  overflow: hidden;
  background:
    repeating-linear-gradient(0deg, rgba(160, 60, 50, 0.16) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(90deg, rgba(160, 60, 50, 0.16) 0 1px, transparent 1px 12px),
    var(--papier);
  box-shadow: inset 0 0 0 4px #2b2017, inset 0 0 18px rgba(0, 0, 0, 0.35);
}
.papier canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.aiguille { position: absolute; right: -2px; top: 50%; width: 22px; height: 3px; margin-top: -1.5px; background: #1b1410; border-radius: 2px; transition: transform 0.06s linear; }
.capteur {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 16px;
  border: 1px solid rgba(255, 196, 107, 0.4);
  background: radial-gradient(circle at 50% 40%, #3a2a1c, #1a120c);
  color: var(--ambre);
  font: 700 0.72rem var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
.capteur i { width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #6b5a46, #2a1f15); box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), 0 0 0 3px rgba(255, 196, 107, 0.25); }
.capteur.appuye i { background: radial-gradient(circle at 40% 35%, #ff8b8f, #a3262b); box-shadow: 0 0 18px 4px rgba(229, 72, 77, 0.6); }
.i-consigne { margin: 0; font-size: 0.86rem; color: #d8ccbf; line-height: 1.4; text-align: center; }
#ph-interro .btn-chrono { align-self: center; }
.verdicts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; }
.btn.verdict { min-height: 54px; padding: 10px 8px; border-radius: 16px; border: 0; font: 800 0.95rem var(--sans); color: #fff; cursor: pointer; overflow: hidden; text-overflow: ellipsis; }
.btn.verdict.mensonge { background: linear-gradient(180deg, #f0585d, #a3262b); box-shadow: 0 5px 0 #6a1418; }
.btn.verdict.verite { background: linear-gradient(180deg, #4fd88a, #1f8a4e); box-shadow: 0 5px 0 #11552f; }
.btn.verdict:active { transform: translateY(3px); box-shadow: none; }

/* Verdict : coup de tampon */
#ph-verdict { justify-content: center; }
.tampon-zone { display: grid; place-items: center; min-height: 100px; }
.tampon {
  display: inline-block;
  padding: 8px 20px;
  border: 5px solid currentColor;
  border-radius: 10px;
  font-family: var(--machine);
  font-size: clamp(2rem, 11vw, 3rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(-9deg) scale(2.6);
  opacity: 0;
}
.tampon.mensonge { color: var(--rouge); }
.tampon.verite { color: var(--vert); }
.tampon.frappe { animation: frappe 0.35s cubic-bezier(.3, 1.6, .5, 1) forwards; }
@keyframes frappe { to { transform: rotate(-9deg) scale(1); opacity: 0.95; } }
.aveu { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 196, 107, 0.12); border: 1px solid rgba(255, 196, 107, 0.45); color: #ffe1ad; font-weight: 700; text-align: center; line-height: 1.35; }

/* Gage */
.carte-gage { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 18px; background: linear-gradient(160deg, #2a1d14, #1a120c); border: 1px solid rgba(255, 196, 107, 0.4); }
.carte-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; font: 800 0.8rem var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ambre); }
.niveau { padding: 3px 9px; border-radius: 999px; font-size: 0.68rem; background: rgba(255, 255, 255, 0.08); color: #f6eadb; }
.niveau.n2 { background: rgba(255, 140, 60, 0.25); }
.niveau.n3 { background: rgba(229, 72, 77, 0.35); }
.carte-texte { margin: 0; font-family: var(--serif); font-weight: 700; font-size: clamp(1.3rem, 6vw, 1.7rem); line-height: 1.25; color: #fff; }
.carte-gage .btn-chrono { align-self: flex-start; }
.gage-actions { display: grid; gap: 8px; margin-top: auto; }

/* ---------- Fin ---------- */
.fin h2 { color: #f6eadb; }
.fin-persos { display: flex; justify-content: center; gap: 22px; height: clamp(110px, 20dvh, 160px); }
.fin-perso { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.fin-perso .perso { flex: 1; aspect-ratio: 100 / 130; }
.fin-perso span { font-weight: 800; font-size: 0.85rem; }
.f-score { margin: 0; font-family: var(--machine); font-size: 2rem; color: var(--ambre); }
.gage-final { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px; border-radius: 16px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--rouge); }
.gage-final span { font-family: var(--machine); color: #ff8b8f; letter-spacing: 0.12em; text-transform: uppercase; }
.gage-final p { margin: 0; white-space: pre-line; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; line-height: 1.3; }


/* Écran de fin : personnages à taille fixe, défilement si l'écran est petit */
.fin { justify-content: safe center; overflow-y: auto; }
.fin-persos { --fh: clamp(96px, 17dvh, 140px); height: auto; align-items: flex-end; }
.fin-perso { height: auto; }
.fin-perso .perso { flex: none; height: var(--fh); width: calc(var(--fh) * 100 / 130); }

@media (max-height: 680px) {
  .salle { --sh: clamp(70px, 14dvh, 100px); }
  .phase { padding: 12px; gap: 9px; }
  .papier { height: 72px; }
}
/* Téléphones : rien ne bouge en continu, sauf le stylet quand il trace */
@media (hover: none), (max-width: 760px) {
  .lampe { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lampe, .phase.entree, .tampon.frappe { animation: none; }
  .tampon.frappe { transform: rotate(-9deg); opacity: 1; }
}

/* Gage révélé : on libère la place pour qu'il tienne à l'écran */
.fin.revele .fin-persos, .fin.revele .f-texte { display: none; }
.fin .actions-fin { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; max-width: 380px; }
.fin .actions-fin .primary { grid-column: 1 / -1; }
.fin .actions-fin .btn { margin: 0; }
@media (max-height: 680px) {
  .fin { gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .fin-persos { --fh: clamp(80px, 13dvh, 110px); }
  .fin h2 { margin: 0; }
}
@media (max-height: 600px) {
  .fin-persos { display: none; }
}
