body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;

  background-image: url("sounds/fondo.jpg"); /* o .png */
  background-size: cover;       /* ocupa toda la pantalla */
  background-position: center;  /* centrada */
  background-repeat: no-repeat; 
  background-attachment: fixed; /* efecto más pro */

  color: white;

  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  background: rgba(0,0,0,0.5); /* oscurece */
  z-index: -1;
}

.mesa {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  margin: 30px;
}

/* CONTENEDOR 3D */
.card-container {
  perspective: 1000px;
}

.card-inner {
  width: 130px;
  height: 190px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s;
}

.card-inner.flip {
  transform: rotateY(180deg);
}

/* CARTA MÁS REALISTA */
.card {
  width: 140px;
  height: 200px;
  border-radius: 14px;
  position: absolute;
  backface-visibility: hidden;
  padding: 12px;
  box-shadow: 
    0 15px 30px rgba(0,0,0,0.5),
    inset 0 0 10px rgba(0,0,0,0.2);
}

/* FRENTE */
.front {
  background: linear-gradient(145deg, #ffffff, #e6e6e6);
  color: black;

  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ESQUINAS */
.corner {
  display: flex;
  flex-direction: column;
  font-size: 16px;
}

.corner.top {
  align-self: flex-start;
}

.corner.bottom {
  align-self: flex-end;
  transform: rotate(180deg);
}

/* CENTRO */
.center {
  font-size: 42px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* EFECTO HOVER (opcional pero queda pro) */
.card-container:hover .card-inner {
  transform: rotateY(10deg) scale(1.05);
}

/* DORSO */
.back {
  background: repeating-linear-gradient(
    45deg,
    #b00,
    #b00 10px,
    #800 10px,
    #800 20px
  );
  transform: rotateY(180deg);
}

/* MAZO */
#mazo {
  width: 130px;
  height: 190px;
}

/* PALOS */
.rojo {
  color: crimson;
}

.negro {
  color: black;
}

.palo {
  font-size: 20px;
}

.valor {
  font-size: 32px;
  align-self: center;
}

/* BOTONES */
button {
  padding: 12px 25px;
  margin: 10px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #0f3460;
  color: white;
  transition: 0.3s;
}

button:hover {
  background: #e94560;
}

/* PUNTAJE PRO */
#puntos {
  font-size: 28px;
  font-weight: bold;
  padding: 5px 15px;
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
  transition: 0.3s;
}

/* EFECTO CUANDO SUMA */
.puntos-up {
  background: #00ffae;
  color: black;
  transform: scale(1.2);
}

/* EFECTO CUANDO RESTA */
.puntos-down {
  background: #ff4d4d;
  color: white;
  transform: scale(1.2);
}

/* FLASH PANTALLA */
.flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
}

.flash.win {
  background: rgba(0,255,150,0.2);
  animation: flashAnim 0.4s;
}

.flash.lose {
  background: rgba(255,0,0,0.2);
  animation: flashAnim 0.4s;
}

@keyframes flashAnim {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* racha */
#racha {
  color: orange;
  font-weight: bold;
}

/* multiplicador */
#multiplicador {
  color: #00ffcc;
  font-weight: bold;
}

/* vidas */
#vidas {
  color: red;
  font-weight: bold;
}

/* record */
#record {
  color: gold;
  font-weight: bold;
}

/* efecto combo */
.combo-activo {
  animation: comboPulse 0.4s;
}

@keyframes comboPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.mesa {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 50px;
  margin: 20px 0;
}

.card,
.card-inner {
  width: 100%;
  height: 100%;
}

.card-inner.active {
  box-shadow: 0 0 25px rgba(255,255,255,0.3);
}

.card-container {
  width: clamp(100px, 25vw, 140px);
  height: clamp(150px, 35vw, 200px);
}

.card-container {
  position: relative;
  z-index: 1;
}

.buttons {
  position: relative;
  z-index: 2; /* 👈 botones arriba */
}

.app {
  width: 100%;
  max-width: 380px;
  padding: 20px;

  background: rgba(20, 25, 45, 0.75);
  backdrop-filter: blur(15px);

  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);

  display: flex;
  flex-direction: column;
  align-items: center;
}

.stats {
  margin-top: 20px;
  padding: 15px;
  border-radius: 15px;

  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);

  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* cada fila */
.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 8px 10px;
  border-radius: 10px;

  background: rgba(255,255,255,0.03);
}

/* texto */
.stat span {
  opacity: 0.8;
}

/* números */
.stat strong {
  font-size: 18px;
}

/* colores especiales */
#puntos { color: gold; }
#racha { color: orange; }
#multiplicador { color: #00e5ff; }
#vidas { color: #ff4d4d; }
#record { color: #ffd700; }

.stat:hover {
  transform: scale(1.03);
  background: rgba(255,255,255,0.08);
  transition: 0.2s;
}

.buttons {
  display: flex;
  gap: 10px;
  width: 100%;
}

.buttons button {
  flex: 1;
  padding: 12px;
  font-size: clamp(14px, 2.5vw, 16px);
}

.stats {
  width: 100%;
}

.stat {
  font-size: clamp(13px, 2.5vw, 16px);
}

@media (max-width: 480px) {

  .app {
    padding: 15px;
    border-radius: 15px;
  }

  h1 {
    font-size: 20px;
  }

  .mesa {
    gap: 20px;
  }

  .buttons {
    flex-direction: column; /* 👈 botones uno debajo del otro */
  }

  .stat {
    padding: 6px;
  }

}

@media (min-width: 768px) {

  .app {
    max-width: 420px;
  }

  .mesa {
    gap: 50px;
  }

}