/* ═══════════════════════════════════════════════════════
   HUNDIR LA FLOTA — Tema naval de profundidades
═══════════════════════════════════════════════════════ */
/*Submenu */

#screen-flota-menu {
  background: radial-gradient(ellipse at 40% 30%, #103846 0%, #06141a 75%);
}

#screen-flota-menu .submenu-title {
  color: #ffffff;
  text-shadow: 0 0 24px rgba(255, 250, 246, 0.3), 1px 1px 0 #f5f3f2;
  letter-spacing: 6px;
}

#screen-flota-menu .submenu-desc { color: #7bb7c8; }
#screen-flota-menu .btn-back { border-color: rgba(120,210,240,0.32); color: #8ed8ee; }
#screen-flota-menu .btn-back:hover { color: #c8f4ff; }
#screen-flota-menu .submenu-rules-link { color: #8ed8ee; }
#screen-flota-menu .submenu-rules-link:hover { color: #c8f4ff; border-color: rgba(120,210,240,0.38); }

/* ── Pantalla base ───────────────────────────────────── */
#screen-hundirlaflota-placement,
#screen-hundirlaflota-game {
  background:
    radial-gradient(ellipse at 50% 0%,   rgba(0, 120, 140, 0.6) 0%, transparent 55%),
    radial-gradient(ellipse at 20% 90%,  rgba(0, 60, 120, 0.5)  0%, transparent 50%),
    linear-gradient(175deg, #04202e 0%, #021018 55%, #010c14 100%);
  font-family: 'Segoe UI', Tahoma, sans-serif;
  color: #c8f0e0;
  overflow: hidden;
}

#screen-hundirlaflota-placement.screen:not(.active),
#screen-hundirlaflota-game.screen:not(.active) { display: none; }

/* ── Botón menú in-game ──────────────────────────────── */
#screen-hundirlaflota-placement .btn-back,
#screen-hundirlaflota-game .btn-back {
  color: #60c8a8;
  border-color: rgba(0, 200, 160, 0.3);
  background: rgba(0, 40, 32, 0.7);
}
#screen-hundirlaflota-placement .btn-back:hover,
#screen-hundirlaflota-game .btn-back:hover {
  background: rgba(0, 60, 48, 1);
  color: #a0ffd8;
}
#screen-hundirlaflota-placement .game-menu-dropdown,
#screen-hundirlaflota-game .game-menu-dropdown {
  background: rgba(1, 18, 16, 0.97);
  border-color: rgba(0, 200, 160, 0.25);
}
#screen-hundirlaflota-placement .game-menu-dropdown button,
#screen-hundirlaflota-game .game-menu-dropdown button { color: #80d8b8; }
#screen-hundirlaflota-placement .game-menu-dropdown button:hover,
#screen-hundirlaflota-game .game-menu-dropdown button:hover {
  background: rgba(0, 200, 160, 0.1);
  color: #b0ffd8;
}

/* ═══════════════════════════════════════════════════════
   COMPONENTE COMPARTIDO — TABLERO NAVAL
═══════════════════════════════════════════════════════ */

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  aspect-ratio: 1;
  background: rgba(4, 28, 44, 0.95);
  border: 2px solid rgba(0, 220, 180, 0.55);
  border-radius: 4px;
  box-shadow:
    0 0 0 1px rgba(0, 220, 180, 0.2),
    0 0 32px rgba(0, 220, 180, 0.18),
    inset 0 0 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  user-select: none;
}

