@font-face {
  font-family: "Orbitron";
  src: url("../fonts/Orbitron.ttf") format("truetype");
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "Rajdhani";
  src: url("../fonts/Rajdhani-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Rajdhani";
  src: url("../fonts/Rajdhani-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Rajdhani";
  src: url("../fonts/Rajdhani-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --navy-0: #04101e;
  --navy-1: #071526;
  --navy-2: #0c243d;
  --teal: #0e4d5c;
  --cyan: #3de7ff;
  --cyan-dim: #1a8fa8;
  --metal: #9aa7b8;
  --metal-hi: #e8eef6;
  --metal-lo: #3a4555;
  --orange: #ff6a1a;
  --fire: #ffb020;
  --hit: #ff2d2d;
  --miss: #e8f4ff;
  --green: #3dff8a;
  --panel: rgba(8, 22, 40, 0.78);
  --glow: 0 0 18px rgba(61, 231, 255, 0.45);
  --font-display: "Orbitron", "Segoe UI", sans-serif;
  --font-ui: "Rajdhani", "Segoe UI", sans-serif;
  --cell: clamp(22px, 7.2vw, 42px);
  --radius: 10px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--navy-0);
  color: var(--metal-hi);
  font-family: var(--font-ui);
  font-weight: 600;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
body {
  min-height: 100dvh;
  position: relative;
}
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* —— Ocean backdrop —— */
#ocean {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 55% at 55% 38%, rgba(255, 110, 50, 0.22), transparent 55%),
    radial-gradient(ellipse 120% 60% at 50% 110%, #062a3a 0%, transparent 55%),
    linear-gradient(180deg, #08111f 0%, #15263c 26%, #1c3348 42%, #123348 58%, #0a2034 78%, #040e18 100%);
}
#ocean .sky {
  position: absolute;
  inset: 0 0 40% 0;
  background:
    radial-gradient(ellipse 55% 45% at 72% 42%, rgba(255, 140, 60, 0.5), transparent 62%),
    radial-gradient(ellipse 35% 28% at 48% 55%, rgba(255, 70, 110, 0.22), transparent 70%),
    radial-gradient(ellipse 80% 50% at 30% 20%, rgba(40, 60, 90, 0.5), transparent 60%),
    linear-gradient(180deg, #070e1a, #152033 55%, transparent);
}
#ocean .horizon {
  position: absolute;
  left: -10%;
  right: -10%;
  top: 40%;
  height: 22%;
  background: linear-gradient(180deg, rgba(255, 160, 70, 0.65), rgba(255, 90, 40, 0.22), transparent);
  filter: blur(10px);
  opacity: 0.85;
}
#ocean .waves {
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: 0;
  height: 55%;
  background:
    repeating-linear-gradient(
      95deg,
      transparent 0 40px,
      rgba(61, 231, 255, 0.03) 40px 42px
    ),
    linear-gradient(180deg, transparent, rgba(4, 30, 50, 0.85));
}
#ocean .wave-1 {
  animation: drift 18s linear infinite;
  opacity: 0.55;
  background-image:
    radial-gradient(ellipse 80px 18px at 10% 20%, rgba(100, 180, 220, 0.12), transparent),
    radial-gradient(ellipse 100px 20px at 40% 50%, rgba(80, 160, 200, 0.1), transparent),
    radial-gradient(ellipse 90px 16px at 75% 30%, rgba(100, 180, 220, 0.12), transparent);
}
#ocean .wave-2 {
  animation: drift 28s linear infinite reverse;
  opacity: 0.4;
}
#ocean .ships-silhouette {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 38%;
  height: 40px;
  background:
    radial-gradient(ellipse 90px 14px at 20% 70%, #050b14 70%, transparent),
    radial-gradient(ellipse 120px 16px at 55% 60%, #050b14 70%, transparent),
    radial-gradient(ellipse 70px 12px at 80% 75%, #050b14 70%, transparent);
  opacity: 0.85;
  filter: blur(0.5px);
}
#ocean .deco-torpedo {
  position: absolute;
  left: 4%;
  bottom: 8%;
  width: 90px;
  height: 18px;
  border-radius: 10px;
  background: linear-gradient(90deg, #3a4555, #c5d0dc 55%, #6ad0ff);
  box-shadow: 0 0 16px rgba(100, 200, 255, 0.45), 12px 8px 0 rgba(200, 230, 255, 0.15);
  transform: rotate(-8deg);
  opacity: 0.55;
  animation: torpedo-drift 7s ease-in-out infinite alternate;
}
#ocean .deco-torpedo::after {
  content: "";
  position: absolute;
  right: -18px;
  top: 2px;
  width: 22px;
  height: 14px;
  background: radial-gradient(circle, rgba(220, 240, 255, 0.7), transparent 70%);
  filter: blur(2px);
}
@keyframes torpedo-drift {
  from { transform: rotate(-8deg) translateX(0); }
  to { transform: rotate(-6deg) translateX(18px); }
}
@media (max-width: 600px) {
  #ocean .deco-torpedo { width: 56px; opacity: 0.35; }
}
@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(-40px); }
}

