/* Minas (buscaminas) de Celutimba. MOBILE-FIRST. Misma paleta que la portada y
   los otros juegos (azul noche, azul electrico y naranja). */

@font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url('../fonts/oswald.woff2') format('woff2');
}

:root {
  --fondo:       #081226;
  --panel:       #0d1b38;
  --borde:       #1c3564;
  --azul:        #2f9df0;
  --azul-brillo: #6cc4ff;
  --naranja:     #f7941d;
  --naranja-brillo: #ffb54d;
  --dorado:      #e6b84c;
  --verde:       #1fbf6b;
  --verde-hondo: #0c8a45;
  --rojo:        #d4133a;
  --texto:       #eaf3ff;
  --texto-suave: #9fb4d8;
  --titulo: 'Oswald', 'Arial Narrow', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  background: var(--fondo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* La barra y su modal viven en css/barra.css, compartidos con los otros juegos. */

.mesa {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 14px 12px 24px;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
}

/* --- Tablero --------------------------------------------------------------- */

.tablero {
  position: relative;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: 18px;
  padding: 12px;
  box-shadow: inset 0 2px 20px rgba(0, 0, 0, .4);
}

/* --- Resultado de la ronda (cobro / boom) ---------------------------------- */

.resultado {
  position: absolute;
  inset: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  background: rgba(8, 18, 38, .5);
  backdrop-filter: blur(1px);
  z-index: 5;
  animation: aparecer .16s ease;
}
.resultado__tarjeta {
  min-width: 156px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px 26px;
  border-radius: 16px;
  background: rgba(8, 18, 38, .94);
  border: 2px solid var(--verde);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .55), 0 0 26px rgba(31, 191, 107, .5);
  transition: transform .1s ease;
}
.resultado:active .resultado__tarjeta { transform: scale(.96); }
.resultado--perdio .resultado__tarjeta {
  border-color: var(--rojo);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .55), 0 0 26px rgba(212, 19, 58, .45);
}
.resultado__mult {
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 2.5rem;
  line-height: 1;
  color: #4ce09a;
}
.resultado--perdio .resultado__mult { color: #ff8fa3; font-size: 2rem; }
.resultado__detalle {
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--naranja-brillo);
}
.resultado--perdio .resultado__detalle { color: var(--texto-suave); }
.resultado__hint {
  margin-top: 8px;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--texto-suave);
}

