/* Torpedo — a naval plotting table. Every colour that changes with the look
   is a custom property under [data-theme]; the grids, ships and marks are
   drawn by render.js and art.js. Motion is transform and opacity only, and
   stops with reduced motion. Sizes of grids come from app.js (--cell, --lab,
   --board-w), measured from the space there is. */

:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.4, 0.1, 0.2, 1);
  --spring: cubic-bezier(0.25, 0.8, 0.3, 1.15);
  --ca-accent: #1f6f8b; /* the accounts SDK's sheets and chip: white on it reads at 5.6:1 */
}

/* ------------------------------------------------------------- themes */
/* Night chart: deep ink-blue water under a brass lamp (the default after dark) */
:root,
[data-theme="night"] {
  color-scheme: dark;
  --bg-a: #0d2136;
  --bg-b: #040a14;
  --glow-1: rgba(52, 132, 186, 0.18);
  --glow-2: rgba(201, 164, 92, 0.08);
  --ink: #e9eff6;
  --ink-soft: rgba(214, 226, 240, 0.68);
  --chip-bg: rgba(255, 255, 255, 0.05);
  --chip-line: rgba(255, 255, 255, 0.09);
  --chip-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --btn-bg: rgba(255, 255, 255, 0.07);
  --btn-hover: rgba(255, 255, 255, 0.13);
  --btn-line: rgba(216, 180, 106, 0.2);
  --primary-a: #dcb96c;
  --primary-b: #b48c3e;
  --primary-line: #8a6a2a;
  --primary-ink: #1b1305;
  --danger: #e0634b;
  --paper: #10223a;
  --paper-2: #182d48;
  --line: rgba(210, 225, 245, 0.13);
  --accent: #dcb96c;
  --accent-soft: rgba(220, 185, 108, 0.22);
  --accent-glow: rgba(240, 196, 110, 0.55);
  --backdrop: rgba(1, 5, 12, 0.62);
  --toast: rgba(14, 30, 52, 0.96);
  --veil-a: #0b2440;
  --veil-b: #020710;

  --sea-a: #134066;
  --sea-b: #0c2b49;
  --sea-c: #071a2e;
  --grid-line: rgba(220, 236, 255, 0.17);
  --grid-edge: rgba(220, 236, 255, 0.3);
  --label: #cfa95f;
  --caustic: 0.11;
  --caustic-blend: screen;
  --sea-shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.9);

  --miss: #f2f7ff;
  --miss-ring: rgba(226, 238, 255, 0.5);
  --water-dot: rgba(196, 218, 240, 0.4);
  --splash: rgba(234, 245, 255, 0.85);
  --hit: #ff6b2c;
  --hit-2: #ffc861;
  --hit-glow: rgba(255, 110, 40, 0.45);
  --smoke: rgba(20, 24, 30, 0.6);
  --wake: rgba(220, 240, 255, 0.35);
  --wake-head: rgba(255, 255, 255, 0.9);
  --aim: #ffd27a;
  --aim-armed: #ff6a45;
  --roster: #a9b7c6;
  --pip-on: #dce6f0;
  --strike-edge: rgba(4, 10, 20, 0.6);
  --snap-ok: rgba(120, 230, 170, 0.32);
  --snap-ok-line: #7de6ad;
  --snap-bad: rgba(255, 110, 90, 0.3);
  --snap-bad-line: #ff7a66;

  --st-1: #dfe6ee;
  --st-2: #9eacbb;
  --st-3: #5f6d7d;
  --sb-1: #76838f;
  --sb-2: #4a5561;
  --sb-3: #2a333d;
  --ch-1: #574a40;
  --ch-2: #2e2723;
  --ch-3: #161210;
  --hull-line: rgba(0, 0, 0, 0.45);
  --deck: #7d8996;
  --deck-mark: rgba(240, 246, 252, 0.6);
  --plank: rgba(255, 255, 255, 0.13);
  --super: #bcc6d0;
  --bridge: #e6ebf0;
  --turret: #aab5c0;
  --barrel: #36404b;
  --funnel: #4a5561;
  --stack: #191e24;
  --sail: #5b6772;
  --foam: rgba(226, 241, 255, 0.45);
}

/* Day chart: pale sea-green water and navy ink */
[data-theme="day"] {
  color-scheme: light;
  --bg-a: #ecf5f2;
  --bg-b: #c7ddd7;
  --glow-1: rgba(255, 255, 255, 0.9);
  --glow-2: rgba(31, 111, 139, 0.14);
  --ink: #10263b;
  --ink-soft: #4b6073;
  --chip-bg: rgba(255, 255, 255, 0.55);
  --chip-line: rgba(255, 255, 255, 0.8);
  --chip-shadow: 0 1px 2px rgba(16, 40, 60, 0.12);
  --btn-bg: rgba(255, 255, 255, 0.6);
  --btn-hover: rgba(255, 255, 255, 0.92);
  --btn-line: rgba(16, 40, 61, 0.15);
  --primary-a: #2a85a3;
  --primary-b: #175b74;
  --primary-line: #11485c;
  --primary-ink: #f3fbfd;
  --danger: #c23a26;
  --paper: #f8fbfa;
  --paper-2: #e7f0ee;
  --line: rgba(16, 40, 61, 0.13);
  --accent: #1a6b87;
  --accent-soft: rgba(26, 107, 135, 0.2);
  --accent-glow: rgba(26, 140, 175, 0.5);
  --backdrop: rgba(10, 30, 40, 0.4);
  --toast: rgba(16, 38, 59, 0.94);
  --veil-a: #d9ece7;
  --veil-b: #a9cbc3;

  --sea-a: #d5eee8;
  --sea-b: #bfe2da;
  --sea-c: #a9d4cb;
  --grid-line: rgba(16, 50, 79, 0.2);
  --grid-edge: rgba(16, 50, 79, 0.32);
  --label: #16324f;
  --caustic: 0.4;
  --caustic-blend: soft-light;
  --sea-shadow: 0 12px 30px -16px rgba(16, 50, 70, 0.55);

  --miss: #16324f;
  --miss-ring: rgba(22, 50, 79, 0.42);
  --water-dot: rgba(22, 50, 79, 0.3);
  --splash: rgba(255, 255, 255, 0.95);
  --hit: #e2502a;
  --hit-2: #ffb347;
  --hit-glow: rgba(240, 100, 40, 0.35);
  --smoke: rgba(50, 54, 60, 0.4);
  --wake: rgba(255, 255, 255, 0.6);
  --wake-head: #ffffff;
  --aim: #17607a;
  --aim-armed: #d9432a;
  --roster: #47627a;
  --pip-on: #24425e;
  --strike-edge: rgba(255, 255, 255, 0.7);
  --snap-ok: rgba(30, 160, 100, 0.25);
  --snap-ok-line: #1c9a63;
  --snap-bad: rgba(220, 70, 50, 0.22);
  --snap-bad-line: #d4452f;

  --st-1: #f5f8fa;
  --st-2: #b9c3cd;
  --st-3: #7e8a96;
  --sb-1: #7d8a96;
  --sb-2: #56626e;
  --sb-3: #36404a;
  --ch-1: #6b5b4e;
  --ch-2: #3f3530;
  --ch-3: #221c19;
  --hull-line: rgba(20, 30, 40, 0.45);
  --deck: #9aa6b2;
  --deck-mark: rgba(255, 255, 255, 0.75);
  --plank: rgba(255, 255, 255, 0.2);
  --super: #d3dae1;
  --bridge: #f4f7f9;
  --turret: #c0c9d2;
  --barrel: #3c4650;
  --funnel: #56616c;
  --stack: #20262c;
  --sail: #66727d;
  --foam: rgba(255, 255, 255, 0.85);
}

