:root {
  --cyan: #00f3ff;
  --magenta: #ff00ff;
  --red: #ff3333;
  --gold: #ffaa00;
  --bg-dark: #07080a;
  --glass-bg: rgba(11, 12, 16, 0.75);
  --font-main: "Orbitron", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

body {
  background-color: var(--bg-dark);
  color: #fff;
  font-family: var(--font-main);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background-image:
    linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hidden {
  display: none !important;
}
.mb-2 {
  margin-bottom: 2rem;
}

/* Panels & Glassmorphism */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 243, 255, 0.15);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.8),
    inset 0 0 20px rgba(0, 243, 255, 0.05);
  border-radius: 12px;
}

.absolute-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  padding: 3rem;
  text-align: center;
  border-color: var(--magenta);
}

/* Layout Principal */
#app {
  display: flex;
  width: 95vw;
  height: 95vh;
  max-width: 1400px;
  gap: 20px;
}

#hud {
  flex: 0 0 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

#game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* Typographie Néon */
.neon-cyan {
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan);
}
.neon-magenta {
  color: var(--magenta);
  text-shadow: 0 0 8px var(--magenta);
}
.neon-red {
  color: var(--red);
  text-shadow: 0 0 10px var(--red);
}
.value {
  font-size: 1.8rem;
  font-weight: 900;
}
.subtitle {
  letter-spacing: 4px;
  font-size: 0.8rem;
  margin-bottom: 20px;
  color: #888;
}

/* Target Canvas */
#target-container {
  border: 2px solid var(--red);
  box-shadow: 0 0 15px rgba(255, 51, 51, 0.3);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 51, 51, 0.05);
  margin-bottom: auto;
}

.stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  padding: 10px;
  border-radius: 8px;
}

/* Barre de Temps */
#timer-container {
  width: 100%;
  height: 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  margin-bottom: 15px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#timer-bar {
  height: 100%;
  width: 100%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  transition:
    width 0.1s linear,
    background-color 0.3s;
}

#timer-bar.warning {
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
}
#timer-bar.danger {
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
  animation: pulse 0.5s infinite;
}

/* Canvas Principal */
#crowdCanvas {
  flex: 1;
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
}

@media (max-width: 760px) {
  #app { width: calc(100vw - 16px); height: calc(100dvh - 16px); flex-direction: column; gap: 8px; }
  #hud { flex: 0 0 auto; min-height: 128px; padding: 8px 12px; display: grid; grid-template-columns: 90px 1fr; grid-template-rows: auto 1fr; column-gap: 12px; }
  #hud h2 { margin: 0; font-size: 1rem; } #hud .subtitle { margin: 2px 0 5px; font-size: .55rem; }
  #target-container { grid-column: 1; grid-row: 1 / 3; margin: 0; padding: 4px; }
  #targetCanvas { display: block; width: 78px; height: 78px; }
  .stats { grid-column: 2; grid-row: 2; flex-direction: row; gap: 8px; }
  .stat-box { flex: 1; padding: 6px; font-size: .6rem; } .value { font-size: 1.1rem; }
  #game-area { min-height: 0; padding: 10px; } #timer-container { height: 10px; margin-bottom: 8px; }
}

@media (max-height: 620px) and (orientation: landscape) {
  #app { height: calc(100dvh - 12px); width: calc(100vw - 12px); gap: 8px; }
  #hud { flex-basis: 180px; padding: 10px; } #targetCanvas { width: 90px; height: 90px; }
  #game-area { padding: 10px; }
}

/* Boutons */
.cyber-btn {
  background: transparent;
  color: #fff;
  font-family: var(--font-main);
  font-weight: 900;
  font-size: 1.2rem;
  padding: 15px 30px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 2px;
}
.cyan-glow:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}
.magenta-glow:hover {
  border-color: var(--magenta);
  color: var(--magenta);
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.4);
}

/* Effets Visuels (Juice) */
#flash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--red);
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity 0.1s;
}

.shake {
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%,
  90% {
    transform: translate3d(-2px, 0, 0);
  }
  20%,
  80% {
    transform: translate3d(4px, 0, 0);
  }
  30%,
  50%,
  70% {
    transform: translate3d(-6px, 0, 0);
  }
  40%,
  60% {
    transform: translate3d(6px, 0, 0);
  }
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

.glitch-text {
  position: relative;
}
.glitch-text::before,
.glitch-text::after {
  content: "WANTED";
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0.8;
}
.glitch-text::before {
  color: var(--cyan);
  z-index: -1;
  animation: glitch-anim 2s infinite linear alternate-reverse;
}
.glitch-text::after {
  color: var(--magenta);
  z-index: -2;
  animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
  0% {
    clip-path: inset(20% 0 80% 0);
    transform: translate(-2px, 1px);
  }
  20% {
    clip-path: inset(60% 0 10% 0);
    transform: translate(2px, -1px);
  }
  40% {
    clip-path: inset(40% 0 50% 0);
    transform: translate(-2px, 2px);
  }
  60% {
    clip-path: inset(80% 0 5% 0);
    transform: translate(2px, -2px);
  }
  80% {
    clip-path: inset(10% 0 70% 0);
    transform: translate(-1px, 1px);
  }
  100% {
    clip-path: inset(30% 0 40% 0);
    transform: translate(1px, -1px);
  }
}
