/* ==========================================================================
   BATTLESHIP · kandabatata.com
   Dark naval war-room: deep ink ocean, radar arcs, berry + amber accents.
   ========================================================================== */

:root {
  --ink: #070d18;
  --ink-2: #0a1322;
  --ink-3: #0e1a2d;
  --panel: rgba(15, 26, 44, .74);
  --panel-solid: #0f1a2c;
  --line: rgba(159, 196, 228, .16);
  --line-strong: rgba(159, 196, 228, .32);
  --text: #e9eefa;
  --muted: #9dafc8;
  --muted-2: #7488a3;

  --berry: #e85a88;
  --berry-deep: #c03968;
  --berry-dark: #7a1e3a;
  --amber: #f0b450;
  --amber-deep: #c88330;
  --sea: #63b3d8;
  --hit: #ff7a59;
  --good: #56c596;
  --bad: #e2574c;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, .85);
  --shadow-soft: 0 14px 34px -22px rgba(0, 0, 0, .9);
  --font-display: 'Outfit', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -.015em; }
p { margin: 0; }
a { color: inherit; }
button { font-family: inherit; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.wrap { width: min(1180px, calc(100% - 2.5rem)); margin-inline: auto; }
.link { color: var(--amber); text-decoration: none; border-bottom: 1px solid rgba(240, 180, 80, .35); }
.link:hover { color: #ffd08a; }
.kbd {
  font-family: var(--font-body);
  font-size: .78em;
  padding: .12em .45em;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: rgba(159, 196, 228, .1);
  color: #dce6f5;
}

/* ============================== BACKGROUND ============================== */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background:
  radial-gradient(120% 90% at 50% -10%, #0d1a2e 0%, #070d18 55%, #04080f 100%); }

.bg-glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; }
.bg-glow--berry {
  width: 46vw; height: 46vw; min-width: 320px; min-height: 320px;
  top: -14vw; left: -10vw;
  background: radial-gradient(circle, rgba(192, 57, 104, .55), transparent 68%);
  animation: glowDrift 26s ease-in-out infinite alternate;
}
.bg-glow--amber {
  width: 38vw; height: 38vw; min-width: 280px; min-height: 280px;
  right: -8vw; bottom: -12vw;
  background: radial-gradient(circle, rgba(200, 131, 48, .38), transparent 70%);
  animation: glowDrift 32s ease-in-out infinite alternate-reverse;
}

.bg-map { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .85; }

.bg-contours path { animation: contourDrift 40s ease-in-out infinite alternate; }
.bg-contours path:nth-child(2n) { animation-duration: 52s; animation-direction: alternate-reverse; }
.bg-sea { animation: seaBreathe 12s ease-in-out infinite; }
.bg-ships .ship { animation: shipDrift 34s ease-in-out infinite; }
.bg-ships .ship--b { animation-duration: 44s; animation-delay: -8s; }
.bg-ships .ship--c { animation-duration: 38s; animation-delay: -16s; }
.bg-fixes circle { animation: fixPulse 5.5s ease-in-out infinite; }
.bg-fixes path { animation: fixPulse 5.5s ease-in-out infinite .6s; }
.bg-arcs { animation: arcSpin 90s linear infinite; transform-origin: 1180px 180px; }

.bg-radar {
  position: absolute; right: 5vw; top: 4vh; width: 340px; height: 340px;
  border-radius: 50%;
  border: 1px solid rgba(99, 179, 216, .14);
  box-shadow: inset 0 0 70px rgba(99, 179, 216, .05);
  opacity: .5;
}
.bg-radar-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(99, 179, 216, .22), rgba(99, 179, 216, .015) 18%, transparent 34%);
  animation: sweep 7s linear infinite;
  mask: radial-gradient(circle, transparent 8%, #000 9%);
}

.bg-scan {
  position: absolute; inset: -30% 0 auto;
  height: 60%;
  background: linear-gradient(to bottom, transparent, rgba(99, 179, 216, .07), transparent);
  animation: scanDown 14s linear infinite;
}

.bg-vignette {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 50% 40%, transparent 40%, rgba(3, 6, 12, .72) 100%),
    linear-gradient(to bottom, rgba(4, 8, 15, .55), transparent 22%, transparent 78%, rgba(4, 8, 15, .7));
}

@keyframes sweep { to { transform: rotate(360deg); } }
@keyframes scanDown { 0% { transform: translateY(-20%); } 100% { transform: translateY(150%); } }
@keyframes glowDrift { 0% { transform: translate3d(0, 0, 0) scale(1); } 100% { transform: translate3d(4vw, 3vh, 0) scale(1.12); } }
@keyframes contourDrift { 0% { transform: translateX(0); } 100% { transform: translateX(-26px); } }
@keyframes seaBreathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes shipDrift { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(26px, -8px); } }
@keyframes fixPulse { 0%, 100% { opacity: .28; } 50% { opacity: .85; } }
@keyframes arcSpin { to { transform: rotate(360deg); } }

/* ================================ TOPBAR ================================ */
.topbar {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: min(1180px, calc(100% - 2.5rem)); margin-inline: auto;
  padding: 1.4rem 0 .6rem;
}
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  color: #fff;
  background: linear-gradient(150deg, var(--berry), var(--berry-dark));
  box-shadow: 0 10px 24px -12px rgba(232, 90, 136, .95), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { display: grid; line-height: 1.1; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; letter-spacing: .01em; }
.brand-sub { font-size: .74rem; color: var(--muted-2); letter-spacing: .08em; text-transform: uppercase; }
.topnav { display: flex; align-items: center; gap: .85rem; }
.topnav-link { color: var(--muted); text-decoration: none; font-size: .86rem; }
.topnav-link:hover { color: #fff; }
.topnav-sep { width: 1px; height: 18px; background: var(--line); }
.kanda {
  display: inline-flex; align-items: center; gap: .45rem;
  text-decoration: none; font-size: .78rem; letter-spacing: .04em;
  color: var(--muted-2);
  padding: .38rem .7rem; border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(15, 26, 44, .5);
  transition: color .2s, border-color .2s, transform .2s;
}
.kanda:hover { color: var(--amber); border-color: rgba(240, 180, 80, .4); transform: translateY(-1px); }
.theme-toggle {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .38rem .68rem; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: .78rem; letter-spacing: .04em;
  border: 1px solid var(--line); background: rgba(15, 26, 44, .5);
  color: var(--muted);
  transition: color .2s, border-color .2s, background .2s, transform .2s;
}
.theme-toggle:hover { color: var(--amber); border-color: rgba(240, 180, 80, .4); transform: translateY(-1px); }
.theme-toggle:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.theme-icon { width: 15px; height: 15px; }
html[data-theme="night"] .theme-icon--moon { display: none; }
html[data-theme="day"] .theme-icon--sun { display: none; }

.kanda-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--berry); box-shadow: 0 0 10px rgba(232, 90, 136, .9);
}

