@import url('https://fonts.googleapis.com/css2?family=Jersey+10&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Sedgwick+Ave+Display&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

@font-face {
  font-family: 'Splatink';
  src: url('Splatink.otf') format('truetype');
}

/* ══════════════════════════════════════
   VARIABLES
══════════════════════════════════════ */
:root {
  --bg:      #0d0d0d;
  --yellow:  #56d639;
  --magenta: #596ee2;
  --cyan:    #E30413;
  --black:   #050505;
  --white:   #f0f0f0;
  --red:     #ff2020;
  --g1:      #ff009e;
  --g2:      #00f0ff;
  --glow-y:  0 0 10px #56d639aa, 0 0 30px #56d63944;
  --glow-m:  0 0 10px #596ee2aa, 0 0 30px #596ee244;
  --glow-c:  0 0 10px #E30413aa, 0 0 30px #E3041344;

  --fs-xs:   clamp(0.55rem, 2.2vw, 0.7rem);
  --fs-sm:   clamp(0.65rem, 2.5vw, 0.85rem);
  --fs-md:   clamp(0.75rem, 3vw, 1rem);
  --fs-lg:   clamp(1rem,    3.5vw, 1.6rem);
  --fs-xl:   clamp(1.4rem,  5vw,   2.4rem);

  --gap-xs: 0.4rem;
  --gap-sm: 0.7rem;
  --gap-md: 1.2rem;
  --gap-lg: 2rem;

  --timer-fs:   clamp(4.5rem, 24vw, 18rem);
  --count-fs:   clamp(8rem,   34vw, 22rem);
  --title-fs:   clamp(2.8rem, 12vw, 7.5rem);
  --fail-h2-fs: clamp(3.5rem, 16vw, 11rem);
  --win-score-fs: clamp(4rem, 22vw, 16rem);
}

/* ══════════════════════════════════════
   RESET
══════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  color: var(--white);
  font-family: 'Jersey 10', sans-serif;
  user-select: none;
  cursor: none;
  touch-action: manipulation;
}

/* ══════════════════════════════════════
   EFFETS GLOBAUX
══════════════════════════════════════ */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 3px,
    rgba(0,0,0,0.18) 3px, rgba(0,0,0,0.18) 4px
  );
  pointer-events: none;
  z-index: 999;
}

#vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 40%,
    rgba(0,0,0,0.55) 75%,
    rgba(0,0,0,0.9) 100%
  );
  pointer-events: none;
  z-index: 998;
}

/* ══════════════════════════════════════
   CURSEUR
══════════════════════════════════════ */
#cursor {
  position: fixed;
  width: 10px;
  height: 10px;
  background: var(--yellow);
  box-shadow: var(--glow-y);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  #cursor { display: block; }
}
#cursor.dead {
  background: var(--magenta);
  box-shadow: var(--glow-m);
  animation: cursorFlicker 0.08s steps(2) infinite;
}
@keyframes cursorFlicker {
  0%  { opacity: 1; }
  50% { opacity: 0.2; }
}

/* ══════════════════════════════════════
   FLASH
══════════════════════════════════════ */
#flash {
  position: fixed;
  inset: 0;
  background: var(--white);
  opacity: 0;
  pointer-events: none;
  z-index: 9990;
}
#flash.flash-on {
  animation: flashOut 0.2s steps(4) forwards;
}
@keyframes flashOut {
  0%   { opacity: 0.7; }
  100% { opacity: 0; }
}

/* ══════════════════════════════════════
   CANVAS
══════════════════════════════════════ */
#particles, #break-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
#particles    { z-index: 1; }
#break-canvas { z-index: 950; }

/* ══════════════════════════════════════
   SCREENS
══════════════════════════════════════ */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(2.5rem, env(safe-area-inset-top))
           max(1.5rem, env(safe-area-inset-right))
           max(2.5rem, env(safe-area-inset-bottom))
           max(1.5rem, env(safe-area-inset-left));
  opacity: 0;
  pointer-events: none;
  text-align: center;
  gap: var(--gap-md);
  transition: opacity 0.15s steps(3);
  z-index: 10;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
}

/* ══════════════════════════════════════
   SCREEN 0 — INTRO
══════════════════════════════════════ */
#screen-intro { gap: var(--gap-md); }

