/* Fog Fleet: moonlit night sea, drifting fog, brass instruments. */
@font-face {
  font-family: "Nunito Sans";
  src: url("/site/brand/NunitoSans-Black.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/site/brand/DMSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/site/brand/DMSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --sea0: #061320;
  --sea1: #0c2638;
  --sea2: #154058;
  --ink: #eef5f8;
  --dim: #9fb6c4;
  --brass: #ffc861;
  --brass-d: #c48a2c;
  --coral: #ff5d4f;
  --mint: #62f0c6;
  --panel: rgba(16, 38, 56, 0.86);
  --line: rgba(255, 200, 97, 0.22);
  --head: "Nunito Sans", "DM Sans", system-ui, sans-serif;
  --shell-ink: #10212e;
  --shell-paper: #f5efe2;
  --shell-accent: #ffc861;
  --shell-on-accent: #10212e;
  --shell-font: "DM Sans", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  background: radial-gradient(120% 80% at 70% 0%, #173a52 0%, var(--sea1) 45%, var(--sea0) 100%);
  color: var(--ink);
  font: 16px/1.4 "DM Sans", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
button {
  font: inherit;
  color: inherit;
}
svg {
  display: block;
}
[hidden] {
  display: none !important;
}

/* Drifting fog behind everything. */
.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.wisp {
  position: absolute;
  width: 70vmax;
  height: 26vmax;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(190, 212, 222, 0.16), transparent);
  filter: blur(8px);
  animation: drift 60s linear infinite;
}
.w1 {
  top: 8%;
  left: -40%;
}
.w2 {
  top: 48%;
  left: -60%;
  animation-duration: 85s;
  animation-delay: -30s;
}
.w3 {
  top: 78%;
  left: -50%;
  animation-duration: 70s;
  animation-delay: -50s;
}
@keyframes drift {
  to {
    transform: translateX(170vmax);
  }
}

#app {
  position: fixed;
  inset: 0;
  padding: var(--safe-t) var(--safe-r) 0 var(--safe-l);
}
.screen {
  position: absolute;
  inset: var(--safe-t) var(--safe-r) 0 var(--safe-l);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: rgba(20, 50, 72, 0.9);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s ease, filter 0.15s;
}
.btn:active {
  transform: translateY(1px) scale(0.98);
}
.btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn.primary {
  background: linear-gradient(180deg, #ffd885, var(--brass) 60%, #f0ad3e);
  border-color: #ffe2a3;
  color: #10212e;
  box-shadow: 0 4px 0 var(--brass-d), 0 10px 26px rgba(255, 200, 97, 0.2);
}
.btn.primary:active {
  box-shadow: 0 2px 0 var(--brass-d);
}
.btn.ghost {
  background: transparent;
}
.btn.big {
  min-height: 60px;
  font: 900 22px/1 var(--head);
  padding: 14px 28px;
  border-radius: 18px;
}
.btn.big small {
  font: 700 14px/1 "DM Sans", system-ui, sans-serif;
  opacity: 0.75;
}
.btn.small {
  min-height: 40px;
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 11px;
}
.btn.small.on {
  border-color: var(--mint);
  color: var(--mint);
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.btn .coin {
  width: 16px;
  height: 16px;
}
.icon-btn {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: rgba(12, 32, 48, 0.8);
  cursor: pointer;
}
.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.corner {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(6, 19, 32, 0.6);
  border: 1px solid var(--line);
  font-size: 14px;
  white-space: nowrap;
}
.ico {
  width: 22px;
  height: 22px;
  flex: none;
}
.coin,
.bp {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: -3px;
}

/* ---------- title ---------- */
.title {
  align-items: center;
  justify-content: safe center;
  overflow-y: auto;
  padding: 24px 20px calc(24px + var(--safe-b));
}
.title-card {
  width: min(440px, 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.title-art {
  width: 100%;
  max-width: 400px;
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.35));
}
/* Short screens (small phones, laptops with browser bars): a smaller picture keeps the daily card in view.
   After the base rules, or they win. */
@media (max-height: 760px) {
  .title-art {
    max-width: 250px;
  }
  .title-card {
    gap: 9px;
  }
}
.title-art .beam {
  transform-origin: 64px 62px;
  animation: sweep 6s ease-in-out infinite alternate;
}
.title-art .bob {
  animation: bob 3.2s ease-in-out infinite;
}
@keyframes sweep {
  from {
    transform: rotate(-6deg);
  }
  to {
    transform: rotate(8deg);
  }
}
@keyframes bob {
  50% {
    transform: translateY(2.5px) rotate(-0.6deg);
  }
}
.title h1 {
  margin: 0;
  font: 900 clamp(48px, 13vw, 76px) / 0.95 var(--head);
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #fff 20%, #bcd3de);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(190, 220, 235, 0.25);
}
.tag {
  margin: 0 0 8px;
  color: var(--dim);
  font-size: 17px;
}
.title .btn.big {
  width: min(320px, 100%);
}
.title .btn.ghost {
  width: min(320px, 100%);
}
.title-meta {
  margin: 4px 0 0;
  color: var(--dim);
  font-size: 14px;
  min-height: 20px;
}
.title-meta .coin {
  margin: 0 3px 0 2px;
}
.hot {
  color: var(--mint);
  font-weight: 700;
}

/* ---------- bars (harbor, placement) ---------- */
.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}
.bar h2 {
  flex: 1;
  margin: 0;
  font: 900 24px/1 var(--head);
}
.foot {
  padding: 10px 16px calc(12px + var(--safe-b));
  display: flex;
  justify-content: center;
}
.foot.row {
  gap: 12px;
}
.foot .btn.big {
  flex: 1;
  max-width: 360px;
}

/* ---------- harbor ---------- */
.harbor-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 12px 12px;
  display: grid;
  gap: 12px;
  align-content: start;
  touch-action: pan-y;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}
.panel h3 {
  margin: 0 0 10px;
  font: 900 19px/1.1 var(--head);
}
.panel h3 small {
  display: block;
  font: 400 13px/1.3 "DM Sans", system-ui, sans-serif;
  color: var(--dim);
  margin-top: 3px;
}
.fleet-panel {
  order: -1;
}
.ladder {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.rung {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: rgba(6, 19, 32, 0.45);
  text-align: left;
  cursor: pointer;
}
.rung.on {
  border-color: var(--brass);
  background: rgba(255, 200, 97, 0.1);
}
.rung.locked {
  opacity: 0.5;
  cursor: default;
}
.captain {
  width: 40px;
  height: 40px;
  flex: none;
}
.who {
  flex: 1;
  min-width: 0;
  display: grid;
}
.who small {
  color: var(--dim);
  font-size: 13px;
}
.unlock {
  font-size: 12px;
  color: var(--mint);
  font-weight: 700;
}
.state {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.s-beaten {
  color: var(--mint);
}
.s-next {
  color: #10212e;
  background: var(--brass);
}
.ships {
  display: grid;
  gap: 8px;
}
.ship {
  display: grid;
  grid-template-columns: 96px 1fr;
  grid-template-areas: "art info" "btns btns";
  gap: 6px 10px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: rgba(6, 19, 32, 0.45);
  border: 2px solid transparent;
}
.ship.in {
  border-color: rgba(98, 240, 198, 0.45);
}
.ship.locked {
  opacity: 0.6;
  grid-template-areas: "art info";
}
.ship-art {
  grid-area: art;
  width: 96px;
  height: 32px;
}
.ship-info {
  grid-area: info;
  display: grid;
  gap: 3px;
  min-width: 0;
}
.ship-info small {
  color: var(--dim);
  font-size: 13px;
  display: flex;
  gap: 5px;
  align-items: flex-start;
}
.ship-info small .ico {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--brass);
}
.perk {
  color: var(--mint) !important;
}
.lv {
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--brass);
  color: #10212e;
  vertical-align: 2px;
}
.bp-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.meter {
  flex: 1;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4aa3ff, #9fd0ff);
}
.ship-btns {
  grid-area: btns;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
}

/* ---------- placement ---------- */
.place-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 0;
}
.place-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 560px;
}
.place-wrap canvas,
.enemy-wrap canvas,
.own-wrap canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  touch-action: none;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
#place-canvas {
  cursor: grab;
}
.hint {
  margin: 0;
  color: var(--dim);
  font-size: 14px;
}
.kit {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(6, 19, 32, 0.6);
  border: 1px solid var(--line);
  font-size: 13px;
}
.chip small {
  color: var(--dim);
}
.chip .ico {
  width: 16px;
  height: 16px;
  color: var(--brass);
}

