/* Sänka skepp page – the game box is css/game-stage.css, the robot games' shared look (names, bubbles, menus, big text,
   back button) css/holo-games.css. The two seas, the ships and the shots are drawn on the canvas (sankaskepp.js). */

/* Phones held upright: a tall box, the two seas one above the other */
@media (max-aspect-ratio: 1/1) {
  .stage {
    --aspect: 3 / 4;
  }
}

/* The ships still afloat, in the name box: one small bar per ship, as long as the ship; a sunk one dims and is struck */
.ss-fleet {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.18em;
  margin-left: 0.3rem;
}

.ss-fleet i {
  display: block;
  width: calc(var(--length, 3) * 0.32em);
  height: 0.5em;
  border-radius: 0.25em 0.5em 0.5em 0.25em;
  background: var(--cyan);
  box-shadow: 0 0 6px rgba(94, 240, 255, 0.7);
  transition: opacity 0.4s, background 0.4s, transform 0.4s;
}

.ss-fleet i.is-sunk {
  background: #ff4d3d;
  box-shadow: none;
  opacity: 0.35;
  transform: translateY(0.18em) rotate(-8deg);
}

.ss-fleet i.just-sunk {
  animation: ss-sink 0.8s ease-in;
}

@keyframes ss-sink {
  0% { transform: none; opacity: 1; background: #ffe94d; }
  60% { transform: translateY(-0.15em); }
  100% { transform: translateY(0.18em) rotate(-8deg); opacity: 0.35; }
}

/* Placing: Slumpa, Vänd and Klar along the bottom of the box (between the corner buttons) */
.ss-place-bar {
  position: absolute;
  left: 50%;
  bottom: calc(0.7rem + var(--safe-bottom, 0px));
  z-index: 3;
  display: flex;
  gap: 0.6rem;
  transform: translateX(-50%);
}

.ss-place-bar[hidden] {
  display: none;
}

.ss-place-bar .button {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.5rem 1rem;
  font-size: 1rem;
}

.ss-place-bar svg {
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ss-place-bar svg circle {
  fill: currentColor;
  stroke: none;
}

/* Show, don't tell: Slumpa breathes while nothing is placed, Klar glows when every ship is on the sea */
.ss-shuffle.is-calling {
  animation: ss-breathe 1.6s ease-in-out infinite;
}

.ss-done:not(:disabled) {
  animation: ss-breathe 1.2s ease-in-out infinite;
}

.ss-done:disabled {
  opacity: 0.35;
}

/* A box held upright: the buttons sit above the corner buttons (back, sound), a little smaller */
@media (max-aspect-ratio: 1/1) {
  .ss-place-bar {
    bottom: calc(4rem + var(--safe-bottom, 0px));
    gap: 0.4rem;
  }

  .ss-place-bar .button {
    padding: 0.45rem 0.7rem;
    font-size: 0.9rem;
  }
}

@keyframes ss-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); filter: brightness(1.3); }
}

/* No peeking (two at the same computer): a dark curtain over the box until the next player is ready */
.ss-curtain {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  background: radial-gradient(circle at 50% 45%, rgba(40, 20, 80, 0.96), rgba(6, 4, 20, 0.99));
}

.ss-curtain[hidden] {
  display: none;
}

.ss-eye {
  width: 5rem;
  height: 2.5rem;
  fill: none;
  stroke: var(--cyan);
  stroke-width: 2.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(94, 240, 255, 0.8));
}

.ss-curtain-name {
  margin: 0;
  font-size: calc(2.2rem * var(--ui, 1));
  font-weight: 900;
  font-style: italic;
  color: var(--side-colour, var(--magenta));
  text-shadow: 0 0 14px var(--side-colour, var(--magenta));
}

.ss-curtain .button {
  font-size: calc(1.1rem * var(--ui, 1));
}

@media (prefers-reduced-motion: reduce) {
  .ss-shuffle.is-calling, .ss-done:not(:disabled), .ss-fleet i.just-sunk {
    animation: none;
  }
}