.tag-pill-sm {
  font-family: 'Jersey 10', sans-serif;
  font-size: var(--fs-md);
  letter-spacing: 0.3em;
  color: var(--magenta);
  text-shadow: var(--glow-m);
  text-transform: uppercase;
  animation: flicker 7s steps(1) infinite;
}
@keyframes flicker {
  0%,93%,100% { opacity: 1; }
  94%  { opacity: 0; }
  96%  { opacity: 1; }
  98%  { opacity: 0.4; }
}

#screen-intro h1 {
  font-family: 'Splatink', cursive;
  font-size: var(--title-fs);
  line-height: 1;
  color: var(--white);
  text-transform: uppercase;
  text-shadow: 3px 0 0 var(--magenta), -3px 0 0 var(--cyan);
  animation: chromAb 5s ease-in-out infinite;
}
@keyframes chromAb {
  0%,100% { text-shadow:  3px 0 0 var(--magenta), -3px 0 0 var(--cyan); }
  50%     { text-shadow: -3px 0 0 var(--magenta),  3px 0 0 var(--cyan); }
}
#screen-intro h1 em {
  font-style: normal;
  color: var(--yellow);
  display: block;
  font-family: 'Jersey 10', sans-serif;
  font-size: 0.4em;
  letter-spacing: 0.1em;
  text-shadow: var(--glow-y);
}

#screen-intro p {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-sm);
  letter-spacing: 0.06em;
  color: var(--white);
  line-height: 2.6;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(255,255,255,0.35);
  max-width: min(480px, 88vw);
}

#btn-start {
  padding: clamp(0.7rem, 3vw, 0.85rem) clamp(1.8rem, 7vw, 2.8rem);
  background: var(--yellow);
  color: var(--black);
  border: none;
  border-radius: 999px;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.7rem, 3vw, 1rem);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: none;
  min-height: 44px;
  box-shadow: var(--glow-y), 0 4px 24px rgba(200,255,0,0.25);
  transition: transform 0.1s, box-shadow 0.1s;
  animation: pillPulse 2.5s ease-in-out infinite;
}
@keyframes pillPulse {
  0%,100% { box-shadow: var(--glow-y), 0 4px 24px rgba(200,255,0,0.2); }
  50%     { box-shadow: 0 0 20px #c8ff00cc, 0 0 50px #c8ff0066, 0 6px 32px rgba(200,255,0,0.4); }
}
#btn-start:active { transform: scale(0.97); }
@media (hover: hover) {
  #btn-start:hover { transform: translateY(-2px); }
}

/* ══════════════════════════════════════
   SCREEN 1 — COUNTDOWN
══════════════════════════════════════ */
#screen-countdown .count-label {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-md);
  letter-spacing: 0.1em;
  color: var(--magenta);
  text-shadow: var(--glow-m);
  text-transform: uppercase;
}
.count-num {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--count-fs);
  line-height: 1;
  color: var(--cyan);
  text-shadow: var(--glow-c);
  animation: countGlow 0.9s ease-in-out infinite;
}
@keyframes countGlow {
  0%,100% { text-shadow: var(--glow-c); }
  50%     { text-shadow: 0 0 20px #E30413, 0 0 70px #E30413bb; }
}

/* ══════════════════════════════════════
   SCREEN 2 — JEU
══════════════════════════════════════ */
#screen-game { gap: var(--gap-sm); }

.warning-tag {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-lg);
  letter-spacing: 0.12em;
  color: var(--cyan);
  text-shadow: 0 0 8px #E30413, 0 0 30px #E30413cc, 0 0 70px #E3041366;
  text-transform: uppercase;
  border: 2px solid var(--cyan);
  box-shadow: 0 0 18px #E30413aa, inset 0 0 12px rgba(227,4,19,0.12);
  padding: clamp(0.4rem, 2vw, 0.6rem) clamp(1rem, 4vw, 1.8rem);
  border-radius: 4px;
  animation: blinkTag 0.7s steps(1) infinite;
}
@keyframes blinkTag {
  0%,54%   { opacity: 1; }
  55%,100% { opacity: 0; }
}

#screen-game h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-sm);
  text-transform: uppercase;
  color: var(--white);
  letter-spacing: 0.3em;
  text-shadow: 0 0 10px rgba(255,255,255,0.2);
}

.sub {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  line-height: 1.8;
  color: var(--white);
  text-transform: uppercase;
}