/* ---------- battle ---------- */
.hud {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
}
.foe {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.foe .captain {
  width: 36px;
  height: 36px;
}
.foe b {
  display: block;
  font: 900 17px/1.1 var(--head);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fleet-row {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.pip {
  display: block;
  height: 7px;
  width: calc(var(--len) * 7px);
  border-radius: 4px;
  background: var(--dim);
}
.pip.sunk {
  background: var(--coral);
  opacity: 0.55;
}
.clock {
  font: 900 22px/1 var(--head);
  font-variant-numeric: tabular-nums;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(6, 19, 32, 0.6);
  border: 1px solid var(--line);
  min-width: 70px;
  text-align: center;
}
.clock.low {
  color: var(--coral);
  border-color: var(--coral);
}
.field {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 12px;
}
.enemy-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 160px;
}
#enemy {
  cursor: crosshair;
}
.mine {
  flex: none;
  height: clamp(108px, calc(100dvh - 100vw - 250px), 200px);
  display: flex;
  gap: 10px;
}
.own-wrap {
  position: relative;
  height: 100%;
  aspect-ratio: 1;
  flex: none;
}
.own-wrap canvas {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}
.mine-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
}
.mine-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.mine-head .fleet-row {
  margin: 0;
}
.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.3;
  display: grid;
  gap: 3px;
}
.feed li {
  padding-left: 12px;
  position: relative;
  color: var(--dim);
}
.feed li:first-child {
  color: var(--ink);
}
.feed li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
}
.feed li.foe::before {
  background: var(--coral);
}
.coach {
  position: absolute;
  z-index: 3;
  top: 10px;
  left: 50%;
  width: min(92%, 380px);
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(245, 239, 226, 0.97);
  color: #10212e;
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  animation: pop 0.25s ease-out;
}
.coach b:first-child {
  display: inline-block;
  margin-right: 4px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--brass);
}
@keyframes pop {
  from {
    transform: translate(-50%, -8px);
    opacity: 0;
  }
}
.banner {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 12px;
  transform: translate(-50%, 8px);
  max-width: 92%;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(6, 19, 32, 0.92);
  border: 2px solid var(--line);
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
}
.banner.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.banner.good {
  border-color: var(--mint);
  color: var(--mint);
}
.banner.bad {
  border-color: var(--coral);
  color: #ffb3aa;
}
.banner.warn {
  border-color: var(--brass);
  color: var(--brass);
}

