/* Simulation pédagogique de cyberattaque — aucun effet réel sur les données. */

:root {
  --cx-red: #ff2a3d;
  --cx-green: #39ff8a;
  --cx-bg: #050607;
}

/* ---------- Glitch global appliqué à la page ---------- */
html.cx-glitch body {
  animation: cx-shake 0.28s steps(2) 3;
  filter: url(#cx-rgb) contrast(1.15);
}
html.cx-tint body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483000;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, rgba(255,42,61,.05), rgba(255,42,61,.18));
  mix-blend-mode: multiply;
}
@keyframes cx-shake {
  0%   { transform: translate(0,0); }
  25%  { transform: translate(-4px, 2px) skewX(-1deg); }
  50%  { transform: translate(5px, -2px); }
  75%  { transform: translate(-2px, 1px) skewX(1deg); }
  100% { transform: translate(0,0); }
}

/* Texte de pouet brouillé */
.cx-scrambled {
  color: var(--cx-red) !important;
  font-family: ui-monospace, Menlo, Consolas, monospace !important;
  text-shadow: 1px 0 rgba(0,255,255,.6), -1px 0 rgba(255,0,0,.6);
}

/* ---------- Overlay plein écran ---------- */
#cx-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  background: var(--cx-bg);
  color: var(--cx-green);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
#cx-overlay::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px);
  animation: cx-scan 6s linear infinite;
}
@keyframes cx-scan { from { background-position: 0 0; } to { background-position: 0 300px; } }

/* Phase terminal */
#cx-term {
  padding: clamp(16px, 4vw, 48px);
  font-size: clamp(12px, 1.6vw, 16px);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
#cx-term .cx-ok   { color: var(--cx-green); }
#cx-term .cx-warn { color: #ffd23f; }
#cx-term .cx-err  { color: var(--cx-red); }
#cx-term .cx-dim  { color: #6b7d73; }
.cx-caret::after {
  content: "█";
  animation: cx-blink 1s steps(1) infinite;
}
@keyframes cx-blink { 50% { opacity: 0; } }

/* Phase revendication */
#cx-claim {
  margin: auto;
  width: min(880px, 100%);
  padding: clamp(20px, 4vw, 48px) 16px;
  text-align: center;
  color: #e8e8e8;
}
#cx-claim svg.cx-sigil {
  width: clamp(110px, 18vw, 180px);
  height: auto;
  color: var(--cx-red);
  filter: drop-shadow(0 0 18px rgba(255,42,61,.55));
  animation: cx-pulse 2.4s ease-in-out infinite;
}
@keyframes cx-pulse { 50% { filter: drop-shadow(0 0 4px rgba(255,42,61,.3)); opacity: .85; } }

.cx-group {
  position: relative;
  display: inline-block;
  margin: 18px 0 4px;
  font-size: clamp(30px, 7vw, 68px);
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--cx-red);
}
.cx-group::before,
.cx-group::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.cx-group::before { color: #00e5ff; transform: translate(-3px, 0); clip-path: inset(0 0 55% 0); animation: cx-g1 2.2s infinite steps(1); opacity: .8; }
.cx-group::after  { color: #ff00c8; transform: translate(3px, 0);  clip-path: inset(55% 0 0 0); animation: cx-g2 1.7s infinite steps(1); opacity: .8; }
@keyframes cx-g1 { 0%,90% { transform: translate(-3px,0); } 92% { transform: translate(6px,-2px); } 96% { transform: translate(-8px,1px); } }
@keyframes cx-g2 { 0%,85% { transform: translate(3px,0); }  88% { transform: translate(-7px,2px); } 94% { transform: translate(9px,0); } }

.cx-tagline { color: #9aa3a0; font-style: italic; margin: 0 0 28px; }
.cx-title {
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 700;
  color: #fff;
  border-top: 1px solid rgba(255,42,61,.5);
  border-bottom: 1px solid rgba(255,42,61,.5);
  padding: 12px 0;
  margin: 0 0 22px;
  letter-spacing: .04em;
}
.cx-msg p { margin: 6px 0; font-size: clamp(14px, 1.8vw, 17px); }

.cx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 28px 0;
  text-align: left;
}
.cx-box {
  border: 1px solid rgba(255,42,61,.45);
  background: rgba(255,42,61,.06);
  padding: 14px 16px;
}
.cx-box h3 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cx-red);
}
.cx-box ul { margin: 0; padding-left: 18px; }
.cx-box li { margin: 4px 0; font-size: 14px; }
.cx-box li.cx-leak { color: var(--cx-green); list-style: "▸ "; }