/* Squared paper: the classroom game, pencil on a notebook page */
[data-theme="paper"] {
  color-scheme: light;
  --bg-a: #f5f0e3;
  --bg-b: #e3d8c0;
  --glow-1: rgba(255, 253, 245, 0.9);
  --glow-2: rgba(143, 177, 214, 0.18);
  --ink: #2a2926;
  --ink-soft: #69645a;
  --chip-bg: rgba(255, 253, 246, 0.6);
  --chip-line: rgba(255, 255, 255, 0.8);
  --chip-shadow: 0 1px 2px rgba(60, 50, 30, 0.12);
  --btn-bg: rgba(255, 255, 255, 0.55);
  --btn-hover: rgba(255, 255, 255, 0.9);
  --btn-line: rgba(60, 50, 30, 0.16);
  --primary-a: #3a6ea5;
  --primary-b: #234f80;
  --primary-line: #1b3f66;
  --primary-ink: #f6f9fd;
  --danger: #c23a26;
  --paper: #fdfbf4;
  --paper-2: #f1ebdb;
  --line: rgba(60, 50, 30, 0.14);
  --accent: #2c5f94;
  --accent-soft: rgba(44, 95, 148, 0.18);
  --accent-glow: rgba(44, 95, 148, 0.4);
  --backdrop: rgba(40, 32, 20, 0.38);
  --toast: rgba(42, 41, 38, 0.94);
  --veil-a: #faf6ea;
  --veil-b: #e9dfc8;

  --sea-a: #fdfbf3;
  --sea-b: #fbf8ee;
  --sea-c: #f6f1e2;
  --grid-line: rgba(70, 125, 190, 0.38);
  --grid-edge: rgba(70, 125, 190, 0.6);
  --label: #3b3a36;
  --caustic: 0;
  --caustic-blend: normal;
  --sea-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 10px 26px -18px rgba(60, 40, 10, 0.5);

  --miss: #3a3936;
  --miss-ring: transparent;
  --water-dot: rgba(58, 57, 54, 0.38);
  --splash: rgba(58, 57, 54, 0.5);
  --hit: #c8352a;
  --hit-2: #c8352a;
  --hit-glow: transparent;
  --smoke: transparent;
  --wake: rgba(58, 57, 54, 0.25);
  --wake-head: #3a3936;
  --aim: #2c5f94;
  --aim-armed: #c8352a;
  --roster: #5a564e;
  --pip-on: #3f3e3a;
  --strike-edge: rgba(253, 251, 243, 0.8);
  --snap-ok: rgba(44, 95, 148, 0.16);
  --snap-ok-line: #2c5f94;
  --snap-bad: rgba(200, 53, 42, 0.14);
  --snap-bad-line: #c8352a;
  --pencil: #3f3e3a;
  --foam: transparent;
}

/* before the script runs, a light device starts on the day chart (no flash) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg-a: #ecf5f2;
    --bg-b: #c7ddd7;
    --ink: #10263b;
    --ink-soft: #4b6073;
    --glow-1: rgba(255, 255, 255, 0.9);
    --glow-2: rgba(31, 111, 139, 0.14);
  }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { color-scheme: dark; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
.no-anim *, .no-anim *::before, .no-anim *::after { transition: none !important; animation: none !important; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: linear-gradient(165deg, var(--bg-a), var(--bg-b)) fixed;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.art-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------------------------------------------------------- background */
.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.bg .glow { position: absolute; border-radius: 50%; filter: blur(70px); will-change: transform; }
.bg .g1 { width: 70vmax; height: 70vmax; left: -25vmax; top: -30vmax; background: var(--glow-1); animation: drift 58s ease-in-out infinite alternate; }
.bg .g2 { width: 60vmax; height: 60vmax; right: -25vmax; bottom: -25vmax; background: var(--glow-2); animation: drift 72s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(7vmax, 5vmax) scale(1.1); } }

