:root {
  --bg-deep: #021018;
  --bg-mid: #0a2f3a;
  --teal: #1fa6a0;
  --teal-bright: #3dd6c6;
  --foam: #e8f4f2;
  --foam-dim: rgba(232, 244, 242, 0.72);
  --ink: #041820;
  --hit: #e85d4c;
  --miss: #6b8790;
  --ship: #c9a45c;
  --ship-edge: #8a6d2f;
  --danger: #ff8a7a;
  --radius: 14px;
  --font-display: "Bricolage Grotesque", Georgia, serif;
  --font-body: "Figtree", system-ui, sans-serif;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--foam);
  background: var(--bg-deep);
  min-height: 100vh;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

.sea {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 700px at 12% -8%, #145a63 0%, transparent 55%),
    radial-gradient(900px 600px at 92% 8%, #0d3d4a 0%, transparent 50%),
    linear-gradient(180deg, #06303a 0%, var(--bg-deep) 52%, #01080c 100%);
}

.sea__glow {
  position: absolute;
  inset: auto -10% -22% -10%;
  height: 58%;
  background: radial-gradient(ellipse at center, rgba(31, 166, 160, 0.26), transparent 65%);
  animation: drift 16s ease-in-out infinite alternate;
}

.sea__caustic {
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background:
    radial-gradient(circle at 20% 30%, rgba(61, 214, 198, 0.35) 0 2%, transparent 45%),
    radial-gradient(circle at 70% 55%, rgba(120, 220, 255, 0.2) 0 1.5%, transparent 40%),
    radial-gradient(circle at 45% 75%, rgba(61, 214, 198, 0.25) 0 2%, transparent 42%);
  mix-blend-mode: screen;
  animation: caustic 12s ease-in-out infinite alternate;
}

.sea__waves {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: repeating-linear-gradient(
    -12deg,
    transparent 0 18px,
    rgba(61, 214, 198, 0.05) 18px 19px
  );
  mask-image: linear-gradient(180deg, transparent, #000 40%, transparent);
  animation: shimmer 11s linear infinite;
}

.sea__bubbles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.55;
}

@keyframes drift {
  from {
    transform: translateX(-3%) translateY(0);
  }
  to {
    transform: translateX(4%) translateY(-2%);
  }
}

@keyframes caustic {
  from {
    transform: translate3d(-1%, 0, 0) scale(1);
    opacity: 0.18;
  }
  to {
    transform: translate3d(2%, -1%, 0) scale(1.05);
    opacity: 0.28;
  }
}

@keyframes shimmer {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 120px 40px;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(61, 214, 198, 0.35);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(61, 214, 198, 0);
  }
}

@keyframes hit-pop {
  0% {
    transform: scale(0.4) rotate(-8deg);
    filter: brightness(2.4);
  }
  40% {
    transform: scale(1.35) rotate(4deg);
    filter: brightness(1.6);
  }
  100% {
    transform: scale(1) rotate(0);
    filter: brightness(1);
  }
}

@keyframes board-shake {
  0%,
  100% {
    transform: translate(0, 0) rotate(0);
  }
  15% {
    transform: translate(-7px, 3px) rotate(-1deg);
  }
  30% {
    transform: translate(8px, -4px) rotate(1.2deg);
  }
  45% {
    transform: translate(-6px, -2px) rotate(-0.8deg);
  }
  60% {
    transform: translate(5px, 3px) rotate(0.6deg);
  }
  75% {
    transform: translate(-3px, 1px) rotate(-0.3deg);
  }
}

@keyframes board-shake-hard {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  10% {
    transform: translate(-12px, 6px) scale(1.02);
  }
  25% {
    transform: translate(14px, -8px) scale(0.98);
  }
  40% {
    transform: translate(-10px, -5px) scale(1.03);
  }
  55% {
    transform: translate(9px, 7px) scale(0.97);
  }
  70% {
    transform: translate(-5px, 2px) scale(1.01);
  }
}

@keyframes splash {
  0% {
    transform: scale(0.15);
    opacity: 1;
  }
  100% {
    transform: scale(3.2);
    opacity: 0;
  }
}

@keyframes boom-burst {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 1;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
}

@keyframes boom-ring {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0.95;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.8);
    opacity: 0;
  }
}