#shake-root {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
#shake-root.shake {
  animation: screen-shake 0.45s ease-out;
}
@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 3px); }
  40% { transform: translate(7px, -4px); }
  60% { transform: translate(-4px, -2px); }
  80% { transform: translate(3px, 3px); }
}
#shake-root.shake-heavy {
  animation: screen-shake-heavy 0.7s ease-out;
}
@keyframes screen-shake-heavy {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  15% { transform: translate(-10px, 6px) rotate(-0.4deg); }
  35% { transform: translate(12px, -8px) rotate(0.5deg); }
  55% { transform: translate(-8px, -4px) rotate(-0.3deg); }
  75% { transform: translate(6px, 5px) rotate(0.2deg); }
}

#fx-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
}

/* —— Header —— */
.top-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.75rem 0.25rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.player-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: linear-gradient(145deg, rgba(40, 55, 75, 0.85), rgba(12, 22, 36, 0.9));
  border: 1px solid rgba(180, 200, 220, 0.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 0 6px 18px rgba(0,0,0,0.4);
  clip-path: polygon(10% 0, 100% 0, 100% 70%, 90% 100%, 0 100%, 0 30%);
  padding: 0.45rem 0.65rem;
  min-width: 0;
}
.player-card.active-turn {
  box-shadow: inset 0 0 0 1px var(--cyan), 0 0 20px rgba(61, 231, 255, 0.35);
}
.avatar {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(160deg, #2a4058, #101a28);
  border: 1px solid rgba(200, 220, 240, 0.35);
  overflow: hidden;
}
.avatar svg { width: 100%; height: 100%; display: block; }
.card-meta { min-width: 0; }
.card-meta.right { text-align: right; margin-left: auto; }
.card-role {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  opacity: 0.9;
}
.card-name {
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 28vw;
}
.card-status {
  font-size: 0.75rem;
  color: var(--metal);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.card-meta.right .card-status { justify-content: flex-end; }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot.online { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.offline { background: #667; }

.logo-wrap { display: flex; justify-content: center; }
.logo-badge {
  position: relative;
  width: min(180px, 38vw);
  height: min(90px, 20vw);
  display: grid;
  place-items: center;
}
.logo-badge .wheel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.95;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.55));
}
.logo-title {
  position: relative;
  z-index: 1;
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.72rem, 2.6vw, 1.05rem);
  line-height: 1.05;
  letter-spacing: 0.06em;
  color: #e9eef5;
  text-shadow:
    0 1px 0 #1a1a1a,
    0 0 12px rgba(200, 220, 255, 0.35),
    0 2px 4px rgba(0,0,0,0.8);
  background: linear-gradient(180deg, #fff 0%, #b8c4d4 45%, #7a8799 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,0.8));
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  max-width: 1200px;
  margin: 0.2rem auto 0.4rem;
  padding: 0 0.75rem;
  width: 100%;
}
.turn-banner {
  flex: 1;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(0.72rem, 2.4vw, 0.95rem);
  letter-spacing: 0.08em;
  padding: 0.45rem 0.8rem;
  background: linear-gradient(90deg, transparent, rgba(61, 231, 255, 0.12), transparent);
  border-top: 1px solid rgba(61, 231, 255, 0.25);
  border-bottom: 1px solid rgba(61, 231, 255, 0.25);
  color: var(--cyan);
  text-shadow: var(--glow);
}
.turn-banner.your-turn {
  color: var(--fire);
  border-color: rgba(255, 176, 32, 0.4);
  background: linear-gradient(90deg, transparent, rgba(255, 120, 30, 0.18), transparent);
  animation: pulse-turn 1.6s ease-in-out infinite;
}
@keyframes pulse-turn {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}
.toolbar-actions { display: flex; gap: 0.4rem; }

.btn {
  border: 1px solid rgba(200, 220, 240, 0.35);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--metal-hi);
  min-height: 40px;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.metal {
  background: linear-gradient(180deg, #5a6a7e, #2a3544 55%, #1a2430);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 3px 8px rgba(0,0,0,0.4);
}
.btn.accent {
  background: linear-gradient(180deg, #3ec9e0, #147a90 55%, #0b4a58);
  border-color: rgba(120, 230, 255, 0.55);
  box-shadow: 0 0 14px rgba(61, 231, 255, 0.35), inset 0 1px 0 rgba(255,255,255,0.3);
  color: #041018;
  font-weight: 700;
}

/* —— Layout —— */
.battle {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 0.6rem calc(0.8rem + var(--safe-b));
}
.fleet-panel {
  background: var(--panel);
  border: 1px solid rgba(140, 180, 210, 0.28);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  backdrop-filter: blur(8px);
  box-shadow: inset 0 0 30px rgba(61, 231, 255, 0.05);
}
.fleet-panel h2 {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--cyan);
}
.next-ship {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(61, 231, 255, 0.08);
  border: 1px solid rgba(61, 231, 255, 0.35);
  box-shadow: 0 0 16px rgba(61, 231, 255, 0.12);
  text-align: center;
}
.next-ship-label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--cyan);
  margin-bottom: 0.35rem;
}
.next-ship-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
}
.next-ship-visual {
  display: flex;
  gap: 3px;
  align-items: center;
  justify-content: center;
}
.next-ship-visual.vert {
  flex-direction: column;
}
.next-ship-visual .next-seg {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(180deg, #b0c0d0, #4a5a6c);
  border: 1px solid rgba(200, 220, 240, 0.5);
  box-shadow: 0 0 8px rgba(61, 231, 255, 0.35);
}
.next-ship-visual.horiz .next-seg:first-child {
  border-radius: 8px 4px 4px 8px;
}
.next-ship-visual.horiz .next-seg:last-child {
  border-radius: 4px 10px 10px 4px;
  clip-path: polygon(0 0, 70% 0, 100% 50%, 70% 100%, 0 100%);
}
.next-ship-visual.vert .next-seg:first-child {
  border-radius: 8px 8px 4px 4px;
}
.next-ship-visual.vert .next-seg:last-child {
  border-radius: 4px 4px 10px 10px;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
}
.next-ship-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.95rem;
  color: var(--metal-hi);
}
.next-ship-hint {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--metal);
}
#fleet-list li.fleet-status {
  cursor: default;
  pointer-events: none;
}
#fleet-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
#fleet-list li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(120, 160, 190, 0.25);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
}
#fleet-list li.sunk { opacity: 0.4; filter: grayscale(0.7); }
#fleet-list li.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(61, 231, 255, 0.35);
}
.ship-silhouette {
  display: flex;
  gap: 2px;
  align-items: center;
  min-height: 16px;
}
.place-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}
.place-controls .btn { flex: 1 1 auto; }