#timer-display {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--timer-fs);
  color: var(--yellow);
  text-shadow:
    0 0 8px  #56d639,
    0 0 24px #56d639cc,
    0 0 60px #56d63988,
    0 0 120px #56d63944;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
  transition: color 0.2s, text-shadow 0.2s;
  animation: timerPulse 1.2s ease-in-out infinite;
}
@keyframes timerPulse {
  0%,100% {
    text-shadow: 0 0 8px #56d639, 0 0 24px #56d639cc,
                 0 0 60px #56d63988, 0 0 120px #56d63944;
  }
  50% {
    text-shadow: 0 0 12px #56d639, 0 0 40px #56d639,
                 0 0 90px #56d639bb, 0 0 180px #56d63966;
  }
}
#timer-display.danger {
  color: var(--magenta);
  text-shadow:
    0 0 8px  #ff009e, 0 0 24px #ff009ecc,
    0 0 60px #ff009e88, 0 0 120px #ff009e44;
  animation: timerPanic 0.1s steps(2) infinite,
             timerPulseDanger 0.6s ease-in-out infinite;
}
@keyframes timerPanic {
  0%  { transform: translateX(0); }
  50% { transform: translateX(3px); }
}
@keyframes timerPulseDanger {
  0%,100% {
    text-shadow: 0 0 8px #ff009e, 0 0 24px #ff009ecc,
                 0 0 60px #ff009e88, 0 0 120px #ff009e44;
  }
  50% {
    text-shadow: 0 0 12px #ff009e, 0 0 40px #ff009e,
                 0 0 90px #ff009ebb, 0 0 180px #ff009e66;
  }
}

.timer-unit {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-xs);
  letter-spacing: 0.2em;
  color: var(--white);
  text-transform: uppercase;
  margin-top: -0.5rem;
}

#game-level {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-xs);
  color: var(--yellow);
  text-shadow: var(--glow-y);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

#total-score-display {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-xs);
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.progress-bar-wrap {
  width: min(360px, 78vw);
  height: 5px;
  background: none;
  border-radius: 999px;
  overflow: hidden;
}
#progress-bar {
  height: 100%;
  background: var(--yellow);
  box-shadow: var(--glow-y);
  width: 0%;
  border-radius: 999px;
  transition: background 0.3s, box-shadow 0.3s;
}
#progress-bar.danger-bar {
  background: var(--magenta);
  box-shadow: var(--glow-m);
}

/* ══════════════════════════════════════
   SCREEN 3 — FAIL
══════════════════════════════════════ */
#screen-fail { gap: var(--gap-md); }

.fail-code {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-sm);
  letter-spacing: 0.1em;
  color: var(--cyan);
  text-shadow: var(--glow-c);
  text-transform: uppercase;
}

#screen-fail h2 {
  font-family: 'Splatink', cursive;
  font-size: var(--fail-h2-fs);
  text-transform: uppercase;
  color: var(--white);
  line-height: 0.9;
  margin-bottom: 0.8rem;
  text-shadow: 4px 0 0 var(--magenta), -4px 0 0 var(--cyan);
  animation: glitchFail 0.6s steps(3) infinite;
}
@keyframes glitchFail {
  0%,80%,100% { clip-path: none; transform: none; }
  82% { clip-path: polygon(0 8%,100% 8%,100% 30%,0 30%); transform: translateX(6px); }
  86% { clip-path: polygon(0 60%,100% 60%,100% 80%,0 80%); transform: translateX(-5px); }
  90% { clip-path: none; transform: none; }
}

.fail-time {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-lg);
  color: var(--white);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.fail-time span { color: var(--yellow); text-shadow: var(--glow-y); }

.fail-total {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-md);
  color: var(--magenta);
  text-shadow: var(--glow-m);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.fail-total span { color: var(--yellow); text-shadow: var(--glow-y); }

.fail-level {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-xs);
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#screen-fail .message {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--white);
  max-width: min(480px, 88vw);
  line-height: 2.4;
  border-left: 2px solid var(--magenta);
  box-shadow: -5px 0 12px rgba(255,0,158,0.2);
  padding-left: 1rem;
  text-align: left;
  text-transform: uppercase;
}
#screen-fail .message em {
  color: var(--cyan);
  text-shadow: var(--glow-c);
  font-style: normal;
}