.grilla {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.casilla {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(155deg, #1b2f57, #12224380 60%, #0e1b38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 3px 8px rgba(0, 0, 0, .35);
  transition: transform .08s ease, filter .12s ease, background .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.casilla::before {
  /* brillo tenue en el centro de la casilla cerrada */
  content: '';
  position: absolute;
  width: 34%;
  height: 34%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(108, 196, 255, .35), transparent 70%);
  opacity: .5;
}
.grilla--activa .casilla.tapada:hover { filter: brightness(1.25); transform: translateY(-2px); }
.grilla--activa .casilla.tapada:active { transform: scale(.94); }

/* Casilla ya resuelta: no reacciona mas */
.casilla.gema, .casilla.mina, .casilla.explotada { cursor: default; }
.casilla.gema::before, .casilla.mina::before, .casilla.explotada::before { display: none; }
.casilla svg { width: 56%; height: 56%; display: block; }

/* Gema (casilla segura destapada) */
.casilla.gema {
  background: radial-gradient(circle at 42% 32%, #35e08a, var(--verde) 55%, var(--verde-hondo));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 0 16px rgba(31, 191, 107, .55);
  animation: aparecer .22s ease;
}
/* Mina (revelada al terminar la partida) */
.casilla.mina {
  background: radial-gradient(circle at 42% 32%, #46516b, #232d44 60%, #161d30);
  opacity: .82;
}
.casilla.mina svg { opacity: .9; }
/* La mina que se piso: en rojo, resaltada */
.casilla.explotada {
  background: radial-gradient(circle at 42% 32%, #ff6a80, var(--rojo) 55%, #8f0c25);
  box-shadow: 0 0 22px rgba(212, 19, 58, .8);
  animation: estallar .3s ease;
}

@keyframes aparecer {
  from { transform: scale(.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes estallar {
  0% { transform: scale(.7); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* --- Marcador -------------------------------------------------------------- */

.marcador {
  width: 100%;
  display: flex;
  gap: 8px;
}
.marcador__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 8px 4px;
}
.marcador__item--fuerte {
  background: linear-gradient(180deg, rgba(247, 148, 29, .16), rgba(247, 148, 29, .04));
  border-color: rgba(247, 148, 29, .45);
}
.marcador__etiqueta { color: var(--texto-suave); font-size: .68rem; text-align: center; }
.marcador__valor {
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--texto);
}
.marcador__item--fuerte .marcador__valor { color: var(--naranja-brillo); font-size: 1.35rem; }

/* --- Ajustes de apuesta ---------------------------------------------------- */

.ajustes {
  width: 100%;
  display: flex;
  gap: 10px;
}
.ajuste {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ajuste__etiqueta {
  color: var(--texto-suave);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding-left: 2px;
}
.ajuste__control {
  display: flex;
  align-items: stretch;
  gap: 6px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 5px;
}
.ajuste__control--minas { justify-content: space-between; }
.ajuste__input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--texto);
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 1.15rem;
  text-align: center;
}
.ajuste__input::-webkit-outer-spin-button,
.ajuste__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ajuste__input { -moz-appearance: textfield; }
.ajuste__minas {
  flex: 1;
  text-align: center;
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--dorado);
  align-self: center;
}

.mini {
  font-family: var(--titulo);
  font-weight: 600;
  font-size: .9rem;
  color: var(--texto-suave);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--borde);
  border-radius: 9px;
  padding: 6px 10px;
  cursor: pointer;
  transition: color .1s, border-color .1s;
}
.mini:hover:not(:disabled) { color: #fff; border-color: var(--azul); }
.mini:disabled { opacity: .4; cursor: default; }
.mini--redondo { padding: 6px 14px; font-size: 1.2rem; line-height: 1; }

/* --- Boton principal ------------------------------------------------------- */

.control { width: 100%; }

.girar {
  width: 100%;
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: 1.5px;
  color: #331a00;
  background: linear-gradient(180deg, var(--naranja-brillo), var(--naranja) 55%, #d97407);
  border: 1px solid #ffd08a;
  border-radius: 14px;
  padding: 14px 20px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(247, 148, 29, .5);
  transition: transform .12s ease, box-shadow .12s ease;
}
.girar:hover:not(:disabled) { box-shadow: 0 6px 30px rgba(247, 148, 29, .75); }
.girar:active:not(:disabled) { transform: scale(.98); }
.girar:disabled { opacity: .55; cursor: default; }

/* Retirar: verde, para que se distinga de empezar */
.girar--cobrar {
  color: #03231a;
  background: linear-gradient(180deg, #48e59a, var(--verde) 55%, var(--verde-hondo));
  border-color: #a9ffd4;
  box-shadow: 0 4px 20px rgba(31, 191, 107, .5);
}
.girar--cobrar:hover:not(:disabled) { box-shadow: 0 6px 30px rgba(31, 191, 107, .8); }

.aviso {
  margin-top: 10px;
  text-align: center;
  color: #ff8fa3;
  font-weight: 600;
  min-height: 1.2em;
}
.aviso--bien { color: var(--naranja-brillo); }

/* --- Velo de acceso -------------------------------------------------------- */

.velo {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 9, 20, .8);
  backdrop-filter: blur(4px);
}
.velo__caja {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: 16px;
  padding: 26px 24px;
  max-width: 340px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.velo__caja h2 { font-family: var(--titulo); font-weight: 600; }
.velo__caja p { color: var(--texto-suave); }
.velo__boton { text-decoration: none; display: inline-block; }

@media (min-width: 560px) {
  .grilla { gap: 10px; }
  .casilla { border-radius: 14px; }
}