/* ================================ SHARED ================================ */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}
.card--flat { background: rgba(12, 21, 36, .6); }

.btn {
  --btn-bg: linear-gradient(150deg, #f0688f, var(--berry-deep) 62%, var(--berry-dark));
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .68rem 1.15rem;
  font-family: var(--font-display); font-weight: 600; font-size: .92rem; letter-spacing: .01em;
  color: #fff; text-decoration: none; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  background: var(--btn-bg);
  box-shadow: 0 14px 30px -18px rgba(232, 90, 136, .95), inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: transform .16s ease, box-shadow .2s ease, filter .2s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1.5px); filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .42; cursor: not-allowed; filter: grayscale(.25); box-shadow: none; }
.btn--lg { padding: .92rem 1.6rem; font-size: 1.02rem; border-radius: 14px; }
.btn--sm { padding: .48rem .8rem; font-size: .82rem; border-radius: 10px; }
.btn--ghost {
  background: rgba(159, 196, 228, .07);
  border: 1px solid var(--line-strong);
  color: var(--text);
  box-shadow: none;
}
.btn--ghost:hover:not(:disabled) { background: rgba(159, 196, 228, .14); border-color: rgba(159, 196, 228, .48); }
.btn--primary { }
.inline-form { display: inline; }
.tag {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--amber); font-weight: 600;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .42rem .85rem; border-radius: 999px;
  border: 1px solid rgba(240, 180, 80, .28);
  background: rgba(240, 180, 80, .08);
  color: #f4cd92; font-size: .78rem; letter-spacing: .06em;
}
.eyebrow-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--amber);
  box-shadow: 0 0 0 0 rgba(240, 180, 80, .6);
  animation: blip 2.6s ease-out infinite;
}
@keyframes blip {
  0% { box-shadow: 0 0 0 0 rgba(240, 180, 80, .55); }
  70% { box-shadow: 0 0 0 9px rgba(240, 180, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(240, 180, 80, 0); }
}

.field-label {
  display: block; font-size: .72rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted-2); margin-bottom: .45rem;
}
.field-help { color: var(--muted-2); font-size: .8rem; line-height: 1.55; }
.alert {
  border: 1px solid rgba(226, 87, 76, .4);
  background: rgba(226, 87, 76, .1);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem; margin-top: 1rem;
  color: #ffd7d2; font-size: .86rem;
}
.alert strong { display: block; margin-bottom: .35rem; color: #fff; }
.alert ul { margin: .2rem 0 0; padding-left: 1.1rem; }

/* ================================ LANDING ================================ */
.home { padding-bottom: 3rem; flex: 1 0 auto; }
.game-shell { flex: 1 0 auto; }
.hero { padding: 3.2rem 0 2rem; max-width: 780px; }
.hero-title {
  margin-top: 1.1rem;
  font-size: clamp(2.3rem, 5.6vw, 4.1rem);
  font-weight: 700; line-height: 1.03;
  text-shadow: 0 22px 60px rgba(0, 0, 0, .55);
}
.hero-title-accent {
  background: linear-gradient(96deg, var(--berry) 0%, #ff9db8 42%, var(--amber) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-title--sm { font-size: clamp(1.9rem, 4vw, 2.9rem); }
.hero-sub { margin-top: 1.15rem; color: var(--muted); font-size: 1.02rem; line-height: 1.65; max-width: 60ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.9rem; }
.hero-actions--tight { margin-top: 1.3rem; }
.hero-hint { margin-top: 1.15rem; color: var(--muted-2); font-size: .84rem; }
.hero--compact { padding-top: 2.4rem; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.2rem; }
.step { padding: 1.35rem 1.3rem 1.5rem; position: relative; overflow: hidden; }
.step::after {
  content: ''; position: absolute; inset: auto -30% -60% auto; width: 60%; height: 120%;
  background: radial-gradient(circle, rgba(232, 90, 136, .16), transparent 65%);
  pointer-events: none;
}
.step-num {
  font-family: var(--font-display); font-size: .8rem; font-weight: 700;
  letter-spacing: .18em; color: var(--berry);
}
.step-title { margin-top: .5rem; font-size: 1.2rem; }
.step-text { margin-top: .5rem; color: var(--muted); font-size: .88rem; line-height: 1.6; }

.rules-strip { margin-top: 1rem; padding: 1.35rem 1.4rem 1.5rem; }
.rules-title { font-size: 1.05rem; letter-spacing: .01em; }
.rules-list { list-style: none; margin: .9rem 0 0; padding: 0; display: grid; gap: .6rem; }
.rules-list li {
  display: flex; flex-wrap: wrap; gap: .35rem 1rem; align-items: baseline;
  padding-bottom: .6rem; border-bottom: 1px dashed rgba(159, 196, 228, .12);
  color: var(--muted); font-size: .88rem;
}
.rules-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.rule-k {
  flex: 0 0 auto; min-width: 118px; color: var(--amber); font-weight: 700; font-size: .72rem;
  letter-spacing: .1em; text-transform: uppercase;
}

/* ================================= JOIN ================================= */
.code-form { max-width: 520px; padding: 1.6rem 1.5rem 1.7rem; margin-top: 1.6rem; }
.name-row { margin-top: 1.8rem; max-width: 360px; }
.text-input {
  width: 100%; padding: .72rem .95rem;
  font-family: var(--font-display); font-size: 1rem; font-weight: 600;
  color: var(--text);
  background: rgba(6, 12, 22, .8);
  border: 1px solid var(--line-strong); border-radius: 12px;
  outline: none; transition: border-color .18s, box-shadow .18s;
}
.text-input::placeholder { color: rgba(157, 175, 200, .45); font-weight: 500; }
.text-input:focus {
  border-color: rgba(232, 90, 136, .7);
  box-shadow: 0 0 0 4px rgba(232, 90, 136, .16);
}
.field-label--gap { margin-top: 1.2rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.code-input {
  width: 100%; padding: .95rem 1.1rem;
  font-family: var(--font-display); font-size: clamp(1.15rem, 3.4vw, 1.55rem);
  font-weight: 600; letter-spacing: .16em; color: #fff;
  background: rgba(6, 12, 22, .8);
  border: 1px solid var(--line-strong); border-radius: 14px;
  outline: none; transition: border-color .18s, box-shadow .18s;
}
.code-input::placeholder { color: rgba(157, 175, 200, .35); letter-spacing: .12em; }
.code-input:focus {
  border-color: rgba(232, 90, 136, .7);
  box-shadow: 0 0 0 4px rgba(232, 90, 136, .16);
}

/* ============================== GAME SHELL ============================== */
.game-shell { padding-bottom: 3rem; }

.statusbar {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  flex-wrap: wrap;
  padding: .55rem 0 1.1rem;
}
.statusbar-left, .statusbar-right { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

.codepill {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .5rem .8rem .5rem .9rem; cursor: pointer;
  border-radius: 12px; border: 1px solid var(--line);
  background: rgba(10, 19, 33, .78); color: var(--text);
  transition: border-color .2s, transform .2s;
}
.codepill:hover { border-color: rgba(240, 180, 80, .45); transform: translateY(-1px); }
.codepill-label { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); }
.codepill-code { font-family: var(--font-display); font-weight: 700; letter-spacing: .16em; font-size: .95rem; }
.codepill .icon { color: var(--muted-2); width: 15px; height: 15px; }

.role-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .45rem .8rem; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(10, 19, 33, .6);
  font-size: .82rem; font-weight: 600;
}
.role-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--berry); box-shadow: 0 0 9px var(--berry); }
.role-sub { color: var(--muted-2); font-weight: 400; font-size: .74rem; }
.role-name { max-width: 15ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-chip[hidden] { display: none !important; }
.role-edit {
  display: inline-grid; place-items: center; padding: .1rem; margin-left: .1rem;
  background: none; border: 0; border-radius: 6px; cursor: pointer; color: var(--muted-2);
  transition: color .18s, background .18s;
}
.role-edit:hover { color: var(--amber); background: rgba(240, 180, 80, .12); }
.role-edit:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
.role-edit .icon { width: 14px; height: 14px; }
.rename-form { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.rename-form[hidden] { display: none; }
.rename-input {
  width: 160px; max-width: 46vw; padding: .42rem .65rem;
  font-family: var(--font-display); font-size: .88rem; font-weight: 600; color: var(--text);
  background: rgba(6, 12, 22, .8);
  border: 1px solid var(--line-strong); border-radius: 10px; outline: none;
}
.rename-input:focus { border-color: rgba(232, 90, 136, .7); box-shadow: 0 0 0 3px rgba(232, 90, 136, .16); }

.live { display: inline-flex; align-items: center; gap: .4rem; font-size: .76rem; color: var(--good); letter-spacing: .04em; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: livePulse 1.9s ease-in-out infinite; }
.live.is-off { color: var(--amber); }
@keyframes livePulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }

.phase-chip {
  padding: .42rem .8rem; border-radius: 999px; font-size: .72rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid rgba(240, 180, 80, .3); color: var(--amber);
  background: rgba(240, 180, 80, .1);
}
.phase-chip[data-phase="playing"] { color: #ffd7a1; border-color: rgba(255, 122, 89, .45); background: rgba(255, 122, 89, .14); }
.phase-chip[data-phase="finished"] { color: #cfd8e6; border-color: var(--line-strong); background: rgba(159, 196, 228, .1); }

.screen[hidden] { display: none !important; }
.screen.is-active { animation: screenIn .35s ease both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* =============================== PLACEMENT =============================== */
.stage-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1.2rem;
  flex-wrap: wrap; margin-bottom: 1.2rem;
}
.stage-title { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-top: .45rem; }
.stage-sub { color: var(--muted); font-size: .9rem; margin-top: .5rem; max-width: 62ch; line-height: 1.6; }
.stage-actions { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }

.place-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.battle-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.board-card { padding: 1.1rem 1.15rem 1.25rem; }
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: .8rem; margin-bottom: .85rem; }
.board-title { font-size: 1.02rem; letter-spacing: .01em; }
.board-meta { font-size: .76rem; color: var(--muted-2); letter-spacing: .04em; }

/* the grid */
.board {
  display: grid;
  grid-template-columns: 18px repeat(var(--n, 10), minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  user-select: none;
  touch-action: manipulation;
}
.coord {
  display: grid; place-items: center;
  font-size: .62rem; font-weight: 700; letter-spacing: .06em;
  color: var(--muted-2); text-transform: uppercase;
}
.coord--corner { opacity: .35; }

.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  padding: 0; margin: 0;
  border-radius: 6px;
  border: 1px solid rgba(99, 179, 216, .18);
  background:
    linear-gradient(160deg, rgba(99, 179, 216, .12), rgba(10, 24, 42, .55) 60%),
    rgba(8, 18, 32, .72);
  cursor: pointer;
  transition: transform .12s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.cell:hover:not(:disabled) { border-color: rgba(240, 180, 80, .55); box-shadow: 0 0 0 2px rgba(240, 180, 80, .16) inset; }
.cell:disabled { cursor: default; }
.cell:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }

/* own ships */
.cell--ship {
  background: linear-gradient(150deg, #cfd9e8, #8ba0bd 55%, #5b718f);
  border-color: rgba(220, 232, 248, .55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 4px 12px -8px rgba(0, 0, 0, .9);
}
.cell--ship.cell--sunk {
  background: linear-gradient(150deg, #6b3a3a, #40232b 60%, #2a1620);
  border-color: rgba(226, 87, 76, .5);
}
.cell--ship-new { animation: shipIn .28s ease; }
@keyframes shipIn { from { transform: scale(.82); } to { transform: scale(1); } }

/* placement previews */
.cell--preview-ok {
  background: linear-gradient(150deg, rgba(86, 197, 150, .5), rgba(86, 197, 150, .12));
  border-color: rgba(86, 197, 150, .7);
}
.cell--preview-bad {
  background: linear-gradient(150deg, rgba(226, 87, 76, .45), rgba(226, 87, 76, .1));
  border-color: rgba(226, 87, 76, .7);
}

/* shots */
.cell--miss::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 30%; height: 30%; border-radius: 50%;
  background: rgba(159, 196, 228, .7);
  box-shadow: 0 0 0 1px rgba(159, 196, 228, .25);
}
.cell--hit {
  background: radial-gradient(circle at 50% 55%, rgba(255, 180, 120, .95), rgba(255, 122, 89, .6) 45%, rgba(122, 30, 40, .75) 100%);
  border-color: rgba(255, 122, 89, .8);
}
.cell--hit::after {
  content: ''; position: absolute; inset: 12%; border-radius: 50%;
  border: 2px solid rgba(255, 214, 170, .9);
  animation: hitRing 1.6s ease-out infinite;
}
@keyframes hitRing {
  0% { transform: scale(.65); opacity: .9; }
  100% { transform: scale(1.15); opacity: 0; }
}
.cell--killship { box-shadow: 0 0 0 2px rgba(226, 87, 76, .9), 0 0 22px rgba(226, 87, 76, .55); }

.cell--open { background: rgba(8, 18, 32, .5); border-style: dashed; border-color: rgba(99, 179, 216, .22); }
.cell--open:not(:disabled) { cursor: crosshair; }
.cell--open:not(:disabled):hover { background: rgba(240, 180, 80, .12); }
.cell--dim { opacity: .55; }
.cell--sel {
  border-color: var(--amber) !important;
  background: rgba(240, 180, 80, .22) !important;
  box-shadow: 0 0 0 2px rgba(240, 180, 80, .55), 0 0 24px rgba(240, 180, 80, .35);
  animation: reticle 1.4s ease-in-out infinite;
}
.cell--sel::before {
  content: ''; position: absolute; inset: 24%;
  border: 1px solid rgba(255, 235, 200, .95); border-radius: 50%;
}
@keyframes reticle { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.cell--boom { animation: boom .7s ease-out; }
@keyframes boom {
  0% { transform: scale(1); }
  35% { transform: scale(1.28); box-shadow: 0 0 30px rgba(255, 170, 90, .9); }
  100% { transform: scale(1); }
}
.cell--splash { animation: splash .7s ease-out; }
@keyframes splash {
  0% { transform: scale(1); }
  40% { transform: scale(1.15); box-shadow: 0 0 22px rgba(99, 179, 216, .7); }
  100% { transform: scale(1); }
}
.cell--pop { animation: pop .9s ease-out; }
@keyframes pop {
  0% { transform: scale(1); }
  30% { transform: scale(1.22); }
  100% { transform: scale(1); }
}
.cell--shake { animation: shake .4s ease-in-out; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* fleet dock */
.fleet-card { padding: 1.15rem 1.15rem 1.3rem; }
.fleet-list { list-style: none; margin: .85rem 0 0; padding: 0; display: grid; gap: .45rem; }
.fleet-row {
  display: grid; grid-template-columns: 1fr auto; gap: .2rem .6rem;
  align-items: center;
  padding: .55rem .65rem; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(8, 17, 30, .6);
  transition: border-color .18s, background .18s, transform .18s;
}
.fleet-row:hover { border-color: var(--line-strong); transform: translateX(2px); }
.fleet-row.is-selected { border-color: rgba(240, 180, 80, .65); background: rgba(240, 180, 80, .1); }
.fleet-row.is-placed { opacity: .92; }
.fleet-name { font-size: .86rem; font-weight: 600; }
.fleet-blocks { display: inline-flex; gap: 2px; grid-row: 2; }
.fleet-row .block { width: 9px; height: 9px; border-radius: 2px; background: #8ba0bd; opacity: .8; }
.fleet-row.is-placed .block { background: var(--good); }
.fleet-state { grid-row: 1 / span 2; justify-self: end; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); }
.fleet-row.is-placed .fleet-state { color: var(--good); }

.orient-block { margin-top: 1rem; }
.orient-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  width: 100%; padding: 4px; cursor: pointer;
  border-radius: 12px; border: 1px solid var(--line);
  background: rgba(6, 12, 22, .7); color: var(--muted);
}
.orient-opt {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .5rem .4rem; border-radius: 9px; font-size: .78rem; font-weight: 600;
  transition: background .18s, color .18s;
}
.orient-opt svg { width: 15px; height: 15px; }
.orient-opt.is-on { background: linear-gradient(150deg, rgba(232, 90, 136, .9), rgba(122, 30, 58, .9)); color: #fff; }
.fleet-note { margin-top: 1rem; font-size: .8rem; color: var(--muted); line-height: 1.55; }

/* ============================== WAITING ROOM ============================== */
.wait-card { max-width: 640px; margin: 1.4rem auto 0; padding: 2rem 1.8rem 2.2rem; text-align: center; }
.wait-card .stage-sub { margin-inline: auto; }
.code-share {
  margin: 1.6rem auto 0; padding: 1.2rem 1.2rem 1.35rem;
  border-radius: var(--radius-sm); border: 1px dashed rgba(240, 180, 80, .38);
  background: rgba(240, 180, 80, .07); max-width: 420px;
}
.code-share-label { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--amber); }
.code-share-value {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.5rem, 6vw, 2.1rem);
  letter-spacing: .22em; margin: .35rem 0 .85rem;
  background: linear-gradient(96deg, #fff, #ffd7a1);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.code-share-actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.code-share .field-help { margin-top: .8rem; }

.radar-wrap { margin-top: 1.8rem; display: grid; place-items: center; gap: .9rem; }
.radar {
  position: relative; width: 148px; height: 148px; border-radius: 50%;
  border: 1px solid rgba(86, 197, 150, .35);
  background: radial-gradient(circle, rgba(86, 197, 150, .1), transparent 70%);
  overflow: hidden;
}
.radar-ring { position: absolute; inset: 22%; border-radius: 50%; border: 1px solid rgba(86, 197, 150, .22); }
.radar-ring--2 { inset: 42%; }
.radar-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(86, 197, 150, .5), rgba(86, 197, 150, .04) 28%, transparent 45%);
  animation: sweep 3.2s linear infinite;
}
.radar-blip {
  position: absolute; left: 66%; top: 34%; width: 8px; height: 8px; border-radius: 50%;
  background: var(--good); box-shadow: 0 0 12px rgba(86, 197, 150, .9);
  animation: blipFade 3.2s ease-in-out infinite;
}
@keyframes blipFade { 0%, 60%, 100% { opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: scale(1); } }
.radar-caption { color: var(--muted); font-size: .84rem; }

.wait-status { list-style: none; margin: 1.7rem auto .35rem; padding: 0; display: grid; gap: .55rem; max-width: 340px; text-align: left; }
.wait-status li {
  display: flex; align-items: center; gap: .6rem;
  font-size: .86rem; color: var(--muted-2);
  padding: .55rem .75rem; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(8, 17, 30, .6);
  transition: color .2s, border-color .2s, background .2s;
}
.wait-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(159, 196, 228, .35); flex: 0 0 auto; }
.wait-status li.is-done { color: var(--text); border-color: rgba(86, 197, 150, .4); background: rgba(86, 197, 150, .08); }
.wait-status li.is-done .wait-dot { background: var(--good); box-shadow: 0 0 10px rgba(86, 197, 150, .8); }

/* ================================= BATTLE ================================= */
.turnbar {
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap;
  padding: .85rem 1.1rem; margin-bottom: 1rem;
  border-radius: 14px; border: 1px solid var(--line);
  background: rgba(10, 19, 33, .72);
  transition: border-color .25s, background .25s, box-shadow .25s;
}
.turnbar.is-mine {
  border-color: rgba(240, 180, 80, .5);
  background: linear-gradient(100deg, rgba(240, 180, 80, .16), rgba(10, 19, 33, .72) 60%);
  box-shadow: 0 0 30px -14px rgba(240, 180, 80, .7);
}
.turnbar.is-theirs { border-color: rgba(159, 196, 228, .22); }
.turn-state { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.turnbar.is-mine .turn-state { color: var(--amber); }
.turnbar.is-theirs .turn-state { color: var(--muted); }
.turn-sub { font-size: .84rem; color: var(--muted); flex: 1 1 200px; }
.turn-count { font-size: .74rem; color: var(--muted-2); letter-spacing: .06em; }

.ship-health { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .4rem; }
.health-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; align-items: center;
  font-size: .78rem; color: var(--muted);
  padding: .35rem .5rem; border-radius: 8px; background: rgba(8, 17, 30, .45);
}
.health-row.is-sunk { color: rgba(226, 87, 76, .95); text-decoration: line-through; }
.health-pips { display: inline-flex; gap: 3px; }
.pip { width: 9px; height: 9px; border-radius: 2px; background: rgba(220, 232, 248, .7); }
.pip--hit { background: var(--hit); }
.health-row.is-sunk .pip { background: rgba(226, 87, 76, .55); }
.health-state { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }

.attack-bar {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  margin-top: 1rem; padding-top: .95rem; border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.target-readout {
  font-family: var(--font-display); font-weight: 600; font-size: .92rem; color: var(--muted);
  padding: .55rem .8rem; border-radius: 10px;
  border: 1px dashed var(--line-strong); background: rgba(8, 17, 30, .55);
  min-width: 190px;
}

.shortcut-line { margin-top: .9rem; font-size: .76rem; color: var(--muted-2); display: flex; flex-wrap: wrap; gap: .35rem .9rem; }
.log-card { margin-top: 1rem; padding: 1.1rem 1.15rem 1.2rem; }
.log-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.battle-log { list-style: none; margin: .85rem 0 0; padding: 0; display: grid; gap: .35rem; max-height: 240px; overflow-y: auto; }
.battle-log::-webkit-scrollbar { width: 8px; }
.battle-log::-webkit-scrollbar-thumb { background: rgba(159, 196, 228, .2); border-radius: 8px; }
.log-row {
  display: grid; grid-template-columns: minmax(0, 88px) 52px 1fr; gap: .6rem; align-items: center;
  font-size: .82rem; color: var(--muted);
  padding: .42rem .6rem; border-radius: 8px;
  background: rgba(8, 17, 30, .45);
  border-left: 2px solid transparent;
}
.log-row--you { border-left-color: rgba(240, 180, 80, .7); }
.log-row--them { border-left-color: rgba(232, 90, 136, .7); }
.log-who {
  font-weight: 700; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.log-cell { font-family: var(--font-display); font-weight: 700; letter-spacing: .08em; color: var(--text); }
.log-row--hit .log-what { color: var(--hit); }
.log-row--miss .log-what { color: var(--muted-2); }
.log-empty { color: var(--muted-2); font-size: .84rem; padding: .5rem; }

/* ================================= RESULT ================================= */
.over-card { max-width: 640px; margin: 1.6rem auto 0; padding: 2.2rem 1.9rem 2.3rem; text-align: center; }
.over-card.is-win { border-color: rgba(240, 180, 80, .45); box-shadow: 0 0 60px -26px rgba(240, 180, 80, .8); }
.over-card.is-loss { border-color: rgba(226, 87, 76, .35); }
.over-title { font-size: clamp(1.8rem, 4.6vw, 2.7rem); margin-top: .6rem; }
.over-card.is-win .over-title {
  background: linear-gradient(96deg, var(--amber), #ffe6b8 50%, var(--berry));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.over-sub { color: var(--muted); margin-top: .6rem; font-size: .95rem; line-height: 1.6; }
.over-stats {
  display: grid; gap: .55rem; margin-top: 1.6rem;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}
.stat {
  padding: .7rem .5rem; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(8, 17, 30, .6);
  display: grid; gap: .2rem;
}
.stat b { font-family: var(--font-display); font-size: 1.25rem; line-height: 1.1; }
.stat span { font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); line-height: 1.3; }

/* ================================= TOAST ================================= */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 18px);
  padding: .7rem 1.1rem; border-radius: 12px;
  background: rgba(12, 22, 38, .96); border: 1px solid var(--line-strong);
  color: var(--text); font-size: .86rem; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s;
  z-index: 60; max-width: min(90vw, 460px); text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast--warn { border-color: rgba(240, 180, 80, .6); }
.toast--hit { border-color: rgba(255, 122, 89, .7); }
.toast--miss { border-color: rgba(99, 179, 216, .5); }
.toast--win { border-color: rgba(86, 197, 150, .7); }

/* ================================= FOOTER ================================= */
.foot {
  width: min(1180px, calc(100% - 2.5rem)); margin: 2.6rem auto 0; margin-top: auto;
  padding: 1.4rem 0 2.2rem; border-top: 1px solid rgba(159, 196, 228, .1);
}
.foot-line { display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: space-between; font-size: .78rem; color: var(--muted-2); }
.foot-brand a { color: var(--amber); text-decoration: none; }
.foot-brand a:hover { text-decoration: underline; }

/* =============================== RESPONSIVE =============================== */
@media (max-width: 980px) {
  .place-layout { grid-template-columns: 1fr; }
  .battle-layout { grid-template-columns: 1fr; }
  .battle-layout .board-card:nth-child(2) { order: -1; }
  .steps { grid-template-columns: 1fr; }
  .fleet-card { order: -1; }
  .fleet-list { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .orient-block { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .8rem; }
  .orient-block .field-label { margin: 0; }
  .orient-block .field-help { grid-column: 1 / -1; }
  .orient-toggle { min-width: 220px; }
}

@media (max-width: 620px) {
  .wrap, .topbar, .foot { width: calc(100% - 1.6rem); }
  .brand-sub { display: none; }
  .kanda span:last-child { display: none; }
  .theme-toggle-label { display: none; }
  .theme-toggle { padding: .42rem .55rem; }
  .hero { padding-top: 2.2rem; }
  .hero-actions .btn, .hero-actions .inline-form { width: 100%; }
  .hero-actions .btn { justify-content: center; }
  .statusbar { gap: .5rem; }
  .codepill-code { letter-spacing: .1em; font-size: .86rem; }
  .role-sub { display: none; }
  .board { grid-template-columns: 14px repeat(var(--n, 10), minmax(0, 1fr)); gap: 3px; }
  .cell { border-radius: 4px; }
  .coord { font-size: .54rem; }
  .turnbar { gap: .4rem; }
  .turn-count { width: 100%; }
  .wait-card, .over-card { padding: 1.6rem 1.2rem 1.8rem; }
  .code-share { padding: 1rem; }
  .log-row { grid-template-columns: minmax(0, 70px) 44px 1fr; font-size: .78rem; }
  .stage-actions .btn { flex: 1 1 auto; }
}

/* ============================ MOTION PREFERENCES ============================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ==========================================================================
   DAY MODE · the same table under a bright sky
   Toggled by the top-right switch, remembered in localStorage, applied to
   <html data-theme="day"> before first paint.
   ========================================================================== */
html[data-theme="day"] {
  --ink: #eef3fa;
  --ink-2: #e5edf7;
  --ink-3: #dbe6f3;
  --panel: rgba(255, 255, 255, .93);
  --panel-solid: #ffffff;
  --line: rgba(20, 44, 74, .15);
  --line-strong: rgba(20, 44, 74, .28);
  --text: #0f1f36;
  --muted: #45586f;
  --muted-2: #63758c;
  --berry: #c0335f;
  --berry-deep: #a52a52;
  --berry-dark: #82203f;
  --amber: #8c560e;
  --amber-deep: #71440a;
  --sea: #1d6c8f;
  --hit: #c94126;
  --good: #0d8560;
  --bad: #b2352a;
  --shadow: 0 24px 60px -32px rgba(20, 44, 74, .38);
  --shadow-soft: 0 14px 34px -24px rgba(20, 44, 74, .42);
}

html[data-theme="day"] body { background: var(--ink); }

/* --- backdrop ------------------------------------------------------------ */
html[data-theme="day"] .bg {
  background: radial-gradient(120% 90% at 50% -10%, #ffffff 0%, #eaf1fa 52%, #dbe6f3 100%);
}
html[data-theme="day"] .bg-glow { opacity: .26; }
html[data-theme="day"] .bg-glow--berry {
  background: radial-gradient(circle, rgba(192, 51, 95, .3), transparent 68%);
}
html[data-theme="day"] .bg-glow--amber {
  background: radial-gradient(circle, rgba(214, 149, 60, .28), transparent 70%);
}
html[data-theme="day"] .bg-map {
  opacity: .48;
  filter: invert(1) hue-rotate(185deg) saturate(1.05);
}
html[data-theme="day"] .bg-radar {
  border-color: rgba(29, 108, 143, .2);
  box-shadow: inset 0 0 70px rgba(29, 108, 143, .06);
  opacity: .35;
}
html[data-theme="day"] .bg-radar-sweep {
  background: conic-gradient(from 0deg, rgba(29, 108, 143, .18), rgba(29, 108, 143, .02) 18%, transparent 34%);
}
html[data-theme="day"] .bg-scan {
  background: linear-gradient(to bottom, transparent, rgba(29, 108, 143, .07), transparent);
}
html[data-theme="day"] .bg-vignette {
  background:
    radial-gradient(120% 80% at 50% 40%, transparent 46%, rgba(176, 198, 224, .34) 100%),
    linear-gradient(to bottom, rgba(255, 255, 255, .5), transparent 20%, transparent 82%, rgba(196, 214, 236, .3));
}

/* --- chrome -------------------------------------------------------------- */
html[data-theme="day"] .card { box-shadow: var(--shadow-soft); }
html[data-theme="day"] .card--flat { background: rgba(255, 255, 255, .78); }
html[data-theme="day"] .kanda,
html[data-theme="day"] .theme-toggle { background: rgba(255, 255, 255, .72); }
html[data-theme="day"] .kanda:hover,
html[data-theme="day"] .theme-toggle:hover { background: #fff; }
html[data-theme="day"] .topnav-link:hover { color: var(--berry-deep); }
html[data-theme="day"] .kbd {
  background: rgba(20, 44, 74, .07);
  border-color: var(--line-strong);
  color: var(--text);
}
html[data-theme="day"] .link { border-bottom-color: rgba(140, 86, 14, .4); }
html[data-theme="day"] .link:hover { color: var(--berry-deep); }

/* --- type & accents ------------------------------------------------------ */
html[data-theme="day"] .hero-title { text-shadow: 0 18px 44px rgba(20, 44, 74, .16); }
html[data-theme="day"] .hero-title-accent {
  /* background-image, not the shorthand — the shorthand would reset
     background-clip and paint the gradient as a solid block. */
  background-image: linear-gradient(96deg, #b02e5c 0%, #d8447a 40%, #9a6212 100%);
}
html[data-theme="day"] .eyebrow {
  border-color: rgba(140, 86, 14, .32);
  background: rgba(240, 180, 80, .2);
  color: #7d4e0c;
}
html[data-theme="day"] .step::after {
  background: radial-gradient(circle, rgba(192, 51, 95, .1), transparent 65%);
}
html[data-theme="day"] .rules-list li { border-bottom-color: rgba(20, 44, 74, .12); }
html[data-theme="day"] .foot { border-top-color: rgba(20, 44, 74, .12); }

/* --- buttons & fields ---------------------------------------------------- */
html[data-theme="day"] .btn { border-color: rgba(255, 255, 255, .35); }
html[data-theme="day"] .btn--ghost {
  background: rgba(255, 255, 255, .8);
  border-color: var(--line-strong);
  box-shadow: 0 8px 20px -16px rgba(20, 44, 74, .7);
}
html[data-theme="day"] .btn--ghost:hover:not(:disabled) {
  background: #fff;
  border-color: rgba(20, 44, 74, .42);
}
html[data-theme="day"] .code-input,
html[data-theme="day"] .text-input,
html[data-theme="day"] .rename-input {
  background: #fff;
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(20, 44, 74, .06);
}
html[data-theme="day"] .code-input::placeholder,
html[data-theme="day"] .text-input::placeholder,
html[data-theme="day"] .rename-input::placeholder { color: rgba(20, 44, 74, .38); }
html[data-theme="day"] .alert {
  color: #8a2016;
  background: rgba(194, 53, 42, .09);
  border-color: rgba(194, 53, 42, .34);
}
html[data-theme="day"] .alert strong { color: #75160f; }

/* --- status bar --------------------------------------------------------- */
html[data-theme="day"] .codepill,
html[data-theme="day"] .role-chip { background: rgba(255, 255, 255, .84); }
html[data-theme="day"] .codepill:hover { border-color: rgba(140, 86, 14, .45); }
html[data-theme="day"] .phase-chip {
  color: #7d4e0c;
  border-color: rgba(140, 86, 14, .34);
  background: rgba(240, 180, 80, .2);
}
html[data-theme="day"] .phase-chip[data-phase="playing"] {
  color: #962f18;
  border-color: rgba(201, 65, 38, .34);
  background: rgba(201, 65, 38, .12);
}
html[data-theme="day"] .phase-chip[data-phase="finished"] {
  color: #3b4d64;
  border-color: var(--line-strong);
  background: rgba(20, 44, 74, .07);
}

/* --- grids -------------------------------------------------------------- */
html[data-theme="day"] .cell {
  border-color: rgba(29, 108, 143, .24);
  background:
    linear-gradient(160deg, rgba(29, 108, 143, .12), rgba(233, 242, 251, .96) 60%),
    #ffffff;
}
html[data-theme="day"] .cell:hover:not(:disabled) {
  border-color: rgba(140, 86, 14, .55);
  box-shadow: 0 0 0 2px rgba(240, 180, 80, .28) inset;
}
html[data-theme="day"] .cell--ship {
  background: linear-gradient(150deg, #54759b, #33506f 55%, #24405c);
  border-color: rgba(20, 44, 74, .45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 12px -8px rgba(20, 44, 74, .8);
}
html[data-theme="day"] .cell--ship.cell--sunk {
  background: linear-gradient(150deg, #8b4a42, #6b2c28 60%, #4d1e1c);
  border-color: rgba(178, 53, 42, .55);
}
html[data-theme="day"] .cell--miss::after {
  background: rgba(20, 44, 74, .42);
  box-shadow: 0 0 0 1px rgba(20, 44, 74, .18);
}
html[data-theme="day"] .cell--hit {
  background: radial-gradient(circle at 50% 55%, rgba(255, 176, 118, .98), rgba(216, 84, 44, .92) 45%, rgba(139, 42, 27, .96) 100%);
  border-color: rgba(201, 65, 38, .75);
}
html[data-theme="day"] .cell--hit::after { border-color: rgba(255, 238, 214, .95); }
html[data-theme="day"] .cell--open {
  background: rgba(255, 255, 255, .66);
  border-color: rgba(29, 108, 143, .3);
}
html[data-theme="day"] .cell--open:not(:disabled):hover { background: rgba(240, 180, 80, .22); }
html[data-theme="day"] .cell--sel { background: rgba(240, 180, 80, .34) !important; }
html[data-theme="day"] .cell--dim { opacity: .62; }

/* --- placement dock ----------------------------------------------------- */
html[data-theme="day"] .fleet-row { background: #fff; }
html[data-theme="day"] .fleet-row:hover { border-color: rgba(20, 44, 74, .35); }
html[data-theme="day"] .fleet-row.is-selected { background: rgba(240, 180, 80, .18); }
html[data-theme="day"] .fleet-row .block { background: #5d7695; }
html[data-theme="day"] .orient-toggle { background: rgba(232, 240, 250, .95); }

/* --- waiting room ------------------------------------------------------- */
html[data-theme="day"] .code-share {
  border-color: rgba(140, 86, 14, .42);
  background: rgba(240, 180, 80, .15);
}
html[data-theme="day"] .code-share-label { color: #7d4e0c; }
html[data-theme="day"] .code-share-value {
  background: none;
  -webkit-text-fill-color: #7d4e0c;
  color: #7d4e0c;
}
html[data-theme="day"] .wait-status li { background: #fff; }
html[data-theme="day"] .wait-dot { background: rgba(20, 44, 74, .22); }
html[data-theme="day"] .radar {
  border-color: rgba(13, 133, 96, .38);
  background: radial-gradient(circle, rgba(13, 133, 96, .12), transparent 70%);
}

/* --- battle ------------------------------------------------------------- */
html[data-theme="day"] .turnbar { background: #fff; }
html[data-theme="day"] .turnbar.is-mine {
  border-color: rgba(140, 86, 14, .42);
  background: linear-gradient(100deg, rgba(240, 180, 80, .3), #fff 62%);
  box-shadow: 0 0 26px -16px rgba(140, 86, 14, .8);
}
html[data-theme="day"] .turnbar.is-theirs { border-color: var(--line-strong); }
html[data-theme="day"] .turnbar.is-mine .turn-state { color: #7d4e0c; }
html[data-theme="day"] .health-row { background: rgba(232, 240, 250, .85); }
html[data-theme="day"] .pip { background: #6d87a6; }
html[data-theme="day"] .health-row.is-sunk .pip { background: rgba(178, 53, 42, .55); }
html[data-theme="day"] .target-readout { background: #fff; }
html[data-theme="day"] .battle-log::-webkit-scrollbar-thumb { background: rgba(20, 44, 74, .22); }
html[data-theme="day"] .log-row { background: rgba(232, 240, 250, .75); }
html[data-theme="day"] .log-row--you { border-left-color: rgba(140, 86, 14, .75); }
html[data-theme="day"] .log-row--them { border-left-color: rgba(192, 51, 95, .75); }

/* --- result & toast ----------------------------------------------------- */
html[data-theme="day"] .stat { background: #fff; }
html[data-theme="day"] .over-card.is-win { border-color: rgba(140, 86, 14, .4); }
html[data-theme="day"] .over-card.is-win .over-title {
  background: none;
  -webkit-text-fill-color: #8a5410;
  color: #8a5410;
}
html[data-theme="day"] .toast {
  background: #fff;
  color: var(--text);
  box-shadow: 0 18px 40px -22px rgba(20, 44, 74, .55);
}

/* Battle feedback: an impact burst or expanding water rings, over persistent markers. */
.cell--boom, .cell--splash { z-index: 3; overflow: visible; }
.cell--boom { animation: impactBurst 1s ease-out; }
.cell--splash { animation: waterImpact 1s ease-out; }
.cell--boom::before, .cell--splash::before {
  content: ''; pointer-events: none; position: absolute; inset: -10%; border-radius: 50%;
}
.cell--boom::before {
  background: radial-gradient(circle, #fff9ce 0 8%, #ffd166 13%, #ff7043 28%, transparent 67%);
  box-shadow: 0 -12px 0 -8px #ffe6a4, 12px -5px 0 -8px #ffb15c, -12px 2px 0 -8px #ff7556, 8px 12px 0 -8px #ffd166;
  animation: impactFlare 1s ease-out both;
}
.cell--splash::before {
  border: 2px solid #b9edff; box-shadow: 0 0 0 5px rgba(125,213,255,.35), 0 0 0 10px rgba(125,213,255,.18);
  animation: waterRipple 1s ease-out both;
}
@keyframes impactBurst { 0%,100% { transform:scale(1); } 25% { transform:scale(1.19); box-shadow:0 0 24px 7px rgba(255,118,58,.8); } 45% { transform:scale(.94); } }
@keyframes impactFlare { 0% { opacity:0; transform:scale(.2); } 22% { opacity:1; transform:scale(1.35); } 100% { opacity:0; transform:scale(1.8); } }
@keyframes waterImpact { 0%,100% { transform:scale(1); } 30% { transform:scale(1.12); box-shadow:0 0 24px rgba(117,214,255,.8); } }
@keyframes waterRipple { 0% { opacity:1; transform:scale(.25); } 100% { opacity:0; transform:scale(1.75); } }
.battle-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:.45rem; }
.turn-flash { display:none; padding:.65rem 1rem; margin-bottom:.7rem; border:1px solid var(--amber); border-radius:12px; background:var(--ink-2); color:var(--text); font-weight:700; }
.turn-flash.is-on { display:block; animation:turnArrival .45s ease-out; }
@keyframes turnArrival { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
.over-card { position:relative; overflow:hidden; isolation:isolate; }
.result-emblem { width:72px; height:72px; margin:0 auto 1rem; display:grid; place-items:center; border-radius:50%; color:var(--amber); border:1px solid rgba(240,180,80,.6); background:rgba(240,180,80,.13); font-size:2.2rem; box-shadow:0 0 30px rgba(240,180,80,.23); }
.is-win .result-emblem { animation:emblemArrival .9s cubic-bezier(.2,1.5,.4,1) both; }
.is-loss .result-emblem { color:var(--text); }
.result-sparkles { position:absolute; inset:0; pointer-events:none; z-index:-1; color:#f7c878; }
.result-sparkles span { position:absolute; font-size:1.5rem; opacity:0; }
.is-win .result-sparkles span { animation:sparkle 2.4s ease-in-out infinite; }
.result-sparkles span:nth-child(1) { top:9%; left:12%; }
.result-sparkles span:nth-child(2) { top:22%; right:11%; animation-delay:.3s; }
.result-sparkles span:nth-child(3) { top:48%; left:6%; animation-delay:.7s; }
.result-sparkles span:nth-child(4) { top:59%; right:7%; animation-delay:1s; }
.result-sparkles span:nth-child(5) { top:5%; right:28%; animation-delay:1.3s; }
@keyframes sparkle { 0%,100% {opacity:.08;transform:scale(.5) rotate(0)} 50% {opacity:.85;transform:scale(1.3) rotate(30deg)} }
@keyframes emblemArrival { from {opacity:0;transform:scale(.3) rotate(-25deg)} to {opacity:1;transform:scale(1) rotate(0)} }
.rematch-status { margin:1rem auto 0; color:var(--muted); }
.rematch-status:empty { display:none; }
.rematch-invite { margin:1rem auto; padding:1rem; border:1px solid var(--line-strong); border-radius:12px; background:var(--ink-2); }
.rematch-invite[hidden] { display:none; }
.rematch-invite p { margin:0; }
@media (prefers-reduced-motion: reduce) {
  .cell--boom, .cell--splash, .cell--boom::before, .cell--splash::before, .is-win .result-emblem, .is-win .result-sparkles span, .turn-flash.is-on { animation:none !important; }
  .cell--boom::before, .cell--splash::before { display:none; }
}