/* ══════════════════════════════════════
   RÉCOMPENSES FESTIVAL
══════════════════════════════════════ */
#reward-banner {
  background: linear-gradient(135deg, rgba(86,214,57,0.15), rgba(89,110,226,0.15));
  border: 2px solid var(--yellow);
  border-radius: 12px;
  padding: 0.6rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  max-width: min(400px, 88vw);
  box-shadow: var(--glow-y), inset 0 0 20px rgba(86,214,57,0.05);
  animation: rewardGlow 1.5s ease-in-out infinite;
}
@keyframes rewardGlow {
  0%,100% { box-shadow: var(--glow-y), inset 0 0 20px rgba(86,214,57,0.05); }
  50%     { box-shadow: 0 0 20px #56d639cc, 0 0 50px #56d63966, inset 0 0 30px rgba(86,214,57,0.12); }
}
#reward-icon {
  font-size: 2rem;
  flex-shrink: 0;
}
#reward-text {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-xs);
  color: var(--yellow);
  text-shadow: var(--glow-y);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  line-height: 1.8;
}
#reward-text .reward-label {
  font-size: 0.5rem;
  color: rgba(255,255,255,0.5);
  display: block;
  margin-bottom: 2px;
}

/* Rewards list dans l'écran level up */
.rewards-unlocked {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(360px, 88vw);
  width: 100%;
}
.reward-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: clamp(8px, 2.5vw, 10px) clamp(12px, 3vw, 16px);
  background: rgba(86,214,57,0.08);
  border: 1px solid rgba(86,214,57,0.3);
  border-radius: 10px;
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--yellow);
  animation: rewardSlideIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes rewardSlideIn {
  from { transform: translateX(-20px) scale(0.9); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}
.reward-item .ri-icon { font-size: clamp(1.4rem, 5vw, 1.6rem); flex-shrink: 0; }
.reward-item .ri-name { flex: 1; color: var(--white); font-size: clamp(0.44rem, 1.8vw, 0.56rem); line-height: 1.7; }
.reward-item .ri-new {
  font-size: clamp(0.38rem, 1.4vw, 0.48rem);
  color: var(--yellow);
  background: rgba(86,214,57,0.2);
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid var(--yellow);
  animation: blinkTag 0.5s steps(1) infinite;
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   SCREEN 4 — WIN / LEVEL UP
══════════════════════════════════════ */
#screen-win, #screen-level-up { gap: var(--gap-sm); }

.win-score-label {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-lg);
  letter-spacing: 0.15em;
  color: var(--magenta);
  text-shadow: var(--glow-m);
  text-transform: uppercase;
  animation: blinkTag 0.6s steps(1) infinite;
}
.win-score {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--win-score-fs);
  color: var(--yellow);
  line-height: 1;
  text-shadow: var(--glow-y);
  letter-spacing: -0.03em;
}
.win-label {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  color: var(--white);
  text-transform: uppercase;
  margin-top: -0.6rem;
}
.win-high-score {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-lg);
  color: var(--yellow);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: var(--glow-y);
  animation: blinkTag 0.5s steps(1) infinite;
}
.win-msg {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--white);
  text-transform: uppercase;
  line-height: 2.4;
}

#levelup-total {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-sm);
  color: var(--cyan);
  text-shadow: var(--glow-c);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════
   BOUTONS RETRY
══════════════════════════════════════ */
.btn-retry {
  padding: clamp(0.6rem, 2.5vw, 0.75rem) clamp(1.5rem, 6vw, 2.4rem);
  background: transparent;
  border: 2px solid var(--white);
  color: var(--white);
  border-radius: 999px;
  font-family: 'Archivo Black', sans-serif;
  font-size: clamp(0.65rem, 2.5vw, 0.8rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: none;
  min-height: 44px;
  transition: all 0.15s;
}
.btn-retry:active {
  border-color: var(--yellow);
  color: var(--yellow);
  box-shadow: var(--glow-y);
}
@media (hover: hover) {
  .btn-retry:hover {
    border-color: var(--yellow);
    color: var(--yellow);
    box-shadow: var(--glow-y);
  }
}

/* ══════════════════════════════════════
   SCREEN PROFIL
══════════════════════════════════════ */
#screen-profile {
  gap: var(--gap-sm);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#screen-profile h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-sm);
  letter-spacing: 0.2em;
  color: var(--yellow);
  text-shadow: var(--glow-y);
  text-transform: uppercase;
}
#user-name {
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--yellow);
  color: var(--white);
  font-family: 'Press Start 2P', monospace;
  font-size: max(16px, 0.85rem);
  text-align: center;
  padding: 0.5rem 1rem;
  outline: none;
  width: min(280px, 80vw);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