.dock {
  padding: 8px 12px calc(10px + var(--safe-b));
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}
.energy {
  display: flex;
  align-items: center;
  gap: 10px;
}
.energy-bar {
  position: relative;
  flex: 1;
  height: 14px;
  border-radius: 99px;
  background: rgba(3, 10, 18, 0.7);
  border: 1px solid var(--line);
  overflow: hidden;
}
.energy-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #3fd7b0, var(--mint) 50%, var(--brass));
  box-shadow: 0 0 12px rgba(98, 240, 198, 0.5);
}
.ticks {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(3, 10, 18, 0.8) calc(10% - 2px) 10%);
}
.energy b {
  font: 900 20px/1 var(--head);
  min-width: 26px;
  text-align: right;
  color: var(--mint);
}
.energy.shake {
  animation: shake 0.35s;
}
@keyframes shake {
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}
.abilities {
  display: grid;
  grid-template-columns: repeat(var(--n, 5), 1fr);
  gap: 8px;
}
.tile {
  position: relative;
  height: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: linear-gradient(180deg, #1b3d55, #10263a);
  box-shadow: 0 4px 0 #071522;
  cursor: grab;
  touch-action: none;
  overflow: hidden;
}
.tile .ico {
  width: 26px;
  height: 26px;
  color: var(--brass);
}
.tile b {
  font-size: 13px;
  line-height: 1;
}
/* 320 px phones with five abilities: "Torpedo" and "Barrage" were clipped. */
@media (max-width: 360px) {
  .abilities {
    gap: 6px;
  }
  .tile b {
    font-size: 11px;
    letter-spacing: -0.02em;
  }
}
.tile .key {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 11px;
  color: var(--dim);
  opacity: 0.8;
}
.cost {
  display: flex;
  gap: 2px;
}
.cost i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mint);
}
.tile .cd {
  position: absolute;
  inset: 0;
  background: rgba(3, 10, 18, 0.62);
  transform-origin: bottom;
  transform: scaleY(var(--cd, 0));
  pointer-events: none;
}
.tile.armed {
  border-color: var(--brass);
  background: linear-gradient(180deg, #3a4a3a, #1d3140);
  box-shadow: 0 4px 0 var(--brass-d), 0 0 18px rgba(255, 200, 97, 0.35);
}
.tile.poor .ico,
.tile.poor b {
  opacity: 0.45;
}
.tile.poor .cost i {
  background: var(--dim);
}
.tile .lost {
  display: none;
}
.tile.gone {
  filter: grayscale(1);
  opacity: 0.55;
}
.tile.gone .lost {
  display: grid;
  place-items: center;
  position: absolute;
  inset: 0;
  font-size: 11px;
  font-weight: 700;
  color: #ffb3aa;
  background: rgba(3, 10, 18, 0.75);
  padding: 4px;
  text-align: center;
}
.tile.pulse {
  animation: pulse 1s ease-in-out infinite;
  border-color: var(--mint);
}
@keyframes pulse {
  50% {
    box-shadow: 0 4px 0 #071522, 0 0 0 5px rgba(98, 240, 198, 0.4);
    transform: translateY(-3px);
  }
}
.drag-ghost {
  position: fixed;
  left: -30px;
  top: -30px;
  z-index: 50;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 200, 97, 0.95);
  color: #10212e;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.drag-ghost .ico {
  width: 30px;
  height: 30px;
}