/* Barrido de radar */
.board::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(0, 255, 180, 0.22) 18deg,
    transparent 36deg
  );
  animation: radar-sweep 4s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes radar-sweep {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Celda base ──────────────────────────────────────── */
.cell {
  position: relative;
  border: 1px solid rgba(0, 200, 160, 0.22);
  cursor: pointer;
  transition: background 0.12s, box-shadow 0.12s;
  z-index: 2;
}

.cell:hover {
  background: rgba(0, 255, 180, 0.12);
  box-shadow: inset 0 0 10px rgba(0, 255, 180, 0.28);
}

/* ── Estados de celda ────────────────────────────────── */

/* Agua — impacto fallido */
.cell.agua {
  background: rgba(30, 115, 235, 0.95);
  border-color: #7ac8ff;
  box-shadow: inset 0 0 10px rgba(80, 170, 255, 0.4), 0 0 8px rgba(60, 150, 255, 0.35);
  cursor: default;
}
.cell.agua:hover {
  background: rgba(30, 115, 235, 0.95);
  box-shadow: inset 0 0 10px rgba(80, 170, 255, 0.4), 0 0 8px rgba(60, 150, 255, 0.35);
}
/* Punto central blanco permanente */
.cell.agua::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32%;
  height: 32%;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #c8e8ff 45%, transparent 100%);
  box-shadow: 0 0 10px #fff, 0 0 20px rgba(140, 210, 255, 0.9);
  z-index: 3;
}
/* Onda expansiva */
.cell.agua::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.2);
  width: 82%;
  height: 82%;
  border-radius: 50%;
  border: 2px solid #aaddff;
  box-shadow: 0 0 12px rgba(120, 200, 255, 0.8);
  animation: agua-ripple 2s ease-out infinite;
  z-index: 2;
}
@keyframes agua-ripple {
  0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
  65%  { transform: translate(-50%, -50%) scale(1);   opacity: 0.5; }
  100% { transform: translate(-50%, -50%) scale(1.3); opacity: 0; }
}

/* Tocado — impacto rojo/naranja */
.cell.tocado {
  background:
    radial-gradient(circle at 50% 72%, rgba(255, 188, 58, 0.42) 0%, transparent 42%),
    linear-gradient(180deg, rgba(92, 22, 10, 0.98) 0%, rgba(175, 44, 8, 0.92) 58%, rgba(70, 16, 7, 0.96) 100%);
  border-color: #ff9a38;
  box-shadow:
    inset 0 0 10px rgba(255, 108, 20, 0.45),
    inset 0 -8px 12px rgba(60, 0, 0, 0.4),
    0 0 12px rgba(255, 92, 18, 0.56),
    0 0 22px rgba(255, 142, 35, 0.24);
  cursor: default;
  overflow: hidden;
  transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
}
.cell.tocado:hover {
  background:
    radial-gradient(circle at 50% 72%, rgba(255, 188, 58, 0.42) 0%, transparent 42%),
    linear-gradient(180deg, rgba(92, 22, 10, 0.98) 0%, rgba(175, 44, 8, 0.92) 58%, rgba(70, 16, 7, 0.96) 100%);
  box-shadow:
    inset 0 0 10px rgba(255, 108, 20, 0.45),
    inset 0 -8px 12px rgba(60, 0, 0, 0.4),
    0 0 12px rgba(255, 92, 18, 0.56),
    0 0 22px rgba(255, 142, 35, 0.24);
}
.cell.tocado::before {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -8%;
  height: 92%;
  background:
    radial-gradient(ellipse at 24% 84%, rgba(255, 238, 140, 0.98) 0%, rgba(255, 156, 25, 0.84) 20%, transparent 42%),
    radial-gradient(ellipse at 52% 72%, rgba(255, 245, 190, 0.96) 0%, rgba(255, 108, 20, 0.9) 25%, transparent 54%),
    radial-gradient(ellipse at 76% 88%, rgba(255, 210, 80, 0.92) 0%, rgba(230, 62, 12, 0.82) 22%, transparent 46%),
    linear-gradient(0deg, rgba(255, 64, 8, 0.78), transparent 72%);
  border-radius: 48% 52% 42% 44%;
  mix-blend-mode: screen;
  transform-origin: 50% 100%;
  animation: tocado-fire 0.48s ease-in-out infinite alternate;
  z-index: 3;
  pointer-events: none;
}
.cell.tocado::after {
  content: '✕';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.3em;
  font-weight: 900;
  color: #fff2a8;
  text-shadow:
    0 0 7px #ffcf50,
    0 0 16px rgba(255, 112, 18, 0.98),
    0 0 28px rgba(255, 52, 8, 0.7);
  animation: tocado-pulse 0.78s ease-in-out infinite alternate;
  z-index: 4;
  line-height: 1;
  pointer-events: none;
}

.cell.tocado .ship-fill {
  filter: brightness(0.72) sepia(0.55) saturate(1.35);
}