#avatar-preview {
  font-size: 4.5rem;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--yellow);
  box-shadow: var(--glow-y);
  background: rgba(0,240,255,0.05);
}
.avatar-section-label {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-xs);
  color: var(--yellow);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.avatar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: min(340px, 88vw);
  max-height: 130px;
  overflow-y: auto;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
}
.avatar-grid-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  font-size: 1.4rem;
  width: 44px;
  height: 44px;
  cursor: none;
  transition: all 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}
.avatar-grid-btn:active,
.avatar-grid-btn.selected {
  background: rgba(200,255,0,0.18);
  border-color: var(--yellow);
  box-shadow: 0 0 8px #c8ff0066;
}
@media (hover: hover) {
  .avatar-grid-btn:hover {
    background: rgba(0,240,255,0.12);
    border-color: var(--yellow);
    box-shadow: 0 0 8px #c8ff0066;
  }
}

/* ══════════════════════════════════════
   LEADERBOARD
══════════════════════════════════════ */
#leaderboard-list,
#leaderboard-list-fail,
#leaderboard-list-reset {
  width: 100%;
  max-width: 340px;
}
.leader-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-xs);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.leader-item.current-user { color: var(--yellow); }
.leader-rank  { min-width: 18px; opacity: 0.5; }
.avatar-mini  { font-size: 1rem; }
.leader-name  { flex: 1; }
.leader-score { color: var(--yellow); }
.lb-loading {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-xs);
  opacity: 0.5;
}