@keyframes spark-fly {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2);
    opacity: 0;
  }
}

@keyframes screen-shock {
  0% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
  }
}

@keyframes sunk-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 180, 80, 0.7);
  }
  50% {
    box-shadow: 0 0 22px 4px rgba(255, 140, 60, 0.55);
  }
}

@keyframes radar-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes burst {
  from {
    opacity: 0.8;
    transform: scale(0.4);
  }
  to {
    opacity: 0;
    transform: scale(1.6);
  }
}

.app {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  min-height: 100vh;
}

.view[hidden] {
  display: none !important;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 9vw, 5.6rem);
  letter-spacing: -0.04em;
  line-height: 0.9;
  color: var(--foam);
  text-shadow: 0 10px 48px rgba(0, 0, 0, 0.4);
  animation: rise 0.8s ease both;
}

.brand--sm {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  text-shadow: none;
}

.headline {
  margin: 1.25rem 0 0;
  max-width: 16ch;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: clamp(1.5rem, 3.3vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--teal-bright);
  animation: rise 0.9s ease 0.08s both;
}

.lede {
  margin: 1rem 0 0;
  max-width: 40ch;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--foam-dim);
  animation: rise 1s ease 0.14s both;
}

.view--lobby {
  display: grid;
  align-content: center;
  min-height: calc(100vh - 4rem);
}

.hero {
  max-width: 580px;
}

.lobby-form {
  margin-top: 2rem;
  display: grid;
  gap: 1rem;
  animation: rise 1.05s ease 0.2s both;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field span {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--foam-dim);
}

.field input {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(232, 244, 242, 0.18);
  border-radius: var(--radius);
  background: rgba(4, 24, 32, 0.55);
  color: var(--foam);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.field input:focus {
  border-color: var(--teal-bright);
  box-shadow: 0 0 0 3px rgba(61, 214, 198, 0.2);
}

.field input::placeholder {
  color: rgba(232, 244, 242, 0.35);
}

#room-code {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-weight: 700;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.35rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s, color 0.2s, opacity 0.2s, border-color 0.2s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--teal-bright);
  color: var(--ink);
  animation: pulse-glow 2.8s ease-in-out infinite;
}

.btn--primary:hover:not(:disabled) {
  background: #63e4d5;
}

.btn--ghost {
  background: transparent;
  color: var(--foam);
  border: 1px solid rgba(232, 244, 242, 0.28);
  animation: none;
}

.btn--ghost:hover:not(:disabled) {
  border-color: var(--teal-bright);
  color: var(--teal-bright);
}

.join-panel {
  display: grid;
  gap: 0.75rem;
  padding-top: 0.25rem;
  animation: rise 0.4s ease both;
}

.error {
  margin: 0.75rem 0 0;
  color: var(--danger);
  font-weight: 600;
}

.panel {
  margin-top: 10vh;
  max-width: 480px;
  animation: rise 0.5s ease both;
}

.panel__title {
  margin: 0.75rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  letter-spacing: -0.03em;
}

.code-box {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.code {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--teal-bright);
  text-shadow: 0 0 40px rgba(61, 214, 198, 0.35);
}

.radar {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 1.75rem 0 0;
  border-radius: 50%;
  border: 1px solid rgba(61, 214, 198, 0.35);
  background:
    radial-gradient(circle, transparent 58%, rgba(61, 214, 198, 0.12) 59% 60%, transparent 61%),
    radial-gradient(circle, transparent 28%, rgba(61, 214, 198, 0.1) 29% 30%, transparent 31%),
    rgba(2, 16, 22, 0.55);
  overflow: hidden;
}

.radar__sweep {
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, transparent 0 70%, rgba(61, 214, 198, 0.45) 100%);
  animation: radar-spin 2.4s linear infinite;
}

.hint {
  margin: 1rem 0 0;
  color: var(--foam-dim);
  font-size: 0.95rem;
  line-height: 1.45;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.topbar__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
}

.btn--sm {
  padding: 0.55rem 0.95rem;
  font-size: 0.85rem;
}

.status {
  margin: 0;
  font-weight: 600;
  color: var(--teal-bright);
  text-align: right;
  transition: color 0.25s, transform 0.25s;
}