.cell.tocado .ship-fill::after {
  content: '';
  position: absolute;
  inset: -18% -8% auto;
  height: 70%;
  background:
    radial-gradient(ellipse at 35% 88%, rgba(110, 112, 105, 0.42) 0%, transparent 55%),
    radial-gradient(ellipse at 64% 22%, rgba(80, 82, 78, 0.32) 0%, transparent 48%);
  animation: tocado-smoke 2.1s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes tocado-fire {
  0% {
    opacity: 0.74;
    transform: scaleX(0.88) scaleY(0.92) skewX(-3deg);
    filter: blur(0.2px);
  }
  50% {
    opacity: 1;
    transform: scaleX(1.08) scaleY(1.08) skewX(4deg);
    filter: blur(0);
  }
  100% {
    opacity: 0.86;
    transform: scaleX(0.96) scaleY(1.15) skewX(-2deg);
    filter: blur(0.4px);
  }
}
@keyframes tocado-pulse {
  from {
    color: #ffd66e;
    text-shadow: 0 0 6px #ff7a18, 0 0 14px rgba(255, 92, 0, 0.72);
  }
  to {
    color: #ffffff;
    text-shadow: 0 0 10px #ffd36d, 0 0 24px rgba(255, 142, 20, 1), 0 0 38px rgba(255, 52, 8, 0.72);
  }
}
@keyframes tocado-smoke {
  from {
    opacity: 0.18;
    transform: translateY(8%) scale(0.94);
  }
  to {
    opacity: 0.42;
    transform: translateY(-10%) scale(1.08);
  }
}

/* Hundido — barco destruido */
.cell.hundido {
  background: rgba(80, 22, 8, 0.98);
  border-color: #e05030;
  box-shadow:
    inset 0 0 14px rgba(0, 0, 0, 0.8),
    0 0 12px rgba(230, 80, 30, 0.55),
    0 0 24px rgba(180, 40, 10, 0.3);
  cursor: default;
  transition: background 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease, filter 0.24s ease;
}
.cell.hundido:hover {
  background: rgba(80, 22, 8, 0.98);
  box-shadow:
    inset 0 0 14px rgba(0, 0, 0, 0.8),
    0 0 12px rgba(230, 80, 30, 0.55),
    0 0 24px rgba(180, 40, 10, 0.3);
}
/* Cruz roja viva */
.cell.hundido::before {
  content: '✕';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.2em;
  font-weight: 900;
  color: #ff8060;
  text-shadow:
    0 0 8px #ff4400,
    0 0 18px rgba(255, 80, 20, 0.95),
    0 0 32px rgba(220, 50, 0, 0.6);
  z-index: 4;
  line-height: 1;
  pointer-events: none;
  animation: hundido-cross 1.8s ease-in-out infinite alternate;
}
@keyframes hundido-cross {
  from { color: #ff7050; text-shadow: 0 0 7px #ff3300,  0 0 16px rgba(255, 70, 10, 0.8); }
  to   { color: #ffaa88; text-shadow: 0 0 12px #ff6600, 0 0 26px rgba(255, 110, 30, 1), 0 0 40px rgba(220, 60, 0, 0.6); }
}
/* Humo en naranjas/ambarinos — visibles sobre el fondo oscuro-rojo */
.cell.hundido::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 38% 88%, rgba(200, 120, 60, 0.55) 0%, transparent 48%),
    radial-gradient(ellipse at 68% 28%, rgba(170, 100, 50, 0.42) 0%, transparent 44%);
  animation: hundido-smoke 2.8s ease-in-out infinite alternate;
  z-index: 3;
  pointer-events: none;
}

.cell.barco.hundido .ship-fill {
  filter: brightness(0.36) grayscale(0.45) saturate(0.7);
  background:
    linear-gradient(135deg, rgba(30, 24, 20, 0.92) 0%, rgba(68, 32, 20, 0.78) 52%, rgba(14, 12, 12, 0.9) 100%);
  border-color: rgba(150, 70, 45, 0.32);
}
@keyframes hundido-smoke {
  from { opacity: 0.55; transform: translateY(0); }
  to   { opacity: 1;    transform: translateY(-5px); }
}

/* Barco — celda con barco propio */
/* Misil confirmado por servidor: solo adorna el resultado ya validado */
.hf-missile {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--hf-missile-size, 28px);
  height: calc(var(--hf-missile-size, 28px) * 1.78);
  pointer-events: none;
  z-index: 9999;
  transform-origin: 50% 50%;
  filter:
    drop-shadow(0 0 7px rgba(255, 170, 80, 0.8))
    drop-shadow(0 0 16px rgba(255, 70, 25, 0.45));
}