/* ══════════════════════════════════════
   STICKERS SPAM
══════════════════════════════════════ */
.sticker-spam {
  position: fixed;
  pointer-events: none;
  z-index: 500;
  filter: drop-shadow(2px 4px 8px rgba(0,0,0,0.7));
  animation: stickerPop 0.25s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
.sticker-splat {
  position: fixed;
  pointer-events: none;
  z-index: 9000;
  filter: drop-shadow(1px 3px 6px rgba(0,0,0,0.55));
  opacity: 0;
}
@keyframes stickerPop {
  0%   { transform: scale(0) rotate(var(--rot)); opacity: 0; }
  100% { transform: scale(1) rotate(var(--rot)); opacity: 1; }
}

/* ══════════════════════════════════════
   CONFETTIS WIN
══════════════════════════════════════ */
.px-confetti {
  position: fixed;
  pointer-events: none;
  z-index: 2;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { opacity: 1; transform: translateY(-20px) rotate(0deg); }
  100% { opacity: 0; transform: translateY(110vh) rotate(720deg); }
}

/* ══════════════════════════════════════
   SHAKE
══════════════════════════════════════ */
@keyframes shakeAnim {
  0%,100% { transform: translateX(0); }
  15% { transform: translateX(-6px) rotate(-1deg); }
  30% { transform: translateX(6px) rotate(1deg); }
  45% { transform: translateX(-5px); }
  60% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
}
.shaking { animation: shakeAnim 0.4s ease-in-out; }

/* ══════════════════════════════════════
   IOS NOTIFICATIONS
══════════════════════════════════════ */
#ios-notifications-container {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(380px, 92vw);
  z-index: 10000;
  pointer-events: none;
}
.ios-notif {
  background: rgba(242,242,247,0.94);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: black;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  box-shadow: 0 8px 28px rgba(0,0,0,0.38), 0 0 0 0.5px rgba(0,0,0,0.06);
  animation: iosSlide 0.5s cubic-bezier(0.18,0.89,0.32,1.28);
}
@keyframes iosSlide {
  from { transform: translateY(-90px) scale(0.94); opacity: 0; }
  to   { transform: translateY(0)     scale(1);    opacity: 1; }
}
.ios-notif-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  flex-shrink: 0;
  overflow: hidden;
}
.ios-notif-icon svg { width: 100%; height: 100%; display: block; }
.ios-notif-body { flex: 1; min-width: 0; }
.ios-notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1px;
}
.ios-notif-app {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(60,60,67,0.55);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.ios-notif-time { font-size: 0.7rem; color: rgba(60,60,67,0.45); }
.ios-notif-sender {
  font-size: 0.87rem;
  font-weight: 600;
  color: #1c1c1e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ios-notif-msg {
  font-size: 0.84rem;
  color: rgba(60,60,67,0.82);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ══════════════════════════════════════
   IOS CALL
══════════════════════════════════════ */
.ios-call {
  position: fixed;
  inset: 0;
  background: #1c1c1e;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: max(80px, env(safe-area-inset-top) + 40px)
           0
           max(60px, env(safe-area-inset-bottom) + 20px);
  font-family: -apple-system, sans-serif;
}
.call-avatar {
  font-size: 4.5rem;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.call-type {
  color: rgba(255,255,255,0.5);
  font-size: 0.82rem;
  margin-top: 14px;
  letter-spacing: 0.02em;
}
.call-name {
  font-size: 2.2rem;
  color: white;
  font-weight: 300;
  margin-top: 4px;
  text-align: center;
}
.call-status {
  color: rgba(255,255,255,0.55);
  font-size: 0.9rem;
  margin-top: 6px;
  animation: callPulse 1.4s ease-in-out infinite;
}
@keyframes callPulse {
  0%, 100% { opacity: 0.55; }
  50%       { opacity: 1; }
}
.call-actions { display: flex; gap: 70px; margin-top: auto; }
.call-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.call-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
}
.decline .call-circle { background: #FF3B30; }
.accept  .call-circle { background: #34C759; }
.call-btn > span { font-size: 0.78rem; color: rgba(255,255,255,0.85); font-family: -apple-system, sans-serif; }

/* ══════════════════════════════════════
   AIRDROP
══════════════════════════════════════ */
.airdrop-overlay {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: max(60px, env(safe-area-inset-bottom) + 20px);
  pointer-events: all;
}
.airdrop-box {
  background: rgba(30,30,30,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 24px 28px;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: white;
  width: min(320px, 88vw);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.12);
}
.airdrop-icon  { font-size: 2.5rem; margin-bottom: 8px; }
.airdrop-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.airdrop-sender{ font-size: 0.9rem; color: rgba(255,255,255,0.7); margin-bottom: 2px; }
.airdrop-msg   { font-size: 0.8rem; color: rgba(255,255,255,0.5); margin-bottom: 20px; }
.airdrop-actions { display: flex; gap: 12px; }
.airdrop-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  min-height: 44px;
}
.airdrop-decline { background: rgba(255,255,255,0.12); color: white; }
.airdrop-accept  { background: #007AFF; color: white; }

/* ══════════════════════════════════════
   SCREEN LEADERBOARD
══════════════════════════════════════ */
#screen-leaderboard { gap: var(--gap-md); }

#screen-leaderboard h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: var(--fs-sm);
  letter-spacing: 0.2em;
  color: var(--yellow);
  text-shadow: var(--glow-y);
  text-transform: uppercase;
}

/* ══════════════════════════════════════
   DINO PAGE — styles intégrés
══════════════════════════════════════ */

/* Layout body du dino (class sur body quand on est sur dino.html) */
body.dino-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding:
    max(2.5rem, env(safe-area-inset-top) + 1rem)
    clamp(1rem, 4vw, 2rem)
    max(1.2rem, env(safe-area-inset-bottom) + 0.8rem);
  overflow: hidden;
}

#dino-title-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.dino-error-tag {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.38rem, 1.5vw, 0.56rem);
  letter-spacing: 0.28em;
  color: var(--cyan);
  text-shadow: var(--glow-c);
  animation: flicker 7s steps(1) infinite;
}

.dino-h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(1.5rem, 7vw, 3.8rem);
  line-height: 1.15;
  letter-spacing: 0.05em;
  color: var(--white);
  text-shadow: 3px 0 0 var(--cyan), -3px 0 0 var(--magenta);
  animation: chromAb 5s ease-in-out infinite;
}

.dino-subtitle {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.36rem, 1.2vw, 0.5rem);
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
}

#dino-game-section {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-shrink: 0;
}

#dino-hud {
  display: flex;
  justify-content: flex-end;
  gap: 1.5rem;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.4rem, 1.3vw, 0.56rem);
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.6);
  padding-right: 0.3rem;
}
#dino-score-val { color: var(--white); }

#canvas-wrap {
  position: relative;
  width: 100%;
}

#dino-canvas {
  display: block;
  width: 100%;
  height: clamp(130px, 25vh, 210px);
  background: transparent;
  border-top: 1px solid rgba(255,255,255,0.1);
}

#dino-overlay {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  pointer-events: none;
}

.ov-idle {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.4rem, 1.4vw, 0.58rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  animation: ovBlink 1s steps(1) infinite;
  text-align: center;
  padding: 0 1rem;
  line-height: 2.2;
}
@keyframes ovBlink {
  0%,49% { opacity: 1; }
  50%,100% { opacity: 0.2; }
}

