/**
 * Grouvel Games Theme
 * Styles pour les jeux avec effet Matrix/Tron
 */

/* === Variables specifiques aux jeux === */
:root {
  color-scheme: dark;
}

/* === Reset et base === */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--games-bg, #000);
  color: var(--games-text, #b8fff2);
  font-family: var(--font-family-games, 'Inter', 'Noto Sans JP', system-ui, -apple-system, Segoe UI, Roboto, sans-serif);
}

/* === Canvas Matrix rain === */
#jp-rain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

/* === Overlay de contenu === */
.overlay {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--games-primary, #00ffcc);
}

/* === Typographie jeux === */
.overlay h1 {
  margin: 2rem 0 0.4rem;
  font-size: 3rem;
  text-shadow: 0 0 15px var(--games-primary, #00ffcc), 0 0 3px var(--games-primary, #00ffcc);
  color: var(--games-primary, #00ffcc);
}

/* === Controles === */
.controls {
  margin-top: 0.6rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  color: var(--games-text, #b8fff2);
}

.controls input[type="range"] {
  width: 240px;
  accent-color: var(--games-primary, #00ffcc);
}

/* === Boutons jeux === */
.buttons {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

a.button,
.button {
  display: inline-block;
  width: 280px;
  padding: 1rem 2rem;
  background: rgba(0, 255, 204, 0.45);
  border: 2px solid var(--games-primary, #00ffcc);
  border-radius: var(--radius-lg, 14px);
  color: #e0fffb;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 1.05rem;
  box-shadow: 0 0 12px var(--games-glow, rgba(0, 255, 204, 0.25));
  transition: transform var(--transition-fast, 0.2s), box-shadow var(--transition-fast, 0.2s), background var(--transition-fast, 0.2s), color var(--transition-fast, 0.2s);
}

a.button:hover,
.button:hover {
  transform: translateY(-2px);
  background: rgba(0, 255, 204, 0.7);
  color: #fff;
  box-shadow: 0 0 20px rgba(0, 255, 204, 0.8);
}

/* === Footer jeux === */
.games-footer,
.overlay footer {
  margin: 30px 0;
  color: var(--games-primary-dim, #008877);
  font-size: 0.95rem;
}

.games-footer a,
.overlay footer a {
  color: var(--games-primary, #00ffcc);
  text-decoration: none;
}

.games-footer a:hover,
.overlay footer a:hover {
  text-decoration: underline;
}

/* === Fader pour transitions de page === */
#fader {
  position: fixed;
  inset: 0;
  z-index: 2;
  background: #000;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.4s ease;
}

#fader.is-hidden {
  opacity: 0;
}

/* === Bouton toggle (pause/play) === */
.toggle-btn,
#toggle {
  padding: 0.5rem 1rem;
  border: 2px solid var(--games-primary, #00ffcc);
  background: rgba(0, 255, 204, 0.35);
  color: var(--games-primary, #00ffcc);
  border-radius: var(--radius-md, 10px);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast, 0.2s);
}

.toggle-btn:hover,
#toggle:hover {
  background: rgba(0, 255, 204, 0.55);
}

/* === Layout jeu individuel === */
.game-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh;
}

.game-canvas-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.game-controls-area {
  height: 200px;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
}

/* === D-pad mobile === */
.pad,
.d-pad {
  width: 200px;
  height: 200px;
  position: relative;
}

.pad button,
.d-pad button {
  position: absolute;
  width: 60px;
  height: 60px;
  background: rgba(0, 255, 204, 0.3);
  border: 2px solid var(--games-primary, #00ffcc);
  border-radius: var(--radius-md, 12px);
  color: var(--games-primary, #00ffcc);
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.pad button:active,
.d-pad button:active {
  background: rgba(0, 255, 204, 0.6);
}

/* Position des boutons D-pad */
.pad .up,
.d-pad .up {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.pad .down,
.d-pad .down {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

.pad .left,
.d-pad .left {
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

.pad .right,
.d-pad .right {
  top: 50%;
  right: 0;
  transform: translateY(-50%);
}

/* === Mobile : afficher controles tactiles === */
@media (hover: none) and (pointer: coarse) {
  .mobile-controls {
    display: flex !important;
  }

  .desktop-hint {
    display: none !important;
  }
}

/* === Desktop : cacher controles tactiles === */
@media (hover: hover) and (pointer: fine) {
  .mobile-controls {
    display: none;
  }

  .desktop-hint {
    display: block;
  }
}

/* === Safe area pour iPhone X+ === */
@supports (padding: env(safe-area-inset-bottom)) {
  .game-controls-area {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
  }
}

/* === Responsive mobile === */
@media (max-width: 640px) {
  .overlay h1 {
    font-size: 2rem;
    margin: 1.5rem 0 0.3rem;
  }

  .controls {
    flex-wrap: wrap;
    padding: 0 1rem;
  }

  .controls input[type="range"] {
    width: 180px;
  }

  a.button,
  .button {
    width: 90%;
    max-width: 280px;
  }
}