.hf-missile::before {
  content: '';
  position: absolute;
  left: 28%;
  top: 0;
  width: 44%;
  height: 70%;
  border-radius: 50% 50% 36% 36%;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.75), rgba(255,255,255,0) 28% 72%, rgba(0,0,0,0.28)),
    linear-gradient(180deg, #f6fbff 0%, #a9c4d4 28%, #526471 72%, #26313a 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.38),
    inset 0 -7px 8px rgba(0,0,0,0.38);
}

.hf-missile::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -10%;
  width: 70%;
  height: 48%;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(255,255,210,0.98) 0%, rgba(255,205,80,0.92) 28%, transparent 55%),
    radial-gradient(ellipse at 45% 45%, rgba(255,85,30,0.84) 0%, transparent 64%),
    radial-gradient(ellipse at 55% 78%, rgba(130,135,130,0.48) 0%, transparent 70%);
  animation: hf-missile-trail 0.12s ease-in-out infinite alternate;
  filter: blur(0.4px);
}

@keyframes hf-missile-trail {
  from {
    transform: translateX(-50%) scaleY(0.82) scaleX(0.88);
    opacity: 0.72;
  }
  to {
    transform: translateX(-50%) scaleY(1.16) scaleX(1.08);
    opacity: 1;
  }
}

.hf-impact {
  position: fixed;
  width: 58px;
  height: 58px;
  margin-left: -29px;
  margin-top: -29px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  animation: hf-impact-pop 0.36s ease-out forwards;
}

.hf-impact::before,
.hf-impact::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.hf-impact::before {
  background:
    radial-gradient(circle, rgba(255,255,255,0.96) 0 10%, transparent 11%),
    radial-gradient(circle, rgba(255,220,90,0.9) 0 26%, rgba(255,90,30,0.52) 45%, transparent 68%);
}

.hf-impact::after {
  border: 2px solid rgba(255, 230, 160, 0.85);
  box-shadow: 0 0 18px rgba(255, 150, 50, 0.8);
}

.hf-impact-agua::before {
  background:
    radial-gradient(circle, rgba(245,255,255,0.98) 0 11%, transparent 12%),
    radial-gradient(circle, rgba(145,220,255,0.9) 0 30%, rgba(40,145,255,0.44) 54%, transparent 72%);
}

.hf-impact-agua::after {
  border-color: rgba(175, 230, 255, 0.9);
  box-shadow: 0 0 18px rgba(70, 170, 255, 0.8);
}

.hf-impact-hundido {
  width: 72px;
  height: 72px;
  margin-left: -36px;
  margin-top: -36px;
}

