/* ═══════════════════════════════════════════════════════
   Première Garde ReCyF — Salle des opérations
   Thème sombre profond · HUD console de mission
   ═══════════════════════════════════════════════════════ */

:root {
  --bg: #070b14;
  --bg-raise: #0d1322;
  --panel: rgba(17, 24, 43, 0.72);
  --line: rgba(120, 150, 210, 0.14);
  --line-strong: rgba(120, 150, 210, 0.32);
  --text: #e8edf7;
  --text-dim: #8d99b5;
  --accent: #f5c542;            /* remplacé par la couleur client (marque blanche) */
  --uni: var(--accent);         /* couleur de l'univers courant */
  --ok: #4ade80;
  --ko: #ff5d5d;
  --font-display: "Unbounded", sans-serif;
  --font-body: "Albert Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); font-size: 0.8em; letter-spacing: 0.08em; }
.pixel { font-family: "Press Start 2P", var(--font-mono); }

/* ── Effet CRT (jeu vidéo) ─────────────── */
.crt-scanlines {
  position: fixed; inset: 0; z-index: 90; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.16) 0 1px, transparent 1px 3px);
  opacity: 0.35;
}
.crt-vignette {
  position: fixed; inset: 0; z-index: 90; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 62%, rgba(0,0,0,0.42) 100%);
}

/* ── Pièces d'or ─────────────────────────── */
.coin {
  display: inline-block; width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3c0, #f5c542 45%, #a87b0a 100%);
  border: 2px solid #7c5c06;
  box-shadow: inset 0 0 4px rgba(255,255,255,0.7), 0 2px 6px rgba(0,0,0,0.5);
  position: relative; vertical-align: middle;
}
.coin::after {
  content: "★"; position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 10px; color: #8a6508; font-family: var(--font-body);
}
.coin-hud { animation: coin-spin 3.2s linear infinite; }
.coin-small { width: 18px; height: 18px; }
.coin-small::after { font-size: 8px; }
@keyframes coin-spin {
  0%, 62% { transform: rotateY(0); }
  81%     { transform: rotateY(180deg); }
  100%    { transform: rotateY(360deg); }
}
.coin-fly {
  position: fixed; z-index: 120; pointer-events: none;
  transition: transform 0.65s cubic-bezier(0.35, -0.25, 0.7, 0.3), opacity 0.65s;
}
.hud-coins { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); }
.hud-coins .pixel { font-size: 12px; }
.hud-coins.bump .coin-hud { animation: coin-bump 0.35s; }
@keyframes coin-bump { 40% { transform: scale(1.5) rotateY(90deg); } }

.hud-mute {
  background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 3px 8px; cursor: pointer; font-size: 13px; line-height: 1;
  filter: grayscale(0.4);
}
.hud-mute:hover { border-color: var(--line-strong); }

/* Texte flottant +1 PIÈCE */
.float-coin-text {
  position: fixed; z-index: 120; pointer-events: none;
  font-family: "Press Start 2P", monospace; font-size: 13px; color: var(--accent);
  text-shadow: 2px 2px 0 #7c5c06, 0 0 14px var(--accent);
  animation: float-up 1s ease-out forwards;
}
@keyframes float-up {
  0%   { opacity: 0; transform: translateY(6px) scale(0.7); }
  20%  { opacity: 1; transform: translateY(0) scale(1.15); }
  100% { opacity: 0; transform: translateY(-46px) scale(1); }
}

.ko-text { color: var(--ko); font-family: "Press Start 2P", monospace; font-size: 0.75em; }
.btn-pixel-arrow { font-size: 0.7em; }

.home-lore { color: var(--text-dim); font-size: 15px; max-width: 620px; margin: -14px auto 34px; animation: fade-up 0.7s 0.45s both; }
.home-lore strong { color: var(--accent); }

