/* Dossier Marchand — charte « Fichier froid » */

:root {
  --asphalte: #121417;
  --bureau: #1E2124;
  --bureau-trait: #2C3035;
  --manille: #E3D6B4;
  --manille-sourd: #C2B79C;
  --etiquette: #9A9486;
  --kraft: #C8A96A;
  --photocopie: #DDD8CA;
  --encre: #1C1C1C;
  --terminal: #0B0D0A;
  --phosphore: #FFB000;
  --phosphore-sourd: #B8860B;
  --phosphore-trait: #6B4A00;
  --tampon: #B32A22;
  --alerte: #FF6A5E;
  --bic: #1F3A68;
  --caviardage: #0A0A0A;
  --ok: #8FB98A;

  --f-titre: "Oswald", "Arial Narrow", sans-serif;
  --f-doc: "Courier Prime", "Courier New", monospace;
  --f-sys: "VT323", "Courier New", monospace;
  --f-etiq: "IBM Plex Mono", ui-monospace, monospace;
  --f-main: "Caveat", "Comic Sans MS", cursive;

  --ombre-papier: 0 14px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background-color: var(--asphalte);
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 176, 0, 0.018) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at 70% 0%, rgba(255, 176, 0, 0.08), transparent 55%);
  background-attachment: fixed;
  color: var(--manille);
  font-family: var(--f-doc);
  font-size: 17px;
  line-height: 1.5;
}

button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
:focus-visible { outline: 2px solid var(--phosphore); outline-offset: 2px; }

.chargement {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  font-family: var(--f-sys); font-size: 30px; color: var(--phosphore);
  text-shadow: 0 0 8px rgba(255, 176, 0, 0.4);
}

/* ---------- Texte ---------- */

.etiq {
  font-family: var(--f-etiq); font-size: 12px; font-weight: 500;
  letter-spacing: 2px; text-transform: uppercase; color: var(--etiquette);
}
.etiq.ambre { color: var(--phosphore); }
.titre-acte {
  margin: 0; font-family: var(--f-titre); font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; line-height: 1.02; font-size: clamp(34px, 5vw, 52px);
}
.intro { margin: 6px 0 0; max-width: 680px; color: var(--manille-sourd); }
.main-julien { font-family: var(--f-main); font-size: 24px; line-height: 1.15; color: var(--bic); }

/* ---------- En-tête ---------- */