@keyframes hf-impact-pop {
  0% {
    transform: scale(0.18);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hf-missile,
  .hf-missile::after,
  .hf-impact,
  .hf-impact::before,
  .hf-impact::after {
    animation: none !important;
  }
}

.cell.barco {
  background: linear-gradient(135deg, rgba(60, 160, 110, 0.55) 0%, rgba(30, 100, 70, 0.45) 100%);
  border-color: rgba(0, 230, 160, 0.55);
  box-shadow: inset 0 0 6px rgba(0, 200, 140, 0.2);
}

.cell.barco.tocado {
  background:
    radial-gradient(circle at 50% 68%, rgba(255, 230, 118, 0.62) 0%, transparent 46%),
    linear-gradient(180deg, rgba(122, 45, 18, 0.96) 0%, rgba(218, 78, 18, 0.92) 56%, rgba(114, 33, 14, 0.94) 100%);
  border-color: #ffc35d;
  box-shadow:
    inset 0 0 8px rgba(255, 205, 90, 0.38),
    inset 0 -6px 10px rgba(88, 18, 0, 0.28),
    0 0 14px rgba(255, 128, 24, 0.68),
    0 0 26px rgba(255, 188, 70, 0.34);
}

.cell.barco.tocado .ship-fill {
  background:
    linear-gradient(135deg, rgba(146, 196, 146, 0.84) 0%, rgba(205, 125, 52, 0.72) 48%, rgba(98, 58, 36, 0.7) 100%);
  border-color: rgba(255, 210, 115, 0.52);
  filter: brightness(1.16) sepia(0.28) saturate(1.42);
  opacity: 0.96;
}

/* Preview válida — colocación permitida */
.cell.preview-valid {
  background: rgba(0, 220, 150, 0.35);
  border-color: #00ffb8;
  box-shadow: inset 0 0 8px rgba(0, 255, 180, 0.35);
}

/* Preview inválida — colocación no permitida */
.cell.preview-invalid {
  background: rgba(230, 50, 20, 0.4);
  border-color: #ff4422;
  box-shadow: inset 0 0 8px rgba(255, 60, 30, 0.35);
}

.cell.ship-selected {
  box-shadow:
    inset 0 0 0 2px rgba(160, 255, 220, 0.85),
    inset 0 0 10px rgba(0, 255, 180, 0.24);
}

.hf-placed-ship-controls {
  position: absolute;
  z-index: 20;
  display: none;
  transform: translateX(-50%);
  gap: 6px;
}

.hf-placed-ship-controls.visible {
  display: flex;
}

.hf-placed-ship-action {
  padding: 5px 9px;
  border: 1px solid rgba(0, 220, 160, 0.5);
  border-radius: 6px;
  background: rgba(0, 38, 30, 0.96);
  color: #b0ffe0;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32), 0 0 14px rgba(0, 220, 160, 0.12);
}

.hf-placed-ship-action.danger {
  border-color: rgba(255, 120, 90, 0.45);
  color: #ffc0a8;
}

.hf-placed-ship-controls.invalid .hf-placed-ship-action {
  border-color: rgba(255, 80, 60, 0.8);
  color: #ffb0a0;
  box-shadow: 0 0 18px rgba(255, 80, 60, 0.24);
}

/* Deshabilitada */
.cell.disabled {
  cursor: not-allowed;
  opacity: 0.4;
  pointer-events: none;
}

/* ── Estado de turno en tableros ─────────────────────── */
.board-attack.turno-activo {
  border-color: rgba(0, 255, 180, 0.55);
  box-shadow:
    0 0 0 1px rgba(0, 255, 180, 0.2),
    0 0 28px rgba(0, 255, 180, 0.15),
    inset 0 0 40px rgba(0, 0, 0, 0.7);
}
.board-attack.turno-activo .cell:hover {
  background: rgba(0, 255, 180, 0.1);
  box-shadow: inset 0 0 10px rgba(0, 255, 180, 0.25);
}
.board-attack.turno-espera,
.board-own.turno-espera {
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════
   FASE 1: EL ASTILLERO (COLOCACIÓN)
═══════════════════════════════════════════════════════ */

#screen-hundirlaflota-placement {
  align-items: center;
  justify-content: flex-start;
  padding-top: 56px;
  overflow-y: auto;
}

.placement-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 900px;
  padding: 0 16px 24px;
}

/* Título del astillero */
.astillero-title {
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 5px;
  color: #40c090;
  text-transform: uppercase;
  margin-bottom: 10px;
  text-shadow: 0 0 10px rgba(0, 200, 140, 0.5);
}

/* Tablero de colocación */
.placement-board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

/* Variable de tamaño: ocupa el mayor espacio posible */
.placement-board-wrap .board-labels.cols,
.placement-board-wrap .board-with-labels {
  width: min(560px, calc(100vh - 180px), calc(100vw - 300px));
}

/* Etiquetas de coordenadas */
.board-labels {
  display: flex;
}
.board-labels.cols {
  padding-left: 16px; /* Offset para alinear con el tablero (las etiquetas de fila miden 16px) */
  gap: 0;
}
.board-labels.cols span,
.board-labels.rows span {
  flex: 1;
  text-align: center;
  font-size: 0.58rem;
  color: rgba(0, 180, 130, 0.5);
  letter-spacing: 1px;
}
.board-with-labels {
  position: relative;
  display: flex;
  gap: 0;
}
.board-labels.rows {
  flex-direction: column;
  justify-content: space-around;
  width: 16px;
  flex-shrink: 0;
}
/* El tablero ocupa el espacio restante después de las etiquetas de fila */
.board-with-labels .board {
  flex: 1;
  min-width: 0;
  aspect-ratio: 1;
}