/* ---------- end of match ---------- */
.end {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px 16px calc(16px + var(--safe-b));
  background: rgba(4, 12, 20, 0.62);
  backdrop-filter: blur(4px);
  animation: fade 0.4s ease-out;
  overflow: auto;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.end-card {
  width: min(420px, 100%);
  text-align: center;
  padding: 22px 18px 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, #16384c, #0c2638);
  border: 2px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: rise 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes rise {
  from {
    transform: translateY(30px) scale(0.95);
    opacity: 0;
  }
}
.end-card.win {
  border-color: var(--brass);
}
.eyebrow {
  margin: 0;
  color: var(--dim);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.end-card h2 {
  margin: 4px 0;
  font: 900 52px/1 var(--head);
  color: var(--brass);
}
.end-card.lose h2 {
  color: var(--coral);
}
.sub {
  margin: 0 0 14px;
  color: var(--dim);
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stats div {
  padding: 8px 4px;
  border-radius: 12px;
  background: rgba(3, 10, 18, 0.45);
  display: grid;
}
.stats b {
  font: 900 22px/1.1 var(--head);
}
.stats span {
  font-size: 12px;
  color: var(--dim);
}
.rewards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}
.chip.gold {
  border-color: var(--brass);
  color: var(--brass);
  font-size: 15px;
}
.unlocked {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px;
  border-radius: 14px;
  background: rgba(98, 240, 198, 0.1);
  border: 1px solid rgba(98, 240, 198, 0.5);
  margin-bottom: 12px;
}
.unlocked .ship-art {
  width: 90px;
  flex: none;
}
.unlocked small {
  display: block;
  color: var(--dim);
}
.hint-up {
  margin: 0 0 10px;
  color: var(--mint);
  font-size: 14px;
  font-weight: 700;
}
.end-btns {
  display: grid;
  gap: 8px;
}

/* ---------- wide screens: side by side ---------- */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .field {
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    gap: 20px;
    padding: 4px 24px;
  }
  .mine {
    order: -1;
    height: auto;
    width: clamp(240px, 26vw, 320px);
    flex-direction: column;
    justify-content: center;
  }
  .own-wrap {
    width: 100%;
    height: auto;
  }
  .mine-info {
    flex: none;
    min-height: 150px;
  }
  .enemy-wrap {
    flex: 0 1 min(640px, calc(100dvh - 220px));
    /* Square around the board, so the coach and banners sit on it (not far above/below on tall screens). */
    align-self: center;
    aspect-ratio: 1;
  }
  .fleet-panel {
    order: 0;
  }
  .harbor-body {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px 16px;
  }
  .bar {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 14px 24px;
  }
  .ship {
    grid-template-columns: 110px 1fr auto;
    grid-template-areas: "art info btns";
  }
  .ship-art {
    width: 110px;
    height: 37px;
  }
  .ship-btns {
    grid-template-columns: 1fr;
    width: 150px;
  }
}

/* ---------- landscape phones (battle: fleet | enemy waters | abilities) ---------- */
/* Stacked boards + dock don't fit 360–430 px of height: the dock covered your fleet and the enemy board shrank. */
@media (max-height: 540px) and (min-aspect-ratio: 4/3) {
  .battle {
    display: grid;
    grid-template: "hud hud" auto "field dock" minmax(0, 1fr) / minmax(0, 1fr) clamp(180px, 28vw, 280px);
  }
  .hud {
    grid-area: hud;
    padding: 6px 12px;
  }
  .field {
    grid-area: field;
    flex-direction: row;
    align-items: stretch;
    gap: 10px;
    padding: 0 0 calc(8px + var(--safe-b)) 12px;
  }
  .mine {
    order: -1;
    height: auto;
    width: clamp(110px, 20vw, 180px);
    flex-direction: column;
    gap: 6px;
  }
  .own-wrap {
    width: 100%;
    height: auto;
  }
  .mine-info {
    flex: 1;
    min-height: 0;
    padding: 6px 8px;
  }
  .enemy-wrap {
    flex: 1 1 auto;
    min-height: 0;
    align-self: stretch;
    aspect-ratio: auto;
  }
  .dock {
    grid-area: dock;
    align-content: center;
    max-width: none;
    padding: 0 12px calc(8px + var(--safe-b)) 0;
  }
  .abilities {
    grid-template-columns: repeat(2, 1fr);
  }
  .tile {
    height: 64px;
  }
  .dock .keys {
    display: none;
  }
  .end-card {
    width: min(560px, 100%);
    padding: 12px 16px;
  }
  .end-card h2 {
    font-size: 38px;
  }
  .end-btns {
    grid-template-columns: 1fr 1fr;
  }
  /* Title: picture and name on the left, buttons and the daily card on the right, so Play is on screen. */
  .title {
    padding: 12px 20px calc(12px + var(--safe-b));
  }
  .title-card {
    width: min(760px, 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-items: center;
    align-items: center;
    gap: 8px 28px;
  }
  .title-art {
    grid-area: 1 / 1 / span 2;
    max-width: 240px;
  }
  .title h1 {
    grid-area: 3 / 1;
    font-size: 46px;
  }
  .tag {
    grid-area: 4 / 1;
    align-self: start;
  }
  #play {
    grid-area: 1 / 2;
    align-self: end;
  }
  #to-harbor {
    grid-area: 2 / 2;
    align-self: start;
  }
  .title-meta {
    grid-area: 3 / 2;
  }
  .title-daily {
    grid-area: 4 / 2;
    align-self: start;
  }
}

/* ---------- daily supply drop (title) ---------- */
.title-daily {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: min(320px, 100%);
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 14px;
}
.title-daily .dl-h {
  color: var(--brass);
  font: 900 15px/1.2 var(--head);
}
.title-daily span {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}
.title-daily small {
  color: var(--dim);
}
.title-daily svg {
  width: 18px;
  height: 18px;
}
.streak i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--brass);
  opacity: 0.6;
}
.streak i.on {
  background: var(--brass);
  opacity: 1;
}

/* ---------- keyboard and screen readers ---------- */
:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 2px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
kbd {
  display: inline-block;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: rgba(6, 19, 32, 0.6);
  font: 700 12px/1.5 "DM Sans", system-ui, sans-serif;
  color: var(--ink);
}
.keys {
  margin: 0;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
}
/* Keyboard hints only where there is a keyboard and mouse. */
.desk {
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  .desk {
    display: inline;
  }
  p.desk {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