.entete {
  display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; align-items: center;
  padding: 14px 24px; background: #0D0F11; border-bottom: 1px solid var(--bureau-trait);
}
.entete-nom { font-family: var(--f-titre); font-weight: 700; font-size: 21px; letter-spacing: 3px; text-transform: uppercase; }
.entete-equipe { font-family: var(--f-etiq); font-size: 13px; color: var(--etiquette); }
.entete-gauche { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.sauve { font-family: var(--f-sys); font-size: 22px; color: var(--phosphore); }
.sauve.hors-ligne { color: var(--alerte); }

/* ---------- Mise en page de l'acte ---------- */

.acte {
  display: grid; grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  min-height: calc(100vh - 58px);
}
.carnet {
  background: #181B1F; border-right: 1px solid var(--bureau-trait);
  padding: 24px 20px; display: flex; flex-direction: column; gap: 20px;
}
.contenu { padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.carnet-bloc { display: flex; flex-direction: column; gap: 6px; }
.carnet-titre { font-family: var(--f-titre); font-size: 13px; letter-spacing: 2px; color: var(--etiquette); text-transform: uppercase; }
.carnet-titre.ambre { color: var(--phosphore); }
.carnet-ligne { font-size: 15px; color: var(--manille-sourd); }

.noeud-btn {
  display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left;
  font-family: var(--f-doc); font-size: 15px; color: var(--manille);
  background: transparent; border: 1px solid transparent; padding: 8px 10px; min-height: 44px;
}
.noeud-btn:hover { border-color: var(--bureau-trait); }
.noeud-btn.choisi { background: #2A2418; border-color: var(--phosphore-trait); }
.noeud-btn.verrouille { color: #8A867E; }
.noeud-btn.resolu .glyphe { color: var(--ok); }
.glyphe { width: 14px; flex-shrink: 0; }

.onglets { display: none; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.onglets .noeud-btn { width: auto; flex-shrink: 0; border-color: var(--bureau-trait); }

/* ---------- Papier ---------- */

.fiche {
  position: relative; background: var(--manille); color: var(--encre);
  padding: 24px; box-shadow: var(--ombre-papier);
}
.fiche .etiq { color: #4A4840; }
.fiche-scotch::before {
  content: ""; position: absolute; left: 42%; top: -11px; width: 84px; height: 22px;
  background: rgba(230, 220, 170, 0.8); transform: rotate(-4deg);
}
.rond-cafe::after {
  content: ""; position: absolute; right: 24px; bottom: 16px; width: 84px; height: 84px;
  border-radius: 50%; border: 6px solid rgba(110, 70, 30, 0.16); pointer-events: none;
}

.synthese { transform: rotate(-0.6deg); padding: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 14.5px; line-height: 1.5; }

.cav {
  background: var(--caviardage); color: var(--caviardage);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  user-select: none; border-radius: 1px;
}
.leve { animation: lever 1.6s ease-out both; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
@keyframes lever {
  0%, 25% { background: var(--caviardage); color: var(--caviardage); }
  100% { background: transparent; color: inherit; }
}

/* ---------- Formulaire de réponse ---------- */

.rangee { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.rangee > * { flex: 1 1 340px; min-width: 0; }

.reponse { display: flex; flex-direction: column; gap: 14px; }
.reponse label.question { font-size: 20px; font-weight: 700; line-height: 1.35; }
.champ-ligne { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.saisie {
  font-family: var(--f-doc); font-size: 26px; width: 100%; max-width: 320px;
  padding: 8px 4px; border: none; border-bottom: 2px solid var(--encre);
  background: transparent; color: var(--encre);
}
.saisie.courte { max-width: 160px; }
.saisie::placeholder { color: #8A7E62; }
.choix { display: flex; flex-direction: column; gap: 8px; }
.choix label {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; min-height: 44px;
  border: 1px solid rgba(28, 28, 28, 0.35); cursor: pointer; font-size: 16px;
}
.choix input { margin-top: 5px; accent-color: var(--encre); }

.bouton {
  font-family: var(--f-titre); font-weight: 700; font-size: 17px; letter-spacing: 2px; text-transform: uppercase;
  padding: 14px 22px; min-height: 48px; background: var(--encre); color: var(--manille); border: none;
}
.bouton.clair { background: var(--manille); color: var(--encre); }
.bouton-ligne {
  font-family: var(--f-etiq); font-size: 14px; padding: 12px 16px; min-height: 44px;
  background: transparent; color: var(--manille); border: 1px solid #4A4E54;
}
.bouton-ligne.ambre { color: var(--phosphore); border-color: var(--phosphore-trait); }

.retour { min-height: 1.2em; }
.essais { font-family: var(--f-etiq); font-size: 12px; color: #5A5850; }

.verse {
  position: absolute; right: 18px; top: 18px; transform: rotate(-8deg);
  border: 3px solid var(--tampon); color: var(--tampon); padding: 4px 12px;
  font-family: var(--f-titre); font-weight: 700; font-size: 18px; letter-spacing: 3px; opacity: 0.85;
}
.bilan { font-size: 18px; line-height: 1.5; padding-right: 140px; }

.pieces { display: flex; flex-wrap: wrap; gap: 8px; }
.piece {
  font-family: var(--f-etiq); font-size: 12px; color: var(--manille-sourd);
  border: 1px dashed #4A4E54; padding: 4px 8px;
}

/* ---------- Cassette ---------- */

.cassette {
  background: var(--bureau); border: 1px solid var(--bureau-trait); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.cassette-tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.compteur { font-family: var(--f-sys); font-size: 28px; color: var(--phosphore); letter-spacing: 2px; }
.cassette-corps { display: flex; gap: 14px; align-items: center; }
.k7 {
  flex-shrink: 0; width: 104px; height: 66px; background: #262626; border: 1px solid #444; border-radius: 4px;
  padding: 6px; display: flex; flex-direction: column; gap: 4px;
}
.k7-etiquette { background: var(--manille); color: var(--encre); font-family: var(--f-main); font-size: 14px; line-height: 1.1; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k7-bobines { display: flex; justify-content: space-around; align-items: center; flex-grow: 1; }
.bobine { width: 18px; height: 18px; border-radius: 50%; border: 3px dashed #7A7A7A; }
.joue .bobine { animation: tourner 1.8s linear infinite; }
@keyframes tourner { to { transform: rotate(360deg); } }
.cassette-titre { font-weight: 700; font-size: 17px; }
.barre { height: 8px; background: #2E3237; cursor: pointer; position: relative; }
.barre-rempli { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--phosphore); }
.controles { display: flex; flex-wrap: wrap; gap: 8px; }
.absent { margin: 0; font-family: var(--f-etiq); font-size: 13px; color: var(--etiquette); }

details.transcription { font-size: 14px; color: var(--manille-sourd); }
details.transcription summary { cursor: pointer; font-family: var(--f-etiq); font-size: 12px; letter-spacing: 1px; color: var(--etiquette); }
details.transcription p { white-space: pre-line; margin: 8px 0 0; }

/* ---------- Terminal (le système, la source) ---------- */

.terminal {
  background-color: var(--terminal);
  background-image: repeating-linear-gradient(0deg, rgba(255, 176, 0, 0.06) 0 1px, transparent 1px 3px);
  border: 1px solid var(--phosphore-trait); padding: 16px 20px; max-width: 820px;
  font-family: var(--f-sys); color: var(--phosphore); text-shadow: 0 0 6px rgba(255, 176, 0, 0.4);
  display: flex; flex-direction: column; gap: 8px;
}
.terminal .alerte { font-size: 22px; color: var(--alerte); }
.terminal .dit { font-size: 26px; line-height: 1.2; }
.terminal .petit { font-size: 21px; color: var(--phosphore-sourd); }
.terminal .bouton-term {
  font-family: var(--f-sys); font-size: 24px; padding: 6px 16px; min-height: 44px;
  background: transparent; color: var(--phosphore); border: 1px solid var(--phosphore);
}
.terminal .bouton-term.plein { background: var(--phosphore); color: var(--terminal); text-shadow: none; }
.terminal input {
  font-family: var(--f-sys); font-size: 32px; width: 100%; max-width: 280px; padding: 4px 10px;
  background: #14170F; border: 1px solid var(--phosphore-trait); color: var(--phosphore);
}
.terminal details.transcription { color: #E8D7A8; text-shadow: none; font-family: var(--f-doc); }
.terminal details.transcription summary { color: var(--phosphore-sourd); }
.apparait { animation: interference 0.9s steps(1) both; }
@keyframes interference {
  0% { opacity: 0; }
  12% { opacity: 1; transform: translateX(3px); }
  20% { opacity: 0.3; transform: none; }
  32% { opacity: 1; filter: brightness(1.6); }
  48% { opacity: 0.6; transform: translateX(-2px); }
  60%, 100% { opacity: 1; transform: none; filter: none; }
}

/* ---------- Aide ---------- */

.aide { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--bureau-trait); padding-top: 16px; }
.aide-liste { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.aide-liste li { background: var(--bureau); border-left: 3px solid var(--phosphore-trait); padding: 10px 14px; font-size: 16px; }
.aide-liste li strong { font-family: var(--f-etiq); font-size: 12px; letter-spacing: 1px; color: var(--phosphore); display: block; }
.suggestion { font-family: var(--f-main); font-size: 22px; color: var(--manille-sourd); }

/* ---------- Écrans plein cadre (attente, prologue, fin) ---------- */

.cadre { max-width: 1040px; margin: 0 auto; padding: 48px 24px 64px; display: flex; flex-direction: column; gap: 28px; }
.cadre.etroit { max-width: 900px; }
.duo { display: flex; flex-wrap: wrap; gap: 36px; align-items: center; }
.duo > * { flex: 1 1 380px; min-width: 0; }

.couverture {
  position: relative; background: var(--kraft); color: #2A2418; padding: 32px 30px 40px;
  border-radius: 2px 18px 2px 2px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6); transform: rotate(-1.5deg);
  display: flex; flex-direction: column; gap: 14px;
}
.couverture h1 { margin: 0; font-family: var(--f-titre); font-weight: 700; font-size: clamp(44px, 7vw, 64px); line-height: 0.95; letter-spacing: 2px; text-transform: uppercase; }
.couverture .etiq { color: #4E4430; }

.decompte { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-end; font-family: var(--f-sys); color: var(--phosphore); text-shadow: 0 0 10px rgba(255, 176, 0, 0.4); }
.decompte div { display: flex; flex-direction: column; }
.decompte b { font-weight: 400; font-size: clamp(56px, 9vw, 84px); line-height: 0.9; }
.decompte span { font-size: 20px; color: var(--phosphore-sourd); }

.tampon-rouge {
  transform: rotate(-8deg); border: 4px solid var(--tampon); color: #D9483E; padding: 6px 18px;
  font-family: var(--f-titre); font-weight: 700; font-size: 32px; letter-spacing: 5px; text-transform: uppercase;
}
.entete-fin { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px; }
.boutons { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.pied { display: flex; flex-wrap: wrap; gap: 20px; border-top: 1px solid var(--bureau-trait); padding-top: 16px; font-size: 15px; color: var(--manille-sourd); }
.pied > * { flex: 1 1 280px; }

.bandeau-erreur {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 10; max-width: 640px; margin: 0 auto;
  background: var(--terminal); border: 1px solid var(--alerte); color: var(--alerte);
  font-family: var(--f-sys); font-size: 22px; padding: 10px 16px;
}

/* ---------- Téléphone ---------- */

@media (max-width: 860px) {
  .acte { grid-template-columns: minmax(0, 1fr); }
  .carnet { order: 2; border-right: none; border-top: 1px solid var(--bureau-trait); }
  .carnet .liste-noeuds { display: none; }
  .onglets { display: flex; }
  .contenu { padding: 20px 16px 40px; }
  .entete { padding: 12px 16px; }
  .bilan { padding-right: 0; }
  .verse { position: static; align-self: flex-start; transform: rotate(-4deg); order: 3; }
  body { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .leve, .apparait, .joue .bobine { animation: none; }
}