.turn-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 0 0 1.15rem;
  padding: 0.85rem 1.15rem;
  border-radius: 16px;
  border: 1px solid rgba(61, 214, 198, 0.35);
  background: linear-gradient(90deg, rgba(31, 166, 160, 0.18), rgba(4, 24, 32, 0.55));
  box-shadow: 0 0 0 1px rgba(61, 214, 198, 0.08), 0 12px 40px rgba(0, 0, 0, 0.25);
  animation: rise 0.35s ease both;
}

.turn-banner[hidden] {
  display: none !important;
}

.turn-banner__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--teal-bright);
  box-shadow: 0 0 0 0 rgba(61, 214, 198, 0.55);
}

.turn-banner__text {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.8vw, 1.45rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--foam);
}

.turn-banner.is-your-turn {
  border-color: rgba(61, 214, 198, 0.7);
  background: linear-gradient(90deg, rgba(61, 214, 198, 0.28), rgba(8, 40, 48, 0.7));
}

.turn-banner.is-your-turn .turn-banner__dot {
  animation: turn-dot-pulse 1.1s ease-in-out infinite;
  background: #63e4d5;
}

.turn-banner.is-your-turn .turn-banner__text {
  color: #9ef0e6;
}

.turn-banner.is-waiting {
  border-color: rgba(201, 164, 92, 0.45);
  background: linear-gradient(90deg, rgba(201, 164, 92, 0.16), rgba(4, 24, 32, 0.55));
}

.turn-banner.is-waiting .turn-banner__dot {
  background: #c9a45c;
  animation: wait-pulse 1.6s ease-in-out infinite;
}

.turn-banner.is-waiting .turn-banner__text {
  color: #e6d0a0;
}

.turn-banner.is-finished {
  border-color: rgba(232, 244, 242, 0.2);
  background: rgba(4, 24, 32, 0.55);
}

.turn-banner.is-finished .turn-banner__dot {
  background: var(--foam-dim);
}

@keyframes turn-dot-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(61, 214, 198, 0.55);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 0 10px rgba(61, 214, 198, 0);
  }
}

.board.is-active-target {
  border-color: rgba(61, 214, 198, 0.65);
  box-shadow: var(--shadow), 0 0 0 2px rgba(61, 214, 198, 0.25), 0 0 36px rgba(61, 214, 198, 0.2);
  animation: target-glow 1.8s ease-in-out infinite;
}

.board.is-under-fire {
  border-color: rgba(232, 93, 76, 0.45);
  box-shadow: var(--shadow), 0 0 0 2px rgba(232, 93, 76, 0.18);
}

.board.is-dimmed {
  opacity: 0.55;
  filter: saturate(0.75);
}

.board.is-dimmed.board--enemy {
  pointer-events: none;
}

@keyframes target-glow {
  0%,
  100% {
    box-shadow: var(--shadow), 0 0 0 2px rgba(61, 214, 198, 0.2), 0 0 24px rgba(61, 214, 198, 0.12);
  }
  50% {
    box-shadow: var(--shadow), 0 0 0 3px rgba(61, 214, 198, 0.4), 0 0 42px rgba(61, 214, 198, 0.28);
  }
}

.status.is-turn {
  color: #9ef0e6;
  transform: scale(1.03);
}

.status.is-waiting {
  animation: wait-pulse 1.6s ease-in-out infinite;
}

.place-layout,
.play-layout {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 860px) {
  .place-layout {
    grid-template-columns: 260px 1fr;
  }

  .play-layout {
    grid-template-columns: 1fr 1fr;
  }
}

.ship-dock h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.ship-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.ship-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(232, 244, 242, 0.14);
  background: rgba(4, 24, 32, 0.4);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  animation: rise 0.45s ease both;
}

.ship-item:hover {
  border-color: rgba(61, 214, 198, 0.45);
  transform: translateX(2px);
}

.ship-item.is-selected {
  border-color: var(--teal-bright);
  background: rgba(31, 166, 160, 0.18);
}

.ship-item.is-placed {
  opacity: 0.55;
}

.ship-item__name {
  font-weight: 600;
}