/* ── Panel lateral de barcos ─────────────────────────── */
.placement-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 200px;
  max-width: 240px;
  flex: 1;
}

.panel-section-title {
  font-size: 0.62rem;
  letter-spacing: 4px;
  color: rgba(0, 180, 130, 0.6);
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* Lista de barcos disponibles */
.ship-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ship-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(0, 30, 24, 0.5);
  border: 1px solid rgba(0, 150, 110, 0.2);
  border-radius: 6px;
  cursor: grab;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.ship-entry:active { cursor: grabbing; }
.ship-entry:hover {
  background: rgba(0, 50, 38, 0.7);
  border-color: rgba(0, 200, 150, 0.4);
  box-shadow: 0 0 12px rgba(0, 200, 140, 0.1);
}
.ship-entry.selected {
  background: rgba(0, 60, 44, 0.8);
  border-color: rgba(0, 255, 180, 0.55);
  box-shadow: 0 0 16px rgba(0, 255, 180, 0.12);
}
.ship-entry.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.ship-entry-label {
  flex: 1;
  min-width: 0;
}
.ship-entry-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: #80d8b8;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.ship-entry-count {
  font-size: 0.62rem;
  color: rgba(0, 180, 130, 0.6);
  margin-top: 1px;
}

/* Barco en CSS puro — bloques metálicos */
.ship-visual {
  display: flex;
  gap: 2px;
  align-items: center;
}
.ship-visual.vertical {
  flex-direction: column;
}

.ship-block {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: linear-gradient(135deg,
    #8ab8a0 0%, #5a8870 30%,
    #3a6650 60%, #2a4a3c 100%
  );
  border: 1px solid rgba(160, 220, 180, 0.4);
  box-shadow:
    inset 1px 1px 3px rgba(255, 255, 255, 0.25),
    inset -1px -1px 2px rgba(0, 0, 0, 0.5),
    0 1px 3px rgba(0, 0, 0, 0.5);
  position: relative;
}
.ship-block:first-child {
  border-radius: 5px 3px 3px 5px;
  background: linear-gradient(135deg,
    #a0d0b8 0%, #6a9880 30%,
    #4a7860 60%, #3a5848 100%
  );
}
.ship-block:last-child {
  border-radius: 3px 5px 5px 3px;
}
.ship-visual.vertical .ship-block:first-child { border-radius: 5px 5px 3px 3px; }
.ship-visual.vertical .ship-block:last-child  { border-radius: 3px 3px 5px 5px; }

/* Versión grande en tablero */
.cell.barco .ship-fill {
  position: absolute;
  inset: 1px;
  border-radius: 2px;
  background: linear-gradient(135deg,
    rgba(100, 160, 130, 0.7) 0%,
    rgba(50, 100, 80, 0.6) 50%,
    rgba(30, 70, 55, 0.5) 100%
  );
  border: 1px solid rgba(140, 200, 160, 0.3);
  box-shadow:
    inset 1px 1px 3px rgba(255, 255, 255, 0.2),
    inset -1px -1px 2px rgba(0, 0, 0, 0.4);
}

/* ── Botones de acción del astillero ─────────────────── */
.placement-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.btn-naval {
  padding: 10px 16px;
  border-radius: 7px;
  border: 1px solid rgba(0, 180, 130, 0.35);
  background: rgba(0, 40, 30, 0.7);
  color: #70c8a0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
}
.btn-naval:hover {
  background: rgba(0, 70, 52, 0.85);
  border-color: rgba(0, 220, 160, 0.55);
  color: #a0ffcc;
  box-shadow: 0 0 14px rgba(0, 200, 140, 0.15), inset 0 0 6px rgba(0, 200, 140, 0.08);
}
.btn-naval:active { transform: scale(0.97); }