#ov-gameover {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.85rem, 4vw, 1.3rem);
  letter-spacing: 0.25em;
  color: var(--cyan);
  text-shadow: var(--glow-c);
}

.ov-sub {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.36rem, 1.2vw, 0.5rem);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.38);
  text-align: center;
}

.hint-touch { display: none; }
.hint-mouse { display: block; }
@media (hover: none) and (pointer: coarse) {
  .hint-mouse { display: none; }
  .hint-touch { display: block; }
}

.hidden { display: none !important; }

#dino-restart-btn {
  background: var(--bg);
  border: 2px solid var(--white);
  color: var(--white);
  border-radius: 999px;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.4rem, 1.3vw, 0.56rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.55rem 1.4rem;
  cursor: none;
  pointer-events: all;
  min-height: 44px;
  transition: all 0.15s;
}
@media (hover: hover) {
  #dino-restart-btn:hover {
    border-color: var(--yellow);
    color: var(--yellow);
    box-shadow: var(--glow-y);
  }
}
#dino-restart-btn:active {
  border-color: var(--yellow);
  color: var(--yellow);
}

#dino-footer { flex-shrink: 0; }

.btn-menu {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  background: transparent;
  border: 2px solid var(--yellow);
  color: var(--yellow);
  border-radius: 999px;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.38rem, 1.3vw, 0.52rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.6rem 1.6rem;
  min-height: 44px;
  transition: all 0.15s;
}
@media (hover: hover) {
  .btn-menu:hover {
    box-shadow: var(--glow-y);
  }
}
.btn-menu:active { box-shadow: var(--glow-y); }

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 900px) {
  :root {
    --timer-fs:     clamp(4rem, 22vw, 14rem);
    --count-fs:     clamp(7rem, 30vw, 16rem);
    --win-score-fs: clamp(4rem, 22vw, 12rem);
  }
}

@media (max-width: 480px) {
  :root {
    --timer-fs:     clamp(3.8rem, 23vw, 8rem);
    --count-fs:     clamp(6rem, 35vw, 10rem);
    --title-fs:     clamp(2.4rem, 13vw, 3.8rem);
    --fail-h2-fs:   clamp(2.8rem, 15vw, 5.5rem);
    --win-score-fs: clamp(3.5rem, 22vw, 7rem);
    --gap-md: 0.8rem;
    --gap-sm: 0.5rem;
  }
  .screen { gap: var(--gap-sm); }
  #screen-intro p { display: none; }
  #screen-game h2, .sub { display: none; }
  .warning-tag { padding: 0.35rem 0.9rem; }
  #screen-fail .message { max-width: 90vw; font-size: 0.52rem; }
  .progress-bar-wrap { width: min(280px, 86vw); }
  #user-name { width: min(240px, 86vw); }
  .avatar-grid-btn { width: 40px; height: 40px; font-size: 1.2rem; }
  body.dino-page { gap: 0.9rem; }
  .dino-h1 { font-size: clamp(1.3rem, 10vw, 2rem); }
}

@media (max-width: 360px) {
  :root {
    --timer-fs:   clamp(3rem, 24vw, 6rem);
    --count-fs:   clamp(5rem, 36vw, 8rem);
    --title-fs:   clamp(2rem, 14vw, 3rem);
    --fail-h2-fs: clamp(2.4rem, 16vw, 4.5rem);
  }
}

@media (max-height: 500px) {
  :root {
    --timer-fs:   clamp(3rem, 20vh, 7rem);
    --count-fs:   clamp(4.5rem, 28vh, 9rem);
    --title-fs:   clamp(1.8rem, 9vh, 3.2rem);
    --gap-md: 0.5rem;
    --gap-sm: 0.3rem;
  }
  .screen { gap: 0.3rem; padding: 0.8rem 1rem; }
  #screen-intro p { display: none; }
  #screen-game h2, .sub { display: none; }
  .timer-unit { margin-top: 0; }
  #screen-fail h2 { line-height: 1; }
  .call-actions { gap: 44px; }
  .call-circle { width: 62px; height: 62px; font-size: 1.6rem; }
  body.dino-page { gap: 0.4rem; }
  .dino-error-tag, .dino-subtitle { display: none; }
  .dino-h1 { font-size: clamp(0.9rem, 4vh, 1.5rem); }
  #dino-canvas { height: clamp(100px, 28vh, 140px); }
  #dino-footer { display: none; }
}