.ship-item__size {
  color: var(--foam-dim);
  font-size: 0.85rem;
}

.dock-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.board-wrap {
  display: grid;
  gap: 0.55rem;
  justify-items: center;
}

.board-label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--foam-dim);
  justify-self: start;
  width: min(100%, 440px);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.fleet-track {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  width: min(100%, 440px);
  justify-self: start;
  display: grid;
  gap: 0.35rem;
}

.fleet-track__item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(232, 244, 242, 0.12);
  background: rgba(4, 24, 32, 0.35);
  font-size: 0.88rem;
  transition: border-color 0.25s, opacity 0.25s, background 0.25s;
}

.fleet-track__item.is-sunk {
  border-color: rgba(232, 93, 76, 0.45);
  background: rgba(232, 93, 76, 0.12);
  opacity: 0.85;
}

.fleet-track__name {
  font-weight: 600;
}

.fleet-track__item.is-sunk .fleet-track__name {
  text-decoration: line-through;
  color: var(--foam-dim);
}

.fleet-track__pips {
  display: flex;
  gap: 3px;
}

.fleet-track__pips i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: rgba(201, 164, 92, 0.85);
  display: block;
}

.fleet-track__item.is-sunk .fleet-track__pips i {
  background: rgba(232, 93, 76, 0.75);
}

.fleet-track__state {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--teal-bright);
}

.fleet-track__item.is-sunk .fleet-track__state {
  color: var(--hit);
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b8790;
  display: inline-block;
}

.online-dot.is-on {
  background: #3dd6c6;
  box-shadow: 0 0 10px rgba(61, 214, 198, 0.8);
}

.board {
  --cell: min(9.2vw, 40px);
  display: grid;
  grid-template-columns: repeat(10, var(--cell));
  grid-template-rows: repeat(10, var(--cell));
  gap: 3px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(2, 16, 22, 0.55);
  border: 1px solid rgba(232, 244, 242, 0.1);
  box-shadow: var(--shadow);
  width: max-content;
  max-width: 100%;
  user-select: none;
  touch-action: manipulation;
  position: relative;
}

.board.is-shake {
  animation: board-shake 0.45s ease;
}

.board.is-shake-hard {
  animation: board-shake-hard 0.65s ease;
}

.cell {
  position: relative;
  border-radius: 5px;
  background: rgba(31, 166, 160, 0.12);
  border: 1px solid rgba(61, 214, 198, 0.12);
  transition: background 0.15s, transform 0.12s, border-color 0.15s;
  overflow: visible;
}

.cell.is-hit {
  background: linear-gradient(145deg, #ff7a68, #c43b2c);
  border-color: #8f2418;
  animation: hit-pop 0.55s cubic-bezier(0.2, 1.4, 0.3, 1);
  z-index: 2;
}

.cell.is-hit.is-boom {
  animation: hit-pop 0.7s cubic-bezier(0.15, 1.6, 0.3, 1);
  filter: saturate(1.4) brightness(1.15);
}

.cell.is-sunk {
  outline: 2px solid rgba(255, 210, 120, 0.9);
  outline-offset: -2px;
  animation: sunk-pulse 1.1s ease-in-out 2;
}

.cell .fx-ring {
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  border: 2px solid rgba(255, 220, 180, 0.9);
  pointer-events: none;
  animation: splash 0.7s ease-out forwards;
  z-index: 3;
}

.cell .fx-ring.is-miss-ring {
  border-color: rgba(180, 220, 230, 0.7);
}

.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
}

.fx-boom {
  position: absolute;
  width: 90px;
  height: 90px;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.fx-boom__core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    #fff6d0 0%,
    #ff9a3c 28%,
    #e85d4c 55%,
    transparent 72%
  );
  animation: boom-burst 0.7s ease-out forwards;
}

.fx-boom__ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid rgba(255, 200, 120, 0.85);
  animation: boom-ring 0.75s ease-out forwards;
}

.fx-boom.is-sunk .fx-boom__core {
  background: radial-gradient(
    circle,
    #ffffff 0%,
    #ffd36a 22%,
    #ff6a3c 48%,
    #c43b2c 62%,
    transparent 74%
  );
  width: 140%;
  height: 140%;
  margin: -20% 0 0 -20%;
  left: 50%;
  top: 50%;
}