.boards { min-width: 0; }
.board-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}
.board-tabs .tab {
  background: linear-gradient(180deg, #2a3a4e, #152030);
  border: 1px solid rgba(140, 180, 210, 0.3);
  color: var(--metal);
  border-radius: 8px;
  padding: 0.55rem;
  font-weight: 700;
  font-size: 0.95rem;
  min-height: 44px;
}
.board-tabs .tab.active {
  color: var(--cyan);
  border-color: rgba(61, 231, 255, 0.55);
  box-shadow: var(--glow);
}

.boards-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.board-wrap { min-width: 0; }
.board-wrap.mobile-hide { display: none; }
.board-title {
  margin: 0 0 0.35rem;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--cyan-dim);
}
.grid-frame {
  position: relative;
  margin: 0 auto;
  width: fit-content;
  max-width: 100%;
  padding: 0.55rem;
  background: linear-gradient(160deg, rgba(30, 50, 70, 0.9), rgba(8, 18, 32, 0.95));
  border: 1px solid rgba(160, 190, 220, 0.35);
  border-radius: 12px;
  box-shadow:
    inset 0 0 40px rgba(61, 231, 255, 0.08),
    0 10px 30px rgba(0, 0, 0, 0.45);
}
.grid-frame.hot {
  box-shadow:
    inset 0 0 40px rgba(255, 100, 40, 0.08),
    0 0 24px rgba(61, 231, 255, 0.15),
    0 10px 30px rgba(0, 0, 0, 0.45);
}

