:root {
  color-scheme: dark;
  --bg: #06141c;
  --bg-2: #0a202b;
  --surface: #0d2733;
  --surface-2: #123443;
  --surface-3: #1a4253;
  --text: #f1f7f5;
  --muted: #a9c1c7;
  --line: #2c5260;
  --accent: #e8b44a;
  --accent-strong: #ffd36a;
  --accent-dark: #8a5a0c;
  --sea: #0d3342;
  --sea-deep: #071e29;
  --teal: #5fd0c0;
  --danger: #ff7868;
  --danger-dark: #6d1e18;
  --ok: #7ee08a;
  --shadow: 0 20px 60px rgb(0 0 0 / 35%);
  --radius: 18px;
  --radius-sm: 10px;
  --focus: 3px solid #ffd36a;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --cell-min: 24px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3ef;
  --bg-2: #e2ece8;
  --surface: #fbfaf4;
  --surface-2: #eef3ed;
  --surface-3: #dce9e5;
  --text: #10252c;
  --muted: #48636a;
  --line: #a9c3c0;
  --accent: #8c5a00;
  --accent-strong: #6d4300;
  --accent-dark: #f3d99b;
  --sea: #c9e3e0;
  --sea-deep: #a8cecc;
  --teal: #0b6b64;
  --danger: #a52b21;
  --danger-dark: #f4c9c4;
  --ok: #176a2b;
  --shadow: 0 18px 50px rgb(20 50 55 / 12%);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 80% -10%, rgb(95 208 192 / 12%), transparent 60%),
    radial-gradient(900px 500px at 0% 100%, rgb(232 180 74 / 8%), transparent 55%),
    linear-gradient(160deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body.large-text { font-size: 21px; }
body.no-animations *, body.no-animations *::before, body.no-animations *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

h1, h2, h3, h4 {
  line-height: 1.2;
  margin: 0 0 0.55em;
  text-wrap: balance;
}
h1 { font-size: clamp(1.55rem, 2.6vw, 2.25rem); letter-spacing: 0.01em; }
h2 { font-size: clamp(1.45rem, 2.4vw, 2rem); }
h3 { font-size: 1.18rem; }
p { margin: 0 0 0.9em; max-width: 72ch; }
a { color: var(--accent-strong); }
button, select, input { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; height: auto; }

:focus-visible {
  outline: var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--accent);
  color: #171006;
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
  padding: 10px clamp(14px, 3vw, 34px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand { display: flex; gap: 10px; align-items: center; min-width: 0; }
.brand h1 { margin: 0; font-size: 1.2rem; }
.brand__tagline { margin: 0; color: var(--muted); font-size: 0.78rem; }
.brand img { border-radius: 12px; }
.top-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  justify-content: flex-end;
}
.field { display: grid; gap: 6px; min-width: 140px; }
.field > span { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.field.compact { min-width: 0; }
.field.compact > span { font-size: 0.72rem; }
.field.compact select { min-height: 40px; padding: 6px 34px 6px 10px; }
select, input[type="text"] {
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
select:focus-visible, input:focus-visible { outline: var(--focus); outline-offset: 2px; }

.connection {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}
.connection .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }
.connection[data-state="connected"] .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.connection[data-state="connecting"] .dot { background: var(--accent); }

main {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 36px) clamp(12px, 3vw, 34px) 80px;
  flex: 1;
}

.screen { animation: fade-in 220ms ease-out; }
[hidden] { display: none !important; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow { color: var(--accent-strong); font-size: 0.82rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 0.5em; }
.muted { color: var(--muted); }
.hint { color: var(--accent-strong); font-size: 0.9rem; }
.notice {
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--text);
}

.hero {
  position: relative;
  min-height: clamp(360px, 52vw, 540px);
  display: grid;
  align-items: end;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 8px);
  box-shadow: var(--shadow);
  background: var(--sea-deep);
  isolation: isolate;
}
.hero picture, .hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero img { z-index: -2; filter: saturate(0.92) contrast(1.04); }
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgb(3 14 20 / 88%) 0%, rgb(3 14 20 / 64%) 48%, rgb(3 14 20 / 20%) 100%),
    linear-gradient(0deg, rgb(3 14 20 / 82%) 0%, transparent 55%);
}
.hero__overlay {
  position: relative;
  z-index: 1;
  max-width: 780px;
  padding: clamp(20px, 4vw, 48px);
  text-shadow: 0 2px 18px rgb(0 0 0 / 55%);
}
[data-theme="light"] .hero__overlay { color: #fff; }
.hero__overlay h2 { color: #fff; font-size: clamp(1.8rem, 4.6vw, 3.4rem); }
.hero__overlay p:not(.eyebrow) { color: #e2efec; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}
button:hover { border-color: var(--accent); }
button:active { transform: translateY(1px); }
button.primary {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  color: #1b1204;
  text-shadow: none;
}
button.primary:hover { filter: brightness(1.05); }
button.quiet { background: transparent; }
button.danger { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); color: var(--danger); }
button.danger.primary { background: var(--danger); color: #2a0805; }
button.big { min-height: 52px; padding: 13px 22px; font-size: 1.03rem; }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
button.quiet.primary { background: transparent; color: var(--accent-strong); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.actions.compact { margin: 0; }
.actions.compact button { min-height: 40px; padding: 7px 12px; font-size: 0.88rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; max-width: 760px; margin: 16px 0; }

.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
.card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 92%, transparent));
}
.card h3 { color: var(--accent-strong); }
.card p { color: var(--muted); margin-bottom: 0; }

.session-box {
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}
.session-list, .lobby-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.session-list li, .lobby-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.lobby-meta { display: grid; gap: 2px; min-width: 0; }
.lobby-meta strong { overflow-wrap: anywhere; }
.lobby-meta span { color: var(--muted); font-size: 0.85rem; }

.waiting-box {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.status-line {
  min-height: 1.6em;
  padding: 12px 14px;
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  font-weight: 650;
}

.placement-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr); gap: 22px; align-items: start; }
.panel { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.fleet-tray { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fleet-tray button { justify-content: flex-start; min-height: 48px; width: 100%; text-align: left; }
.fleet-tray button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); }
.fleet-tray button.done { border-style: dashed; color: var(--muted); }

