@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:ital,wght@0,400;0,700;1,400&family=Inter:wght@400;500;600;700&family=Special+Elite&display=swap');

:root {
  /* Palette Moderne 2026 (Le Leurre) */
  --mod-bg: #f8fafc;
  --mod-card: rgba(255, 255, 255, 0.88);
  --mod-text: #0f172a;
  --mod-muted: #64748b;
  --mod-primary: #4f46e5;
  --mod-primary-hover: #4338ca;
  --mod-border: #e2e8f0;

  /* Palette Vintage 1976 (Machine à écrire & Archives) */
  --ret-paper: #f3ead3;
  --ret-paper-dark: #e5d7b5;
  --ret-ink: #1e1b18;
  --ret-ink-faded: #5c5346;
  --ret-red: #b83227;
  --ret-blue: #1f4e78;
  --ret-ochre: #c68b12;
  --ret-green: #2d6a4f;
}

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

/* =========================================================
   ACTE 1 : INTERFACE ULTRA-MODERNE ÉPURÉE (2026)
   ========================================================= */
body.era-modern {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at 15% 20%, #e0e7ff 0%, #f8fafc 45%, #f1f5f9 100%);
  color: var(--mod-text);
  min-height: 100vh;
  transition: background 0.4s ease;
}

body.era-modern .glass-card {
  background: var(--mod-card);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.06);
  border-radius: 24px;
}

body.era-modern .modern-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #eef2ff;
  color: var(--mod-primary);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

body.era-modern .btn-modern {
  background: var(--mod-primary);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 15px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.25);
}

body.era-modern .btn-modern:hover:not(:disabled) {
  background: var(--mod-primary-hover);
  transform: translateY(-1px);
}

body.era-modern .btn-modern:disabled {
  background: #cbd5e1;
  box-shadow: none;
  cursor: not-allowed;
}

/* =========================================================
   ACTE 2 : OVERLAY MACHINE À REMONTER LE TEMPS (2026 -> 1976)
   ========================================================= */
#timeMachineOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #090807;
  color: #f3ead3;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  text-align: center;
}

#timeMachineOverlay.active {
  display: flex;
}

/* Lignes de balayage cathodique (CRT) */
#timeMachineOverlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.38) 0px,
    rgba(0, 0, 0, 0.38) 2px,
    transparent 2px,
    transparent 4px
  );
  pointer-events: none;
  z-index: 3;
}

/* Tunnel temporel concentrique */
.tm-vortex {
  position: absolute;
  width: 160vmax;
  height: 160vmax;
  background: repeating-radial-gradient(
    circle,
    transparent 0,
    transparent 28px,
    rgba(217, 155, 67, 0.14) 30px,
    transparent 33px
  );
  animation: vortexSpin 3s linear infinite;
  z-index: 1;
}

@keyframes vortexSpin {
  0% { transform: scale(0.6) rotate(0deg); opacity: 0.4; }
  50% { transform: scale(1.25) rotate(180deg); opacity: 0.9; }
  100% { transform: scale(0.6) rotate(360deg); opacity: 0.4; }
}

.tm-glitch-alert {
  position: relative;
  z-index: 4;
  font-family: 'Courier Prime', monospace;
  font-size: clamp(0.9rem, 2.5vw, 1.3rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.5);
  padding: 8px 18px;
  margin-bottom: 20px;
  animation: glitchJitter 0.18s infinite;
}

.tm-year-counter {
  position: relative;
  z-index: 4;
  font-family: 'Special Elite', monospace;
  font-size: clamp(5rem, 20vw, 14rem);
  line-height: 1;
  color: #fdf6e3;
  text-shadow: -4px 0 #ef4444, 4px 0 #38bdf8, 0 0 35px rgba(245, 158, 11, 0.6);
  letter-spacing: 0.04em;
}

.tm-milestone {
  position: relative;
  z-index: 4;
  margin-top: 20px;
  font-family: 'Courier Prime', monospace;
  font-size: clamp(1rem, 3vw, 1.6rem);
  color: #fbbf24;
  min-height: 2em;
}

.tm-flashbulb {
  position: fixed;
  inset: 0;
  background: #fffbeb;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
}

.tm-flashbulb.bang {
  animation: flashBang 1.3s ease-out forwards;
}

@keyframes flashBang {
  0% { opacity: 1; }
  25% { opacity: 0.95; }
  100% { opacity: 0; }
}

@keyframes glitchJitter {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3px, 2px); }
  50% { transform: translate(3px, -1px); }
  75% { transform: translate(-2px, -2px); }
  100% { transform: translate(0, 0); }
}

body.glitching-out {
  animation: screenBreak 0.25s infinite;
  filter: contrast(1.4) hue-rotate(25deg);
}

@keyframes screenBreak {
  0% { transform: skewX(0deg); }
  30% { transform: skewX(-4deg) scale(1.01); }
  60% { transform: skewX(5deg) translateY(-3px); }
  100% { transform: skewX(0deg); }
}

/* =========================================================
   ACTE 3 : INTERFACE MACHINE À ÉCRIRE VINTAGE (1976)
   ========================================================= */