.fx-boom.is-sunk .fx-boom__ring {
  width: 130%;
  height: 130%;
  border-width: 4px;
  border-color: rgba(255, 230, 150, 0.95);
}

.fx-spark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: #ffe7a0;
  box-shadow: 0 0 8px #ff9a3c;
  animation: spark-fly 0.65s ease-out forwards;
}

.flash {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(255, 120, 90, 0.45), transparent 55%);
  animation: screen-shock 0.35s ease both;
}

.flash.is-sunk {
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 220, 140, 0.55), transparent 40%),
    radial-gradient(circle at center, rgba(255, 80, 40, 0.4), transparent 60%);
  animation: screen-shock 0.55s ease both;
}

.flash.is-miss {
  background: radial-gradient(circle at center, rgba(120, 180, 200, 0.28), transparent 50%);
}

.audio-gate {
  position: fixed;
  left: 50%;
  bottom: 4.5rem;
  transform: translateX(-50%);
  z-index: 60;
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  background: rgba(4, 24, 32, 0.92);
  border: 1px solid rgba(61, 214, 198, 0.4);
  box-shadow: var(--shadow);
  max-width: calc(100vw - 1.5rem);
}

.audio-gate[hidden] {
  display: none !important;
}

.audio-gate__btn {
  animation: pulse-glow 2s ease-in-out infinite;
}

.audio-gate__hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--foam-dim);
  text-align: center;
}

.volume-dock {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(232, 244, 242, 0.25);
  background: rgba(4, 24, 32, 0.88);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.volume-dock__label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--foam-dim);
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 130px;
  height: 10px;
  border-radius: 999px;
  background: rgba(61, 214, 198, 0.25);
  outline: none;
  cursor: pointer;
  touch-action: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--teal-bright);
  border: none;
  box-shadow: 0 0 10px rgba(61, 214, 198, 0.45);
  cursor: pointer;
}

.volume-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--teal-bright);
  border: none;
  cursor: pointer;
}

.volume-dock__value {
  min-width: 2.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--foam);
  text-align: right;
}

@media (max-width: 600px) {
  .volume-dock {
    right: 0.75rem;
    bottom: 0.75rem;
    padding: 0.45rem 0.65rem;
  }

  .volume-slider {
    width: 88px;
  }

  .volume-dock__label {
    display: none;
  }
}

body.is-hurt {
  animation: board-shake-hard 0.4s ease;
}

.cell:focus-visible {
  outline: 2px solid var(--teal-bright);
  outline-offset: 1px;
}

.board--enemy .cell {
  cursor: crosshair;
}

.board--enemy .cell:hover:not(.is-shot) {
  background: rgba(61, 214, 198, 0.28);
  transform: scale(1.04);
}

.cell.is-preview {
  background: rgba(201, 164, 92, 0.45);
  border-color: rgba(201, 164, 92, 0.7);
}

.cell.is-preview-bad {
  background: rgba(232, 93, 76, 0.4);
  border-color: rgba(232, 93, 76, 0.7);
}

.cell.is-ship {
  background: linear-gradient(145deg, #d7b56a, #9a7634);
  border-color: var(--ship-edge);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  animation: rise 0.35s ease both;
}

.cell.is-miss {
  background: rgba(107, 135, 144, 0.45);
}

.cell.is-miss::after {
  content: "";
  display: block;
  width: 28%;
  height: 28%;
  margin: 36% auto 0;
  border-radius: 50%;
  background: rgba(232, 244, 242, 0.55);
}

.cell.is-hit::after {
  content: "";
  display: block;
  width: 55%;
  height: 2px;
  margin: 48% auto 0;
  background: rgba(255, 255, 255, 0.75);
  transform: rotate(45deg);
}

.game-over {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  gap: 0.75rem;
  text-align: center;
  padding: 1.5rem;
  background: rgba(2, 12, 16, 0.78);
  backdrop-filter: blur(10px);
  animation: rise 0.35s ease both;
}

.game-over__burst {
  width: 160px;
  height: 160px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(61, 214, 198, 0.45), transparent 70%);
  animation: burst 1.1s ease-out infinite;
}