/* ── Fond ─────────────────────────────── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(120,150,210,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,150,210,0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, black 30%, transparent 100%);
}

.bg-glow {
  position: fixed; z-index: 0; pointer-events: none;
  width: 70vw; height: 70vw; max-width: 900px; max-height: 900px;
  left: 50%; top: -20%; transform: translateX(-50%);
  background: radial-gradient(circle, var(--uni) 0%, transparent 60%);
  opacity: 0.09;
  filter: blur(60px);
  transition: background 1.2s ease;
}

#particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5; }

/* ── HUD ─────────────────────────────── */
.hud[hidden] { display: none; }
.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 14px 28px;
  background: linear-gradient(180deg, rgba(7,11,20,0.92), rgba(7,11,20,0.6) 80%, transparent);
  backdrop-filter: blur(8px);
}
.hud-brand { font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: 0.12em; color: var(--text-dim); }
.hud-center { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 14px; }
.hud-progress { flex: 1; height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.hud-progress-bar { height: 100%; width: 0%; background: var(--uni); border-radius: 4px; transition: width 0.5s cubic-bezier(.6,0,.2,1), background 0.8s; box-shadow: 0 0 12px var(--uni); }
.hud-step { color: var(--text-dim); font-size: 12px; white-space: nowrap; }
.hud-right { display: flex; gap: 20px; font-size: 13px; }
.hud-score { color: var(--uni); transition: color 0.8s; }
.hud-timer { color: var(--text-dim); }

/* ── Écrans ─────────────────────────────── */
#app { position: relative; z-index: 1; min-height: 100vh; }

.screen {
  display: none;
  min-height: 100vh;
  padding: 90px 24px 60px;
  align-items: center; justify-content: center;
  flex-direction: column;
}
.screen.active { display: flex; animation: screen-in 0.55s cubic-bezier(.2,.8,.2,1) both; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(24px) scale(0.99); filter: blur(4px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* ── Accueil ─────────────────────────────── */
.home-inner { width: min(860px, 100%); text-align: center; }

.home-badge {
  display: inline-block; padding: 6px 16px; margin-bottom: 28px;
  border: 1px solid var(--line-strong); border-radius: 100px;
  color: var(--accent); font-size: 12px;
  animation: fade-up 0.7s 0.1s both;
}

.home-title {
  font-family: var(--font-display);
  font-size: clamp(42px, 8vw, 84px);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.05;
  background: linear-gradient(115deg, var(--text) 40%, var(--accent) 70%, var(--text) 95%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fade-up 0.7s 0.2s both, shine 6s 1s linear infinite;
}
@keyframes shine { to { background-position: -200% 0; } }

/* Effet glitch au survol du titre */
.glitch { position: relative; }
.glitch:hover::before, .glitch:hover::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  background: inherit; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.glitch:hover::before { transform: translate(2px, -1px); opacity: 0.5; clip-path: inset(0 0 55% 0); animation: glitch-a 0.35s steps(2) infinite; }
.glitch:hover::after  { transform: translate(-2px, 1px); opacity: 0.5; clip-path: inset(55% 0 0 0); animation: glitch-b 0.35s steps(2) infinite; }
@keyframes glitch-a { 50% { transform: translate(-2px, 1px); } }
@keyframes glitch-b { 50% { transform: translate(2px, -1px); } }

.home-subtitle { color: var(--text-dim); margin-top: 14px; font-size: 18px; animation: fade-up 0.7s 0.3s both; }

.home-rules {
  display: flex; justify-content: center; gap: clamp(18px, 4vw, 48px);
  margin: 40px 0; flex-wrap: wrap;
  animation: fade-up 0.7s 0.4s both;
}
.rule { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text-dim); font-size: 13px; }
.rule-num { font-size: 26px; color: var(--text); font-weight: 500; }

@keyframes fade-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* Formulaire */
.home-form {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(22px, 4vw, 36px);
  backdrop-filter: blur(12px);
  animation: fade-up 0.7s 0.5s both;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; letter-spacing: 0.04em; }
.field .optional { opacity: 0.6; }
.field input {
  width: 100%; padding: 12px 14px;
  background: rgba(7, 11, 20, 0.6);
  border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font-family: var(--font-body); font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.field input::placeholder { color: rgba(141, 153, 181, 0.4); }

.form-row-email { grid-template-columns: 1fr; }

.email-status { display: block; margin-top: 8px; font-size: 11px; color: var(--text-dim); min-height: 15px; transition: color 0.2s; }
.email-status.ok { color: var(--ok); }
.email-status.ko { color: var(--ko); }

.field input[readonly] { opacity: 0.65; border-style: dashed; }

.level-label { color: var(--text-dim); font-size: 12px; margin: 26px 0 12px; }

.level-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .level-cards { grid-template-columns: 1fr; } }

.level-card {
  position: relative;
  padding: 18px 16px;
  background: rgba(7, 11, 20, 0.5);
  border: 1px solid var(--line); border-radius: 14px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.level-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.level-card.selected {
  border-color: var(--lvl, var(--accent));
  box-shadow: 0 0 0 1px var(--lvl, var(--accent)), 0 8px 32px -12px var(--lvl, var(--accent));
}
.level-card.selected::after {
  content: "✓"; position: absolute; top: 10px; right: 12px;
  color: var(--lvl); font-weight: 700;
}
.level-card.locked { opacity: 0.35; cursor: not-allowed; filter: saturate(0.4); }
.level-card.locked:hover { transform: none; border-color: var(--line); }
.level-card.assigned::before {
  content: "VOTRE RANG";
  position: absolute; top: -9px; left: 14px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.16em;
  color: var(--lvl); background: var(--bg); padding: 0 8px;
}
.level-rank { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--lvl, var(--text)); }
.level-aud { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); margin: 4px 0 8px; }
.level-desc { font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 32px;
  font-family: var(--font-display); font-size: 14px; font-weight: 600; letter-spacing: 0.06em;
  border-radius: 100px; border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s, opacity 0.18s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--uni); color: #0a0e18;
  box-shadow: 0 4px 28px -6px var(--uni);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 36px -6px var(--uni); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost {
  background: transparent; color: var(--text);
  border-color: var(--line-strong);
}
.btn-ghost:hover { border-color: var(--text-dim); }

.btn-launch { width: 100%; margin-top: 28px; padding: 17px; }

.home-provided { margin-top: 22px; color: var(--text-dim); font-size: 11px; animation: fade-up 0.7s 0.6s both; }

/* ── Carte des univers ─────────────────────────────── */
.map-title { font-family: var(--font-display); font-size: clamp(26px, 4vw, 38px); font-weight: 600; }
.map-sub { color: var(--text-dim); margin: 8px 0 40px; font-size: 12px; }

.map-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
  width: min(1100px, 100%);
}
@media (max-width: 1000px) { .map-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .map-grid { grid-template-columns: 1fr; } }

.map-card {
  --uc: var(--accent);
  position: relative;
  padding: 30px 22px 26px;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: 18px;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1), border-color 0.25s, box-shadow 0.25s;
  animation: fade-up 0.6s both;
}
.map-card:nth-child(1) { animation-delay: 0.05s; }
.map-card:nth-child(2) { animation-delay: 0.15s; }
.map-card:nth-child(3) { animation-delay: 0.25s; }
.map-card:nth-child(4) { animation-delay: 0.35s; }