body.era-retro {
  font-family: 'Courier Prime', 'Courier New', monospace;
  background-color: var(--ret-paper);
  background-image:
    radial-gradient(ellipse at center, rgba(255,250,235,0.4) 0%, rgba(168,142,102,0.38) 100%),
    repeating-linear-gradient(0deg, rgba(92,83,70,0.03) 0px, rgba(92,83,70,0.03) 1px, transparent 1px, transparent 26px);
  color: var(--ret-ink);
  min-height: 100vh;
  position: relative;
}

/* Légère vignette papier vieilli sur les bords */
body.era-retro::after {
  content: "";
  position: fixed;
  inset: 0;
  box-shadow: inset 0 0 90px rgba(74, 55, 28, 0.32);
  pointer-events: none;
  z-index: 50;
}

.retro-paper-sheet {
  background: #faf3e0;
  border: 2px solid var(--ret-ink);
  box-shadow: 6px 6px 0px var(--ret-ink);
  position: relative;
}

.retro-heading {
  font-family: 'Special Elite', 'Courier Prime', monospace;
  letter-spacing: 0.04em;
}

/* Ruban bicolore noir/rouge de machine à écrire */
.ink-ribbon-divider {
  height: 6px;
  background: linear-gradient(90deg, var(--ret-ink) 0%, var(--ret-ink) 65%, var(--ret-red) 65%, var(--ret-red) 100%);
  margin: 14px 0;
}

/* Tampon encreur ("CONFIDENTIEL", "EXACT", etc.) */
.rubber-stamp {
  display: inline-block;
  font-family: 'Special Elite', monospace;
  text-transform: uppercase;
  color: var(--ret-red);
  border: 3px solid var(--ret-red);
  padding: 5px 14px;
  border-radius: 4px;
  transform: rotate(-4deg);
  letter-spacing: 0.1em;
  font-weight: 700;
  mask-image: radial-gradient(rgba(0,0,0,0.92), rgba(0,0,0,0.75));
}

.rubber-stamp.slam {
  animation: stampSlam 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes stampSlam {
  0% { transform: scale(2.8) rotate(-14deg); opacity: 0; }
  70% { transform: scale(0.93) rotate(-3deg); opacity: 1; }
  100% { transform: scale(1) rotate(-4deg); opacity: 1; }
}

/* Cadre Photo Polaroid / Archive 1976 */
.polaroid-frame {
  background: #fffdf7;
  padding: 14px 14px 42px 14px;
  border: 1px solid #cbbfa3;
  box-shadow: 0 12px 28px rgba(30, 27, 24, 0.22);
  display: inline-block;
  position: relative;
  transform: rotate(-1deg);
  transition: transform 0.35s ease;
}

.polaroid-frame::before {
  /* Morceau de scotch jauni en haut */
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(2deg);
  width: 110px;
  height: 26px;
  background: rgba(234, 211, 156, 0.78);
  border: 1px solid rgba(180, 155, 100, 0.4);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.polaroid-caption {
  font-family: 'Special Elite', monospace;
  color: var(--ret-ink);
  font-size: 1.05rem;
  margin-top: 12px;
  text-align: center;
}

/* Touches mécaniques de machine à écrire (pour le smartphone du joueur !) */
.typewriter-key {
  position: relative;
  border: 3px solid #2b2623;
  border-radius: 18px;
  background: radial-gradient(circle at 35% 30%, #3a3532, #1c1917);
  color: #f7f1e1;
  box-shadow:
    0 8px 0 #0f0d0c,
    0 12px 18px rgba(0, 0, 0, 0.35),
    inset 0 2px 3px rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: transform 0.07s ease, box-shadow 0.07s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 12px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Anneau chromé autour de la touche mécanique */
.typewriter-key::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 12px;
  border: 2px solid rgba(235, 224, 196, 0.45);
  pointer-events: none;
}

.typewriter-key:active:not(:disabled),
.typewriter-key.pressed {
  transform: translateY(7px);
  box-shadow:
    0 1px 0 #0f0d0c,
    0 3px 6px rgba(0, 0, 0, 0.3);
}

.typewriter-key.key-0 { background: radial-gradient(circle at 35% 30%, #b83227, #7c1d15); }
.typewriter-key.key-1 { background: radial-gradient(circle at 35% 30%, #1f4e78, #12314d); }
.typewriter-key.key-2 { background: radial-gradient(circle at 35% 30%, #c68b12, #8a5e07); }
.typewriter-key.key-3 { background: radial-gradient(circle at 35% 30%, #2d6a4f, #1b4332); }

.typewriter-key:disabled:not(.pressed) {
  opacity: 0.42;
  filter: grayscale(0.6);
  cursor: not-allowed;
}

/* Curseur clignotant machine à écrire */
.tw-cursor::after {
  content: "▋";
  display: inline-block;
  margin-left: 3px;
  color: var(--ret-red);
  animation: blinkCursor 0.8s steps(1) infinite;
}

@keyframes blinkCursor {
  50% { opacity: 0; }
}
