/* ======== Reset ======== */
* { margin: 0; padding: 0; box-sizing: border-box; }
a { text-decoration: none; }
body {
  font-family: "Poppins", sans-serif;
  background: radial-gradient(circle at top, #1a1a1a, #000);
  color: #f5f5f5;
  text-align: center;
}

/* ======== Menú ======== */
.links {
  display: flex;
  justify-content: center;
  background: linear-gradient(90deg, #000, #1a1a1a);
  border-bottom: 2px solid #ff1100ff;
  padding: 0.6rem 0;
  font-size: 14px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.links div { margin: 0 1rem; }
.links a {
  color: #f5f5f5;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: 0.3s;
}
.links a:hover { color: #ff1100ff; transform: scale(1.1); }

/* ======== Títulos ======== */
h1, h2 { margin-top: 1rem; letter-spacing: 3px; }
h1 {
  color: #ff1100ff;
  font-size: 2.2rem;
  text-transform: uppercase;
  animation: glow 2s infinite alternate;
}
h2 { color: #fff; font-size: 1.5rem; margin-bottom: 1rem; }

/* ======== Contenedor principal ======== */
.app {
  max-width: 980px;
  margin: 18px auto;
  padding: 16px;
  background: #250000cc;
  border-radius: 12px;
  border: 2px solid #b00000;
  box-shadow: 0 0 20px #ff000050, inset 0 0 15px #300000aa;
}

/* ======== Topbar ======== */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 6px 14px;
  border-bottom: 2px solid #700000;
}
.balance{
  font-size: 16px;
}
.balance strong{
  color: #ffe066;
  text-shadow: 0 0 5px #ffdd00;
}
.sep{ margin: 0 8px; opacity: .65; }

.btn-sound{
  border: 2px solid #aa0000;
  background: #111;
  color: #fff;
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: .2s;
}
.btn-sound:hover{ transform: scale(1.03); box-shadow: 0 0 12px #ff000060; }
.btn-sound.is-muted{ opacity: .7; filter: grayscale(.2); }

/* ======== Mesa ======== */
.mesa-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}
.mano { flex: 1; min-width: 160px; }
.mesa { flex: 2; min-width: 260px; }

.mesa h3, .mano h3 {
  font-size: 16px;
  margin-bottom: 8px;
  color: #ff4444;
  text-shadow: 0 0 5px #ff000080;
}

/* ======== Cartas (con SVG) ======== */
.cartas{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:center;
  min-height: 120px;
}

.card-img{
  width: 72px;
  height: 108px;
  border-radius: 8px;
  box-shadow: 0 0 10px #000000aa;
  background: #fff;
  transition: transform .18s ease, box-shadow .18s ease;
  opacity: 0;
  animation: aparecerCarta .25s forwards;
}
.card-img:hover{
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 0 14px #000000cc;
}

.mesa-cartas .card-img{
  width: 78px;
  height: 116px;
}

@keyframes aparecerCarta{
  from { opacity:0; transform: translateY(-10px); }
  to { opacity:1; transform: translateY(0); }
}

/* ======== Controles ======== */
.controls{ margin-top: 14px; }
.bet{ margin-bottom: 10px; }
.bet__group{
  display:flex;
  justify-content:center;
  gap: 8px;
  margin-top: 6px;
}
.bet__input{
  width: 80px;
  text-align:center;
  font-size: 14px;
  border-radius: 6px;
  background: #3d0000;
  color: #fff;
  border: 2px solid #990000;
  padding: 7px;
}

/* ======== Botones ======== */
.btn{
  padding: 10px 16px;
  margin: 4px;
  border-radius: 10px;
  cursor:pointer;
  border:none;
  font-weight: 800;
  font-size: 13px;
  transition: .2s;
}
.btn--primary{
  background:#d40000;
  color:#fff;
  box-shadow: 0 0 10px #ff000050;
}
.btn--primary:hover{ background:#ff1a1a; box-shadow: 0 0 14px #ff000090; }

.btn--secondary{
  background:#660000;
  color:#ffdddd;
  border:2px solid #aa0000;
}
.btn--secondary:hover{ background:#990000; }

.btn--ghost{
  background:transparent;
  border:2px solid #ff5555;
  color:#ffdddd;
}
.btn--ghost:hover{ background:#5a0000; border-color:#ff9999; }

.btn--dark{
  background:#111;
  color:#fff;
  border:2px solid #333;
}
.btn--dark:hover{ transform: scale(1.03); box-shadow: 0 0 12px #ff000040; }

button:disabled{ opacity:.5; cursor:not-allowed; }

/* ======== Mensaje ======== */
.message{
  margin-top: 12px;
  font-size: 16px;
  color: #ffbbbb;
  min-height: 32px;
  text-shadow: 0 0 6px #ff000080;
}

/* ======== Historial ======== */
.historial{
  margin-top: 16px;
  padding: 12px;
  background: #2a0000aa;
  border: 2px solid #700000;
  border-radius: 10px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: inset 0 0 10px #000;
}
.historial h3{
  color:#ff4444;
  margin-bottom: 10px;
}
.historial-lista{
  display:flex;
  flex-direction:column;
  gap: 8px;
}
.hist-item{
  padding: 10px 12px;
  border: 1px solid #3b0000;
  border-radius: 10px;
  background: #140000b0;
  text-align: left;
  font-size: 13px;
  line-height: 1.35;
}
.hist-item .tag{
  font-weight: 900;
}
.hist-item.win .tag{ color:#00ff88; }
.hist-item.lose .tag{ color:#ff4444; }
.hist-item.tie .tag{ color:#ffe066; }

/* ======== Footer ======== */
.footer{
  margin-top: 18px;
  padding: 16px 10px;
  border-top: 2px solid #ff1100ff;
  background: linear-gradient(90deg, #000, #1a1a1a);
  color: #ddd;
  font-size: 13px;
}
.footer-links{
  margin-top: 6px;
  opacity: .9;
}

/* ======== Glow ======== */
@keyframes glow{
  from { text-shadow: 0 0 10px #ff1100ff, 0 0 20px #ff1100ff; }
  to   { text-shadow: 0 0 25px #ff1100ff, 0 0 50px #ff1100ff; }
}