/* ═══════════════════════════════════════════════════════════════════
   Naval Theme – Farbvariablen und Board-Optik
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --color-ocean:     #0a1628;
  --color-deepsea:   #1a3a5c;
  --color-steel:     #5d8aa8;
  --color-gold:      #e8c547;
  --color-explosion: #c0392b;
  --color-water:     #2e86ab;
}

/* Ozean-Hintergrund mit Gitter-Textur */
body {
  background: var(--color-ocean);
  background-image:
    radial-gradient(ellipse at 20% 80%, rgba(46,134,171,0.07) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(26,58,92,0.10) 0%, transparent 60%),
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
  font-family: 'Oswald', 'Segoe UI', system-ui, sans-serif;
}

/* Board-Zell-Basis */
.cell {
  background: var(--color-deepsea);
  border-color: rgba(46,134,171,0.15);
}

/* Schiff (nur eigenes Board via data-own="1") */
.cell.ship {
  background: var(--color-steel);
  border-color: #7aaec8;
}
.cell.ship[data-own="1"]::after {
  content: '🚢';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7em;
  line-height: 1;
}

/* Treffer */
.cell.hit {
  background: var(--color-explosion);
  border-color: #e74c3c;
  box-shadow: 0 0 10px rgba(192,57,43,0.7);
}
.cell.hit::after {
  content: '💥';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75em;
  line-height: 1;
}

/* Miss */
.cell.miss {
  background: rgba(46,134,171,0.18);
  border-color: var(--color-water);
}
.cell.miss::after {
  content: '🌊';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7em;
  line-height: 1;
}

/* Versenkt */
.cell.sunk {
  background: #3a0a0a;
  border-color: #6b1212;
}
.cell.sunk::after {
  content: '💥';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75em;
  line-height: 1;
  opacity: 0.5;
}

.logo, h1, h2, h3, .turn-indicator {
  font-family: 'Oswald', sans-serif;
  letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════════════════════════
   Schuss-Animationen
   ═══════════════════════════════════════════════════════════════════ */

/* Treffer-Animation */
@keyframes anim-hit {
  0%   { transform: scale(0.3); opacity: 0; }
  60%  { transform: scale(1.4); }
  80%  { transform: scale(1.1); }
  100% { transform: scale(1);   opacity: 1; }
}

/* Miss-Animation */
@keyframes anim-miss {
  0%   { transform: scale(0.5) rotate(-10deg); }
  50%  { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1)   rotate(0deg); }
}

/* Versenkt-Animation */
@keyframes anim-sunk {
  0%   { opacity: 1;   transform: translateY(0);   filter: brightness(1); }
  40%  {               transform: translateY(-2px); filter: brightness(2); }
  100% { opacity: 0.3; transform: translateY(4px); }
}

/* Turn-Indikator-Puls */
@keyframes pulse-turn {
  0%   { box-shadow: 0 0 0 0   rgba(232,197,71,0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(232,197,71,0);   }
  100% { box-shadow: 0 0 0 0   rgba(232,197,71,0);   }
}

/* Klassen, die die Animationen auslösen */
.cell.animate-hit  { animation: anim-hit  0.5s ease-out forwards; }
.cell.animate-miss { animation: anim-miss 0.4s ease-out forwards; }
.cell.animate-sunk { animation: anim-sunk 1.2s ease-in-out forwards; }

/* Turn-Indikator pulsiert wenn mein Zug */
.turn-indicator.my-turn {
  animation: pulse-turn 1.5s infinite;
  border-color: var(--color-gold);
  color: var(--color-gold);
  background: rgba(232,197,71,0.1);
  box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════════
   Ergebnis-Screen-Animationen
   ═══════════════════════════════════════════════════════════════════ */

@keyframes anim-trophy {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.15); }
  80%  { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes anim-skull-shake {
  0%,100% { transform: rotate(0deg); }
  20%     { transform: rotate(-8deg); }
  40%     { transform: rotate(8deg); }
  60%     { transform: rotate(-5deg); }
  80%     { transform: rotate(5deg); }
}

.result-icon.animate-win  { animation: anim-trophy      0.5s ease-out forwards; }
.result-icon.animate-lose { animation: anim-skull-shake 0.4s ease-in-out; }

/* ═══════════════════════════════════════════════════════════════════
   Countdown-Styles (werden in Task 3 via HTML genutzt)
   ═══════════════════════════════════════════════════════════════════ */

@keyframes anim-countdown {
  0%   { transform: scale(1.5); opacity: 0; }
  20%  { transform: scale(1);   opacity: 1; }
  80%  { transform: scale(1);   opacity: 1; }
  100% { transform: scale(0.8); opacity: 0; }
}

.countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(10,22,40,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.countdown-overlay.hidden { display: none; }

.countdown-number {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(6rem, 20vw, 10rem);
  font-weight: 700;
  color: var(--color-gold);
  text-shadow: 0 0 40px rgba(232,197,71,0.6);
  animation: anim-countdown 0.8s ease-in-out;
}

/* ═══════════════════════════════════════════════════════════════════
   Mute-Button
   ═══════════════════════════════════════════════════════════════════ */

.btn-mute {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  z-index: 500;
  background: rgba(13,34,64,0.85);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: background 0.2s;
}
.btn-mute:hover { background: rgba(46,134,171,0.3); }
.btn-mute.muted { opacity: 0.5; }