.cx-count-label { font-size: 12px; letter-spacing: .2em; color: #9aa3a0; text-transform: uppercase; }
.cx-count {
  font-size: clamp(40px, 10vw, 96px);
  font-weight: 800;
  color: var(--cx-red);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(255,42,61,.6);
  line-height: 1.1;
}
.cx-foot { margin-top: 22px; font-size: 12px; color: #5d6662; }

/* ---------- Bandeau persistant ---------- */
#cx-banner {
  position: fixed;
  left: 0; right: 0; top: 0;
  z-index: 2147483500;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 16px 6px;
  background: repeating-linear-gradient(-45deg, #b5001a 0 14px, #8a0014 14px 28px);
  color: #fff;
  font: 700 13px/1.4 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .06em;
  text-align: center;
  box-shadow: 0 2px 14px rgba(255,0,30,.5);
  pointer-events: none;   /* ne bloque jamais un clic sur Mastodon */
  opacity: .92;
}
#cx-banner b { font-variant-numeric: tabular-nums; }
/* ---------- Verrouillage final ---------- */
html.cx-locked-page, html.cx-locked-page body { overflow: hidden !important; }
#cx-overlay.cx-final { cursor: not-allowed; }
.cx-locked {
  display: inline-block;
  margin-bottom: 18px;
  padding: 6px 14px;
  border: 2px solid var(--cx-red);
  color: var(--cx-red);
  font-weight: 800;
  letter-spacing: .25em;
  animation: cx-blink 1.2s steps(1) infinite;
}

/* ---------- Accessibilité : moins d'animations ---------- */
@media (prefers-reduced-motion: reduce) {
  html.cx-glitch body,
  #cx-overlay::before,
  .cx-group::before, .cx-group::after,
  #cx-claim svg.cx-sigil { animation: none !important; }
}

/* ---------- Mercredi : flash subliminal ---------- */
#cx-overlay.cx-flash { align-items: center; justify-content: center; background: #000; }
#cx-overlay.cx-flash::before { display: none; }
.cx-flash-box { margin: auto; text-align: center; color: var(--cx-red); }
.cx-flash-box svg.cx-sigil { width: clamp(140px, 30vw, 260px); height: auto; color: var(--cx-red); }
.cx-flash-text { margin-top: 16px; font: 800 clamp(20px, 4vw, 40px)/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; }

/* ---------- Message multilingue / traces ---------- */
.cx-poly { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 18px 0 0; color: #8b9590; font-size: 14px; }
.cx-box li.cx-trace { color: #ffd23f; list-style: "› "; }

/* ---------- Bandeau après restauration ---------- */
#cx-banner.cx-banner-warn {
  background: repeating-linear-gradient(-45deg, #8a6a00 0 14px, #6e5400 14px 28px);
  box-shadow: 0 2px 14px rgba(255,190,0,.35);
}

/* Libellé remplacé par une phrase lisible */
.cx-hijacked {
  color: var(--cx-red) !important;
  font-weight: 700 !important;
  text-shadow: 0 0 8px rgba(255,42,61,.55), 1px 0 rgba(0,255,255,.5), -1px 0 rgba(255,0,0,.5);
  animation: cx-flicker .35s steps(2) 2;
}
@keyframes cx-flicker { 50% { opacity: .3; } }