.map-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, var(--uc), transparent 70%);
  opacity: 0.08; transition: opacity 0.25s;
}
.map-card:not(.done):hover { transform: translateY(-6px); border-color: color-mix(in srgb, var(--uc) 50%, transparent); box-shadow: 0 18px 44px -18px var(--uc); }
.map-card:not(.done):hover::before { opacity: 0.18; }

.map-card.done { cursor: default; opacity: 0.75; }
.map-card.done .map-status { color: var(--ok); }
.map-card.locked { cursor: not-allowed; opacity: 0.45; filter: saturate(0.3); }

.map-icon { width: 58px; height: 58px; margin: 0 auto 14px; color: var(--uc); filter: drop-shadow(0 0 14px color-mix(in srgb, var(--uc) 60%, transparent)); }
.map-icon svg { width: 100%; height: 100%; }
.map-pillar { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--uc); }
.map-name { font-family: var(--font-display); font-size: 19px; font-weight: 600; margin: 6px 0 4px; }
.map-tagline { font-size: 13px; color: var(--text-dim); margin-bottom: 14px; }
.map-status { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; color: var(--text-dim); }

/* ── Intro univers / fin d'univers ─────────────────────────────── */
.universe-inner { text-align: center; width: min(660px, 100%); }
.universe-icon { width: 92px; height: 92px; margin: 0 auto 20px; color: var(--uni); filter: drop-shadow(0 0 24px color-mix(in srgb, var(--uni) 70%, transparent)); animation: float 4s ease-in-out infinite; }
.universe-icon svg { width: 100%; height: 100%; }
@keyframes float { 50% { transform: translateY(-8px); } }
.universe-pillar { color: var(--uni); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; }
.universe-name { font-family: var(--font-display); font-size: clamp(30px, 5vw, 46px); font-weight: 800; margin: 8px 0; }
.universe-tagline { color: var(--uni); font-style: italic; margin-bottom: 22px; }
.universe-intro { color: var(--text-dim); font-size: 17px; margin-bottom: 34px; }
.uend-score { font-size: 30px; color: var(--uni); margin: 10px 0 18px; }

