/* ==========================================================================
   L'Entreprise Mystère — IMT-BS Career Center
   Univers "dossier confidentiel" + charte IMT-BS
   Violet #AD1D89 · Bleu #00B8DE
   ========================================================================== */

:root {
  /* Charte IMT-BS */
  --violet: #AD1D89;
  --violet-light: #E04FB8;   /* variante éclaircie validée contraste sur fond sombre */
  --bleu: #00B8DE;
  --bleu-light: #4DD4F0;

  /* Univers espionnage */
  --bg: #0B1220;             /* bleu nuit */
  --bg-2: #111C31;
  --bg-3: #182642;
  --panel: #14203A;
  --line: #2A3A5C;
  /* Surfaces cliquables : nettement plus claires que le fond, bordure visible
     (les cartes/boutons dépliables étaient trop proches de leur arrière-plan). */
  --btn-surface: #24365E;
  --btn-surface-hover: #2F4478;
  --btn-line: #6C87BC;
  --kraft: #C9A96A;
  --kraft-dark: #A8853F;
  --paper: #F6EFDE;
  --paper-2: #EFE5C9;
  --ink: #2B2416;
  --text: #E8EDF6;
  --text-dim: #9FACC4;
  --ok: #3DD68C;
  --ok-dark: #157A4C;
  --err: #FF6B6B;
  --warn: #FFC24B;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Accessibilité : plus de police « machine à écrire ». Les titres, libellés et
     messages du QG utilisent la même sans-serif que le reste de l'interface. */
  --font-titre: var(--font-sans);
  /* Monospace réservée aux codes d'accès (alignement des caractères). */
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --dock-h: 62px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(173, 29, 137, .16), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(0, 184, 222, .10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
}

/* Trame "papier administratif" discrète */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, transparent 1px 4px);
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--dock-h) + 28px);
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
a { color: var(--bleu-light); }

button {
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  min-height: 48px;
  padding: 12px 20px;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease, opacity .15s;
}
button:active { transform: scale(.98); }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--bleu);
  outline-offset: 2px;
}
button[disabled] { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--violet), #8E1470);
  color: #fff;
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 6px 18px rgba(173, 29, 137, .38);
  width: 100%;
}
.btn-primary:not([disabled]):hover { box-shadow: 0 8px 24px rgba(173, 29, 137, .55); }

.btn-secondary {
  background: transparent;
  color: var(--bleu-light);
  border: 2px solid var(--bleu);
  width: 100%;
}
.btn-ghost {
  background: var(--btn-surface);
  color: var(--text);
  border: 2px solid var(--btn-line);
  min-height: 40px;
  padding: 8px 16px;
  font-size: .9rem;
}

/* ---------- Typographies thématiques ---------- */
.mono { font-family: var(--font-titre); }
.stamp-title {
  font-family: var(--font-titre);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 1.05rem;
}

