:root {
  --bg: #0e3a5f;
  --bg2: #0a2c49;
  --panel: #ffffff;
  --ink: #102a3c;
  --muted: #5b7184;
  --accent: #f6c344;     /* jaune nitrile */
  --accent-d: #d9a520;
  --blue: #1f7ac0;
  --good: #2faa6a;
  --bad: #e0533d;
  --line: #e2e9ef;
  --radius: 16px;
  --tap: 48px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }   /* sinon .modal{display:grid} ecrase l'attribut hidden */
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: radial-gradient(120% 80% at 50% 0%, var(--bg) 0%, var(--bg2) 100%);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

/* ---------- HUD ---------- */
#hud {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.gauge { flex: 1; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 1px 8px; align-items: center; }
.gauge-ic { grid-row: 1 / 3; font-size: 18px; color: var(--accent); width: 22px; text-align: center; }
.gauge .bar { height: 9px; background: rgba(255,255,255,.18); border-radius: 6px; overflow: hidden; }
.gauge .fill { height: 100%; width: 50%; border-radius: 6px; transition: width .5s ease; }
.fill.culture { background: linear-gradient(90deg, var(--accent), var(--accent-d)); }
.fill.securite { background: linear-gradient(90deg, #4fd1a5, #2faa6a); }
.gauge-lbl { font-size: 10px; letter-spacing: .5px; text-transform: uppercase; color: rgba(255,255,255,.7); }
#carnet-btn { width: var(--tap); height: var(--tap); border: 0; border-radius: 12px; background: rgba(255,255,255,.12); font-size: 22px; cursor: pointer; }

/* ---------- Stage / cards ---------- */
#stage { flex: 1; padding: 6px 14px 28px; display: flex; flex-direction: column; }
.screen { animation: rise .35s ease both; display: flex; flex-direction: column; gap: 14px; flex: 1; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
}
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--blue); background: #e8f2fb; padding: 4px 10px; border-radius: 999px; }
h1.title { color: #fff; font-size: 24px; margin: 6px 2px 0; }
.subtitle { color: rgba(255,255,255,.75); font-size: 13px; margin: 2px 2px 6px; }
.objective { color: var(--muted); font-size: 14px; line-height: 1.45; }

/* Dialogue */
.npc { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; font-weight: 700; color: #fff; flex: 0 0 auto; }
.avatar.sofia { background: linear-gradient(135deg, #1f7ac0, #155a91); }
.avatar.marc { background: linear-gradient(135deg, #e0533d, #b73a27); }
.npc-name { font-weight: 700; font-size: 15px; }
.npc-role { font-size: 12px; color: var(--muted); }
.bubble { background: #f4f8fb; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 15px; line-height: 1.5; margin-bottom: 8px; }

/* Buttons */
.btn {
  appearance: none; border: 0; width: 100%; min-height: var(--tap);
  padding: 14px 16px; border-radius: 12px; font-size: 16px; font-weight: 600;
  background: var(--accent); color: #3a2c00; cursor: pointer; margin-top: auto;
  box-shadow: 0 6px 16px rgba(246,195,68,.4);
}
.btn:active { transform: translateY(1px); }
.btn.blue { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(31,122,192,.4); }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: none; border: 1px solid var(--line); }
.btn-row { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }

/* Choices */
.choice {
  text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 12px;
  padding: 14px 16px; min-height: var(--tap); font-size: 15px; cursor: pointer; transition: border-color .15s;
}
.choice:active { border-color: var(--blue); }
.choice.correct { border-color: var(--good); background: #eafaf1; }
.choice.wrong { border-color: var(--bad); background: #fdeeea; }
.choice.dim { opacity: .5; }

.feedback { font-size: 14px; line-height: 1.5; padding: 12px 14px; border-radius: 12px; margin-top: 4px; }
.feedback.good { background: #eafaf1; color: #1d6b44; }
.feedback.bad { background: #fdeeea; color: #9e3322; }

/* Scene hotspots */
.scene-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hotspot {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 12px;
  min-height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; cursor: pointer; font-size: 14px; font-weight: 600; text-align: center; color: var(--ink);
}
.hotspot:active { box-shadow: inset 0 0 0 2px var(--blue); }
.hotspot .ic { font-size: 28px; }
.hotspot.start { grid-column: 1 / 3; background: linear-gradient(135deg, var(--blue), #155a91); color: #fff; border: 0; }
.hotspot.visited { opacity: .65; }

/* Pinhole minigame */
.glove-zone {
  position: relative; width: 100%; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden;
  background:
    radial-gradient(60% 70% at 50% 38%, #2a5db0 0%, #2452a0 60%, #1d4488 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.spot {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
}
.spot .dot { width: 14px; height: 14px; border-radius: 50%; }
.spot.pin .dot { background: radial-gradient(circle at 50% 50%, #0a0f1a 0 32%, #2a3550 60%, transparent 72%); }
.spot.decoy .dot { background: radial-gradient(circle at 40% 40%, rgba(255,255,255,.55), rgba(255,255,255,.12) 70%, transparent); filter: blur(.4px); }
.spot.marked { box-shadow: 0 0 0 3px var(--accent); border-radius: 50%; }
.spot.reveal-pin { box-shadow: 0 0 0 3px var(--good); border-radius: 50%; }
.spot.reveal-miss { box-shadow: 0 0 0 3px var(--bad); border-radius: 50%; }
.count-pill { align-self: center; background: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 14px; color: var(--ink); }

/* Quiz */
.q-text { font-weight: 700; font-size: 16px; line-height: 1.4; }
.q-progress { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* Badge / results */
.badge { display: flex; gap: 12px; align-items: flex-start; background: linear-gradient(135deg, #fff8e6, #fdeec2); border: 1px solid #f0d896; border-radius: 14px; padding: 14px; }
.badge .b-ic { font-size: 30px; }
.badge .b-title { font-weight: 800; font-size: 14px; }
.badge .b-text { font-size: 13px; color: #6a5520; line-height: 1.45; }
.stars { font-size: 40px; letter-spacing: 6px; text-align: center; color: var(--accent); }
.stars .off { color: rgba(255,255,255,.25); }
.result-line { color: rgba(255,255,255,.85); text-align: center; font-size: 15px; }

.rule { font-size: 14px; line-height: 1.5; }
.muted { color: var(--muted); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(8,22,36,.7); display: grid; place-items: end center; z-index: 20; }
.modal-card { background: #fff; width: 100%; max-width: 480px; border-radius: 20px 20px 0 0; padding: 20px; max-height: 80vh; overflow: auto; }
.modal-card h2 { margin: 0 0 8px; }
.modal-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 16px 0 6px; }
.modal-card dt { font-weight: 700; margin-top: 8px; }
.modal-card dd { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
#carnet-evidence { padding-left: 18px; margin: 0; }
#carnet-evidence li { margin: 4px 0; }

/* ---------- Splash ---------- */
.splash { align-items: center; justify-content: center; text-align: center; }
.splash .title { font-size: 30px; }
.glove-mark { font-size: 72px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-10px) rotate(6deg); } }
.btn.big { font-size: 19px; padding: 18px; letter-spacing: .5px; }
.center { text-align: center; }

/* ---------- Marc ---------- */
.marc-card .bubble { font-size: 16px; }

/* ---------- Arcade ---------- */
.arcade { gap: 8px; }
.arcade-hud { display: flex; justify-content: space-between; color: #fff; font-weight: 700; font-size: 14px; padding: 2px 4px; }
.arcade-hud .danger { color: #ffd3c9; }
.belt {
  position: relative; flex: 1; min-height: 60vh; border-radius: 18px; overflow: hidden;
  background:
    repeating-linear-gradient(180deg, #123a5e 0 38px, #0f3354 38px 76px);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.06), inset 0 14px 24px rgba(0,0,0,.3);
  touch-action: manipulation;
}
.belt::before, .belt::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 10px;
  background: repeating-linear-gradient(180deg, #f6c344 0 14px, #1d4470 14px 28px);
  opacity: .5;
}
.belt::before { left: 0; } .belt::after { right: 0; }
.glove {
  position: absolute; top: 0; border: 0; background: none; cursor: pointer;
  font-size: 44px; line-height: 1; width: 56px; height: 56px; margin-left: -28px;
  display: grid; place-items: center; will-change: transform; padding: 0;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.35));
}
.glove .hole {
  position: absolute; width: 11px; height: 11px; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #000 0 45%, #3a0d0d 70%, transparent);
  box-shadow: 0 0 6px 2px rgba(255,60,40,.7); top: 14px; right: 9px;
  animation: blip .7s ease-in-out infinite;
}
@keyframes blip { 0%,100% { transform: scale(1); } 50% { transform: scale(1.35); } }
.pop-good { animation: popg .22s ease forwards; }
@keyframes popg { to { transform: translateY(-14px) scale(1.5); opacity: 0; } }
.pop-bad { animation: popb .22s ease forwards; }
@keyframes popb { 0% { filter: hue-rotate(0); } to { transform: scale(.4); opacity: 0; } }

/* Toast */
.toast {
  position: fixed; left: 50%; top: 88px; transform: translate(-50%, -8px);
  background: #11324e; color: #fff; padding: 9px 16px; border-radius: 999px;
  font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; z-index: 30;
  box-shadow: 0 8px 20px rgba(0,0,0,.35); transition: opacity .15s, transform .15s; max-width: 84%;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: #1d7a4d; } .toast.bad { background: #c2402c; }

/* ---------- Verdict ---------- */
.verdict { text-align: center; }
.big-stat { font-size: 40px; font-weight: 800; color: var(--bad); }
.big-stat small { font-size: 15px; color: var(--muted); font-weight: 600; }
.aql-line { font-size: 13px; color: var(--muted); margin: 4px 0 12px; }
.verdict-banner { font-weight: 800; padding: 10px; border-radius: 12px; font-size: 15px; }
.verdict-banner.rej { background: #fdeeea; color: #b5331f; }
.verdict-banner.acc { background: #eafaf1; color: #1d6b44; }
.mini { font-size: 13px; margin-top: 10px; }
.rule.big { color: #fff; font-size: 20px; font-weight: 700; line-height: 1.4; }
.b-title { font-weight: 800; font-size: 14px; }