.game-over h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.2rem);
  letter-spacing: -0.03em;
}

.game-over p {
  margin: 0 0 0.75rem;
  color: var(--foam-dim);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 30;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  background: rgba(4, 24, 32, 0.92);
  border: 1px solid rgba(61, 214, 198, 0.35);
  color: var(--foam);
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: rise 0.25s ease both;
}

.toast[hidden],
.flash[hidden],
.game-over[hidden] {
  display: none !important;
}

.stats-card {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(61, 214, 198, 0.22);
  background: rgba(4, 24, 32, 0.45);
  animation: rise 0.5s ease both;
  max-width: 420px;
}

.stats-card__title {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.stats-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.stats-grid div {
  display: grid;
  gap: 0.15rem;
}

.stats-grid dt {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--foam-dim);
}

.stats-grid dd {
  margin: 0;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--teal-bright);
}

.play-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: -0.5rem 0 1.25rem;
}

.play-stats__you,
.play-stats__opp {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(232, 244, 242, 0.12);
  background: rgba(4, 24, 32, 0.35);
  font-size: 0.82rem;
}

.play-stats strong {
  font-size: 0.9rem;
}

.play-stats span {
  color: var(--foam-dim);
}

.combo {
  margin: 0;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(232, 93, 76, 0.2);
  border: 1px solid rgba(255, 140, 100, 0.55);
  color: #ffb39a;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
}

.combo.is-pop {
  animation: hit-pop 0.35s ease;
}

.status.is-waiting {
  animation: wait-pulse 1.6s ease-in-out infinite;
}

@keyframes wait-pulse {
  0%,
  100% {
    opacity: 0.65;
    text-shadow: none;
  }
  50% {
    opacity: 1;
    text-shadow: 0 0 18px rgba(61, 214, 198, 0.45);
  }
}

.impact-banner {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(2, 12, 16, 0.35), transparent 55%);
}

.impact-banner[hidden] {
  display: none !important;
}

.impact-banner__kicker {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--teal-bright);
  animation: rise 0.25s ease both;
}

.impact-banner__title {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 10vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.9;
  color: var(--foam);
  text-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  animation: hit-pop 0.55s cubic-bezier(0.15, 1.5, 0.3, 1) both;
}

.impact-banner__sub {
  margin: 0.5rem 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffd36a;
  animation: rise 0.4s ease 0.05s both;
}

.impact-banner.is-sunk .impact-banner__title {
  color: #ff8a6a;
}

.impact-banner.is-hit .impact-banner__title {
  color: #9ef0e6;
}

body.is-slowmo .board {
  filter: saturate(1.15) contrast(1.05);
  transition: filter 0.2s;
}

body.is-slowmo .app {
  animation: board-shake 0.35s ease;
}

.fx-lockon {
  position: absolute;
  width: 54px;
  height: 54px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.fx-lockon__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(61, 214, 198, 0.95);
  box-shadow: 0 0 18px rgba(61, 214, 198, 0.55);
  animation: boom-ring 0.32s ease-out forwards;
}

.fx-lockon__cross::before,
.fx-lockon__cross::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: rgba(232, 244, 242, 0.95);
}

.fx-lockon__cross::before {
  width: 2px;
  height: 100%;
  transform: translate(-50%, -50%);
}

.fx-lockon__cross::after {
  width: 100%;
  height: 2px;
  transform: translate(-50%, -50%);
}

.cell.is-locking {
  outline: 2px solid var(--teal-bright);
  outline-offset: 1px;
  z-index: 3;
}

.cell.is-reveal {
  animation: sunk-pulse 0.7s ease-in-out 2;
  outline: 2px solid rgba(255, 220, 120, 1);
  outline-offset: 0;
  box-shadow: 0 0 22px rgba(255, 180, 80, 0.75);
  z-index: 4;
  filter: brightness(1.35) saturate(1.3);
}

@media (max-width: 600px) {
  .app {
    width: min(100% - 1.25rem, 1100px);
    padding-top: 1.25rem;
  }

  .board {
    --cell: min(8.2vw, 34px);
    gap: 2px;
    padding: 6px;
  }

  .dock-actions .btn {
    flex: 1 1 auto;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .play-stats {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


