/* ------------------------------------------------------------------
 * Neon Fleet
 * ------------------------------------------------------------------ */
.fleet-wrap {
  display: grid;
  gap: 1rem;
}

.fleet-phases {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.fleet-phases span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  color: var(--text-dim);
  font-family: "Orbitron", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.fleet-phases span.active {
  color: var(--accent-glow);
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line) 30%);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 40%, transparent);
}

.fleet-boards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.2rem;
  justify-items: center;
}

/* Board tabs - desktop keeps both boards side by side, so the tabs are
 * hidden; on touch screens they switch which single board is shown. */
.fleet-tabs {
  display: none;
}

.fleet-cell {
  touch-action: manipulation;
}

.fleet-panel {
  display: grid;
  gap: 0.5rem;
  justify-items: center;
  min-width: 0;
}

.fleet-panel-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  width: 100%;
  max-width: 340px;
}

.fleet-panel-head h4 {
  margin: 0;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fleet-count {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.fleet-board {
  display: grid;
  gap: 3px;
  width: min(340px, 100%);
}

.fleet-labels {
  display: grid;
  grid-template-columns: 22px repeat(10, 1fr);
  gap: 3px;
  color: var(--text-dim);
  font-size: 0.66rem;
  text-align: center;
  font-family: "Orbitron", sans-serif;
}

.fleet-labels-cols span:not(:first-child) {
  padding-top: 2px;
}

.fleet-row {
  display: grid;
  grid-template-columns: 22px repeat(10, 1fr);
  gap: 3px;
}

.fleet-label-row {
  display: grid;
  place-items: center;
  color: var(--text-dim);
  font-size: 0.66rem;
  font-family: "Orbitron", sans-serif;
}

.fleet-cell {
  aspect-ratio: 1;
  border: 1px solid rgba(60, 90, 140, 0.4);
  border-radius: 6px;
  background: rgba(8, 16, 34, 0.85);
  cursor: default;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--text-main);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.fleet-enemy-board .fleet-cell:not(:disabled) {
  cursor: crosshair;
}

.fleet-enemy-board .fleet-cell:not(:disabled):hover {
  background: color-mix(in srgb, var(--accent) 26%, rgba(8, 16, 34, 0.9));
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 40%, transparent);
}

.fleet-mine-board .fleet-cell.ship {
  background: linear-gradient(160deg, #1c6f9e, #0e3f63);
  border-color: #38bdf8;
  box-shadow: inset 0 0 8px rgba(56, 189, 248, 0.5);
}

.fleet-mine-board .fleet-cell.ship.ship-h-start {
  border-radius: 6px 2px 2px 6px;
}

.fleet-mine-board .fleet-cell.ship.ship-h-end {
  border-radius: 2px 6px 6px 2px;
}

.fleet-mine-board .fleet-cell.ship.ship-v-start {
  border-radius: 6px 6px 2px 2px;
}

.fleet-mine-board .fleet-cell.ship.ship-v-end {
  border-radius: 2px 2px 6px 6px;
}

.fleet-cell.preview {
  background: color-mix(in srgb, var(--accent) 16%, rgba(8, 16, 34, 0.9));
}

.fleet-cell.preview.valid {
  background: color-mix(in srgb, #39ff14 30%, rgba(8, 16, 34, 0.9));
}

.fleet-cell.preview.invalid {
  background: color-mix(in srgb, #ff4d6d 30%, rgba(8, 16, 34, 0.9));
}

.fleet-cell.hit {
  background: rgba(80, 12, 26, 0.9);
  border-color: #ff4d6d;
  animation: fleet-explode 380ms ease;
}

.fleet-hit-mark {
  color: #ff6b8a;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 77, 109, 0.9);
}

.fleet-cell.miss {
  background: rgba(10, 18, 34, 0.9);
}

.fleet-miss-mark {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 1px solid rgba(144, 166, 195, 0.6);
}

.fleet-cell.revealed-ship {
  background: linear-gradient(160deg, #2b6b57, #14402f);
  border-color: #4ade80;
}

.fleet-status {
  margin: 0;
  text-align: center;
  color: var(--text-dim);
  min-height: 1.3rem;
}

.fleet-ships {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.fleet-ship-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 13, 26, 0.8);
  color: var(--text-main);
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  font-family: "Orbitron", sans-serif;
  font-size: 0.74rem;
  transition: border-color 0.18s ease, box-shadow 0.2s ease;
}

.fleet-ship-chip em {
  font-style: normal;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  font-size: 0.66rem;
}

.fleet-ship-chip.active {
  border-color: color-mix(in srgb, var(--accent) 75%, #ffffff 25%);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent-glow);
}

.fleet-ship-chip.placed {
  opacity: 0.55;
  cursor: default;
}

.fleet-hint {
  width: 100%;
  font-size: 0.82rem;
}

@keyframes fleet-explode {
  0% {
    transform: scale(1.6);
    box-shadow: 0 0 24px rgba(255, 77, 109, 0.9);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 767px) {
  .fleet-boards {
    grid-template-columns: 1fr;
  }

  /* Only the active board is visible on phones. */
  .fleet-panel {
    display: none;
  }

  .fleet-panel.active {
    display: grid;
  }

  .fleet-tabs {
    display: flex;
    gap: 0.5rem;
    justify-content: stretch;
  }

  .fleet-tab {
    flex: 1 1 0;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(8, 13, 26, 0.8);
    color: var(--text-dim);
    font-family: "Orbitron", sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    touch-action: manipulation;
    transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  }

  .fleet-tab.active {
    color: var(--accent-glow);
    border-color: color-mix(in srgb, var(--accent) 70%, var(--line) 30%);
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 35%, transparent);
  }

  /* Placed-ship chips and board cells are tap targets on phones. */
  .fleet-ship-chip {
    min-height: 44px;
  }

  .fleet-cell {
    border-radius: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fleet-cell.hit {
    animation: none;
  }
}
