body {
  font-family: Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  margin: 0;
  background-color: #121212;
  color: white;
  padding-top: 20px;
}

.game-container {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 50px;
  width: 100%;
  max-width: 800px;
  padding: 0 15px 30px;
  box-sizing: border-box;
}

.game-info {
  display: flex;
  justify-content: space-around;
  width: 300px;
  margin-bottom: 20px;
  font-size: 18px;
}

.canvas-container {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 20px;
  align-items: flex-start;
}

#tetris {
  border: 2px solid #FFD700;
  background-color: #222;
  max-width: 100%;
  height: auto;
}

#next {
  border: 2px solid #FFD700;
  background-color: #222;
}

.next-piece {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.next-piece p {
  margin-bottom: 5px;
}

.controls {
  margin-top: 20px;
  text-align: left;
  font-size: 16px;
  width: 100%;
  max-width: 300px;
}

.controls p {
  margin: 5px 0;
}

#fullscreen-button {
  padding: 10px 20px;
  font-size: 16px;
  background-color: #FFD700;
  color: black;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin-bottom: 20px;
  transition: background-color 0.3s;
}

#fullscreen-button:hover {
  background-color: #FFC700;
}

/* =========================
   CONTROLES MÓVILES
========================= */
.mobile-controls {
  display: none;
  margin-top: 20px;
  gap: 10px;
  flex-direction: column;
  align-items: center;
  z-index: 1000;
}

.mobile-row {
  display: flex;
  gap: 10px;
}

.mobile-btn {
  width: 70px;
  height: 70px;
  font-size: 28px;
  font-weight: bold;
  border: none;
  border-radius: 15px;
  background: #FFD700;
  color: #000;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.mobile-btn:active {
  transform: scale(0.95);
  background: #FFC700;
}

.mobile-btn.wide {
  width: 110px;
}

/* =========================
   MODO MÓVIL
========================= */
@media (max-width: 768px) {
  .mobile-controls {
    display: flex;
  }

  .canvas-container {
    flex-direction: column;
    align-items: center;
  }

  .game-info {
    width: 100%;
    max-width: 320px;
    font-size: 16px;
  }

  .controls {
    font-size: 14px;
    text-align: center;
  }

  #tetris {
    width: 90vw;
    max-width: 300px;
    height: auto;
  }

  #next {
    width: 80px;
    height: 80px;
  }

  h1 {
    font-size: 28px;
  }
}

/* =========================
   PANTALLA COMPLETA
========================= */
.game-container:fullscreen,
.game-container:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  margin: 0;
  padding: 10px;
  background: #121212;
  box-sizing: border-box;
  justify-content: flex-start;
}

.game-container:fullscreen .canvas-container,
.game-container:-webkit-full-screen .canvas-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-container:fullscreen #tetris,
.game-container:-webkit-full-screen #tetris {
  max-height: 80vh;
  width: auto;
}

.game-container:fullscreen .mobile-controls,
.game-container:-webkit-full-screen .mobile-controls {
  display: flex !important;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(15px, env(safe-area-inset-bottom));
  z-index: 9999;
  margin: 0;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 20px;
  backdrop-filter: blur(8px);
}

.game-container:fullscreen .mobile-btn,
.game-container:-webkit-full-screen .mobile-btn {
  width: 65px;
  height: 65px;
  font-size: 26px;
}

/* Ocultar algunos elementos para aprovechar espacio */
@media (max-width: 768px) {
  .game-container:fullscreen h1,
  .game-container:-webkit-full-screen h1,
  .game-container:fullscreen .controls,
  .game-container:-webkit-full-screen .controls {
    display: none;
  }

  .game-container:fullscreen .next-piece,
  .game-container:-webkit-full-screen .next-piece {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 999;
    transform: scale(0.85);
  }

  .game-container:fullscreen .game-info,
  .game-container:-webkit-full-screen .game-info {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 999;
    font-size: 14px;
    width: auto;
    gap: 10px;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 12px;
    border-radius: 12px;
  }
}