.btn-naval.primary {
  background: linear-gradient(135deg, rgba(0, 120, 80, 0.85), rgba(0, 80, 55, 0.9));
  border-color: rgba(0, 255, 160, 0.45);
  color: #b0ffe0;
}
.btn-naval.primary:hover {
  background: linear-gradient(135deg, rgba(0, 160, 105, 0.9), rgba(0, 110, 76, 0.95));
  box-shadow: 0 0 20px rgba(0, 255, 160, 0.2), 0 0 40px rgba(0, 200, 120, 0.08);
}
.btn-naval.primary:disabled,
.btn-naval.primary[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(0.5);
}

/* Indicador de orientación */
.orientation-indicator {
  font-size: 0.65rem;
  color: rgba(0, 180, 130, 0.55);
  letter-spacing: 2px;
  text-align: center;
  margin-top: -4px;
}

/* ═══════════════════════════════════════════════════════
   FASE 2: BATALLA
═══════════════════════════════════════════════════════ */

#screen-hundirlaflota-game {
  align-items: center;
  justify-content: flex-start;
  padding-top: 52px;
  overflow-y: auto;
}

.battle-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 1100px;
  padding: 0 16px 24px;
}

/* Zona de estado */
.battle-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 900px;
  padding: 10px 20px;
  background: rgba(0, 20, 16, 0.7);
  border: 1px solid rgba(0, 180, 130, 0.2);
  border-radius: 8px;
  backdrop-filter: blur(6px);
  gap: 16px;
  flex-wrap: wrap;
}

.battle-status-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.battle-status-label {
  font-size: 0.55rem;
  letter-spacing: 3px;
  color: rgba(0, 180, 130, 0.55);
  text-transform: uppercase;
}
.battle-status-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: #80e8c0;
  letter-spacing: 1px;
}
.battle-status-value.turno-activo {
  color: #00ffaa;
  text-shadow: 0 0 10px rgba(0, 255, 170, 0.5);
  animation: turno-glow 1.2s ease-in-out infinite alternate;
}
@keyframes turno-glow {
  from { text-shadow: 0 0 6px rgba(0, 255, 170, 0.4); }
  to   { text-shadow: 0 0 16px rgba(0, 255, 170, 0.8), 0 0 30px rgba(0, 200, 140, 0.4); }
}

.battle-status-msg {
  font-size: 0.78rem;
  color: #60c8a0;
  letter-spacing: 0.5px;
  text-align: center;
  flex: 1;
  min-width: 120px;
}

/* Contadores de barcos hundidos */
.sunken-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #50a888;
}
.sunken-icon { font-size: 1rem; }
.sunken-count { font-weight: 700; color: #80d0b0; }

/* ── Tableros duales ─────────────────────────────────── */
.boards-container {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
}

.board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 500px;
}
/* Los tableros de batalla son tan grandes como su contenedor permite */
.board-wrap .board-labels.cols,
.board-wrap .board-with-labels {
  width: 100%;
}

.board-wrap-title {
  font-size: 0.6rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(0, 180, 130, 0.6);
  text-shadow: 0 0 8px rgba(0, 200, 140, 0.3);
}

/* .board-attack y .board-own reciben flex:1 vía .board-with-labels .board */

/* Rival label */
.rival-label {
  font-size: 0.72rem;
  color: #60b898;
  letter-spacing: 1px;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 700px) {
  .placement-layout {
    flex-direction: column;
    align-items: center;
    padding-top: 8px;
  }

  /* En móvil la dimensión del board la fija el ancho disponible */
  .placement-board-wrap .board-labels.cols,
  .placement-board-wrap .board-with-labels {
    width: min(92vw, calc(100vh - 380px));
  }

  .placement-panel {
    max-width: 92vw;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .ship-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .ship-entry {
    flex: 1;
    min-width: 140px;
  }

  .placement-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .boards-container {
    flex-direction: column;
    align-items: center;
  }

  .board-wrap {
    width: 100%;
    max-width: min(92vw, 480px);
  }

  #screen-hundirlaflota-placement { padding-top: 48px; }
  #screen-hundirlaflota-game      { padding-top: 48px; }
}

@media (max-width: 400px) {
  .ship-entry { min-width: 100%; }
  .battle-status-bar { padding: 8px 12px; gap: 10px; }
}