/* -------------------------------------------------------------- layout */
.app {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px 2px 16px; width: 100%; max-width: 980px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 38px; height: 38px; flex: 0 0 auto; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3)); }
.brand span { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand b { font-family: var(--serif); font-weight: 600; font-size: clamp(19px, 5.2vw, 23px); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-soft); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 3px; white-space: nowrap; }
.brand small .seat { flex: 0 0 auto; width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.brand small .lv { flex: 0 0 auto; display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.brand small .lv b { width: 3px; border-radius: 1px; background: var(--ink-soft); opacity: 0.35; }
.brand small .lv b:nth-child(1) { height: 4px; }
.brand small .lv b:nth-child(2) { height: 7px; }
.brand small .lv b:nth-child(3) { height: 10px; }
.brand small :is(.lv1 b:nth-child(1), .lv2 b:nth-child(-n + 2), .lv3 b) { background: var(--accent); opacity: 1; }
.menu { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.account-chip { display: flex; align-items: center; min-width: 0; margin-left: 2px; }
.account-chip:empty { display: none; }

.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, opacity 0.2s;
  flex: 0 0 auto;
  touch-action: manipulation;
}
.icon-btn:hover { background: var(--btn-bg); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn:disabled { opacity: 0.3; cursor: default; transform: none; background: transparent; }
.icon-btn svg, .btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.stage { flex: 1; min-height: 0; position: relative; }
.screen { position: absolute; inset: 0; animation: screen-in 0.38s var(--ease); }
@keyframes screen-in { from { opacity: 0; } }

/* -------------------------------------------------------------- buttons */
.actions { display: flex; gap: 10px; padding: 6px 4px 0; width: 100%; }
.btn {
  appearance: none;
  flex: 1;
  min-width: 0;
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--ink);
  font: 600 15px var(--sans);
  padding: 10px 14px;
  min-height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s, filter 0.2s, opacity 0.2s;
}
.btn svg { width: 19px; height: 19px; flex: 0 0 auto; }
.btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn.icon-only { flex: 0 0 auto; width: 52px; padding: 0; }
.btn.primary {
  background: linear-gradient(180deg, var(--primary-a), var(--primary-b));
  color: var(--primary-ink);
  border-color: var(--primary-line);
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary:disabled { filter: saturate(0.4); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.start { width: 100%; margin-top: 22px; min-height: 52px; font: 600 18px var(--serif); border-radius: 16px; }
.link { appearance: none; border: 0; background: none; color: var(--ink-soft); font: 500 14px var(--sans); padding: 12px 8px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; min-height: 40px; }
.link:hover { color: var(--ink); }

/* ---------------------------------------------------------------- grids */
.grid {
  --cell: 30px;
  --lab: 14px;
  position: relative;
  display: grid;
  grid-template-columns: var(--lab) calc(var(--cell) * 10);
  grid-template-rows: var(--lab) calc(var(--cell) * 10);
  flex: 0 0 auto;
  transition: opacity 0.45s var(--ease);
}
.grid .cols { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(10, 1fr); padding-bottom: 2px; }
.grid .rows { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(10, 1fr); padding-right: 4px; }
.grid .cols div, .grid .rows div {
  display: grid;
  place-items: center;
  font: 650 calc(var(--lab) * 0.74) / 1 var(--sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--label);
  opacity: 0.92;
}
.grid .rows div { justify-items: end; padding-right: 1px; }
[data-theme="paper"] .grid .cols div, [data-theme="paper"] .grid .rows div { font-family: var(--serif); font-style: italic; font-weight: 500; }

.sea {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  border-radius: calc(var(--cell) * 0.16);
  overflow: hidden;
  isolation: isolate;
  box-shadow: inset 0 0 0 1px var(--grid-edge), var(--sea-shadow);
  touch-action: none;
}
.water {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 28% 18%, var(--sea-a), var(--sea-b) 58%, var(--sea-c));
}
[data-theme="paper"] .water { background: var(--sea-a); }
/* a slow caustic shimmer: ridges of noise, two layers drifting apart */
.caustic {
  position: absolute;
  left: -220px;
  top: -220px;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.026' numOctaves='2' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 0 0 0 0 0.12 0.9 0.12 0 0 0 0 0'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23f)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  opacity: var(--caustic);
  mix-blend-mode: var(--caustic-blend);
  animation: caustic-a 38s linear infinite;
  will-change: transform;
}
.caustic.b { background-size: 300px 300px; left: -300px; top: 0; bottom: -300px; opacity: calc(var(--caustic) * 0.7); animation: caustic-b 52s linear infinite; }
@keyframes caustic-a { to { transform: translate3d(220px, 220px, 0); } }
@keyframes caustic-b { to { transform: translate3d(300px, -300px, 0); } }
.grid.kind-own .caustic, .grid.peek .caustic, .half.waiting .caustic, .grid.calm .caustic { animation-play-state: paused; }
.grid.kind-own .caustic.b { display: none; }
[data-theme="paper"] .caustic { display: none; }

.layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.layer .lines { fill: none; stroke: var(--grid-line); stroke-width: 1; shape-rendering: crispEdges; }

.cells { position: absolute; inset: 0; display: grid; grid-template-rows: repeat(10, 1fr); outline: none; }
.cells .row { display: grid; grid-template-columns: repeat(10, 1fr); }
.cell { position: relative; }
.cell.deny { animation: deny 0.34s var(--ease); }
@keyframes deny { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.grid.kind-target .cells, .grid.kind-setup .cells { cursor: pointer; }
.grid.locked .cells { cursor: default; }
.cells:focus-visible { outline: none; }

.over, .fx { position: absolute; inset: 0; pointer-events: none; }

/* ----------------------------------------------------------------- ships */
.art { overflow: visible; }
.ship-art .hull { fill: url(#g-steel); stroke: var(--hull-line); stroke-width: 1.4; }
.ship-art .hull.sub { fill: url(#g-sub); }
.ship-art .deck { fill: var(--deck); }
.ship-art .edge { fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 1.5; }
.ship-art .mark { fill: none; stroke: var(--deck-mark); stroke-width: 2.2; }
.ship-art .mark.dash { stroke-dasharray: 16 11; }
.ship-art .mark.faint { opacity: 0.5; }
.ship-art .lift { fill: rgba(0, 0, 0, 0.16); stroke: rgba(255, 255, 255, 0.1); }
.ship-art .plank { fill: none; stroke: var(--plank); stroke-width: 1.4; }
.ship-art .super { fill: var(--super); stroke: rgba(0, 0, 0, 0.28); stroke-width: 1; }
.ship-art .bridge { fill: var(--bridge); stroke: rgba(0, 0, 0, 0.2); stroke-width: 0.8; }
.ship-art .tbody { fill: var(--turret); stroke: rgba(0, 0, 0, 0.38); stroke-width: 1; }
.ship-art .barrel { stroke: var(--barrel); stroke-width: 3.2; stroke-linecap: round; }
.ship-art .hatch { fill: rgba(0, 0, 0, 0.3); }
.ship-art .gunlet { fill: var(--turret); stroke: rgba(0, 0, 0, 0.35); stroke-width: 0.8; }
.ship-art .funnel { fill: var(--funnel); stroke: rgba(0, 0, 0, 0.3); stroke-width: 0.8; }
.ship-art .stack { fill: var(--stack); }
.ship-art .rig { stroke: var(--barrel); stroke-width: 1.6; stroke-linecap: round; }
.ship-art .mastc { fill: var(--bridge); stroke: var(--barrel); stroke-width: 1; }
.ship-art .tube { fill: var(--funnel); }
.ship-art .sail { fill: var(--sail); stroke: rgba(0, 0, 0, 0.4); stroke-width: 1; }
.ship-art .fin { fill: none; stroke: var(--sail); stroke-width: 4.5; stroke-linecap: round; }
.ship-art .glass { stroke: #a8dcff; stroke-width: 3.2; stroke-linecap: round; }
.ship-art .foam { fill: none; stroke: var(--foam); stroke-width: 3; }
.ship-art .wave, .ship-art .wake { fill: none; stroke: var(--foam); stroke-width: 2.2; stroke-linecap: round; opacity: 0.7; }
.st-1 { stop-color: var(--st-1); } .st-2 { stop-color: var(--st-2); } .st-3 { stop-color: var(--st-3); }
.sb-1 { stop-color: var(--sb-1); } .sb-2 { stop-color: var(--sb-2); } .sb-3 { stop-color: var(--sb-3); }
.ch-1 { stop-color: var(--ch-1); } .ch-2 { stop-color: var(--ch-2); } .ch-3 { stop-color: var(--ch-3); }
.hatch-line { stroke: var(--pencil, #444); stroke-width: 3; stroke-opacity: 0.55; }
.hatch-line.dense { stroke: var(--hit); stroke-width: 3.4; stroke-opacity: 0.7; }

/* pencil on paper */
[data-theme="paper"] .ship-art .hull { fill: url(#p-hatch); stroke: var(--pencil); stroke-width: 3.4; stroke-linejoin: round; }
[data-theme="paper"] .ship-art :is(.deck, .super, .bridge, .tbody, .funnel, .sail, .lift, .gunlet, .tube) { fill: rgba(253, 251, 243, 0.85); stroke: var(--pencil); stroke-width: 1.8; }
[data-theme="paper"] .ship-art :is(.barrel, .rig, .fin, .mark, .glass) { stroke: var(--pencil); }
[data-theme="paper"] .ship-art :is(.foam, .wave, .wake, .plank, .edge, .stack, .hatch) { display: none; }
[data-theme="paper"] .ship-art .mastc { fill: var(--pencil); }

/* on the grid */
.layer .ship .body { transform-box: fill-box; transform-origin: 50% 50%; transition: opacity 0.3s; }
.layer .ship.ghost { opacity: 0.55; }
.layer .ship.ghost .foam, .layer .ship.ghost .wave, .layer .ship.ghost .wake { display: none; }
.layer .ship.sunk {
  --deck: #2c2622;
  --super: #3c332d;
  --bridge: #4a3f37;
  --turret: #372f2a;
  --barrel: #120e0c;
  --funnel: #221c19;
  --stack: #0c0a09;
  --sail: #2e2825;
  --plank: rgba(255, 130, 70, 0.16);
  --deck-mark: rgba(255, 140, 80, 0.25);
  --foam: transparent;
}
.layer .ship.sunk .hull { fill: url(#g-char); }
.layer .ship.sunk .body { transform: rotate(-2.4deg) scale(0.97); }
[data-theme="paper"] .layer .ship.sunk .hull { fill: url(#p-hatch2); stroke: var(--hit); }
[data-theme="paper"] .layer .ship.sunk .body { transform: none; }
.layer .ship.sinking .body { animation: sink-in 1.25s var(--ease) both; }
@keyframes sink-in {
  0% { opacity: 0; transform: scale(1.05); }
  35% { opacity: 1; }
  100% { transform: rotate(-2.4deg) scale(0.97); }
}
.layer .ship.drop .body { animation: drop-in 0.34s var(--spring); }
@keyframes drop-in { from { opacity: 0.5; transform: scale(1.08); } }
.layer .ship.selected .hull { stroke: var(--accent); stroke-width: 5; }
.layer .ship.lifted { opacity: 0.28; }

/* ----------------------------------------------------------------- marks */
.mk { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.mk.fresh { animation: mk-in 0.42s var(--spring) both; animation-delay: var(--delay, 0ms); }
@keyframes mk-in { from { opacity: 0; transform: scale(0.4); } }
.mk.k-miss .ring { position: absolute; width: 50%; height: 50%; border-radius: 50%; border: max(1.5px, calc(var(--cell) * 0.055)) solid var(--miss-ring); }
.mk.k-miss .dot { width: 22%; height: 22%; border-radius: 50%; background: var(--miss); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.mk.k-water .dot { width: 12%; height: 12%; border-radius: 50%; background: var(--water-dot); }
[data-theme="paper"] .mk.k-miss .dot { width: 20%; height: 20%; box-shadow: none; }
.mk .glow { position: absolute; inset: -6%; border-radius: 50%; background: radial-gradient(circle, var(--hit-glow), transparent 66%); }
.mk .flame { position: absolute; inset: 0 6% 4%; transform-origin: 50% 86%; filter: drop-shadow(0 0 3px rgba(255, 120, 40, 0.55)); }
.mk .flame svg { display: block; width: 100%; height: 100%; }
.fl-outer { fill: var(--hit); }
.fl-inner { fill: var(--hit-2); }
.fl-core { fill: #fff5d6; }
.fl-cross { fill: none; stroke: var(--hit); stroke-width: 9; stroke-linecap: round; display: none; }
.mk.k-hit .flame { animation: flicker 1.3s ease-in-out infinite alternate; }
@keyframes flicker {
  0% { transform: scale(1, 1); opacity: 1; }
  40% { transform: scale(0.94, 1.07); opacity: 0.92; }
  70% { transform: scale(1.05, 0.95); opacity: 1; }
  100% { transform: scale(0.97, 1.04); opacity: 0.95; }
}
.mk.k-hit .smoke {
  position: absolute;
  left: 22%;
  top: -6%;
  width: 56%;
  height: 56%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--smoke), transparent 70%);
  animation: smoke 2.8s ease-out infinite;
}
@keyframes smoke {
  from { transform: translate(0, 30%) scale(0.5); opacity: 0.9; }
  to { transform: translate(18%, -70%) scale(1.5); opacity: 0; }
}
[data-theme="night"] .mk.k-burnt .flame, [data-theme="day"] .mk.k-burnt .flame { display: none; }
.mk.k-burnt .glow { inset: 24%; background: radial-gradient(circle, #ffe2a0 0, var(--hit) 30%, rgba(255, 90, 30, 0.28) 56%, transparent 72%); }
.mk.k-burnt::after { content: ""; position: absolute; width: 16%; height: 16%; border-radius: 50%; background: #fff1cf; opacity: 0.9; }
[data-theme="paper"] .mk.k-burnt::after { display: none; }
.grid.kind-own .mk.k-hit .smoke { display: none; }
[data-theme="paper"] :is(.fl-outer, .fl-inner, .fl-core) { display: none; }
[data-theme="paper"] .fl-cross { display: inline; }
[data-theme="paper"] .mk.k-hit .flame, [data-theme="paper"] .mk.k-burnt .flame { animation: none; inset: 12%; opacity: 1; filter: none; }
[data-theme="paper"] .mk .glow, [data-theme="paper"] .mk .smoke { display: none; }

/* --------------------------------------------------------------- effects */
.torp { position: absolute; width: max(4px, calc(var(--cell) * 0.2)); left: calc((var(--c) + 0.5) * 10%); translate: -50% 0; }
.torp.near { top: calc((var(--r) + 0.5) * 10%); bottom: -8%; }
.torp.far { top: -8%; bottom: calc(95% - var(--r) * 10%); }
.torp .wake {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: linear-gradient(to top, transparent, var(--wake) 45%, var(--wake-head));
  transform-origin: 50% 100%;
  animation: wake-grow 0.34s cubic-bezier(0.55, 0, 0.9, 0.6) both, fade-out 0.8s 0.36s both;
}
.torp.far .wake { background: linear-gradient(to bottom, transparent, var(--wake) 45%, var(--wake-head)); transform-origin: 50% 0; }
.torp .head { position: absolute; inset: 0; animation: run-up 0.34s cubic-bezier(0.55, 0, 0.9, 0.6) both, fade-out 0.15s 0.34s both; }
.torp.far .head { animation-name: run-down, fade-out; }
.torp .head::after {
  content: "";
  position: absolute;
  left: -60%;
  right: -60%;
  top: -7px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--wake-head), transparent);
}
.torp.far .head::after { top: auto; bottom: -7px; }
@keyframes wake-grow { from { transform: scaleY(0); } }
@keyframes run-up { from { transform: translateY(100%); } }
@keyframes run-down { from { transform: translateY(-100%); } }
@keyframes fade-out { to { opacity: 0; } }

.boom { position: absolute; left: calc(var(--c) * 10%); top: calc(var(--r) * 10%); width: 10%; height: 10%; }
.boom > * { position: absolute; }
.splash .ring { inset: 6%; border-radius: 50%; border: max(1.5px, calc(var(--cell) * 0.06)) solid var(--splash); animation: ring-out 0.75s ease-out both; }
.splash .r2 { animation-delay: 0.13s; }
.splash .drop { left: 43%; top: 43%; width: 14%; height: 14%; border-radius: 50%; background: var(--splash); animation: drop-out 0.6s cubic-bezier(0.2, 0.7, 0.4, 1) both; }
@keyframes ring-out { from { transform: scale(0.2); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
@keyframes drop-out {
  from { transform: translate(0, 0) scale(1.2); opacity: 1; }
  to { transform: translate(calc(var(--dx) * var(--cell)), calc(var(--dy) * var(--cell))) scale(0.4); opacity: 0; }
}
.blast .flash { inset: -40%; border-radius: 50%; background: radial-gradient(circle, #fff 0, #fff2c2 18%, rgba(255, 170, 70, 0.55) 42%, transparent 68%); animation: flash 0.5s ease-out both; }
.blast .ball { inset: 2%; border-radius: 50%; background: radial-gradient(circle at 50% 56%, #fff3c4, var(--hit-2) 28%, var(--hit) 56%, transparent 70%); animation: ball 0.85s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.blast .shock { inset: 0; border-radius: 50%; border: 2px solid rgba(255, 214, 160, 0.75); animation: ring-out 0.6s ease-out both; }
.blast .spark { left: 50%; top: 50%; width: 3px; height: 26%; margin-left: -1.5px; border-radius: 2px; background: linear-gradient(#fff6d0, var(--hit)); transform-origin: 50% 0; rotate: var(--a); animation: spark 0.55s ease-out both; }
.blast.big .flash { inset: -80%; }
.blast.big .ball { inset: -20%; }
@keyframes flash { from { transform: scale(0.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
@keyframes ball { 0% { transform: scale(0.2); opacity: 1; } 60% { opacity: 0.9; } 100% { transform: scale(1.25); opacity: 0; } }
@keyframes spark { from { transform: translateY(0) scaleY(0.3); opacity: 1; } to { transform: translateY(calc(var(--cell) * 0.85)) scaleY(1); opacity: 0; } }
[data-theme="paper"] .blast .flash, [data-theme="paper"] .blast .ball { display: none; }
.ripple {
  position: absolute;
  left: calc(var(--c0) * 10%);
  top: calc(var(--r0) * 10%);
  width: calc(var(--w) * 10%);
  height: calc(var(--h) * 10%);
  border-radius: 40%;
  border: 2px solid var(--splash);
  animation: ripple 1.3s ease-out both;
}
@keyframes ripple { from { transform: scale(0.9); opacity: 0.9; } to { transform: scale(1.7); opacity: 0; } }

/* the aim */
.aim { position: absolute; left: 0; top: 0; width: 10%; height: 10%; transform: translate(calc(var(--c) * 100%), calc(var(--r) * 100%)); transition: transform 0.16s var(--ease); pointer-events: none; z-index: 2; }
.aim.jump { transition: none; }
.aim .ring { position: absolute; inset: 7%; border-radius: 50%; border: 2px solid var(--aim); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 10px -1px var(--aim); }
.aim .cross {
  position: absolute;
  inset: -16%;
  background:
    linear-gradient(var(--aim), var(--aim)) 50% 0 / 2px 24% no-repeat,
    linear-gradient(var(--aim), var(--aim)) 50% 100% / 2px 24% no-repeat,
    linear-gradient(var(--aim), var(--aim)) 0 50% / 24% 2px no-repeat,
    linear-gradient(var(--aim), var(--aim)) 100% 50% / 24% 2px no-repeat;
}
.aim.armed .ring { border-color: var(--aim-armed); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 14px var(--aim-armed); animation: armed 1.1s ease-in-out infinite; }
.aim.armed .cross { --aim: var(--aim-armed); }
.aim.pulse .ring { animation: aim-in 0.32s var(--spring); }
.aim.armed.pulse .ring { animation: aim-in 0.32s var(--spring), armed 1.1s 0.32s ease-in-out infinite; }
@keyframes aim-in { from { transform: scale(1.6); opacity: 0; } }
@keyframes armed { 50% { transform: scale(0.88); } }

/* the setup's outline */
.snap { position: absolute; left: calc(var(--c) * 10%); top: calc(var(--r) * 10%); width: 10%; height: 10%; }
.snap.ok { background: var(--snap-ok); box-shadow: inset 0 0 0 1.5px var(--snap-ok-line); }
.snap.bad { background: var(--snap-bad); box-shadow: inset 0 0 0 1.5px var(--snap-bad-line); }

/* -------------------------------------------------------------- the setup */
.setup { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 2px 12px 10px; }
.setup .head { width: var(--board-w, 340px); max-width: 100%; }
.setup h2 { margin: 0; font: 600 21px var(--serif); letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setup .head p { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); line-height: 1.35; }
.setup .head p b { color: var(--accent); font-weight: 600; }
.dock-row { width: var(--board-w, 340px); max-width: 100%; display: flex; align-items: center; gap: 6px; }
.dock { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-height: 48px; padding: 6px 8px; border-radius: 16px; background: var(--chip-bg); border: 1px solid var(--chip-line); }
.dock-ship {
  appearance: none;
  position: relative;
  border: 0;
  padding: 4px;
  margin: 0;
  border-radius: 10px;
  background: transparent;
  cursor: grab;
  touch-action: none;
  display: grid;
  place-items: center;
  transition: background 0.2s, opacity 0.25s, transform 0.2s;
}
.dock-ship svg { display: block; width: calc(var(--dock) * var(--len)); height: var(--dock); }
.dock-ship.v svg { transform: none; }
.dock-ship:hover { background: var(--btn-bg); }
.dock-ship[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.dock-ship.placed { opacity: 0.18; cursor: default; pointer-events: none; }
.dock-ship.placed svg { filter: grayscale(1); }
.dock-ship.lifting { opacity: 0.35; }
.dock-tools { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
.turn-btn { border: 1px solid var(--btn-line); background: var(--btn-bg); }
.turn-btn:disabled { border-color: transparent; }
.turn-btn.v svg { transform: rotate(90deg); }
.turn-btn svg { transition: transform 0.25s var(--ease); }
.setup .actions { width: var(--board-w, 340px); max-width: 100%; padding: 0; }

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  pointer-events: none;
  transform: translate(var(--x), var(--y));
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.45));
}
.drag-ghost svg { display: block; width: calc(var(--cell) * var(--len)); height: var(--cell); }
.drag-ghost.v svg { transform-origin: calc(var(--cell) / 2) calc(var(--cell) / 2); transform: rotate(90deg); }
.drag-ghost .inner { transform: scale(1.06); transition: transform 0.15s; }

/* ------------------------------------------------------ the battle panel */
.panel { display: flex; align-items: center; gap: 6px; min-width: 0; }
.who { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 0 2px 0 4px; }
.lamp { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--line); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); transition: background 0.4s, box-shadow 0.4s; }
.on .lamp { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 12px var(--accent); }
.who span { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.who b { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { font-size: 11.5px; letter-spacing: 0.02em; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.on .who small { color: var(--accent); font-weight: 600; }
.thinking .who small { animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.45; } }
.fire-btn {
  flex: 1 1 auto;
  min-width: 0;
  display: none;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 14px;
  font: 700 16px var(--sans);
  letter-spacing: 0.02em;
  animation: fire-in 0.28s var(--spring);
}
.fire-btn b { font-family: var(--mono); font-weight: 600; font-size: 14px; opacity: 0.8; }
.aimed .fire-btn { display: inline-flex; }
.aimed .who { display: none; }
@keyframes fire-in { from { transform: scale(0.85); opacity: 0; } }
.panel .icon-btn { width: 42px; height: 42px; color: var(--ink-soft); }
.panel .icon-btn svg { width: 21px; height: 21px; }
.panel .icon-btn:hover { color: var(--ink); }
.peek-btn { touch-action: none; }
.peek-btn.held { background: var(--accent-soft); color: var(--accent); }

/* rosters: the enemy's fleet afloat and sunk (a target), your own with its
   damage (a shield) — pips on a phone's strip, silhouettes where there is room */
.rosters { flex: 0 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; --rc: 13px; }
.solo, .duel { --pip: 8px; }
.roster { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rs-title { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em; color: var(--ink-soft); }
.rs-title span { display: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-icon { flex: 0 0 auto; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.roster.enemy .rs-icon { color: var(--hit); }
.roster.own .rs-icon { color: var(--accent); }
.rs-list { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 3px 5px; }
.rs-ship { position: relative; display: flex; }
.rs-ship .ship-art { display: none; }
.segs { display: flex; gap: 1px; }
.seg { width: var(--pip); height: var(--pip); border-radius: 2px; background: var(--pip-on); transition: background 0.3s, opacity 0.3s; }
.roster.own .seg { background: transparent; box-shadow: inset 0 0 0 1.5px var(--roster); }
.roster.own .seg.hit { background: var(--hit); box-shadow: none; }
.rs-ship.sunk .seg { opacity: 0.32; }
.roster.own .rs-ship.sunk .seg { opacity: 0.5; }
.rs-ship.sunk::after { content: ""; position: absolute; left: -3px; right: -3px; top: calc(50% - 1px); height: 2px; border-radius: 1px; background: var(--hit); transform: rotate(-8deg); box-shadow: 0 0 0 1px var(--strike-edge); }
.rs-ship.just { animation: just 0.7s var(--spring); }
@keyframes just { 30% { transform: scale(1.5); } }
.roster.hidden-fleet .rs-list:empty::after { content: "–"; color: var(--ink-soft); font-size: 12px; }
/* a narrow side panel: pips under a wrapping title */
.solo-side .rosters:not(.pics) { gap: 10px; }
.solo-side .rosters:not(.pics) .roster { flex-direction: column; align-items: flex-start; gap: 5px; max-width: 100%; }
.solo-side .rosters:not(.pics) .rs-title { align-items: flex-start; }
.solo-side .rosters:not(.pics) .rs-title span { display: inline; white-space: normal; line-height: 1.2; font-size: 12px; }
/* little silhouettes, with a red dot where your own ships were hit */
:is(.rosters.pics, .half.side .rosters) { gap: 12px; }
:is(.rosters.pics, .half.side .rosters) .roster { flex-direction: column; align-items: flex-start; gap: 6px; max-width: 100%; }
:is(.rosters.pics, .half.side .rosters) .rs-title span { display: inline; }
:is(.rosters.pics, .half.side .rosters) .rs-list { gap: 5px 9px; }
:is(.rosters.pics, .half.side .rosters) .rs-ship .ship-art { display: block; width: calc(var(--rc) * var(--len)); height: var(--rc); }
:is(.rosters.pics, .half.side .rosters) .segs { position: absolute; inset: 0; gap: 0; }
:is(.rosters.pics, .half.side .rosters) .seg { flex: 1; height: 100%; border-radius: 0; background: transparent; box-shadow: none; display: grid; place-items: center; }
:is(.rosters.pics, .half.side .rosters) .seg.hit::after { content: ""; width: 46%; height: 46%; border-radius: 50%; background: var(--hit); box-shadow: 0 0 4px var(--hit); }
:is(.rosters.pics, .half.side .rosters) .rs-ship.sunk .seg { opacity: 1; }
:is(.rosters.pics, .half.side .rosters) .rs-ship.sunk .ship-art { opacity: 0.35; filter: grayscale(1); }
:is(.rosters.pics, .half.side .rosters) .rs-ship .ship-art :is(.foam, .wave, .wake) { display: none; }

/* ------------------------------------------------- face to face: halves */
.duel { overflow: hidden; }
.duel::before { content: ""; position: absolute; left: 4%; right: 4%; top: 50%; height: 1px; background: linear-gradient(90deg, transparent, var(--line) 20%, var(--line) 80%, transparent); }
.app.wide .duel::before { left: 50%; right: auto; top: 4%; bottom: 4%; width: 1px; height: auto; background: linear-gradient(transparent, var(--line) 20%, var(--line) 80%, transparent); }
.half {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--hw, 100%);
  height: var(--hh, 50%);
  translate: -50% -50%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px 4px;
  padding: 4px 6px;
}
.app:not(.wide) .half.p0 { top: 75%; }
.app:not(.wide) .half.p1 { top: 25%; rotate: 180deg; }
.app.wide .half.p0 { left: 75%; rotate: -90deg; }
.app.wide .half.p1 { left: 25%; rotate: 90deg; }
.half .board-wrap { grid-area: board; }
.half .tools { grid-area: tools; display: flex; gap: 4px; }
.half .tools .icon-btn { width: 40px; height: 40px; color: var(--ink-soft); }
.half .tools .icon-btn svg { width: 21px; height: 21px; }
.half .tools .icon-btn:hover { color: var(--ink); }
.half .who { min-width: 92px; }
/* a phone upright: the eye and the flag beside the grid, the name and both rosters under it */
.half.beside { grid-template-columns: var(--board-w) 40px; grid-template-areas: "board tools" "panel panel"; }
.half.beside .tools { flex-direction: column; align-self: end; gap: 6px; }
.half.beside .panel { grid-area: panel; width: min(calc(var(--hw) - 12px), max(100%, 300px)); height: 46px; padding-left: 2px; }
/* a phone on its side: name and tools on one line, the two rosters under them */
.half.tall { grid-template-columns: minmax(0, calc(var(--board-w) - 88px)) auto; grid-template-areas: "board board" "who tools" "rost rost"; row-gap: 4px; }
.half.tall .panel { display: contents; }
.half.tall :is(.who, .fire-btn) { grid-area: who; justify-self: stretch; }
.half.tall .rosters { grid-area: rost; justify-self: stretch; padding: 0 4px; }
/* a tablet: the panel beside the grid */
.half.side { grid-template-columns: auto var(--panel-w, 220px); grid-template-rows: 1fr auto auto auto 1fr; grid-template-areas: "board ." "board who" "board rost" "board tools" "board ."; column-gap: 18px; row-gap: 16px; }
.half.side .panel { display: contents; }
.half.side :is(.who, .fire-btn) { grid-area: who; justify-self: stretch; }
.half.side .rosters { grid-area: rost; justify-self: stretch; --rc: 15px; }
.half.side .tools { justify-self: start; gap: 6px; }
.half.side .who b { font-size: 17px; }
.half.side .who small { font-size: 12.5px; }

.board-wrap { position: relative; flex: 0 0 auto; }
.board-wrap::before {
  content: "";
  position: absolute;
  left: var(--lab);
  top: var(--lab);
  right: 0;
  bottom: 0;
  border-radius: calc(var(--cell) * 0.18);
  box-shadow: 0 0 0 2px var(--accent), 0 0 26px 2px var(--accent-glow);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
}
.on .board-wrap::before { opacity: 1; animation: glow 2.6s ease-in-out infinite alternate; }
@keyframes glow { from { opacity: 0.55; } to { opacity: 1; } }
.half.waiting .grid.kind-target { opacity: 0.5; }
.half.won .board-wrap::before { opacity: 1; box-shadow: 0 0 0 2px var(--accent), 0 0 40px 6px var(--accent-glow); animation: glow 1.6s ease-in-out infinite alternate; }

.grid.peek { position: absolute; left: 0; top: 0; opacity: 0; pointer-events: none; transition: opacity 0.18s; }
.peeking .grid.peek { opacity: 0.66; }
.peeking .grid.kind-target { opacity: 0.08 !important; }
.peek-cap { position: absolute; left: calc(var(--lab) + 6px); right: 6px; top: calc(var(--lab) + 6px); text-align: center; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--ink); opacity: 0; transition: opacity 0.18s; pointer-events: none; }
.peeking .peek-cap { opacity: 0.9; }

.half-toast, .solo-toast {
  position: absolute;
  left: calc(50% + var(--lab) / 2);
  bottom: 12%;
  translate: -50% 10px;
  z-index: 4;
  max-width: 88%;
  padding: 8px 15px;
  border-radius: 999px;
  background: var(--toast);
  color: #fff;
  font: 600 14.5px var(--sans);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, translate 0.28s var(--spring);
}
.half-toast.show, .solo-toast.show { opacity: 1; translate: -50% 0; }
.half-toast.hit, .solo-toast.hit { background: linear-gradient(180deg, #c8471f, #962d12); }
.half-toast.sunk, .solo-toast.sunk { background: linear-gradient(180deg, #a3361a, #5f1d0d); }
.half-toast.turn, .solo-toast.turn { background: linear-gradient(180deg, var(--primary-a), var(--primary-b)); color: var(--primary-ink); }

.banner {
  position: absolute;
  left: calc(50% + var(--lab) / 2);
  bottom: 10px;
  translate: -50% 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 18px 8px;
  max-width: 86%;
  border-radius: 16px;
  border: 1px solid var(--chip-line);
  background: var(--paper);
  color: var(--ink);
  font: 600 16px var(--serif);
  white-space: nowrap;
  text-align: center;
  box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  animation: popc 0.32s var(--ease);
}
.banner small { font: 500 11px var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }

/* a dialog for one player, inside their half */
.slot { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; pointer-events: none; }
.slot .scrim { position: absolute; inset: -2px; background: var(--backdrop); opacity: 0.6; pointer-events: auto; animation: fade 0.25s; border-radius: 12px; }
.slot .dialog { position: relative; left: auto; top: auto; translate: none; width: min(94%, 380px); max-height: 96%; padding: 16px 18px 12px; }
.slot .dialog p { margin: 2px 0 12px; font-size: 14.5px; }
.slot .result { padding: 12px 16px 8px; }
.slot .result .crest { height: 34px; margin: 0 auto 2px; }
.slot .result h2 { font-size: 22px; }
.slot .result p { margin: 2px 0 8px; font-size: 13.5px; }
.slot .result-table { margin-bottom: 10px; font-size: 13px; }
.slot .dialog .btn { min-height: 44px; padding: 8px 10px; }
.slot .result .link { padding-top: 4px; min-height: 32px; font-size: 13px; }

/* -------------------------------------------------- one view: solo, pass */
.solo { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 2px 12px 10px; }
.solo-status { width: var(--board-w); }
.solo-status .panel { height: 46px; }
.solo-main { position: relative; }
.solo.won .board-wrap::before { opacity: 1; animation: glow 1.6s ease-in-out infinite alternate; }
.solo-side { display: flex; align-items: flex-start; gap: 12px; width: var(--board-w); }
.solo-side .side-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; padding-top: calc(var(--lab-own, 12px) + 2px); }
.solo .actions { width: var(--board-w); padding: 0; }
.solo .grid.kind-own.incoming .sea { box-shadow: inset 0 0 0 1px var(--grid-edge), 0 0 0 2px var(--hit), 0 0 18px var(--hit-glow); }
.solo .grid.kind-own .sea { transition: box-shadow 0.4s; }

/* ------------------------------------------------------------ the veil */
.veil { display: grid; place-items: center; padding: 16px 20px 24px; background: radial-gradient(120% 90% at 50% 30%, var(--veil-a), var(--veil-b)); border-radius: 0; z-index: 3; }
.veil-card { width: min(100%, 440px); display: flex; flex-direction: column; align-items: center; text-align: center; animation: rise 0.45s var(--ease); }
.veil-art { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); margin-bottom: 14px; }
.veil-art svg { width: 44px; height: 44px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; animation: sway 3.2s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
.veil h2 { margin: 0; font: 600 27px/1.2 var(--serif); letter-spacing: 0.01em; }
.veil p { margin: 10px 0 0; color: var(--ink-soft); font-size: 15.5px; line-height: 1.5; max-width: 34ch; }
.hold {
  appearance: none;
  position: relative;
  margin-top: 30px;
  width: 128px;
  height: 128px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, var(--paper-2), var(--paper));
  box-shadow: 0 16px 34px -14px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.25s var(--ease);
}
.hold.holding { transform: scale(0.95); }
.hold-ring { position: absolute; inset: 0; width: 100%; height: 100%; rotate: -90deg; }
.hold-ring circle { fill: none; stroke-width: 5; }
.hold-ring .track { stroke: var(--line); }
.hold-ring .fill { stroke: var(--accent); stroke-linecap: butt; stroke-dasharray: 100 100; stroke-dashoffset: 100; transition: stroke-dashoffset 0.35s var(--ease); }
.hold.holding .hold-ring .fill { stroke-dashoffset: 0; transition: stroke-dashoffset var(--hold, 750ms) linear; }
.hold-icon { position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; translate: -50% -50%; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hold-label { margin-top: 14px !important; font-weight: 600; color: var(--ink) !important; font-size: 14.5px !important; }
.veil .link { margin-top: 18px; }

/* ------------------------------------------------------------- sheets */
.backdrop { position: fixed; inset: 0; z-index: 20; background: var(--backdrop); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade 0.25s; }
.backdrop.soft { background: color-mix(in srgb, var(--backdrop) 55%, transparent); -webkit-backdrop-filter: none; backdrop-filter: none; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  z-index: 21;
  max-width: 560px;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
  padding-bottom: env(safe-area-inset-bottom);
  animation: rise 0.32s var(--ease);
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 6px 22px; flex: 0 0 auto; }
.sheet h2 { font: 600 24px var(--serif); margin: 0; letter-spacing: 0.01em; }
.sheet-body { overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 2px 22px 26px; font-size: 15px; line-height: 1.55; touch-action: pan-y; }
.sheet-body h3 { font: 600 17px var(--serif); margin: 20px 0 8px; color: var(--ink); }
.sheet-body h3:first-child { margin-top: 6px; }
.prose p { margin: 0 0 12px; }
.prose p.lead { font-size: 16px; color: var(--ink); margin-top: 12px; }
.prose ul { margin: 0; padding-left: 20px; }
.prose li { margin: 5px 0; }
.prose, .prose * { -webkit-user-select: text; user-select: text; }
.muted { color: var(--ink-soft); }
.note { font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.45; }
.about { font-size: 13px; margin-top: 10px; text-align: center; color: var(--ink-soft); }
.about b { font-weight: 600; color: var(--ink); }
@media (min-width: 700px) and (min-height: 560px) {
  .sheet { bottom: auto; top: 50%; transform: translateY(-50%); border-radius: 24px; max-height: 84dvh; animation: pop 0.28s var(--ease); }
}
@keyframes pop { from { opacity: 0; transform: translateY(-50%) scale(0.96); } }

.choice .fleet-pic, .fleet-pic { display: flex; flex-direction: row; flex-wrap: wrap; gap: 5px 7px; align-items: center; margin-top: 8px; }
.fleet-pic svg { height: 11px; width: calc(11px * var(--len)); }
.rules-fleet { display: grid; gap: 6px; margin: 4px 0 10px; }
.rules-fleet .row { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 10px; font-size: 14px; }
.rules-fleet svg { flex: 0 0 auto; height: 18px; width: calc(18px * var(--len)); }

/* -------------------------------------------------------- choices */
.choices { display: grid; gap: 8px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px 12px;
  min-height: 60px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--paper-2);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.15s;
}
.choice > svg { flex: 0 0 auto; width: 32px; height: 32px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.choice span { display: flex; flex-direction: column; min-width: 0; }
.choice b { font: 600 15px var(--sans); }
.choice small { font-size: 12px; color: var(--ink-soft); line-height: 1.3; margin-top: 1px; }
.choice:active { transform: scale(0.98); }
.choice[aria-checked="true"] { border-color: var(--accent); background: var(--paper); box-shadow: 0 0 0 3px var(--accent-soft); }
.choice.fleet { flex-direction: column; align-items: flex-start; gap: 4px; }

.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  font: 500 14px var(--sans);
  padding: 8px 14px 8px 10px;
  min-height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.opt:active { transform: scale(0.97); }
.opt[aria-checked="true"] { border-color: var(--accent); background: var(--paper); box-shadow: 0 0 0 3px var(--accent-soft); }
.opts.plain .opt { padding-left: 16px; padding-right: 16px; min-width: 76px; justify-content: center; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.tabs .opt { padding: 6px 12px; min-height: 40px; font-size: 13.5px; }
.swatch {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex: 0 0 auto;
  position: relative;
  background:
    linear-gradient(var(--sb), var(--sb)) 33% 0 / 1px 100% no-repeat,
    linear-gradient(var(--sb), var(--sb)) 66% 0 / 1px 100% no-repeat,
    linear-gradient(var(--sb), var(--sb)) 0 33% / 100% 1px no-repeat,
    linear-gradient(var(--sb), var(--sb)) 0 66% / 100% 1px no-repeat,
    var(--sa);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.swatch::before, .swatch::after { content: ""; position: absolute; border-radius: 50%; }
.swatch::before { left: 4px; top: 4px; width: 7px; height: 7px; background: var(--sl); box-shadow: 0 0 0 1.5px var(--sa); }
.swatch::after { right: 4px; bottom: 4px; width: 8px; height: 8px; background: var(--sd); }
.swatch.auto { background: linear-gradient(135deg, #cfe9e3 50%, #0f2d48 50%); }
.swatch.auto::before, .swatch.auto::after { display: none; }

.toggle { display: flex; align-items: center; gap: 12px; margin-top: 12px; cursor: pointer; font-size: 15px; line-height: 1.35; min-height: 32px; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track { flex: 0 0 auto; width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; transition: background 0.25s; box-shadow: inset 0 0 0 1px var(--line); }
.toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.25s var(--ease); }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.players-edit { display: grid; gap: 8px; }
.player-row { display: flex; align-items: center; gap: 10px; }
.player-row .tag { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 700 13px var(--sans); background: var(--accent-soft); color: var(--accent); }
.text-in {
  flex: 1;
  min-width: 0;
  appearance: none;
  font: 500 16px var(--sans); /* 16 px: iOS never zooms into the field */
  color: var(--ink);
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 46px;
  -webkit-user-select: text;
  user-select: text;
}
.text-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ------------------------------------------------------------- results */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin: 4px 0 6px; }
.tile { background: var(--paper-2); border-radius: 16px; padding: 10px 12px; display: flex; flex-direction: column-reverse; gap: 2px; }
.tile small { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.tile b { font: 700 24px var(--serif); font-variant-numeric: tabular-nums; }
.board-mount { min-width: 0; min-height: 96px; background: var(--paper-2); border-radius: 16px; padding: 4px 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
th { text-align: left; vertical-align: bottom; font-weight: 600; color: var(--ink-soft); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; padding: 4px 3px; border-bottom: 1px solid var(--line); line-height: 1.25; }
.table-scroll { overflow-x: auto; overscroll-behavior-x: contain; margin: 0 -4px; padding: 0 4px; }
td { padding: 7px 3px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th.num, td.num { text-align: right; }
td.name { font-weight: 600; max-width: 12em; overflow: hidden; text-overflow: ellipsis; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.recent .when { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.recent .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .res { color: var(--ink-soft); white-space: nowrap; }
.recent .res.w { color: var(--accent); font-weight: 600; }
.recent .why { grid-column: 2 / 4; font-size: 12px; color: var(--ink-soft); }

/* ------------------------------------------------------------- dialogs */
.dialogs { position: fixed; inset: 0; z-index: 22; pointer-events: none; }
.dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: min(92vw, 400px);
  max-height: 92dvh;
  overflow: auto;
  background: var(--paper);
  color: var(--ink);
  border-radius: 24px;
  padding: 24px 22px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
  pointer-events: auto;
  animation: popc 0.32s var(--ease);
}
@keyframes popc { from { opacity: 0; scale: 0.95; } }
.dialog p { position: relative; margin: 4px 0 18px; color: var(--ink-soft); font-size: 15.5px; line-height: 1.5; }
.dialog p.lead { color: var(--ink); font-size: 17px; margin-bottom: 4px; }
.dialog .row { position: relative; display: flex; gap: 10px; }
.dialog .row .btn { min-width: 0; }

.result { overflow: hidden; }
.result .glow { position: absolute; inset: -45% -20% auto; height: 75%; background: radial-gradient(ellipse at 50% 42%, var(--accent-soft), transparent 66%); pointer-events: none; }
.result.won .glow { background: radial-gradient(ellipse at 50% 42%, color-mix(in oklab, var(--accent) 42%, transparent), transparent 66%); }
.result .crest { position: relative; display: flex; justify-content: center; align-items: center; height: 46px; margin: -4px auto 6px; }
.result .crest svg { height: 100%; width: auto; max-width: 70%; }
.result h2 { position: relative; margin: 0; font: 600 28px var(--serif); }
.result.won h2 { animation: shimmer 2.6s ease-in-out infinite; }
@keyframes shimmer { 50% { text-shadow: 0 0 18px color-mix(in oklab, var(--accent) 70%, transparent); } }
.result p { margin: 6px 0 14px; }
.result p.best { color: var(--accent); font-weight: 600; font-size: 14px; margin: -6px 0 12px; }
.result-table { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, auto); column-gap: 14px; gap: 0 14px; margin: 0 0 16px; font-size: 13.5px; font-variant-numeric: tabular-nums; text-align: right; background: var(--paper-2); border-radius: 14px; padding: 6px 10px; }
.result-table > * { padding: 5px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-table .h { font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-soft); align-self: end; }
.result-table .n { text-align: left; font-weight: 600; }
.result-table .n.w { color: var(--accent); }

/* phones: the result card sits low, so the revealed fleets stay in view */
@media (max-width: 600px) and (min-height: 600px) {
  .dialogs .dialog.result { top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); translate: -50% 0; padding: 18px 18px 12px; }
  .dialogs .result h2 { font-size: 25px; }
}

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  translate: -50% 8px;
  z-index: 30;
  background: var(--toast);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  width: max-content;
  max-width: min(88vw, 440px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, translate 0.25s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.toast.show { opacity: 1; translate: -50% 0; }

/* ------------------------------------------------------- landscape, wide */
.app.wide .setup {
  display: grid;
  grid-template-columns: auto minmax(240px, 340px);
  grid-template-rows: auto auto auto;
  align-content: center;
  justify-content: center;
  column-gap: 22px;
  row-gap: 14px;
}
.app.wide .setup .board-slot { grid-column: 1; grid-row: 1 / span 3; align-self: center; }
.app.wide .setup :is(.head, .dock-row, .actions) { grid-column: 2; width: 100%; }
.app.wide .setup .dock-row { align-items: flex-start; }
.app.wide .setup .actions { flex-wrap: wrap; }

.app.wide .solo {
  display: grid;
  grid-template-columns: auto minmax(230px, 330px);
  grid-template-rows: auto auto auto;
  grid-template-areas: "main status" "main side" "main actions";
  align-content: center;
  justify-content: center;
  column-gap: 22px;
  row-gap: 14px;
}
.app.wide .solo-main { grid-area: main; align-self: center; }
.app.wide .solo-status { grid-area: status; width: 100%; }
.app.wide .solo-side { grid-area: side; width: 100%; }
.app.wide .solo .actions { grid-area: actions; width: 100%; flex-wrap: wrap; }
.app.wide .solo .actions .btn { flex: 1 1 40%; }

/* ------------------------------------------------------- small screens */
@media (max-height: 640px) {
  .top { padding-top: 4px; padding-bottom: 0; }
  .brand img { width: 32px; height: 32px; }
  .brand b { font-size: 20px; }
  .btn { min-height: 44px; padding: 8px 10px; }
  .setup, .solo { gap: 6px; }
}
@media (max-width: 400px) {
  .top { padding-left: 12px; padding-right: 6px; }
  .menu .icon-btn { width: 40px; }
  .btn { font-size: 14.5px; padding: 8px 8px; gap: 6px; }
  .dialog .btn, .sheet .btn { font-size: 14.5px; padding: 11px 10px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .setup, .solo { padding-left: 8px; padding-right: 8px; }
}
@media (max-width: 360px) {
  .brand b { font-size: 18px; }
  .brand small { font-size: 10px; letter-spacing: 0.04em; gap: 6px; }
  .brand small .seat { width: 13px; height: 13px; }
  /* a long name keeps its line: the icon steps aside */
  .long-title .brand img { display: none; }
}
@media (max-width: 340px) {
  .brand img { width: 30px; height: 30px; }
  .brand { gap: 8px; }
  .menu .icon-btn { width: 38px; }
  .choices.two { grid-template-columns: 1fr; }
  .actions .btn:not(.icon-only) svg { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bg .glow, .caustic, .veil-art svg, .mk.k-hit .flame, .mk.k-hit .smoke, .on .board-wrap::before, .half.won .board-wrap::before, .aim.armed .ring, .thinking .who small, .result.won h2 { animation: none; }
  .mk.k-hit .smoke { display: none; }
  .screen, .sheet, .dialog, .backdrop, .banner, .veil-card, .fire-btn, .mk.fresh, .rs-ship.just, .layer .ship.sinking .body, .layer .ship.drop .body { animation: none; }
  .aim { transition: none; }
  .hold.holding .hold-ring .fill { transition-duration: var(--hold, 750ms); }
}

.victory { position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(255, 228, 160, 0.38) 50%, transparent 70%); animation: sweep 1.8s ease-out both; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