.board-panel { min-width: 0; }
.board-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; justify-content: space-between; }
.board-head h3 { margin-bottom: 0.35em; }
.board-head p { margin: 0; font-size: 0.86rem; }

.board {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 1;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(120% 80% at 20% 0%, color-mix(in srgb, var(--teal) 16%, transparent), transparent 55%),
    linear-gradient(160deg, var(--sea), var(--sea-deep));
  box-shadow: inset 0 0 32px rgb(0 0 0 / 24%), var(--shadow);
  touch-action: manipulation;
}
.board-row {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 2px;
  flex: 1 1 0;
  min-height: 0;
}
.own-board { max-width: 480px; }
.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: var(--cell-min);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 4px;
  background: color-mix(in srgb, var(--sea) 72%, rgb(255 255 255 / 3%));
  color: transparent;
  overflow: hidden;
  user-select: none;
}
.cell::after {
  content: attr(data-coord);
  position: absolute;
  top: 1px;
  left: 3px;
  font-size: clamp(5px, 0.62vw, 9px);
  line-height: 1;
  color: color-mix(in srgb, var(--muted) 55%, transparent);
  pointer-events: none;
}
body[data-coordinates="false"] .cell::after { display: none; }
.cell.unknown { background: color-mix(in srgb, var(--sea) 86%, #000 6%); }
.cell.water { background: color-mix(in srgb, var(--sea) 76%, transparent); }
.cell.miss::before {
  content: "";
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: color-mix(in srgb, #dff9f4 85%, var(--teal));
  box-shadow: 0 0 8px rgb(223 249 244 / 35%);
}
.cell.hit { background: linear-gradient(145deg, #f3a43c, #b9431e); animation: hit-flash 420ms ease-out; }
.cell.hit::before { content: "✹"; font-size: clamp(12px, 1.5vw, 20px); color: #2a0d04; }
.cell.sunk { background: linear-gradient(145deg, #7c261d, #2d0c0a); }
.cell.sunk::before { content: "✕"; font-size: clamp(13px, 1.5vw, 20px); color: #ffd8cf; }
.cell.known-empty { background: color-mix(in srgb, var(--sea) 60%, var(--muted) 8%); }
.cell.known-empty::before { content: "·"; color: color-mix(in srgb, var(--muted) 65%, transparent); font-size: 20px; }
.cell.ship {
  background: linear-gradient(135deg, #d8b56a, #7f5a1b);
  border-color: #3e2a08;
  box-shadow: inset 0 0 10px rgb(0 0 0 / 28%);
}
.cell.ship::before { content: ""; width: 64%; height: 28%; border-top: 2px solid rgb(255 244 208 / 55%); border-bottom: 2px solid rgb(44 25 3 / 45%); }
.cell.ship[data-type="battleship"] { background: linear-gradient(135deg, #f0d08a, #8c641f); }
.cell.ship[data-type="cruiser"] { background: linear-gradient(135deg, #ddc27f, #77551c); }
.cell.ship[data-type="destroyer"] { background: linear-gradient(135deg, #c9b075, #654814); }
.cell.ship.damaged { background: linear-gradient(145deg, #f3a43c, #a63d1b); }
.cell.ship.destroyed { background: linear-gradient(145deg, #6e211a, #280a08); }
.cell.hit::after, .cell.sunk::after { color: rgb(255 240 225 / 75%); }
.cell.selected { outline: 3px solid var(--accent-strong); outline-offset: -3px; z-index: 2; }
.cell.preview-ok { outline: 3px dashed var(--ok); outline-offset: -3px; }
.cell.preview-bad { outline: 3px dashed var(--danger); outline-offset: -3px; }
.cell:focus-visible { outline: var(--focus); outline-offset: -3px; z-index: 3; }
.cell[aria-disabled="true"] { cursor: default; }
.cell:hover:not([aria-disabled="true"]) { border-color: var(--accent); }
.board.game-over .cell { cursor: default; }
.board .cell.sunk.hidden-ship { background: linear-gradient(145deg, #4d5f63, #243236); }

@keyframes hit-flash {
  0% { filter: brightness(1.8); transform: scale(0.94); }
  60% { filter: brightness(1.15); }
  100% { filter: none; transform: none; }
}

.board-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.board-actions .primary { flex: 1 1 160px; }
.fleet-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.fleet-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 0.9rem; }
.fleet-list .ok { color: var(--ok); }
.fleet-list .bad { color: var(--danger); }
.fleet-list .damaged { color: var(--accent-strong); }

.boards { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr) minmax(250px, 0.58fr); gap: 18px; align-items: start; }
.own-panel .board { max-width: 440px; }
.side-panel { display: grid; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.side-panel h3 { font-size: 1rem; color: var(--accent-strong); }
.shot-log { max-height: 320px; overflow: auto; padding-left: 1.4em; margin: 0; }
.shot-log li { padding: 5px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); overflow-wrap: anywhere; }
.shot-log li:last-child { border-bottom: 0; }
.stats-list { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; margin: 0; }
.stats-list dt { color: var(--muted); }
.stats-list dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.turn-line { margin: 0; font-size: 1.14rem; font-weight: 750; }
.timer-line { margin: 0; font-variant-numeric: tabular-nums; color: var(--accent-strong); font-weight: 700; }
.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: baseline;
  margin: 10px 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
}
.status-strip p { margin: 0; }

.result {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), var(--surface));
}
.result h3 { color: var(--accent-strong); font-size: 1.5rem; }
.result p { margin-bottom: 0.6em; }

.spectate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.spectate-grid .board { max-width: none; }

.modal {
  width: min(820px, calc(100% - 24px));
  max-height: min(86vh, 900px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgb(0 0 0 / 62%); backdrop-filter: blur(3px); }
.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.modal-head h2 { margin: 0; }
.modal-body { padding: 18px; overflow: auto; max-height: calc(86vh - 70px); }
.modal-body p { max-width: 70ch; }
.rules-image {
  display: block;
  width: 100%;
  max-width: 620px;
  margin: 8px auto 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #e9e2cf;
  filter: sepia(0.12) contrast(0.98);
}
.shortcuts-list { display: grid; gap: 8px; margin: 0; }
.shortcuts-list > div { display: grid; grid-template-columns: minmax(110px, 0.42fr) 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.shortcuts-list dt { font-weight: 700; }
.shortcuts-list dd { margin: 0; color: var(--muted); }
kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font: 0.86em/1.5 var(--font);
  text-align: center;
}
.settings-grid { display: grid; gap: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 6px 0; }
.check input { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--accent); }
.confirm { width: min(520px, calc(100% - 24px)); }

@media (max-width: 1080px) {
  .boards { grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); }
  .side-panel { grid-column: 1 / -1; grid-template-columns: 1.4fr 0.8fr; }
  .side-panel .game-actions { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .menu-grid { grid-template-columns: 1fr; }
  .placement-layout { grid-template-columns: 1fr; }
  .boards { grid-template-columns: 1fr; }
  .side-panel { grid-template-columns: 1fr; }
  .spectate-grid { grid-template-columns: 1fr; }
  .enemy-panel { order: 1; }
  .own-panel { order: 2; }
  .side-panel { order: 3; }
  .board { max-width: none; }
  .board-actions {
    position: sticky;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 12;
    padding: 8px;
    margin: 10px -8px -8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(10px);
  }
  .topbar { position: static; }
  .top-controls { justify-content: flex-start; }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  main { padding: 12px 10px 48px; }
  .hero { min-height: 420px; }
  .hero::after { background: linear-gradient(0deg, rgb(3 14 20 / 92%) 0%, rgb(3 14 20 / 55%) 60%, rgb(3 14 20 / 30%) 100%); }
  .hero__actions button { flex: 1 1 100%; }
  .cell::after { font-size: 6px; }
  .board { padding: 4px; gap: 1px; }
  .board-row { gap: 1px; }
  .cell { border-radius: 3px; }
  .status-strip { gap: 4px 14px; }
  .shortcuts-list > div { grid-template-columns: 1fr; gap: 2px; }
  .modal-body { padding: 14px; }
  .top-controls .field.compact { min-width: 150px; }
}
@media (max-width: 380px) {
  body { font-size: 16px; }
  .top-controls { gap: 6px; }
  .top-controls button { padding: 8px 10px; font-size: 0.82rem; }
  .cell::after { display: none; }
  .board { padding: 3px; }
  .board-row { gap: 1px; }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #eef3ef;
    --bg-2: #e2ece8;
    --surface: #fbfaf4;
    --surface-2: #eef3ed;
    --surface-3: #dce9e5;
    --text: #10252c;
    --muted: #48636a;
    --line: #a9c3c0;
    --accent: #8c5a00;
    --accent-strong: #6d4300;
    --accent-dark: #f3d99b;
    --sea: #c9e3e0;
    --sea-deep: #a8cecc;
    --teal: #0b6b64;
    --danger: #a52b21;
    --danger-dark: #f4c9c4;
    --ok: #176a2b;
    --shadow: 0 18px 50px rgb(20 50 55 / 12%);
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: #d9f0ec;
    --muted: #e4f3f0;
    --accent: #ffd76e;
    --accent-strong: #ffe49b;
    --surface: #06141c;
    --surface-2: #0a202b;
    --text: #fff;
  }
  .cell { border-width: 2px; }
  .cell::after { color: #fff; font-weight: 700; }
}

@media (forced-colors: active) {
  body, .board, .cell, .panel, .card, .modal, .topbar, .status-strip {
    background: Canvas;
    color: CanvasText;
  }
  .cell { border: 1px solid CanvasText; forced-color-adjust: none; }
  .cell.ship, .cell.hit, .cell.sunk, .cell.miss, .cell.known-empty { background: Canvas; }
  .cell.ship::before { border-color: CanvasText; }
  .cell.hit::before { content: "X"; color: CanvasText; }
  .cell.sunk::before { content: "#"; color: CanvasText; }
  .cell.miss::before { background: CanvasText; }
  button.primary { background: Highlight; color: HighlightText; }
  .hero img { display: none; }
  .hero { background: Canvas; }
  .hero__overlay, .hero__overlay h2, .hero__overlay p { color: CanvasText; text-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
