/* Un reset CSS básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; 
}
html, body {
  height: 100%;
  overflow-x: hidden; 
}
body {
  background: black;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: normal;
  gap: 0px;
  font-family: sans-serif;
  color: white;
  overscroll-behavior-y: contain !important;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  min-height: 100vh;
  min-height: -webkit-fill-available; 
}

/* --- TAMAÑO CELULAR (Por defecto) --- */
canvas#game {
  border: 1px solid white;
  margin: 10px 0 0 0;
  max-width: 95vw;       
  max-height: 55vh;      /* En celu ocupa hasta el 55% del alto para dejar lugar a botones */
  width: auto;
  height: auto;
  aspect-ratio: 1 / 2;   
  object-fit: contain;   
}

h2 {
  font-size: 18px; 
  text-transform: uppercase;
  font-weight: 400;
  line-height: 1.56em;
}

ol {
  list-style: none;
}

.info {
  border: 0px solid white;
  padding: 10px;
  display: flex;
  flex-wrap: wrap; 
  gap: 15px; 
  font-size: 16px; 
  text-transform: uppercase;
  align-items: flex-start;
  justify-content: center; 
  margin-top: 0px; 
  width: 100%; 
  max-width: 350px; 
}

.paneles {
  display: none;
  flex-wrap: nowrap; 
  gap: 20px;
  align-items: flex-start;
  justify-content: center; 
  margin-top: 0px; 
  width: 100%;
  max-width: 350px;
}

.proxima, .puntajes {
  border: 0px solid white;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  width: 50%;
  align-items: center;
}

canvas#next {
  border: 1px solid #333;
}

.score-board {
  border: 1px solid white;
  padding: 10px;
  text-align: center; 
}

.score-board h2 {
  margin-top: 0;
}

.top-scores {
  list-style-type: none;
  padding: 0;
}

.paused-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 36px;
  padding: 20px;
  border-radius: 10px;
  z-index: 10;
  display: none; 
}

.pie {
  text-align: center;
  font-size: 11px;
  color: #cccccc;
  width: 100%;
  padding: 10px;
  padding-bottom: env(safe-area-inset-bottom);
  display: none;
}

.controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap; 
  width: 100%;
  max-width: 360px;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: env(safe-area-inset-bottom);
  padding: 0 5px; 
}

.controls button {
  -webkit-appearance: none; 
  -moz-appearance: none;    
  appearance: none;
  box-sizing: border-box;
  border: none;
  padding: 15px 20px; 
  font-size: 14px; 
  font-weight: bold;
  line-height: 1; 
  background-color: #333; 
  color: white;             
  cursor: pointer;
  border-radius: 8px;       
  text-align: center;       
  display: inline-block;    
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.controls button:hover {
  background-color: #444;
}

.controls button:active {
  background-color: #555;
  transform: translateY(2px); 
}

#startButtonOverlay {
    position: absolute; 
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8); 
    color: white;
    font-size: 36px;
    font-family: monospace;
    padding: 20px 40px;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    border: 2px solid white; 
    display: none; 
    z-index: 100;   
}

@supports(padding: max(0px)) { 
  body {
    padding-top: max(12px, env(safe-area-inset-top)); 
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* =========================================
   --- TAMAÑO PC / TABLET HORIZONTAL --- 
   Esto se aplica solo si la pantalla tiene más de 768px de ancho
   ========================================= */
@media (min-width: 768px) {
  canvas#game {
    /* En PC, hacemos que el tablero ocupe el 75% del alto de la pantalla */
    /* Como tiene aspect-ratio 1/2, se va a ver como una tablet vertical */
    max-height: 75vh; 
    margin-top: 20px;
  }

  /* Agrandamos un poco los textos y los contenedores para que no queden chiquitos en PC */
  .info, .paneles, .controls {
    max-width: 500px; 
  }

  h2 {
    font-size: 22px; 
  }

  .info {
    font-size: 20px; 
  }
  
  .controls button {
    padding: 20px 30px; /* Botones más grandes para hacer clic fácil con el mouse */
    font-size: 16px;
  }
}