/* Tampon encreur */
.stamp {
  display: inline-block;
  font-family: var(--font-titre);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  border: 3px solid currentColor;
  border-radius: 6px;
  padding: 2px 10px;
  transform: rotate(-4deg);
  opacity: .92;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='40'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.7' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .82 0'/%3E%3C/filter%3E%3Crect width='120' height='40' filter='url(%23n)'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='40'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.7' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .82 0'/%3E%3C/filter%3E%3Crect width='120' height='40' filter='url(%23n)'/%3E%3C/svg%3E");
}
.stamp.rouge { color: var(--err); }
.stamp.vert  { color: #0F5F38; }   /* fonds clairs (papier, dossier kraft) */
.stamp.bleu  { color: var(--bleu-light); }
.stamp.kraft { color: #4A3208; }

@keyframes stampIn {
  0%   { transform: rotate(-4deg) scale(2.4); opacity: 0; }
  60%  { transform: rotate(-4deg) scale(.92); opacity: 1; }
  100% { transform: rotate(-4deg) scale(1); opacity: .92; }
}
.stamp.animate { animation: stampIn .45s cubic-bezier(.2, 1.4, .4, 1) both; }

/* ---------- Cartes / panneaux ---------- */
.panel {
  background: linear-gradient(180deg, var(--bg-3), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.paper {
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.025) 0 1px, transparent 1px 26px),
    linear-gradient(180deg, var(--paper), var(--paper-2));
  color: var(--ink);
  border-radius: 8px;
  padding: 20px;
  box-shadow: inset 0 0 40px rgba(120, 90, 30, .12), var(--shadow);
}
.paper h2, .paper h3 { color: #4A3A18; }

.kraft-folder {
  background: linear-gradient(180deg, var(--kraft), var(--kraft-dark));
  color: var(--ink);
  border-radius: 10px 16px 10px 10px;
  padding: 18px;
  box-shadow: var(--shadow);
  position: relative;
}
.kraft-folder::before {
  content: "";
  position: absolute; top: -10px; left: 18px;
  width: 34%; height: 14px;
  background: inherit;
  border-radius: 8px 8px 0 0;
}

/* ---------- En-tête d'écran ---------- */
.screen-head {
  text-align: center;
  margin: 8px 0 20px;
}
.screen-head .kicker {
  font-family: var(--font-titre);
  font-size: .78rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--bleu-light);
  margin-bottom: 6px;
}
.screen-head h1 { font-size: 1.5rem; }
.screen-head .sub { color: var(--text-dim); font-size: .95rem; }

/* ---------- Accueil ---------- */
.welcome-hero {
  text-align: center;
  padding: 28px 16px 8px;
}
.agency-emblem { width: 118px; height: 118px; margin: 0 auto 10px; display: block; }
.welcome-hero h1 {
  font-family: var(--font-titre);
  font-size: 1.7rem;
  letter-spacing: .04em;
}
.welcome-hero .confidentiel { margin: 10px auto 4px; font-size: 1rem; }

.field { margin-bottom: 14px; text-align: left; }
.field label {
  display: block;
  font-family: var(--font-titre);
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font-size: 1.05rem;
  font-family: var(--font-titre);
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.field input:focus-visible { outline: 3px solid var(--bleu); outline-offset: 1px; }

.programme-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.programme-choice .choice {
  background: var(--bg-2);
  border: 2px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 8px;
  font-weight: 700;
  font-size: 1.02rem;
}
.programme-choice .choice[aria-pressed="true"] {
  border-color: var(--violet-light);
  background: rgba(173, 29, 137, .18);
  box-shadow: 0 0 0 1px var(--violet-light);
}

.logo-chip {
  display: inline-block;
  background: #fff;
  border-radius: 10px;
  padding: 8px 14px;
  margin-top: 18px;
}
.logo-chip img { height: 34px; display: block; }

footer.mentions {
  text-align: center;
  color: var(--text-dim);
  font-size: .78rem;
  margin-top: 22px;
  line-height: 1.6;
}

/* ---------- Intro télex ---------- */
.telex {
  min-height: 60dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.telex-paper {
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
  color: var(--ink);
  font-family: var(--font-titre);
  font-size: 1.12rem;
  line-height: 1.7;
  padding: 26px 22px;
  border-radius: 4px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.telex-paper::before {
  content: "";
  position: absolute; inset: 0 0 auto;
  height: 8px;
  background: repeating-linear-gradient(90deg, transparent 0 10px, rgba(0,0,0,.14) 10px 13px);
}
.telex-head {
  font-size: .75rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #7A6636;
  border-bottom: 1px dashed #B9A468;
  padding-bottom: 8px;
  margin-bottom: 14px;
}
.telex-msg { min-height: 5.2em; margin: 0; white-space: pre-wrap; }
.telex .cursor { display: inline-block; width: .55em; background: var(--ink); animation: blink 1s steps(2) infinite; height: 1.1em; vertical-align: -0.15em; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Hub ---------- */
/* Encart d'onboarding affiché à la première arrivée au QG : signale l'existence
   du calendrier et de l'annuaire, que beaucoup de joueurs ne repéraient pas. */
.outils-tip {
  border: 1px solid var(--bleu, #00B8DE);
  border-left-width: 4px;
  border-radius: 10px;
  background: rgba(0, 184, 222, .08);
  padding: 12px 14px;
  margin-top: 14px;
}
.outils-tip-head {
  font-family: var(--font-titre);
  font-size: .82rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.outils-tip p { margin: 0; font-size: .92rem; }

.agents-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--font-titre);
  font-size: .9rem;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.agents-banner .badge {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  color: var(--text);
}

.progress-global { margin: 0 0 18px; }
.progress-track {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--bleu), var(--violet-light));
  transition: width .5s ease;
  min-width: 0;
}
.progress-label {
  font-size: .78rem;
  color: var(--text-dim);
  text-align: right;
  margin-top: 4px;
  font-family: var(--font-titre);
}

.dossier-card {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: linear-gradient(180deg, var(--kraft), var(--kraft-dark));
  color: var(--ink);
  border-radius: 10px 14px 10px 10px;
  padding: 16px;
  margin-bottom: 14px;
  border: none;
  position: relative;
  box-shadow: var(--shadow);
  min-height: 84px;
}
.dossier-card::before {
  content: "";
  position: absolute; top: -8px; left: 14px;
  width: 30%; height: 12px;
  background: inherit;
  border-radius: 8px 8px 0 0;
}
.dossier-card .d-icon { font-size: 1.9rem; text-align: center; }
.dossier-card .d-num {
  font-family: var(--font-titre);
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #5E4A1E;
}
.dossier-card .d-title { font-weight: 800; font-size: 1.06rem; }
.dossier-card .d-theme { font-size: .85rem; color: #5E4A1E; }
.dossier-card .d-state { justify-self: end; text-align: right; font-size: .8rem; }

/* Tampon de statut du dossier : encre franche sur pastille claire, pour rester
   lisible sur le carton kraft comme sur un dossier verrouillé (grisé). */
.d-stamp {
  display: inline-block;
  font-family: var(--font-titre);
  text-transform: uppercase;
  text-align: center;
  line-height: 1.15;
  padding: 7px 12px;
  border: 3px double currentColor;
  border-radius: 5px;
  background: rgba(255, 252, 242, .5);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
  transform: rotate(-5deg);
  margin-right: 4px;
  white-space: nowrap;
}
.d-stamp .d-stamp-l1 {
  display: block;
  font-size: .92rem;
  font-weight: 800;
  letter-spacing: .09em;
}
.d-stamp .d-stamp-l2 {
  display: block;
  margin-top: 2px;
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .14em;
  opacity: .8;
}
.d-stamp.atraiter { color: #93170B; }   /* rouge « urgent » sur kraft */
.d-stamp.encours  { color: #123E63; }   /* bleu encre */
.d-stamp.classe   { color: #0E5733; }   /* vert archivé */
.d-stamp.refuse   { color: #2A211A; }   /* le dossier est déjà grisé par le filtre */

@media (max-width: 400px) {
  .d-stamp { padding: 6px 9px; }
  .d-stamp .d-stamp-l1 { font-size: .82rem; letter-spacing: .06em; }
  .d-stamp .d-stamp-l2 { font-size: .55rem; letter-spacing: .1em; }
}

/* Le grisé des dossiers verrouillés reste marqué, mais assez clair pour que le
   tampon « Accès refusé » garde un contraste suffisant. */
.dossier-card.locked { filter: grayscale(.85) brightness(.74); }
.dossier-card.locked .d-title { text-decoration: none; }
.dossier-card.done { outline: 2px solid var(--ok-dark); }
.led {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #55617C;
  box-shadow: inset 0 0 3px rgba(0,0,0,.5);
  vertical-align: -1px;
  margin-right: 5px;
}
.led.on {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok), inset 0 0 3px rgba(0,0,0,.3);
}

/* ---------- Décor dossier / zones ---------- */
.decor {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 18px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.decor.campus     { background: linear-gradient(160deg, #12233F, #0E1A30 60%), var(--bg-2); }
.decor.openspace  { background: linear-gradient(160deg, #1C2A3C, #101B2C 60%); }
.decor.crise      { background: linear-gradient(160deg, #2A1626, #140F1E 60%); }

.zones-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .zones-grid { grid-template-columns: 1fr; } }

.zone-card {
  background: var(--btn-surface);
  border: 2px solid var(--btn-line);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 108px;
}
.zone-card .z-icon { font-size: 1.7rem; }
.zone-card .z-nom { font-weight: 700; font-size: .95rem; line-height: 1.3; }
.zone-card .z-status { font-size: .78rem; color: #D9E1EF; font-family: var(--font-titre); }
.zone-card.done { border-color: var(--ok); background: #1D4A38; }
/* Alertes du Dossier 3 : plus de code couleur (les couleurs laissaient croire à une
   hiérarchie d'urgence ou de difficulté inexistante). Toutes les alertes ont le même
   traitement ; seul l'état « résolu » se distingue. */
.zone-card.zone-alerte { border-width: 2px; border-color: #C24545; }
.zone-card.zone-alerte.done   { border-color: var(--ok-dark); }

/* Chrono discret */
.chrono {
  font-family: var(--font-titre);
  font-size: .8rem;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 10px;
}
.chrono.over { color: var(--warn); }

/* ---------- Post-it ---------- */
.corkboard {
  background:
    radial-gradient(circle at 20% 30%, rgba(0,0,0,.12) 1px, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(0,0,0,.10) 1px, transparent 2px),
    linear-gradient(180deg, #9A7148, #7E5A36);
  border: 8px solid #5C4023;
  border-radius: 10px;
  padding: 16px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.postit {
  position: relative;
  border: none;
  border-radius: 2px;
  min-height: 130px;
  padding: 12px 10px;
  font-size: .84rem;
  line-height: 1.35;
  color: var(--ink);
  box-shadow: 3px 5px 8px rgba(0, 0, 0, .35);
  transform: rotate(var(--tilt, -1.5deg));
  transition: transform .35s ease;
  text-align: left;
  perspective: 600px;
}
.postit .pin {
  position: absolute; top: -8px; left: 50%;
  transform: translateX(-50%);
  width: 15px; height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff8, transparent 55%), #B02E2E;
  box-shadow: 0 3px 4px rgba(0,0,0,.4);
}
.postit.jaune  { background: #FFEC8B; }
.postit.rose   { background: #FFB3C7; }
.postit.vert   { background: #B4EFA5; }
.postit.bleu   { background: #A8D9FF; }
.postit.orange { background: #FFC98B; }
.postit .p-front { font-family: var(--font-titre); font-weight: 700; display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; height: 100%; text-align: center; }
.postit .p-hint { font-size: .68rem; font-weight: 400; opacity: .6; }
.postit.flipped { transform: rotate(0deg); }
@keyframes flipIn { from { transform: rotateY(90deg); opacity: 0; } to { transform: rotateY(0); opacity: 1; } }
.postit .p-back { animation: flipIn .4s ease both; }
.postit .p-back strong { display: block; margin-bottom: 4px; font-size: .8rem; }

/* ---------- Question ---------- */
.q-card { margin-bottom: 16px; }
.q-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--font-titre);
  font-size: .75rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--bleu-light);
  margin-bottom: 10px;
}
.q-enonce { font-size: 1.08rem; font-weight: 700; line-height: 1.45; margin-bottom: 16px; }

.opt-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.opt {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  background: var(--btn-surface);
  border: 2px solid var(--btn-line);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: .98rem;
  line-height: 1.4;
  width: 100%;
}
.opt .opt-key {
  flex: 0 0 auto;
  font-family: var(--font-titre);
  font-weight: 700;
  color: var(--bleu-light);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 30px;
  text-align: center;
  padding: 1px 6px;
}
.opt[aria-pressed="true"], .opt.selected {
  border-color: var(--violet-light);
  background: #4E2450;
  box-shadow: 0 0 0 1px var(--violet-light);
}
.opt.correct-flash { border-color: var(--ok); background: #1E4A38; }
.opt.wrong-flash   { border-color: var(--err); background: #4E2129; }

.vf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.vf-grid .opt { justify-content: center; font-weight: 800; font-size: 1.15rem; min-height: 76px; align-items: center; }

/* Ordre (glisser-déposer + boutons ▲▼) */
.ordre-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.ordre-item {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--btn-surface);
  border: 2px solid var(--btn-line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: .95rem;
  line-height: 1.4;
}
.ordre-item .drag-handle {
  flex: 0 0 auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-size: 1.15rem;
  color: #D9E1EF;
  padding: 10px 8px;
  margin: -10px 0;
}
.ordre-item.dragging {
  border-color: var(--bleu);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
  position: relative;
  z-index: 5;
}
.ordre-item.dragging .drag-handle { cursor: grabbing; }
.ordre-item.shifted { transition: transform .18s ease; }
.ordre-item .ordre-pos {
  flex: 0 0 auto;
  font-family: var(--font-titre);
  font-weight: 700;
  color: var(--bleu-light);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 30px;
  text-align: center;
  padding: 1px 6px;
}
.ordre-item .ordre-text { flex: 1 1 auto; }
.move-btns { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.move-btn {
  background: var(--bg-2);
  border: 1px solid var(--btn-line);
  color: var(--bleu-light);
  border-radius: 8px;
  min-width: 36px;
  min-height: 28px;
  font-size: .8rem;
  line-height: 1;
}
.move-btn[disabled] { opacity: .3; }
.ordre-list.wrong-flash .ordre-item:not(.pos-ok) { border-color: var(--err); background: #4E2129; }

/* Aide au repérage : étapes bien placées / à déplacer (après une erreur) */
.ordre-summary {
  font-size: .88rem;
  color: var(--warn);
  background: rgba(255, 194, 75, .10);
  border: 1px solid #8a6d2e;
  border-radius: 10px;
  padding: 8px 12px;
  margin: 0 0 12px;
}
.ordre-item .ordre-text { display: flex; flex-direction: column; gap: 4px; }
.ordre-flag {
  align-self: flex-start;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .04em;
  border-radius: 8px;
  padding: 1px 8px;
}
.ordre-item.pos-ok  { border-color: var(--ok); background: #1D4A38; }
.ordre-item.pos-ok .ordre-pos { color: var(--ok); border-color: var(--ok); }
.ordre-flag.ok { color: var(--ok); border: 1px solid var(--ok); background: rgba(61, 214, 140, .12); }
.ordre-item.pos-ko { border-color: var(--warn); }
.ordre-item.pos-ko .ordre-pos { color: var(--warn); border-color: var(--warn); }
.ordre-flag.ko { color: var(--warn); border: 1px solid var(--warn); background: rgba(255, 194, 75, .12); }

/* Matching */
.match-instructions { font-size: .85rem; color: var(--text-dim); margin-bottom: 10px; }
.match-col-label {
  font-family: var(--font-titre);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 12px 0 6px;
}
.match-left .opt.paired { opacity: .75; border-style: dashed; }
.match-left .opt .pair-tag {
  margin-left: auto;
  font-family: var(--font-titre);
  font-size: .75rem;
  background: rgba(0, 184, 222, .18);
  border: 1px solid var(--bleu);
  border-radius: 8px;
  padding: 2px 8px;
  color: var(--bleu-light);
  flex: 0 0 auto;
}
.match-right .opt { border-color: #9AB4E4; }
.match-right .opt.target-armed { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }

/* Matching — deux colonnes côte à côte */
.match-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
}
.match-duo .match-col-label { margin: 0 0 6px; }
.match-duo .opt-list { margin-bottom: 0; }
.match-duo .opt { font-size: .88rem; padding: 10px; gap: 8px; flex-wrap: wrap; }
.match-duo .match-left .opt .pair-tag { margin-left: auto; }
@media (max-width: 420px) {
  .match-duo { gap: 8px; }
  .match-duo .opt { font-size: .8rem; padding: 8px; }
  .match-duo .opt .opt-key { min-width: 24px; }
}

/* Badge « Réponses multiples » */
.badge-multi {
  display: inline-block;
  margin-left: 8px;
  background: rgba(0, 184, 222, .18);
  border: 1px solid var(--bleu);
  color: var(--bleu-light);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: .7rem;
  letter-spacing: .08em;
}

/* Feedback */
.feedback {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-weight: 600;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.feedback.ok  { background: rgba(61, 214, 140, .12); border: 1px solid var(--ok-dark); color: var(--ok); }
.feedback.err { background: rgba(255, 107, 107, .10); border: 1px solid #8E3B3B; color: var(--err); }
.feedback.hint { background: rgba(255, 194, 75, .10); border: 1px solid #8a6d2e; color: var(--warn); font-weight: 400; }

/* Encart "Ce qu'il faut retenir" */
.retenir-overlay {
  position: fixed; inset: 0;
  z-index: 60;
  background: rgba(5, 9, 18, .82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.retenir-card {
  max-width: 560px;
  width: 100%;
  max-height: 84dvh;
  overflow: auto;
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
  color: var(--ink);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  border-top: 8px solid var(--violet);
}
.retenir-card .r-success {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ok);
  border: 1px solid var(--ok);
  background: rgba(61, 214, 140, .12);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.retenir-card .r-kicker {
  font-family: var(--font-titre);
  font-size: .78rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--violet);
  margin-bottom: 10px;
}
.retenir-card p { font-size: 1.02rem; line-height: 1.55; }
.retenir-card .btn-primary { margin-top: 6px; }

/* ---------- Dossier à feuilleter ---------- */
.feuillet-pages { position: relative; margin: 14px 0; }
.feuillet-page {
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.03) 0 1px, transparent 1px 26px),
    linear-gradient(180deg, #FDFBF4, #F3ECD8);
  color: var(--ink);
  border-radius: 6px;
  padding: 20px 18px 24px;
  min-height: 250px;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.feuillet-page .f-page-num {
  font-family: var(--font-titre);
  font-size: .72rem;
  letter-spacing: .16em;
  color: #8A7440;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.feuillet-page h3 { font-size: 1.1rem; color: #4A3A18; }
/* Les sauts de ligne du contenu (\n) sont respectés : permet de séparer
   visuellement deux règles distinctes dans une même page de feuillet. */
.feuillet-page p { white-space: pre-line; }
/* Navigation empilée : « Page suivante » en pleine largeur, comme les boutons
   d'avancement des autres écrans, avec le retour arrière en dessous. */
.feuillet-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.btn-page-next {
  background: linear-gradient(135deg, var(--bleu), #0093B3);
  color: #062230;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .02em;
  min-height: 52px;
  width: 100%;
  box-shadow: 0 6px 18px rgba(0, 184, 222, .32);
}
.btn-page-next:not([disabled]):hover { box-shadow: 0 8px 24px rgba(0, 184, 222, .5); }
.btn-page-prev {
  background: var(--btn-surface);
  color: var(--text);
  border: 2px solid var(--btn-line);
  width: 100%;
  min-height: 44px;
  font-size: .95rem;
}
.feuillet-dots { display: flex; justify-content: center; gap: 6px; }
.feuillet-dots .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--line);
}
.feuillet-dots .dot.seen { background: var(--kraft); }
.feuillet-dots .dot.current { background: var(--bleu); }

/* ---------- Panneau d'alerte ---------- */
.alerte-screen {
  position: fixed; inset: 0;
  z-index: 70;
  background:
    repeating-linear-gradient(45deg, rgba(255, 60, 60, .05) 0 22px, transparent 22px 44px),
    linear-gradient(180deg, #200D14, #12060B);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow: auto;
}
.alerte-card {
  max-width: 560px;
  width: 100%;
  border: 2px solid var(--err);
  border-radius: 12px;
  background: rgba(20, 8, 12, .92);
  padding: 22px;
  box-shadow: 0 0 40px rgba(255, 80, 80, .25);
}
.alerte-card .a-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-titre);
  color: var(--err);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .85rem;
  margin-bottom: 14px;
}
.alerte-card .a-beacon {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--err);
  box-shadow: 0 0 12px var(--err);
  animation: beacon 1.2s ease-in-out infinite;
}
@keyframes beacon { 50% { opacity: .35; box-shadow: 0 0 4px var(--err); } }
.alerte-card .a-texte { font-size: 1.04rem; line-height: 1.6; }
.alerte-card .a-echeance {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--warn);
  border-radius: 10px;
  color: var(--warn);
  font-weight: 700;
}
.alerte-card .a-wait {
  margin-top: 16px;
  font-family: var(--font-titre);
  font-size: .82rem;
  color: var(--text-dim);
  text-align: center;
}
.alerte-card .btn-primary { margin-top: 16px; }

/* ---------- Débriefing ---------- */
.debrief-list { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.debrief-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(255, 255, 255, .55);
  border: 1px solid #C9BA8D;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
}
.debrief-item input[type="checkbox"] {
  width: 26px; height: 26px;
  flex: 0 0 auto;
  accent-color: var(--violet);
  margin-top: 1px;
}
.debrief-item span { font-size: .95rem; line-height: 1.45; color: var(--ink); }

/* ---------- Message du QG ---------- */
.qg-message {
  background: linear-gradient(180deg, #101C33, #0C1524);
  border: 1px solid var(--bleu);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 184, 222, .12);
}
.qg-message .qg-head {
  background: rgba(0, 184, 222, .12);
  border-bottom: 1px solid var(--bleu);
  font-family: var(--font-titre);
  font-size: .8rem;
  letter-spacing: .1em;
  color: var(--bleu-light);
  padding: 10px 16px;
}
.qg-message .qg-body {
  font-family: var(--font-titre);
  padding: 18px 16px;
  font-size: .98rem;
  line-height: 1.65;
}

/* ---------- Fragment de code ---------- */
.fragment-reveal {
  text-align: center;
  padding: 18px;
}
.fragment-reveal .code-display {
  font-family: var(--font-mono);
  font-size: 2rem;
  letter-spacing: .35em;
  color: var(--bleu-light);
  background: var(--bg-2);
  border: 1px solid var(--bleu);
  border-radius: 12px;
  padding: 14px 10px 14px 20px;
  display: inline-block;
  margin: 12px 0;
  text-shadow: 0 0 14px rgba(0, 184, 222, .5);
}

/* ---------- Écran final ---------- */
.final-code {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  letter-spacing: .3em;
  text-align: center;
  color: var(--bleu-light);
  background: var(--bg-2);
  border: 2px solid var(--bleu);
  border-radius: 14px;
  padding: 18px 8px 18px 22px;
  margin: 14px 0;
  text-shadow: 0 0 18px rgba(0, 184, 222, .55);
}
.agent-card-preview {
  border: 2px solid var(--violet-light);
  border-radius: 14px;
  padding: 20px;
  background: linear-gradient(160deg, #171230, #0E0B1E);
  margin-bottom: 16px;
}
.agent-card-preview .acp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-titre);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--violet-light);
  margin-bottom: 12px;
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}
.stat-tile {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.stat-tile .v { font-family: var(--font-titre); font-size: 1.25rem; font-weight: 700; color: var(--bleu-light); }
.stat-tile .l { font-size: .72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- Barre persistante (dock) ---------- */
#dockbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  height: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(10, 16, 30, .92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
}
#dockbar[hidden] { display: none; }
#dockbar button {
  flex: 1;
  background: none;
  border: none;
  border-radius: 0;
  color: var(--text-dim);
  font-size: .68rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--dock-h);
  padding: 6px 2px;
}
#dockbar button .ic { font-size: 1.35rem; }
#dockbar button:hover, #dockbar button:focus-visible { color: var(--text); }

/* ---------- Overlays calendrier / annuaire ---------- */
.overlay-root {
  position: fixed; inset: 0;
  z-index: 55;
  background: rgba(5, 9, 18, .8);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 560px) { .overlay-root { align-items: center; } }
.overlay-sheet {
  width: 100%;
  max-width: 620px;
  max-height: 88dvh;
  overflow: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  padding: 18px 16px 26px;
}
@media (min-width: 560px) { .overlay-sheet { border-radius: 18px; } }
.overlay-sheet .o-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.overlay-sheet .o-head h2 { font-size: 1.15rem; margin: 0; }
.overlay-sheet .o-close {
  background: var(--btn-surface);
  border: 2px solid var(--btn-line);
  color: var(--text);
  border-radius: 50%;
  width: 42px; height: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 1.1rem;
}
.overlay-sheet .o-sub { color: var(--text-dim); font-size: .85rem; margin-bottom: 14px; }

/* Calendrier : punaises */
.punaise-list { display: flex; flex-direction: column; gap: 10px; }
.punaise-item {
  display: grid;
  grid-template-columns: 30px 1fr 24px;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--btn-surface);
  border: 2px solid var(--btn-line);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  align-items: start;
}
.punaise-item:hover { background: var(--btn-surface-hover); }
/* Chevron : indique clairement que la fiche s'ouvre / se referme */
.punaise-item::after {
  content: "▼";
  color: var(--bleu-light);
  font-size: .95rem;
  line-height: 1.4;
  align-self: start;
}
.punaise-item[aria-expanded="true"] {
  border-color: var(--bleu);
  background: var(--btn-surface-hover);
}
.punaise-item[aria-expanded="true"]::after { content: "▲"; }
.punaise-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  box-shadow: inset -2px -3px 4px rgba(0,0,0,.35), 0 2px 4px rgba(0,0,0,.4);
  margin-top: 2px;
}
.punaise-dot.rouge     { background: radial-gradient(circle at 35% 30%, #FF8F8F, #C22525); }
.punaise-dot.orange    { background: radial-gradient(circle at 35% 30%, #FFC98B, #D07716); }
.punaise-dot.bleu      { background: radial-gradient(circle at 35% 30%, #8FD8FF, #1273B5); }
.punaise-dot.vert      { background: radial-gradient(circle at 35% 30%, #9FF0B5, #2E9E52); }
.punaise-dot.vertfonce { background: radial-gradient(circle at 35% 30%, #57B87B, #14602F); }
.punaise-item .pi-periode { font-weight: 800; font-size: .98rem; }
.punaise-item .pi-detail { font-size: .88rem; color: #D9E1EF; margin-top: 4px; line-height: 1.45; }
.punaise-item .pi-detail strong { color: var(--text); }
.punaise-item .pi-vous {
  display: inline-block;
  margin-top: 6px;
  font-size: .8rem;
  color: var(--warn);
  border: 1px dashed var(--warn);
  border-radius: 8px;
  padding: 2px 8px;
}

/* Annuaire */
.fiche-list { display: flex; flex-direction: column; gap: 10px; }
.fiche {
  background: var(--btn-surface);
  border: 2px solid var(--btn-line);
  border-radius: 12px;
  padding: 13px 14px;
}
.fiche.prioritaire { border-color: var(--violet-light); box-shadow: 0 0 0 1px var(--violet-light); }
.fiche.dimmed { opacity: .72; }
.fiche .f-nom { font-weight: 800; font-size: .98rem; }
.fiche .f-role {
  font-family: var(--font-titre);
  font-size: .74rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--bleu-light);
  margin: 2px 0 6px;
}
.fiche .f-quand { font-size: .87rem; color: #D9E1EF; line-height: 1.45; }
.fiche .f-coords { margin-top: 6px; font-size: .87rem; display: flex; flex-wrap: wrap; gap: 12px; }
.fiche .f-coords .f-coord-line { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.fiche .f-coords .f-coord-nom { color: #C4CEE0; }
.fiche .f-tag-prio {
  float: right;
  font-size: .68rem;
  font-family: var(--font-titre);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--violet-light);
  border: 1px solid var(--violet-light);
  border-radius: 6px;
  padding: 1px 7px;
  margin-left: 8px;
}

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-h) + 18px);
  transform: translateX(-50%) translateY(20px);
  z-index: 80;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: .9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  max-width: 90vw;
  text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Divers ---------- */
.spacer { height: 12px; }
.center { text-align: center; }
.dim { color: var(--text-dim); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

.reset-zone { margin-top: 26px; text-align: center; }

/* Écran de reprise */
.resume-choice { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }

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

/* Desktop : recentrage confort */
@media (min-width: 900px) {
  #app { max-width: 680px; padding-top: 28px; }
}