.grid {
  --gap: 2px;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 22px repeat(10, var(--cell));
  grid-template-rows: 18px repeat(10, var(--cell));
  gap: var(--gap);
  user-select: none;
}
.grid .corner { grid-column: 1; grid-row: 1; }
.grid .col-label,
.grid .row-label {
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  color: rgba(220, 235, 255, 0.75);
  font-weight: 700;
}
.grid .cell {
  position: relative;
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(20, 60, 80, 0.35), rgba(8, 30, 48, 0.55)),
    rgba(6, 28, 44, 0.65);
  border: 1px solid rgba(61, 231, 255, 0.22);
  box-shadow: inset 0 0 8px rgba(61, 231, 255, 0.08);
  min-width: 0;
  min-height: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  color: inherit;
}
.grid .cell:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
}
.grid .cell.ship,
.grid .cell.sunk-ship {
  background: transparent;
  border-color: rgba(61, 231, 255, 0.12);
  box-shadow: none;
}
.grid .cell.ship-under {
  background: rgba(61, 231, 255, 0.04) !important;
  border-color: rgba(61, 231, 255, 0.1) !important;
  box-shadow: none !important;
}
.grid .cell.hit-on-ship::before,
.grid .cell.hit-on-ship::after {
  display: none;
}

/* Continuous SVG ship overlays */
.ship-layer {
  position: absolute;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
}
.ship-sprite {
  position: absolute;
  pointer-events: none;
  z-index: 3;
}
.ship-sprite .ship-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.ship-sprite.sunk {
  filter: saturate(0.75) brightness(0.92);
}
.fleet-mini-ship {
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 0 3px rgba(61, 231, 255, 0.25));
}
.grid .cell.preview-ok {
  background: rgba(61, 231, 255, 0.35) !important;
  border-color: var(--cyan) !important;
}
.grid .cell.preview-bad {
  background: rgba(255, 60, 60, 0.35) !important;
  border-color: #ff5555 !important;
}
.grid .cell.miss::after {
  content: "";
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  background: var(--miss);
  box-shadow: 0 0 6px rgba(255,255,255,0.7);
}
.grid .cell.hit::before,
.grid .cell.sunk::before {
  content: "";
  position: absolute;
  inset: 18%;
  border: 2px solid var(--hit);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 45, 45, 0.8), inset 0 0 6px rgba(255, 80, 40, 0.6);
}
.grid .cell.hit::after,
.grid .cell.sunk::after {
  content: "";
  position: absolute;
  left: 48%;
  top: 18%;
  width: 2px;
  height: 64%;
  background: var(--hit);
  box-shadow: 0 0 6px var(--hit);
  transform: rotate(45deg);
}
.grid .cell.sunk {
  background: linear-gradient(180deg, #4a2a20, #1a1010) !important;
}
.grid .cell.sunk-ship {
  background: linear-gradient(180deg, #5a3a2a, #2a1810) !important;
  border-color: rgba(255, 120, 40, 0.5) !important;
  opacity: 0.9;
}
.grid .cell.fireable:not(.miss):not(.hit):not(.sunk):hover,
.grid .cell.fireable:not(.miss):not(.hit):not(.sunk):focus-visible {
  background: rgba(255, 140, 40, 0.28);
  border-color: var(--orange);
  cursor: crosshair;
}
.grid.placing .cell:not(.ship) {
  cursor: pointer;
}
.grid .cell.blocked {
  pointer-events: none;
}

/* —— Sunk banner —— */
.sunk-banner {
  position: fixed;
  left: 50%;
  bottom: calc(12% + var(--safe-b));
  transform: translateX(-50%) scale(0.85);
  z-index: 50;
  pointer-events: none;
  opacity: 0;
}
.sunk-banner.show {
  animation: sunk-pop 2.8s ease forwards;
}
@keyframes sunk-pop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.6) translateY(20px); }
  12% { opacity: 1; transform: translateX(-50%) scale(1.08) translateY(0); }
  22% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(0.95) translateY(-10px); }
}
.sunk-inner {
  position: relative;
  text-align: center;
  padding: 0.9rem 1.6rem 1rem;
  min-width: min(88vw, 420px);
  background: linear-gradient(180deg, #2a1408, #0e0806 70%);
  border: 2px solid rgba(255, 140, 40, 0.75);
  clip-path: polygon(8% 0, 92% 0, 100% 30%, 100% 70%, 92% 100%, 8% 100%, 0 70%, 0 30%);
  box-shadow: 0 0 40px rgba(255, 100, 20, 0.55), inset 0 0 30px rgba(255, 80, 0, 0.2);
}
.sunk-boom {
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  font-size: 1.6rem;
  filter: drop-shadow(0 0 8px orange);
}
.sunk-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 6vw, 2.2rem);
  letter-spacing: 0.12em;
  color: #ff9a2a;
  text-shadow: 0 0 18px rgba(255, 100, 0, 0.9), 0 2px 0 #401000;
}
.sunk-sub {
  margin-top: 0.2rem;
  font-size: 0.95rem;
  color: #ffd9a8;
}

