/* ============================================================
   TAK-TAK – game.css  (design moderne)
   ============================================================ */

#game-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: none;
}

/* ── HUD ───────────────────────────────────────────────── */
.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: #06080f;
  border-top: 1px solid rgba(255,255,255,0.06);
  gap: 16px;
  flex-wrap: wrap;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
}

.hud-label {
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.7rem;
}

.hud-value-score {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fbbf24;
  letter-spacing: 1px;
}

.hud-value-level {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #22d3ee;
}

.hud-lives { display: flex; gap: 4px; }

.hud-heart {
  font-size: 1.4rem;
  transition: opacity 0.3s, transform 0.3s;
}
.hud-heart.lost {
  opacity: 0.2;
  transform: scale(0.75);
}

/* ── Game overlay screens ──────────────────────────────── */
.game-screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #06080f;
  z-index: 10;
  gap: 18px;
  text-align: center;
  padding: 28px;
}
.game-screen.active {
  display: flex;
  pointer-events: auto;
}

/* Menu : fond transparent pour s'intégrer à la page */
#menu-screen {
  background: transparent;
}

/* Quand le menu est actif, le game-wrapper se fond dans la page */
.game-wrapper:has(#menu-screen.active) {
  background: transparent;
  box-shadow: none;
  border: none;
}

/* La pause reste semi-transparente pour voir le jeu derrière */
#pause-screen {
  background: rgba(6, 8, 15, 0.82);
  backdrop-filter: blur(2px);
}

.screen-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: 3px;
  line-height: 1;
}

/* ── Animation néon TAK-TAK (menu principal uniquement) ── */
@keyframes taktak-neon {
  0%   {
    color: #fff;
    text-shadow: 0 0 6px #fff, 0 0 18px #fff, 0 0 36px #ff6a00, 0 0 72px #ff6a00;
  }
  3%   {
    color: rgba(255,255,255,0.7);
    text-shadow: 0 0 2px #ff6a00, 0 0 6px #ff6a00;
  }
  5%   {
    color: #fff;
    text-shadow: 0 0 6px #fff, 0 0 18px #fff, 0 0 36px #ff6a00, 0 0 72px #ff6a00;
  }
  30%  {
    color: #ffaa55;
    text-shadow: 0 0 8px #ff6a00, 0 0 24px #ff6a00, 0 0 52px #ff6a00, 0 0 96px #ff6a00;
  }
  50%  {
    color: #fff;
    text-shadow: 0 0 6px #fff, 0 0 18px #fff, 0 0 36px #22d3ee, 0 0 72px #22d3ee;
  }
  80%  {
    color: #7ee8ff;
    text-shadow: 0 0 8px #22d3ee, 0 0 24px #22d3ee, 0 0 52px #22d3ee, 0 0 96px #22d3ee;
  }
  100% {
    color: #fff;
    text-shadow: 0 0 6px #fff, 0 0 18px #fff, 0 0 36px #ff6a00, 0 0 72px #ff6a00;
  }
}

@keyframes taktak-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-5px) scale(1.04); }
}

#menu-screen .screen-title {
  font-size: clamp(2.4rem, 7vw, 4rem);
  animation: taktak-neon 4s ease-in-out infinite,
             taktak-float 4s ease-in-out infinite;
}

.screen-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.78rem, 2vw, 0.9rem);
  color: #94a3b8;
  line-height: 1.8;
}

.screen-score {
  font-family: 'Rajdhani', sans-serif;
  font-size: clamp(1.2rem, 4vw, 2rem);
  font-weight: 700;
  color: #fbbf24;
  letter-spacing: 2px;
}

.screen-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* Boutons d'overlay du jeu */
.screen-btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
}

.screen-btn-start {
  background: #ff6a00;
  color: #fff;
}
.screen-btn-start:hover {
  background: #cc5000;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255,106,0,0.4);
}

.screen-btn-orange {
  background: rgba(251,191,36,0.15);
  color: #fbbf24;
  border: 1px solid rgba(251,191,36,0.3);
}
.screen-btn-orange:hover {
  background: rgba(251,191,36,0.25);
}

.screen-btn-blue {
  background: rgba(34,211,238,0.12);
  color: #22d3ee;
  border: 1px solid rgba(34,211,238,0.3);
}
.screen-btn-blue:hover {
  background: rgba(34,211,238,0.22);
}

/* ── Controls hint ─────────────────────────────────────── */
.controls-hint {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.control-key {
  font-size: 0.75rem;
  color: #64748b;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 4px 10px;
  font-weight: 500;
}

/* ── Score saved badge ─────────────────────────────────── */
.score-saved-badge {
  font-size: 0.85rem;
  color: #10b981;
  animation: fadeIn 0.5s ease;
}

/* ── Touch controls (mobile) ───────────────────────────── */
/* Position fixed dès le départ – hors de tout overflow:hidden */
.touch-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 90px;
  z-index: 100;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px 12px;
  pointer-events: none;
}

@media (pointer: coarse) {
  #game-canvas {
    width: 100%;
    height: auto;
  }
  .touch-controls {
    display: flex;
  }
  /* Empêche iOS de scroller pendant le jeu */
  .game-wrapper {
    touch-action: none;
  }
}

/* Paysage mobile : tout tenir dans une seule vue sans scroll */
@media (pointer: coarse) and (orientation: landscape) {
  #game-canvas {
    width: auto;
    height: calc(100svh - 90px);
    max-width: 100%;
  }
  .game-wrapper {
    display: flex;
    justify-content: center;
  }

  /* Le container devient transparent, chaque bouton est positionné individuellement */
  .touch-controls {
    display: contents;
  }
  #touch-left {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 60px;
    height: auto;
    border-radius: 0;
    font-size: 1.8rem;
    opacity: 0.55;
  }
  #touch-right {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 60px;
    height: auto;
    border-radius: 0;
    font-size: 1.8rem;
    opacity: 0.55;
  }

  .game-hud {
    padding: 4px 16px;
    gap: 10px;
    flex-wrap: nowrap;
  }
  .hud-label { display: none; }
  .hud-value-score, .hud-value-level { font-size: 1.3rem; }
  .hud-heart { font-size: 1.1rem; }
}

.touch-btn {
  pointer-events: auto;
  width: 90px;
  height: 65px;
  background: rgba(0, 212, 255, 0.15);
  border: 2px solid rgba(0, 212, 255, 0.35);
  border-radius: 14px;
  color: #00d4ff;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.touch-btn:active {
  background: rgba(0, 212, 255, 0.35);
  border-color: rgba(0, 212, 255, 0.7);
}

/* ── Animations ────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