@media (max-height: 380px) {
  .dino-h1 { font-size: clamp(0.7rem, 3vh, 1rem); }
  #dino-canvas { height: clamp(90px, 30vh, 120px); }
}

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

/* ══════════════════════════════════════
   MODALE QR CODE RÉCOMPENSES
══════════════════════════════════════ */

#qr-modal {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  /* Rétablit le curseur dans la modale — override du cursor:none global */
  cursor: auto;
}

/* Tous les éléments dans la modale héritent du curseur normal */
#qr-modal * {
  cursor: auto;
}
#qr-modal button,
#qr-modal .qr-close-btn {
  cursor: pointer;
}

.qr-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.qr-modal-box {
  position: relative;
  background: #111;
  border: 2px solid var(--yellow);
  border-radius: 20px;
  padding: 1.6rem 1.4rem 1.2rem;
  width: min(340px, 92vw);
  box-shadow: var(--glow-y), 0 20px 60px rgba(0,0,0,0.8);
  transform: scale(0.88) translateY(20px);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.qr-close-btn {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--white);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  min-height: unset;
  font-family: 'Archivo Black', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.qr-close-btn:active { background: rgba(255,255,255,0.25); transform: scale(0.93); }
@media (hover: hover) { .qr-close-btn:hover { background: rgba(255,255,255,0.2); } }

.qr-modal-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-right: 2rem;
}

.qr-reward-icon {
  font-size: 2.4rem;
  flex-shrink: 0;
}

.qr-reward-name {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.55rem, 2vw, 0.72rem);
  color: var(--yellow);
  text-shadow: var(--glow-y);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.6;
}

.qr-reward-desc {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.42rem, 1.5vw, 0.54rem);
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 3px;
}

/* QR image */
.qr-code-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.qr-frame {
  background: white;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 0 24px rgba(86,214,57,0.3), 0 0 60px rgba(86,214,57,0.12);
  border: 3px solid var(--yellow);
}

.qr-frame img {
  display: block;
  border-radius: 4px;
}

.qr-code-label {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.5rem, 1.8vw, 0.65rem);
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.qr-code-label span {
  color: var(--yellow);
  text-shadow: var(--glow-y);
  font-size: 1.1em;
}

/* Étapes */
.qr-instructions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qr-inst-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.42rem, 1.5vw, 0.54rem);
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.8;
}

.qr-step-num {
  background: var(--yellow);
  color: var(--black);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  flex-shrink: 0;
  font-weight: bold;
}

.qr-validity {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.36rem, 1.2vw, 0.46rem);
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 0.6rem;
}

/* Badge QR sur les reward-items */
.ri-qr {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.42rem, 1.6vw, 0.52rem);
  color: var(--black);
  background: var(--yellow);
  border: none;
  border-radius: 6px;
  padding: clamp(4px, 1.2vw, 6px) clamp(8px, 2vw, 12px);
  letter-spacing: 0.06em;
  flex-shrink: 0;
  font-weight: bold;
  box-shadow: var(--glow-y);
  white-space: nowrap;
}

/* Sur mobile : rendre les reward-items bien plus visibles */
@media (max-width: 480px) {
  .reward-item {
    padding: 12px 14px;
    gap: 12px;
    border-radius: 10px;
    border-width: 2px;
  }
  .ri-icon { font-size: 1.8rem !important; }
  .ri-name {
    font-size: 0.52rem !important;
    line-height: 1.6;
  }
  .ri-qr {
    font-size: 0.5rem;
    padding: 6px 10px;
  }
  .ri-new {
    font-size: 0.46rem;
    padding: 3px 7px;
  }
  .rewards-unlocked {
    gap: 8px;
  }
  .reward-zone-title {
    font-size: 0.44rem;
    margin-bottom: 8px;
  }
}

.reward-item-tap {
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  /* Zone tactile généreuse */
  min-height: 52px;
}
.reward-item-tap:active {
  background: rgba(86,214,57,0.22);
  border-color: var(--yellow);
  transform: scale(0.97);
}
@media (hover: hover) {
  .reward-item-tap {
    cursor: pointer;
  }
  .reward-item-tap:hover {
    background: rgba(86,214,57,0.14);
    border-color: var(--yellow);
  }
}

/* Label titre zone récompenses */
.reward-zone-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.38rem, 1.3vw, 0.5rem);
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 6px;
}