/* ── Question ─────────────────────────────── */
.q-inner { width: min(760px, 100%); }

.q-meta { display: flex; justify-content: space-between; color: var(--text-dim); font-size: 12px; margin-bottom: 22px; }
#q-universe-tag { color: var(--uni); letter-spacing: 0.14em; text-transform: uppercase; }

.q-scenario {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--uni);
  border-radius: 12px;
  padding: 20px 24px;
  color: var(--text-dim);
  font-size: 16px;
  margin-bottom: 26px;
  backdrop-filter: blur(10px);
}
.q-scenario::before {
  content: "SITUATION"; position: absolute; top: -9px; left: 16px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em;
  color: var(--uni); background: var(--bg); padding: 0 8px;
}

.q-question { font-family: var(--font-display); font-size: clamp(19px, 3vw, 24px); font-weight: 600; line-height: 1.4; margin-bottom: 26px; }

.q-choices { display: flex; flex-direction: column; gap: 12px; }

.choice {
  display: flex; align-items: flex-start; gap: 14px;
  width: 100%; text-align: left;
  padding: 16px 18px;
  background: rgba(13, 19, 34, 0.6);
  border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  animation: fade-up 0.4s both;
}
.choice:nth-child(1) { animation-delay: 0.05s; }
.choice:nth-child(2) { animation-delay: 0.12s; }
.choice:nth-child(3) { animation-delay: 0.19s; }
.choice:nth-child(4) { animation-delay: 0.26s; }

.choice:not(:disabled):hover { transform: translateX(6px); border-color: var(--uni); background: rgba(13, 19, 34, 0.9); }
.choice:disabled { cursor: default; }

.choice-key {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 8px;
  font-family: var(--font-mono); font-size: 13px; color: var(--text-dim);
  transition: all 0.15s;
}
.choice:not(:disabled):hover .choice-key { border-color: var(--uni); color: var(--uni); }

.choice.is-correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, rgba(13,19,34,0.6)); }
.choice.is-correct .choice-key { border-color: var(--ok); color: var(--ok); }
.choice.is-wrong { border-color: var(--ko); background: color-mix(in srgb, var(--ko) 10%, rgba(13,19,34,0.6)); animation: shake 0.4s; }
.choice.is-wrong .choice-key { border-color: var(--ko); color: var(--ko); }
.choice.is-faded { opacity: 0.35; }

@keyframes shake {
  20% { transform: translateX(-6px); } 40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(2px); }
}