/* —— Overlay / modal —— */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(2, 8, 16, 0.72);
  display: grid;
  place-items: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}
.metal-panel {
  width: min(420px, 100%);
  background: linear-gradient(160deg, #2c3b4e, #121a26);
  border: 1px solid rgba(180, 200, 220, 0.4);
  border-radius: 14px;
  padding: 1.25rem 1.2rem 1.1rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.15);
}
.metal-panel h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  color: var(--cyan);
  text-align: center;
}
.metal-panel p {
  margin: 0 0 0.85rem;
  text-align: center;
  color: var(--metal);
  line-height: 1.35;
}
.metal-panel label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--cyan-dim);
  font-size: 0.9rem;
}
.metal-panel input[type="text"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(140, 180, 210, 0.4);
  background: rgba(0, 0, 0, 0.35);
  color: var(--metal-hi);
  font: inherit;
  font-size: 1.05rem;
  margin-bottom: 0.9rem;
}
.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.modal-actions .btn { min-width: 120px; }
.win-burst {
  text-align: center;
  font-size: 2.4rem;
  margin-bottom: 0.3rem;
  animation: win-bounce 0.8s ease infinite alternate;
}
@keyframes win-bounce {
  from { transform: scale(1) rotate(-4deg); }
  to { transform: scale(1.12) rotate(4deg); }
}

.toast {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  z-index: 55;
  background: rgba(8, 20, 36, 0.92);
  border: 1px solid rgba(61, 231, 255, 0.4);
  color: var(--metal-hi);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 0.95rem;
  box-shadow: var(--glow);
  pointer-events: none;
}

/* FX bits */
.fx-torpedo {
  position: absolute;
  width: 28px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #888, #eee 40%, #6af);
  box-shadow: 0 0 12px rgba(100, 200, 255, 0.8);
  z-index: 41;
  offset-path: none;
}
.fx-splash {
  position: absolute;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  border: 2px solid rgba(200, 230, 255, 0.8);
  box-shadow: 0 0 16px rgba(150, 210, 255, 0.7);
  animation: splash 0.55s ease-out forwards;
  z-index: 42;
}
@keyframes splash {
  0% { transform: scale(0.2); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}
.fx-explosion {
  position: absolute;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #ffb020 25%, #ff4a00 55%, transparent 70%);
  box-shadow: 0 0 30px rgba(255, 100, 0, 0.9);
  animation: boom 0.7s ease-out forwards;
  z-index: 43;
}
.fx-explosion.big {
  width: 110px;
  height: 110px;
  margin: -55px 0 0 -55px;
  animation-duration: 1s;
}
@keyframes boom {
  0% { transform: scale(0.2); opacity: 1; }
  40% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
.fx-particle {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffb020;
  z-index: 44;
  animation: particle 0.7s ease-out forwards;
}
@keyframes particle {
  to { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

/* —— Responsive: tablet+ side by side —— */
@media (min-width: 820px) and (orientation: landscape), (min-width: 960px) {
  :root { --cell: clamp(28px, 3.6vw, 44px); }
  .battle {
    grid-template-columns: 180px 1fr;
    align-items: start;
  }
  .board-tabs { display: none; }
  .boards-row {
    grid-template-columns: 1fr 1fr;
  }
  .board-wrap.mobile-hide { display: block !important; }
  .fleet-panel {
    position: sticky;
    top: 0.5rem;
  }
  #fleet-list { flex-direction: column; flex-wrap: nowrap; }
  .card-name { max-width: 140px; }
  .logo-badge { width: 160px; height: 88px; }
}

@media (max-width: 819px) {
  .top-bar { grid-template-columns: 1fr auto 1fr; }
  .avatar { width: 36px; height: 36px; }
  .card-name { font-size: 0.9rem; }
  .board-title { display: none; }
}

@media (max-width: 420px) {
  :root { --cell: clamp(20px, 7.6vw, 32px); }
  .toolbar { flex-wrap: wrap; }
  .turn-banner { order: 2; flex-basis: 100%; }
}
