/* ==== Flappy Bird - Estilos ==== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

body {
  font-family: "Segoe UI", Tahoma, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a2a6c 0%, #2a5298 50%, #4facfe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  padding: 10px;
}

#contenedor {
  text-align: center;
  width: 100%;
  max-width: 430px;
}

h1 {
  font-size: 2rem;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
  margin-bottom: 8px;
}

#puntojes {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 8px 16px;
  margin-bottom: 8px;
}

#puntojes strong {
  color: #ffd93b;
}

#lienzo-contenedor {
  position: relative;
  width: 100%;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  touch-action: none;        /* móvil: cada toque cuenta, sin zoom de doble toque */
  user-select: none;
  -webkit-user-select: none;
}

/* Pantallas (inicio / fin) */
.pantalla {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.72);
  border-radius: 12px;
}

.pantalla h2 {
  font-size: 1.7rem;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.7);
}

.pantalla p {
  font-size: 1rem;
  padding: 0 20px;
}

kbd {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  padding: 2px 8px;
  font-family: inherit;
}

.boton {
  font-size: 1.2rem;
  font-weight: bold;
  color: #1a2a6c;
  background: linear-gradient(180deg, #ffd93b, #ffb800);
  border: none;
  border-radius: 30px;
  padding: 12px 36px;
  cursor: pointer;
  box-shadow: 0 4px 0 #c78c00, 0 6px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s, box-shadow 0.1s;
}

.boton:hover {
  filter: brightness(1.08);
}

.boton:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #c78c00, 0 3px 8px rgba(0, 0, 0, 0.4);
}

.boton:disabled {
  cursor: not-allowed;
  filter: grayscale(0.6) brightness(0.75);
  transform: none;
  box-shadow: 0 4px 0 #777, 0 6px 14px rgba(0, 0, 0, 0.4);
}

#nuevo-record {
  font-size: 1.2rem;
  color: #ffd93b;
  font-weight: bold;
}

/* Top 5 de récords */
.lista-records {
  list-style: none;
  width: 80%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lista-records li {
  display: flex;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.98rem;
}

.lista-records li.primero {
  background: rgba(255, 217, 59, 0.25);
  border: 1px solid #ffd93b;
}

.lista-records li .nombre {
  font-weight: bold;
}

.lista-records li .puntos {
  color: #ffd93b;
  font-weight: bold;
}

.lista-records li.vacio {
  justify-content: center;
  opacity: 0.7;
}

/* Guardar récord */
#guardar-record {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

#guardar-record p {
  font-size: 1.05rem;
  color: #ffd93b;
  font-weight: bold;
}

.fila-nombre {
  display: flex;
  gap: 8px;
  align-items: center;
}

.titulo-records {
  font-size: 1.15rem;
  color: #ffd93b;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6);
}

#input-nombre {
  font-size: 1rem;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  width: 180px;
  outline: none;
  text-align: center;
}

.boton-chico {
  font-size: 0.95rem;
  padding: 10px 22px;
}

/* Botones fijos siempre visibles (música y puntajes) */
#botones-fijos {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  z-index: 20;
}

.boton-fijo {
  font-size: 1.15rem;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s, background 0.2s;
}

.boton-fijo:hover {
  background: rgba(0, 0, 0, 0.65);
}

.boton-fijo:active {
  transform: scale(0.92);
}

.boton-fijo.apagado {
  opacity: 0.55;
  filter: grayscale(1);
}

/* Mensaje del bebé: GIGANTE arriba de la pantalla */
#mensaje-bebe {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 96%;
  text-align: center;
  font-size: 2.4rem;
  font-weight: 900;
  color: #ff9ecb;
  text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.8);
  z-index: 25;
  pointer-events: none;
  line-height: 1.2;
}

#instrucciones {
  margin-top: 10px;
  font-size: 0.9rem;
  opacity: 0.8;
}

.oculta {
  display: none !important;
}

/* Móvil */
@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  .pantalla h2 { font-size: 1.3rem; }
}

/* ===== Modo APP (teléfonos): como juego instalado ===== */
@media (max-width: 600px) and (pointer: coarse) {
  body {
    padding: 0;
    background: linear-gradient(180deg, #4ec9f5 0%, #aee9ff 100%);
  }

  #contenedor {
    max-width: none;
    width: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
  }

  /* Ocultar encabezado e instrucciones: pantalla completa de juego */
  h1, #instrucciones { display: none; }

  #puntojes {
    border-radius: 0;
    margin-bottom: 0;
    font-size: 1rem;
    padding: 12px 18px;
    background: rgba(0, 0, 0, 0.5);
  }

  #lienzo-contenedor {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* El juego mantiene su proporción 2:3 y se centra (estilo app instalada) */
  canvas {
    width: 100vw;
    height: calc(100vw * 1.5);
    border-radius: 0;
    box-shadow: none;
  }

  .pantalla { border-radius: 0; }

  #mensaje-bebe {
    font-size: 1.9rem;
    top: 70px;
  }

  #botones-fijos {
    top: 66px;
    right: 8px;
  }

  .pantalla {
    font-size: 0.95rem;
  }

  .pantalla .lista-records { width: 88%; }
}