/* Feedback */
.q-feedback {
  margin-top: 26px;
  padding: 22px 24px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(10px);
  animation: fade-up 0.4s both;
}
.q-feedback.good { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.q-feedback.bad  { border-color: color-mix(in srgb, var(--ko) 45%, transparent); }

.feedback-head { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.q-feedback.good .feedback-head { color: var(--ok); }
.q-feedback.bad  .feedback-head { color: var(--ko); }
.feedback-text { color: var(--text-dim); font-size: 15.5px; }
.feedback-ref {
  display: inline-block;
  margin: 14px 0 18px; padding: 5px 12px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  font-size: 11px; color: var(--uni);
}

/* ── Niveau de plateforme ─────────────────── */
.screen-play { padding: 0; }
.screen-play.active { display: block; animation: none; }
#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  image-rendering: auto;
}
.play-hint {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 55;
  padding: 10px 20px;
  background: rgba(7, 11, 20, 0.8);
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  color: var(--text-dim); font-size: 11px; white-space: nowrap;
  backdrop-filter: blur(6px);
  animation: fade-up 0.5s both;
  transition: opacity 1s;
  pointer-events: none;
}
.play-hint .pixel { color: var(--uni); font-size: 9px; }
.play-hint.faded { opacity: 0; }

.hud-bits { color: #7dd8ff; }
.hud-bits .pixel { font-size: 12px; }

.touch-controls {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 56;
  display: none;
  justify-content: space-between; align-items: flex-end;
  padding: 0 22px 22px;
  pointer-events: none;
}
body.touch-device .screen-play.active .touch-controls { display: flex; }
.tc-group { display: flex; gap: 14px; }
.tc-btn {
  pointer-events: auto;
  width: 64px; height: 64px;
  border-radius: 18px;
  border: 2px solid var(--line-strong);
  background: rgba(13, 19, 34, 0.75);
  color: var(--text); font-size: 22px;
  backdrop-filter: blur(4px);
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.tc-btn:active { background: var(--uni); color: #0a0e18; }
.tc-jump { width: 76px; height: 76px; border-radius: 50%; }

/* ── Question / simulation en overlay au-dessus du niveau ── */
.screen-question.qoverlay,
.screen-sim.qoverlay {
  display: flex;
  position: fixed; inset: 0; z-index: 70;
  background: rgba(7, 11, 20, 0.88);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  animation: screen-in 0.4s cubic-bezier(.2,.8,.2,1) both;
}

/* ── Question BOSS ─────────────────────────── */
.q-inner.boss .q-scenario { border-color: var(--ko); border-left-color: var(--ko); animation: boss-pulse 1.6s ease-in-out infinite; }
.q-inner.boss .q-scenario::before { content: "⚔ QUESTION BOSS"; color: var(--ko); }
@keyframes boss-pulse {
  50% { box-shadow: 0 0 24px -6px var(--ko); }
}
.boss-tag { color: var(--ko); }

/* ── Machine à écrire ─────────────────────── */
.typing::after { content: "▌"; animation: blink 0.7s steps(1) infinite; color: var(--uni); }
@keyframes blink { 50% { opacity: 0; } }

/* ── Simulation BOSS (audit d'email) ─────────── */
.screen-sim.qoverlay { display: flex; }
.sim-inner { width: min(780px, 100%); padding-bottom: 40px; }
.sim-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.sim-counters { display: flex; gap: 18px; }
.sim-counter { font-size: 11px; letter-spacing: 0.1em; }
.sim-counter.found { color: var(--accent); }
.sim-counter.errors { color: var(--ko); }
.sim-title { font-family: var(--font-display); font-size: clamp(19px, 3vw, 24px); font-weight: 600; margin-bottom: 10px; }
.sim-brief { color: var(--text-dim); font-size: 15.5px; margin-bottom: 22px; }

/* Maquette d'email réaliste (claire, comme un vrai client mail) */
.sim-mail {
  background: #f2f4f8;
  color: #1d2433;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 18px 60px -20px rgba(0,0,0,0.8);
  font-family: var(--font-body);
  margin-bottom: 22px;
}
.sim-mail-toolbar {
  display: flex; align-items: center; gap: 7px;
  background: #dde3ec; padding: 10px 14px;
}
.sim-mail-toolbar i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.sim-mail-toolbar i:nth-child(1) { background: #ff5f57; }
.sim-mail-toolbar i:nth-child(2) { background: #febc2e; }
.sim-mail-toolbar i:nth-child(3) { background: #28c840; }
.sim-mail-toolbar span { margin-left: 8px; font-size: 12px; color: #5a6478; }
.sim-mail-header { padding: 16px 22px 12px; border-bottom: 1px solid #dde3ec; }
.sim-mail-row { display: flex; gap: 10px; margin-bottom: 6px; font-size: 14.5px; }
.sim-mail-row .k { color: #7a8499; min-width: 52px; font-weight: 500; }
.sim-attachment {
  display: inline-block; margin: 10px 22px 0;
  padding: 8px 14px; background: #e5eaf2; border: 1px solid #cdd6e4; border-radius: 8px;
  font-size: 13.5px;
}
.sim-mail-body { padding: 18px 22px 22px; font-size: 15px; line-height: 1.7; }
.sim-mail-body p { margin-bottom: 13px; color: #1d2433; }
.sim-mail-statusbar {
  padding: 8px 14px; background: #dde3ec; border-top: 1px solid #cdd6e4;
  font-family: var(--font-mono); font-size: 12px; color: #5a6478;
}

/* Scène SVG interactive (bureau piégé) */
.sim-mail.scene { background: #e9edf4; padding: 0; }
.sim-mail.scene svg { display: block; width: 100%; height: auto; }
.sim-mail.scene [data-zone] { cursor: pointer; transition: filter 0.15s; }
.sim-mail.scene:not(.done) [data-zone]:hover { filter: brightness(1.12) drop-shadow(0 0 6px rgba(59, 130, 196, 0.9)); }
.sim-mail.scene.done [data-zone] { cursor: default; }

/* Chronologie de crise (type "sequence") */
.sim-mail.sequence { background: transparent; box-shadow: none; }
.seq-wrap { display: flex; flex-direction: column; gap: 20px; }
.seq-timeline { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.seq-slot {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 16px;
  background: rgba(13, 19, 34, 0.6);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--text-dim); font-size: 14.5px;
  transition: border-color 0.25s, background 0.25s;
}
.seq-slot.filled {
  border-style: solid; border-color: color-mix(in srgb, var(--ok) 55%, transparent);
  background: color-mix(in srgb, var(--ok) 8%, rgba(13, 19, 34, 0.6));
  color: var(--text);
  animation: fade-up 0.3s;
}
.seq-num {
  flex-shrink: 0;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 8px;
  font-size: 11px; color: var(--uni);
}
.seq-slot.filled .seq-num { border-color: var(--ok); color: var(--ok); }
.seq-cards-title { color: var(--text-dim); font-size: 11px; letter-spacing: 0.14em; }
.seq-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 760px) { .seq-cards { grid-template-columns: 1fr; } }
.seq-card {
  position: relative;
  padding: 13px 14px;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font-family: var(--font-body); font-size: 13.5px; line-height: 1.45;
  text-align: left; cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, opacity 0.3s;
  backdrop-filter: blur(8px);
}
.seq-card:not(:disabled):hover { transform: translateY(-3px); border-color: var(--uni); }
.seq-card.placed { opacity: 0.18; cursor: default; }
.seq-card.wrong { animation: shake 0.4s; border-color: var(--ko); }
.seq-card.trap-revealed {
  border-color: var(--ko);
  background: color-mix(in srgb, var(--ko) 12%, var(--panel));
  color: var(--text-dim);
  cursor: default;
}
.seq-trap-badge {
  display: block;
  color: var(--ko); font-size: 9px; letter-spacing: 0.14em;
  margin-bottom: 6px;
}
.sim-clue-list li.trap::before { content: "☠"; color: var(--ko); }

/* Zones cliquables */
.sim-zone { cursor: pointer; border-radius: 4px; padding: 1px 3px; margin: -1px -1px; transition: background 0.15s, outline-color 0.15s; outline: 1.5px dashed transparent; }
.sim-mail:not(.done) .sim-zone:hover { background: rgba(62, 150, 224, 0.14); outline-color: rgba(62, 150, 224, 0.6); }
.sim-zone.found {
  background: rgba(34, 160, 90, 0.18);
  outline: 1.5px solid #22a05a;
  position: relative;
}
.sim-zone.found::after { content: " ✓"; color: #1d8a4c; font-weight: 700; }
.sim-zone.nope { animation: zone-nope 0.5s; }
@keyframes zone-nope {
  20% { background: rgba(255, 93, 93, 0.3); }
  40% { transform: translateX(-3px); }
  60% { transform: translateX(3px); }
  100% { transform: none; }
}
.sim-actions { text-align: center; }

/* Récapitulatif */
.sim-recap {
  margin-top: 26px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 24px 26px;
  backdrop-filter: blur(10px);
  animation: fade-up 0.4s both;
}
.sim-verdict { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.sim-verdict.win { color: var(--ok); }
.sim-verdict.lose { color: var(--ko); }
.sim-verdict-text { color: var(--text-dim); font-size: 15px; margin-bottom: 18px; }
.sim-clue-list { list-style: none; margin-bottom: 16px; }
.sim-clue-list li {
  padding: 10px 0 10px 30px; position: relative;
  border-bottom: 1px dashed var(--line);
  font-size: 14.5px; color: var(--text-dim);
}
.sim-clue-list li b { color: var(--text); display: block; margin-bottom: 2px; }
.sim-clue-list li::before { position: absolute; left: 2px; top: 10px; font-weight: 700; }
.sim-clue-list li.hit::before { content: "✓"; color: var(--ok); }
.sim-clue-list li.miss::before { content: "✗"; color: var(--ko); }
.sim-recap .btn { margin-top: 8px; }

/* ── Médaille (mention du certificat) ─────────── */
.result-medal {
  display: inline-flex; align-items: center; gap: 12px;
  margin: 14px 0 4px;
  padding: 10px 22px;
  border: 2px solid var(--medal, var(--accent));
  border-radius: 100px;
  color: var(--medal, var(--accent));
  font-size: 13px;
  text-shadow: 0 0 18px color-mix(in srgb, var(--medal, var(--accent)) 60%, transparent);
  animation: fade-up 0.6s 0.4s both;
}

/* ── La Boutique du Gardien ────────────────── */
.shop-inner { width: min(680px, 100%); text-align: center; }
.shop-tag { color: var(--text-dim); font-size: 12px; letter-spacing: 0.2em; margin-bottom: 26px; }

.merchant {
  font-size: 72px; line-height: 1;
  margin-bottom: 18px;
  filter: drop-shadow(0 0 22px color-mix(in srgb, var(--accent) 55%, transparent));
  animation: float 3.5s ease-in-out infinite;
}

.dialog-box {
  position: relative;
  text-align: left;
  background: var(--panel);
  border: 2px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--line-strong), 0 12px 40px -14px var(--accent);
  padding: 22px 26px 26px;
  min-height: 96px;
  margin-bottom: 26px;
  backdrop-filter: blur(10px);
}
.dialog-name {
  position: absolute; top: -11px; left: 16px;
  font-size: 9px; letter-spacing: 0.14em; color: var(--accent);
  background: var(--bg); padding: 2px 10px;
}
.dialog-box p { color: var(--text); font-size: 16.5px; min-height: 52px; }
.dialog-cursor {
  position: absolute; right: 14px; bottom: 8px;
  color: var(--accent); font-size: 12px;
  animation: cursor-bounce 0.8s ease-in-out infinite;
}
@keyframes cursor-bounce { 50% { transform: translateY(-4px); } }

.shop-item {
  display: flex; align-items: center; gap: 20px;
  background: rgba(13, 19, 34, 0.7);
  border: 1px solid var(--line-strong); border-radius: 14px;
  padding: 18px 22px; margin-bottom: 26px;
  text-align: left;
}
.shop-cert { font-size: 44px; filter: drop-shadow(0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)); }
.shop-item-body { flex: 1; }
.shop-item-name { font-family: var(--font-display); font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.shop-item-price { display: flex; align-items: center; gap: 8px; color: var(--accent); }
.shop-item-price .pixel { font-size: 14px; }
.price-label { color: var(--text-dim); font-size: 13px; }
.shop-wallet { text-align: center; border-left: 1px dashed var(--line-strong); padding-left: 20px; }
.wallet-label { display: block; font-size: 10px; color: var(--text-dim); margin-bottom: 8px; }
.wallet-coins { display: inline-flex; align-items: center; gap: 8px; }
.wallet-coins .pixel { font-size: 16px; color: var(--text); }
.shop-item.poor .wallet-coins .pixel { color: var(--ko); }
.shop-item.rich .wallet-coins .pixel { color: var(--ok); }

.btn-shop:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── GAME OVER ─────────────────────────────── */
.screen-gameover { --uni: var(--ko); }
.screen-gameover.active { animation: go-shake 0.5s; }
@keyframes go-shake {
  10% { transform: translate(-8px, 3px); } 25% { transform: translate(7px, -4px); }
  40% { transform: translate(-5px, 2px); } 55% { transform: translate(4px, -2px); }
  70% { transform: translate(-2px, 1px); } 85% { transform: translate(1px, 0); }
}
.go-inner { text-align: center; width: min(640px, 100%); }
.go-title {
  font-size: clamp(34px, 8vw, 64px);
  color: var(--ko);
  text-shadow: 4px 4px 0 #4a0f0f, 0 0 34px color-mix(in srgb, var(--ko) 70%, transparent);
  animation: go-flicker 2.4s steps(1) infinite;
  margin-bottom: 30px;
}
@keyframes go-flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; } 93% { opacity: 0.4; } 94% { opacity: 1; } 96% { opacity: 0.6; } 97% { opacity: 1; }
}
.go-coins { font-size: 20px; color: var(--text); display: inline-flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.go-coins .coin { margin-right: 2px; }
.go-msg { color: var(--text-dim); font-size: 16.5px; margin-bottom: 34px; }
.btn-go { background: var(--ko); box-shadow: 0 4px 28px -6px var(--ko); }
.btn-go:hover { box-shadow: 0 8px 36px -6px var(--ko); }

/* ── Résultat ─────────────────────────────── */
.result-inner { text-align: center; width: min(640px, 100%); }
.result-label { color: var(--text-dim); font-size: 12px; letter-spacing: 0.2em; }

.result-gauge { position: relative; width: 260px; margin: 18px auto 6px; }
.gauge-svg { width: 100%; }
.gauge-track { stroke: var(--line); }
.gauge-fill {
  stroke: var(--uni);
  stroke-dasharray: 251;
  stroke-dashoffset: 251;
  transition: stroke-dashoffset 1.6s cubic-bezier(.3,0,.2,1), stroke 0.6s;
  filter: drop-shadow(0 0 10px var(--uni));
}
.gauge-score {
  position: absolute; left: 0; right: 0; bottom: 6px;
  font-family: var(--font-display); font-size: 52px; font-weight: 800;
}
.gauge-total { font-size: 22px; color: var(--text-dim); font-weight: 400; }

.result-title { font-family: var(--font-display); font-size: clamp(26px, 5vw, 40px); font-weight: 800; margin: 10px 0; }
.result-message { color: var(--text-dim); margin-bottom: 22px; }

.result-detail {
  display: flex; justify-content: center; gap: 26px; flex-wrap: wrap;
  color: var(--text-dim); font-size: 12px; margin-bottom: 30px;
}
.result-detail b { color: var(--text); font-weight: 500; }

.result-actions { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.result-note { margin-top: 24px; color: var(--text-dim); font-size: 11px; min-height: 16px; }

.screen-result.pass { --uni: var(--ok); }
.screen-result.fail { --uni: var(--ko); }

/* ── Divers ─────────────────────────────── */
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}
