:root {
  --bg: #f4f8f1;
  --ink: #17212b;
  --muted: #5f7080;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --line: rgba(24, 47, 63, 0.16);
  --accent: #2f9f76;
  --accent-2: #f0b84e;
  --danger: #d84058;
  --ship: #3f74c8;
  --cell: rgba(255, 255, 255, 0.8);
  --shadow: 0 18px 46px rgba(25, 45, 55, 0.14);
}

body.theme-winter { --bg: #edf7ff; --accent: #2c8dc4; --accent-2: #84cef4; --ship: #5878db; }
body.theme-spring { --bg: #f0faef; --accent: #3f9f5f; --accent-2: #efc94d; --ship: #4f86d9; }
body.theme-summer { --bg: #fff7dd; --accent: #128e77; --accent-2: #f2a72d; --ship: #276fc2; }
body.theme-autumn { --bg: #fff1e5; --accent: #a85f31; --accent-2: #d49330; --ship: #486eb5; }
body.dark {
  --bg: #101820;
  --ink: #edf6ff;
  --muted: #a9b7c6;
  --panel: rgba(23, 35, 47, 0.92);
  --panel-strong: #1b2936;
  --line: rgba(255, 255, 255, 0.16);
  --cell: rgba(255, 255, 255, 0.11);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html,
body,
.app,
.panel,
.board,
.cell,
.fleet,
.fleet-item,
.hand-card,
button,
a {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input,
textarea,
select {
  -webkit-user-select: text;
  user-select: text;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.62), transparent 34rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0)),
    var(--bg);
  font-family: "Segoe UI", system-ui, sans-serif;
}
body.dark {
  background:
    radial-gradient(circle at top left, rgba(72, 116, 160, 0.28), transparent 34rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent),
    var(--bg);
}

button, input, select {
  font: inherit;
  border: 0;
  border-radius: 18px;
}
button {
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.01em;
}
input, select {
  width: 100%;
  padding: 14px 16px;
  background: var(--panel-strong);
  color: var(--ink);
  outline: 2px solid var(--line);
}
select { appearance: auto; }
button:disabled { opacity: 0.48; cursor: not-allowed; transform: none !important; }

.hidden { display: none !important; }
.app { position: relative; z-index: 1; padding: 18px; max-width: 1740px; margin: 0 auto; }
.topbar, .tabs, .panel-head, .account-strip, .join-row, .room-code, .tools, .bonus-options {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar { justify-content: space-between; margin-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: var(--shadow);
  font-size: 25px;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 2px; font-size: clamp(26px, 3vw, 40px); }
h2 { font-size: 22px; margin-bottom: 12px; }
h3 { font-size: 17px; margin-bottom: 10px; }
p, small, .hint { color: var(--muted); }
.hint { line-height: 1.45; }
.account-strip {
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.portal-back {
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.compact { display: grid; gap: 12px; }
.auth-grid, .menu-grid, .shop-grid, .settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.tabs { margin-bottom: 14px; flex-wrap: wrap; }
.tab, .primary, .secondary, .icon-btn {
  min-height: 48px;
  padding: 13px 18px;
  color: var(--ink);
  background: var(--panel-strong);
  border: 2px solid var(--line);
  box-shadow: 0 10px 20px rgba(20, 45, 65, 0.08);
  transition: transform 0.16s ease, filter 0.16s ease, background 0.16s ease;
}
.tab.active, .primary {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}
.big-button { width: 100%; min-height: 62px; font-size: 18px; margin: 8px 0 12px; }
.ghost { margin-left: auto; }
.icon-btn { min-width: 48px; padding: 11px 13px; }
button:hover { transform: translateY(-1px); filter: brightness(1.03); }
.tab-page { display: none; }
.tab-page.active { display: block; animation: fade 0.22s ease; }

.segmented { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.segmented label, .bonus-options label, .badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}
.field-label { display: block; margin: 14px 0 7px; font-weight: 800; }
.server-list, .list, .shop-list, .admin-users, .fleet, .bonus-bar, .chat-log, .event-log {
  display: grid;
  gap: 9px;
}
.server-list code {
  display: block;
  padding: 11px 13px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 800;
}
.list-item, .shop-item, .admin-row, .fleet-item, .bonus-item, .chat-message, .event-item {
  padding: 13px 14px;
  border-radius: 20px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}
.list-item, .shop-item, .admin-row, .fleet-item, .bonus-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.shop-item > div { display: grid; gap: 3px; }

.game-grid {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr) 330px;
  gap: 14px;
}
.side, .chat-panel { align-self: start; }
.battle { display: grid; gap: 14px; }
.status-panel { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 14px; }
.boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(10, minmax(24px, 1fr));
  gap: 6px;
  padding: 10px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.4), transparent 20%),
    radial-gradient(circle at 70% 70%, rgba(255,255,255,.24), transparent 22%),
    linear-gradient(135deg, rgba(29, 144, 184, .45), rgba(23, 91, 156, .55));
  box-shadow: inset 0 0 28px rgba(0, 56, 96, .25);
}

.battle-intel {
  display: none !important;
}

.enemy-fleet {
  min-height: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -3px 0 9px;
}

.enemy-fleet-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.enemy-ship-mini {
  display: inline-flex;
  gap: 2px;
  padding: 5px 7px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.enemy-ship-mini i {
  width: 10px;
  height: 10px;
  border-radius: 4px;
  background: rgba(78, 118, 150, 0.62);
}

.enemy-ship-mini i.hit {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(216, 64, 88, 0.45);
}

.event-log {
  min-height: 28px;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: center;
}

.event-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #38d17d;
  box-shadow: 0 0 0 5px rgba(56, 209, 125, 0.14), 0 0 16px rgba(56, 209, 125, 0.45);
  animation: eventDot 3s ease forwards;
}

.bonus-confirm-pop {
  position: absolute;
  z-index: 8;
  display: flex;
  gap: 6px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.bonus-confirm-pop button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  color: white;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.24);
}

.bonus-confirm-pop .confirm { background: var(--accent); }
.bonus-confirm-pop .cancel { background: var(--danger); }

.ship-drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(var(--decks), 28px);
  gap: 3px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(15, 31, 45, 0.7);
  pointer-events: none;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
}

.ship-drag-ghost i {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(145deg, #8da0ad, #344455);
}
.cell {
  aspect-ratio: 1;
  border-radius: 13px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.42), transparent 24%),
    linear-gradient(145deg, rgba(75, 178, 211, .55), rgba(25, 112, 172, .7));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), inset 0 -8px 16px rgba(0,57,105,.16);
  position: relative;
  overflow: hidden;
  transition: transform 0.14s ease, background 0.14s ease;
}
.cell::before {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
}
.cell:hover { transform: translateY(-1px); }
.cell.ship {
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.35), transparent 25%),
    linear-gradient(145deg, rgba(68, 151, 194, .45), rgba(12, 91, 146, .7));
}
.cell.ship::before {
  opacity: 1;
  inset: 14% 8%;
  background: linear-gradient(135deg, #394b5e, #728294 48%, #26323f);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.34), inset 0 -3px 0 rgba(0,0,0,.2);
}
.cell.ship-horizontal.ship-bow::before { border-radius: 999px 12px 12px 999px; clip-path: polygon(0 50%, 28% 8%, 100% 8%, 100% 92%, 28% 92%); }
.cell.ship-horizontal.ship-stern::before { border-radius: 12px 999px 999px 12px; clip-path: polygon(0 8%, 72% 8%, 100% 50%, 72% 92%, 0 92%); }
.cell.ship-horizontal.ship-middle::before { border-radius: 10px; inset-inline: 0; }
.cell.ship-vertical.ship-bow::before { border-radius: 999px 999px 12px 12px; clip-path: polygon(50% 0, 92% 28%, 92% 100%, 8% 100%, 8% 28%); }
.cell.ship-vertical.ship-stern::before { border-radius: 12px 12px 999px 999px; clip-path: polygon(8% 0, 92% 0, 92% 72%, 50% 100%, 8% 72%); }
.cell.ship-vertical.ship-middle::before { border-radius: 10px; inset-block: 0; }
.cell.ship::after {
  content: "";
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: rgba(238, 245, 248, .72);
  box-shadow: 0 0 0 2px rgba(38, 50, 63, .3);
}
.cell.preview { background: rgba(47, 159, 118, 0.36); outline: 2px solid var(--accent); }
.cell.invalid { background: rgba(216, 64, 88, 0.28); outline-color: var(--danger); }
.cell.hit { background: rgba(216, 64, 88, 0.28); }
.cell.miss { background: rgba(96, 121, 145, 0.24); }
.cell.radar { outline: 2px dashed var(--accent-2); }
.cell.hit::after {
  content: "🔥";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(14px, 2vw, 24px);
  animation: fire 0.9s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 8px rgba(255, 86, 20, .85));
}
.cell.destroyed {
  animation: shipExplosion .55s ease both;
}
.cell.destroyed::before {
  background: linear-gradient(135deg, #1c2228, #57534c 45%, #16191d);
  filter: grayscale(.75) brightness(.72);
  transform: rotate(-7deg) scale(.92);
}
.cell.destroyed::after {
  content: "✹";
  color: #ffcf5a;
  font-size: clamp(18px, 2.4vw, 30px);
  animation: ember 1.2s ease-in-out infinite alternate;
}
.cell.miss::after {
  content: "";
  position: absolute;
  inset: 25%;
  border-radius: 50%;
  background: #d8edf7;
  animation: pulse 0.24s ease;
}
.cell.bonus-preview {
  outline: 3px solid rgba(255,255,255,.88);
  transform: translateY(-1px) scale(1.03);
}
.cell.nuke-preview { background: radial-gradient(circle, rgba(255,88,34,.8), rgba(255,191,71,.42), rgba(25,112,172,.5)); animation: dangerPulse .75s ease-in-out infinite alternate; }
.cell.radar-preview { background: radial-gradient(circle, rgba(88,255,196,.65), rgba(35,145,206,.55)); }
.cell.torpedo-preview { background: linear-gradient(135deg, rgba(255,255,255,.68), rgba(49,151,220,.55)); }
.cell.airstrike-preview { background: radial-gradient(circle, rgba(255,239,133,.72), rgba(255,118,72,.46), rgba(25,112,172,.48)); }
.fleet-item.active, .bonus-item.active { outline: 3px solid var(--accent); }
.bonus-item {
  position: relative;
  overflow: hidden;
}
.bonus-item small { display: block; margin-top: 3px; }
.bonus-item:not(:disabled):hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 30px rgba(20, 45, 65, 0.16);
}
.bonus-item.active {
  animation: bonusGlow 1s ease-in-out infinite alternate;
}
.bonus-item b {
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
}
.chat-log, .event-log { max-height: 240px; overflow: auto; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 10px 0 14px; }
.tools { flex-wrap: wrap; }
.tools button { flex: 1 1 120px; }
.toast-host { position: fixed; right: 18px; top: 18px; display: grid; gap: 8px; z-index: 9; }
.toast {
  padding: 13px 15px;
  border-radius: 18px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow);
}
.season-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.particle { position: absolute; top: -28px; animation: fall linear forwards; opacity: 0.68; }

@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(0.82); } to { transform: scale(1); } }
@keyframes pulse { from { transform: scale(0.2); } to { transform: scale(1); } }
@keyframes fall { to { transform: translateY(110vh) rotate(360deg); } }
@keyframes fire { from { transform: scale(.86) rotate(-5deg); } to { transform: scale(1.12) rotate(4deg); } }
@keyframes ember { from { opacity: .62; transform: scale(.85); } to { opacity: 1; transform: scale(1.15); } }
@keyframes shipExplosion {
  0% { filter: brightness(1); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), 0 0 0 rgba(255,106,0,0); }
  45% { filter: brightness(1.7); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), 0 0 26px rgba(255,106,0,.85); }
  100% { filter: brightness(.84) saturate(.72); }
}
@keyframes dangerPulse { from { filter: brightness(.92); } to { filter: brightness(1.22); } }
@keyframes bonusGlow { from { box-shadow: 0 0 0 rgba(255, 191, 71, 0); } to { box-shadow: 0 0 22px rgba(255, 191, 71, .62); } }
@keyframes eventDot {
  0%, 70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.35); }
}

@media (max-width: 1220px) {
  .game-grid, .boards, .auth-grid, .menu-grid, .shop-grid, .settings-grid, .status-panel { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .app { padding: 10px; }
  .topbar, .list-item, .shop-item, .admin-row { align-items: stretch; flex-direction: column; }
  .board { gap: 4px; }
  .cell { border-radius: 9px; }
  .ghost { margin-left: 0; }
}

/* Naval visual pass: stable flames, sea background, richer ships and synchronized battle effects. */
:root {
  --bg: #0d5270;
  --ink: #f2ead8;
  --muted: #b7d6df;
  --panel: rgba(9, 33, 47, 0.84);
  --panel-strong: rgba(15, 55, 72, 0.92);
  --line: rgba(228, 193, 111, 0.26);
  --accent: #0fa6c2;
  --accent-2: #d6ad55;
  --ship: #516474;
  --cell: rgba(32, 138, 178, 0.62);
  --shadow: 0 18px 46px rgba(0, 18, 28, 0.34);
}

body {
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.22), transparent 24rem),
    radial-gradient(circle at 78% 20%, rgba(21, 181, 214, 0.28), transparent 28rem),
    linear-gradient(135deg, rgba(5, 65, 96, 0.92), rgba(8, 91, 124, 0.88)),
    var(--bg);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    repeating-linear-gradient(165deg, rgba(255,255,255,.08) 0 2px, transparent 2px 34px),
    repeating-linear-gradient(25deg, rgba(255,255,255,.05) 0 1px, transparent 1px 28px),
    radial-gradient(circle at 30% 80%, rgba(255,255,255,.18), transparent 18rem);
  mix-blend-mode: soft-light;
}
body.screen-shake .app { animation: screenShake .82s cubic-bezier(.36,.07,.19,.97) both; }

.brand-icon { background: radial-gradient(circle at 35% 30%, #ffe9a6, var(--accent-2) 45%, #7d5724); }
.panel {
  background: var(--panel);
  border-color: var(--line);
  outline: 1px solid rgba(255,255,255,.06);
}
.tab, .primary, .secondary, .icon-btn {
  background: var(--panel-strong);
  border-color: var(--line);
  box-shadow: 0 10px 20px rgba(0, 18, 28, 0.18);
}
.tab.active, .primary {
  color: #fff7df;
  background: linear-gradient(135deg, #0d7892, #0ea7c4 54%, #c9993f);
}
.account-strip { flex-wrap: wrap; }
.account-strip small { color: var(--muted); margin-left: 6px; }
.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  margin-right: 6px;
  border-radius: 999px;
  color: #221704;
  background: linear-gradient(135deg, #fff1b6, #d2a34d);
  border: 1px solid rgba(82, 55, 16, .28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.62);
  font-size: 12px;
  font-weight: 900;
  vertical-align: middle;
}

.board {
  position: relative;
  padding: 12px;
  border-radius: 22px;
  background:
    linear-gradient(rgba(255,255,255,.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.18) 1px, transparent 1px),
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.34), transparent 20%),
    radial-gradient(circle at 70% 70%, rgba(255,255,255,.18), transparent 22%),
    linear-gradient(135deg, rgba(24, 147, 184, .72), rgba(10, 82, 137, .86));
  background-size: calc(10% + .6px) calc(10% + .6px), calc(10% + .6px) calc(10% + .6px), auto, auto, auto;
  box-shadow: inset 0 0 34px rgba(0, 42, 76, .42), 0 16px 34px rgba(0, 18, 28, .22);
}
.cell {
  border-radius: 7px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.33), transparent 20%),
    linear-gradient(145deg, rgba(55, 177, 211, .48), rgba(12, 92, 157, .68));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), inset 0 -8px 16px rgba(0,57,105,.16);
}
.cell.ship {
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.25), transparent 24%),
    linear-gradient(145deg, rgba(51, 150, 185, .38), rgba(10, 74, 126, .7));
}
.cell.ship::before {
  opacity: 1;
  inset: 10% 5%;
  background:
    linear-gradient(90deg, rgba(255,255,255,.16), transparent 22%, rgba(0,0,0,.18) 75%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.16) 0 2px, transparent 2px 9px),
    linear-gradient(135deg, #2b3136, #7c8587 42%, #3e474e 68%, #1f252b);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.28), inset 0 -3px 0 rgba(0,0,0,.28), 0 4px 10px rgba(0,0,0,.2);
}
.cell.ship-horizontal.ship-bow::before { border-radius: 999px 10px 10px 999px; clip-path: polygon(0 50%, 24% 9%, 100% 9%, 100% 91%, 24% 91%); }
.cell.ship-horizontal.ship-stern::before { border-radius: 10px 999px 999px 10px; clip-path: polygon(0 9%, 76% 9%, 100% 50%, 76% 91%, 0 91%); }
.cell.ship-horizontal.ship-middle::before { border-radius: 8px; inset-inline: 0; }
.cell.ship-vertical.ship-bow::before { border-radius: 999px 999px 10px 10px; clip-path: polygon(50% 0, 91% 24%, 91% 100%, 9% 100%, 9% 24%); }
.cell.ship-vertical.ship-stern::before { border-radius: 10px 10px 999px 999px; clip-path: polygon(9% 0, 91% 0, 91% 76%, 50% 100%, 9% 76%); }
.cell.ship-vertical.ship-middle::before { border-radius: 8px; inset-block: 0; }
.cell.ship:not(.hit):not(.destroyed)::after {
  content: "";
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: rgba(225, 237, 236, .76);
  box-shadow: 0 0 0 2px rgba(30, 36, 42, .32), 9px 0 0 rgba(225,237,236,.45), -9px 0 0 rgba(225,237,236,.45);
}
.cell.hit:not(.destroyed)::after {
  content: "";
  position: absolute;
  inset: 16% 24% 8%;
  border-radius: 48% 52% 42% 58%;
  background:
    radial-gradient(circle at 45% 25%, #fff8ae 0 12%, transparent 13%),
    radial-gradient(circle at 52% 48%, #ff9b22 0 24%, transparent 25%),
    radial-gradient(circle at 45% 72%, #df2d16 0 32%, transparent 34%);
  filter: drop-shadow(0 0 8px rgba(255, 86, 20, .88));
  animation: flameFlow 1.45s ease-in-out infinite;
}
.cell.destroyed {
  animation: none;
  filter: saturate(.65) brightness(.82);
}
.cell.destroyed::before {
  background:
    repeating-linear-gradient(100deg, rgba(255,255,255,.08) 0 2px, transparent 2px 8px),
    linear-gradient(135deg, #11161b, #5e594d 44%, #191d21);
  filter: grayscale(.75) brightness(.72);
  transform: rotate(-7deg) scale(.92);
}
.cell.destroyed::after {
  content: "";
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 46% 44%, rgba(255, 178, 60, .8) 0 9%, transparent 10%),
    radial-gradient(circle at 52% 52%, rgba(52, 46, 42, .72) 0 32%, transparent 35%),
    radial-gradient(circle at 45% 65%, rgba(8, 8, 8, .38), transparent 45%);
  filter: blur(.2px);
  animation: none;
}
.cell.miss::after {
  background:
    radial-gradient(circle, #f6fbff 0 24%, rgba(219,244,255,.74) 25% 42%, transparent 45%);
  animation: splashPop .38s ease-out both;
}
.cell.bonus-preview { outline: 3px solid rgba(255,255,255,.92); transform: translateY(-1px) scale(1.03); }
.cell.nuke-preview { background: radial-gradient(circle, rgba(255,88,34,.78), rgba(255,191,71,.42), rgba(25,112,172,.5)); animation: none; }
.cell.radar-preview { background: radial-gradient(circle, rgba(88,255,196,.62), rgba(35,145,206,.55)); }
.cell.torpedo-preview { background: linear-gradient(135deg, rgba(255,255,255,.68), rgba(49,151,220,.55)); }
.cell.airstrike-preview { background: radial-gradient(circle, rgba(255,239,133,.72), rgba(255,118,72,.46), rgba(25,112,172,.48)); }

.fx-cell.fx-nuke { animation: nukeCell 1.1s ease-out both; }
.fx-cell.fx-radar { animation: radarCell .92s ease-out both; }
.fx-cell.fx-torpedo { animation: torpedoCell .7s ease-out both; }
.fx-cell.fx-airstrike { animation: airCell .84s ease-out both; }
.fx-hit { animation: hitKick .45s ease-out both; }
.fx-splash { animation: splashKick .45s ease-out both; }
.fx-sunk { box-shadow: 0 0 24px rgba(255, 116, 24, .8), inset 0 0 0 1px rgba(255,255,255,.22); }
.battle-burst {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 210%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
}
.nuke-burst {
  width: 420%;
  background:
    radial-gradient(circle, rgba(255,255,210,.96) 0 10%, rgba(255,145,38,.88) 11% 28%, rgba(109,71,48,.48) 29% 46%, transparent 52%);
  border-radius: 50%;
  animation: nukeBurst 1.15s ease-out both;
}
.ship-detonation {
  width: 340%;
  background:
    radial-gradient(circle at 50% 45%, #fff9b8 0 8%, #ffb02e 9% 24%, #dd3e16 25% 38%, rgba(39,36,34,.66) 39% 56%, transparent 62%);
  border-radius: 50%;
  animation: shipDetonation 1.25s ease-out both;
}
.radar-scan {
  width: 330%;
  border: 3px solid rgba(98, 255, 205, .86);
  border-radius: 50%;
  box-shadow: 0 0 28px rgba(98,255,205,.55);
  animation: radarSweep 1s ease-out both;
}
.torpedo-wake {
  width: 160%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.85), transparent);
  animation: wake .65s ease-out both;
}
.air-burst {
  width: 240%;
  background: radial-gradient(circle, rgba(255,245,157,.95) 0 9%, rgba(255,124,50,.7) 10% 32%, transparent 42%);
  border-radius: 50%;
  animation: airBurst .8s ease-out both;
}

@keyframes flameFlow {
  0%, 100% { transform: translateY(0) rotate(-2deg) scale(1); filter: drop-shadow(0 0 8px rgba(255, 86, 20, .86)); }
  50% { transform: translateY(-2px) rotate(3deg) scale(1.08); filter: drop-shadow(0 0 11px rgba(255, 126, 34, .92)); }
}
@keyframes splashPop { from { transform: scale(.25); } to { transform: scale(1); } }
@keyframes screenShake {
  10%, 90% { transform: translate3d(-1px, 2px, 0); }
  20%, 80% { transform: translate3d(3px, -2px, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 3px, 0); }
  40%, 60% { transform: translate3d(6px, -4px, 0); }
}
@keyframes nukeCell { 0% { filter: brightness(1); } 35% { filter: brightness(2.25) saturate(1.6); } 100% { filter: brightness(1); } }
@keyframes radarCell { from { box-shadow: 0 0 0 rgba(98,255,205,0); } to { box-shadow: 0 0 18px rgba(98,255,205,.58); } }
@keyframes torpedoCell { from { transform: scale(.92); } to { transform: scale(1); } }
@keyframes airCell { 0% { filter: brightness(1); } 45% { filter: brightness(1.7); } 100% { filter: brightness(1); } }
@keyframes hitKick { 0% { transform: scale(.96); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes splashKick { 0% { filter: brightness(1); } 50% { filter: brightness(1.45); } 100% { filter: brightness(1); } }
@keyframes nukeBurst { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.18); } 32% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.25); } }
@keyframes shipDetonation { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(0deg); } 24% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.18) rotate(18deg); } }
@keyframes radarSweep { from { opacity: 1; transform: translate(-50%, -50%) scale(.22); } to { opacity: 0; transform: translate(-50%, -50%) scale(1.2); } }
@keyframes wake { from { opacity: .95; transform: translate(-70%, -50%) scaleX(.3); } to { opacity: 0; transform: translate(-50%, -50%) scaleX(1.4); } }
@keyframes airBurst { 0% { opacity: 0; transform: translate(-50%, -60%) scale(.2); } 35% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.08); } }

/* Optimization and no-blink pass. Markers stay readable without endless flashing. */
.cell.hit:not(.destroyed)::after,
.cell.miss::after,
.bonus-item.active,
.cell.nuke-preview,
.cell.radar-preview,
.cell.torpedo-preview,
.cell.airstrike-preview {
  animation: none !important;
}

.particle {
  animation-name: seasonFall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-fill-mode: none;
  will-change: transform;
}
.particle-winter { color: #f4fbff; text-shadow: 0 0 8px rgba(255,255,255,.9); }
.particle-autumn { filter: drop-shadow(0 2px 2px rgba(89,45,16,.35)); }
.particle-spring { color: #ffd3e3; text-shadow: 0 0 8px rgba(255,211,227,.55); }
.particle-summer { color: #ffe49b; text-shadow: 0 0 10px rgba(255,205,76,.76); }

.season-winter .tab::after,
.season-winter .primary::after,
.season-winter .secondary::after,
.season-winter .icon-btn::after {
  content: " ❄";
  color: #e9fbff;
}
.season-autumn .tab::after,
.season-autumn .primary::after,
.season-autumn .secondary::after,
.season-autumn .icon-btn::after {
  content: " 🍂";
}
.season-spring .tab::after,
.season-spring .primary::after,
.season-spring .secondary::after,
.season-spring .icon-btn::after {
  content: " ✿";
}
.season-summer .tab::after,
.season-summer .primary::after,
.season-summer .secondary::after,
.season-summer .icon-btn::after {
  content: " ☀";
}
.season-winter .board { box-shadow: inset 0 0 34px rgba(199, 238, 255, .34), 0 16px 34px rgba(0, 18, 28, .22), 0 0 0 3px rgba(240,250,255,.24); }
.season-autumn .board { box-shadow: inset 0 0 34px rgba(181, 93, 26, .24), 0 16px 34px rgba(0, 18, 28, .22), 0 0 0 3px rgba(221,139,66,.18); }
.season-spring .board { box-shadow: inset 0 0 34px rgba(255, 190, 214, .2), 0 16px 34px rgba(0, 18, 28, .22), 0 0 0 3px rgba(255,211,227,.18); }
.season-summer .board { box-shadow: inset 0 0 34px rgba(255, 218, 89, .24), 0 16px 34px rgba(0, 18, 28, .22), 0 0 0 3px rgba(255,217,97,.18); }

.profile-grid {
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(280px, 1fr);
  gap: 16px;
}
.levels-panel { grid-column: 1 / -1; }
.profile-hero {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(14,116,147,.65), rgba(209,160,69,.34));
  border: 1px solid var(--line);
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.profile-stats span,
.achievement,
.level-row {
  padding: 12px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}
.level-progress {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.13);
  border: 1px solid var(--line);
}
.level-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #1fc6df, #e0b355);
}
.achievement-list,
.levels-list { display: grid; gap: 10px; }
.achievement.done,
.level-row.done { outline: 2px solid rgba(214,173,85,.56); }
.level-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
}
.captain-name { font-weight: 900; }
.legendary-name,
.rank-admiral {
  color: #ffe0a3;
  font-family: Georgia, "Times New Roman", serif;
  text-shadow: 0 0 5px #ff6a00, 0 0 14px rgba(255,54,0,.86), 0 0 22px rgba(255,163,26,.72);
}
.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(320px, 1.2fr);
  gap: 16px;
}
.admin-row { cursor: pointer; }
.admin-row.active { outline: 2px solid var(--accent-2); }
.admin-adjust {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.admin-bonuses-panel {
  grid-column: 1 / -1;
}

.admin-bonus-settings,
.admin-inventory-grid {
  display: grid;
  gap: 10px;
}

.admin-bonus-row,
.admin-inventory-row {
  display: grid;
  gap: 10px;
  align-items: end;
  padding: 12px 13px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.admin-bonus-row {
  grid-template-columns: minmax(180px, 1fr) minmax(120px, .34fr) minmax(130px, .34fr);
}

.admin-inventory-row {
  grid-template-columns: minmax(160px, 1fr) minmax(90px, 120px) auto;
}

.admin-bonus-row label {
  display: grid;
  gap: 5px;
  font-weight: 800;
}

.admin-bonus-row span,
.admin-bonus-row small,
.admin-inventory-row small {
  color: var(--muted);
  line-height: 1.35;
}

.admin-bonus-actions {
  display: flex;
  justify-content: flex-end;
}

@keyframes seasonFall {
  from { transform: translate3d(0, -12vh, 0) rotate(0deg); }
  to { transform: translate3d(22px, 112vh, 0) rotate(360deg); }
}

@media (max-width: 900px) {
  .profile-grid,
  .admin-grid,
  .admin-adjust,
  .admin-bonus-row,
  .admin-inventory-row { grid-template-columns: 1fr; }

  .admin-bonus-actions {
    justify-content: stretch;
  }
}

/* Fast one-screen layout and modal flow. */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 19, 29, .62);
  backdrop-filter: blur(10px);
}
.modal-panel {
  width: min(680px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  padding: 22px;
  border-radius: 34px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 26px 80px rgba(0, 10, 18, .42);
}
.modal-wide { width: min(1060px, 100%); }
.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.modal-segmented { margin-top: 12px; }
.danger-button {
  min-height: 48px;
  padding: 13px 18px;
  color: #fff7f2;
  background: linear-gradient(135deg, #b82939, #e57b45);
  border: 2px solid rgba(255,255,255,.12);
  box-shadow: 0 10px 20px rgba(80, 16, 18, .2);
}
.games-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .72fr);
  gap: 16px;
}
.no-room-panel {
  max-width: 760px;
  margin: 42px auto;
  text-align: center;
}
.tournament-card small { display: block; margin-top: 4px; }
.compact-bonus .event-item { text-align: center; font-weight: 800; }
.game-active .tabs .tab:not([data-tab="shop"]) { display: none; }
.game-active .tabs { justify-content: flex-end; }
.game-grid:not([data-phase="battle"]) .battle-only,
.game-grid[data-phase="battle"] .placement-only,
.game-grid[data-phase="finished"] .placement-only,
.game-grid[data-phase="abandoned"] .placement-only,
.game-grid[data-phase="finished"] .bonus-utility,
.game-grid[data-phase="abandoned"] .bonus-utility {
  display: none !important;
}

@media (min-width: 1221px) {
  html, body { height: 100%; overflow: hidden; }
  .app {
    height: 100vh;
    max-width: none;
    padding: 12px 16px;
    overflow: hidden;
  }
  .topbar { margin-bottom: 8px; }
  .brand-icon { width: 46px; height: 46px; border-radius: 18px; }
  h1 { font-size: clamp(24px, 2.4vw, 34px); }
  .tabs { margin-bottom: 8px; }
  .tab-page.active {
    height: calc(100vh - 116px);
    overflow: hidden;
  }
  #tab-game.active { height: calc(100vh - 112px); }
  .game-grid {
    height: 100%;
    grid-template-columns: 270px minmax(0, 1fr) 286px;
    gap: 10px;
  }
  .panel { padding: 13px; border-radius: 24px; }
  .side,
  .chat-panel,
  .battle,
  .board-panel {
    min-height: 0;
  }
  .side,
  .chat-panel {
    align-self: stretch;
    overflow: hidden;
  }
  .side {
    display: grid;
    grid-template-rows: auto auto auto auto auto minmax(72px, 1fr) auto auto;
    gap: 7px;
  }
  .game-grid[data-phase="battle"] .side {
    grid-template-rows: auto auto auto minmax(72px, 1fr) auto;
  }
  .game-grid[data-phase="finished"] .side,
  .game-grid[data-phase="abandoned"] .side {
    grid-template-rows: auto auto auto;
  }
  .side h3,
  .side p,
  .chat-panel h3 { margin-bottom: 5px; }
  .hint { font-size: 13px; line-height: 1.28; }
  .tools { gap: 7px; }
  .tools button {
    flex: 1 1 calc(50% - 7px);
    min-height: 40px;
    padding: 9px 10px;
    border-radius: 15px;
  }
  .fleet,
  .bonus-bar,
  .chat-log,
  .event-log,
  .list,
  .shop-list,
  .admin-users {
    overflow: auto;
    min-height: 0;
  }
  .fleet { max-height: none; }
  .fleet-item,
  .bonus-item,
  .event-item,
  .chat-message,
  .list-item,
  .shop-item,
  .admin-row {
    padding: 9px 10px;
    border-radius: 16px;
  }
  .battle {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
  }
  .status-panel {
    grid-template-columns: 1fr 1fr auto;
    min-height: 76px;
  }
  .boards {
    height: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .board-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }
  .board {
    align-self: center;
    width: min(100%, calc((100vh - 250px)));
    max-width: 620px;
    margin: 0 auto;
    gap: 4px;
    padding: 9px;
  }
  .chat-panel {
    display: grid;
    grid-template-rows: auto minmax(70px, 1fr) auto auto minmax(84px, 1fr);
    gap: 8px;
  }
  .chat-log,
  .event-log { max-height: none; }
  .chat-form { margin: 0; }
}

@media (max-width: 1220px) {
  .games-grid,
  .modal-actions { grid-template-columns: 1fr; }
}

/* Readability and performance correction: allow scrolling instead of clipping. */
html,
body {
  height: auto !important;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto !important;
}

.app {
  height: auto !important;
  min-height: 100vh;
  overflow: visible !important;
  padding-bottom: 28px;
}

.tab-page.active,
#tab-game.active {
  height: auto !important;
  min-height: calc(100vh - 132px);
  overflow: visible !important;
}

.panel,
.modal-panel,
.modal-backdrop {
  backdrop-filter: none;
}

.tab,
.primary,
.secondary,
.icon-btn,
.danger-button {
  position: relative;
  min-width: 0;
  white-space: normal;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.season-winter .tab::after,
.season-winter .primary::after,
.season-winter .secondary::after,
.season-winter .icon-btn::after,
.season-autumn .tab::after,
.season-autumn .primary::after,
.season-autumn .secondary::after,
.season-autumn .icon-btn::after,
.season-spring .tab::after,
.season-spring .primary::after,
.season-spring .secondary::after,
.season-spring .icon-btn::after,
.season-summer .tab::after,
.season-summer .primary::after,
.season-summer .secondary::after,
.season-summer .icon-btn::after {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 12px;
  line-height: 1;
  opacity: .74;
  pointer-events: none;
}

.season-winter .tab,
.season-winter .primary,
.season-winter .secondary,
.season-winter .icon-btn,
.season-autumn .tab,
.season-autumn .primary,
.season-autumn .secondary,
.season-autumn .icon-btn,
.season-spring .tab,
.season-spring .primary,
.season-spring .secondary,
.season-spring .icon-btn,
.season-summer .tab,
.season-summer .primary,
.season-summer .secondary,
.season-summer .icon-btn {
  padding-right: 30px;
}

.list-item > div,
.shop-item > div,
.admin-row > div,
.fleet-item > span,
.bonus-item > span {
  min-width: 0;
}

.season-layer {
  contain: strict;
}

.particle {
  opacity: .44;
  text-shadow: none !important;
  filter: none !important;
}

body::before {
  opacity: .52;
}

@media (min-width: 1221px) {
  .topbar {
    align-items: flex-start;
    gap: 14px;
  }

  .account-strip {
    max-width: min(720px, 48vw);
    justify-content: flex-end;
  }

  .tabs {
    gap: 10px;
  }

  .game-grid {
    height: auto !important;
    grid-template-columns: minmax(280px, .78fr) minmax(620px, 1.58fr) minmax(300px, .84fr);
    align-items: start;
  }

  .side,
  .chat-panel,
  .battle,
  .board-panel {
    align-self: start;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .side {
    display: block;
  }

  .tools button {
    flex: 1 1 132px;
    min-height: 46px;
    padding: 10px 14px;
    font-size: 15px;
  }

  .fleet,
  .bonus-bar {
    max-height: none;
    overflow: visible;
  }

  .boards {
    height: auto;
    align-items: start;
  }

  .board-panel {
    display: block;
  }

  .board {
    width: min(100%, 520px);
    max-width: 520px;
    gap: 4px;
    padding: 9px;
  }

  .chat-panel {
    display: block;
  }

  .chat-log,
  .event-log {
    max-height: min(30vh, 260px);
    overflow: auto;
  }
}

@media (max-width: 680px) {
  .tab,
  .primary,
  .secondary,
  .icon-btn,
  .danger-button {
    min-height: 44px;
    padding: 10px 14px;
  }
}

/* Ergonomic controls, equal boards, coordinates and lighter naval rendering. */
.segmented,
.bonus-options {
  gap: 12px;
}

.segmented label,
.bonus-options label {
  position: relative;
  min-height: 46px;
  padding: 10px 14px 10px 44px;
  border-radius: 999px;
  background: rgba(15, 35, 51, .72);
  border: 1px solid rgba(182, 219, 232, .22);
  color: var(--ink);
  line-height: 1.2;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.segmented input[type="radio"],
.segmented input[type="checkbox"],
.bonus-options input[type="radio"],
.bonus-options input[type="checkbox"] {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  appearance: none;
  border-radius: 50%;
  outline: none;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,.45), transparent 28%),
    rgba(6, 24, 36, .72);
  border: 2px solid rgba(201, 228, 236, .58);
  box-shadow: inset 0 0 0 4px rgba(6, 24, 36, .78), 0 0 0 1px rgba(255,255,255,.08);
  transform: translateY(-50%);
}

.segmented input[type="radio"]:checked,
.segmented input[type="checkbox"]:checked,
.bonus-options input[type="radio"]:checked,
.bonus-options input[type="checkbox"]:checked {
  background:
    radial-gradient(circle, #fff4bd 0 23%, #13bdd5 25% 48%, rgba(6, 24, 36, .78) 51%);
  border-color: #d9b862;
  box-shadow: 0 0 16px rgba(31, 198, 223, .48), inset 0 0 0 3px rgba(6, 24, 36, .72);
}

.boards {
  align-items: start;
}

.board {
  grid-template-columns: 28px repeat(10, minmax(24px, 1fr)) !important;
  gap: 3px !important;
  padding: 10px !important;
  border-radius: 12px !important;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.16) 1px, transparent 1px),
    radial-gradient(circle at 18% 22%, rgba(103, 216, 235, .48), transparent 20%),
    radial-gradient(circle at 74% 72%, rgba(255,255,255,.16), transparent 22%),
    repeating-linear-gradient(145deg, rgba(255,255,255,.055) 0 8px, transparent 8px 28px),
    linear-gradient(135deg, rgba(16, 116, 162, .95), rgba(5, 63, 111, .98) 58%, rgba(8, 47, 87, .96));
  background-size: calc((100% - 28px) / 10) calc((100% - 28px) / 10), calc((100% - 28px) / 10) calc((100% - 28px) / 10), auto, auto, auto, auto;
  box-shadow: inset 0 0 36px rgba(0, 38, 70, .48), 0 16px 34px rgba(0, 18, 28, .24);
}

.coord {
  display: grid;
  place-items: center;
  min-width: 24px;
  min-height: 24px;
  color: #d9eff7;
  font-size: clamp(11px, 1vw, 14px);
  font-weight: 900;
  text-shadow: 0 1px 4px rgba(0,0,0,.52);
  user-select: none;
}

.coord-corner {
  opacity: .45;
}

.cell {
  border-radius: 5px !important;
  background:
    radial-gradient(circle at 26% 22%, rgba(169, 233, 243, .5), transparent 18%),
    radial-gradient(circle at 78% 82%, rgba(255,255,255,.12), transparent 24%),
    linear-gradient(145deg, rgba(38, 160, 202, .64), rgba(8, 89, 150, .82));
  box-shadow: inset 0 0 0 1px rgba(214,241,248,.2), inset 0 -7px 13px rgba(0,50,92,.18);
  transition: background .08s ease, transform .08s ease, outline-color .08s ease;
}

.cell:hover {
  transform: none;
  filter: brightness(1.08);
}

.cell.ship::before {
  inset: 12% 6%;
  background:
    radial-gradient(circle at 22% 50%, rgba(236,245,246,.82) 0 5%, transparent 6%),
    radial-gradient(circle at 47% 50%, rgba(236,245,246,.7) 0 4%, transparent 5%),
    radial-gradient(circle at 72% 50%, rgba(236,245,246,.58) 0 4%, transparent 5%),
    linear-gradient(180deg, rgba(255,255,255,.24), transparent 38%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.16) 0 2px, transparent 2px 10px),
    linear-gradient(135deg, #1f272f, #75838a 42%, #44515a 64%, #18212a);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.3), inset 0 -4px 0 rgba(0,0,0,.28), 0 5px 10px rgba(0,0,0,.22);
}

.cell.ship-horizontal.ship-bow::before { clip-path: polygon(0 50%, 26% 8%, 100% 8%, 100% 92%, 26% 92%); }
.cell.ship-horizontal.ship-stern::before { clip-path: polygon(0 8%, 74% 8%, 100% 50%, 74% 92%, 0 92%); }
.cell.ship-vertical.ship-bow::before { clip-path: polygon(50% 0, 92% 26%, 92% 100%, 8% 100%, 8% 26%); }
.cell.ship-vertical.ship-stern::before { clip-path: polygon(8% 0, 92% 0, 92% 74%, 50% 100%, 8% 74%); }

.cell.ship:not(.hit):not(.destroyed)::after {
  content: "";
  position: absolute;
  inset: 32% 36%;
  border-radius: 3px;
  background: linear-gradient(135deg, #edf4ed, #8fa1a4);
  box-shadow:
    0 -7px 0 -2px rgba(240,246,244,.72),
    8px 0 0 -2px rgba(225,237,236,.72),
    -8px 0 0 -2px rgba(225,237,236,.72),
    0 5px 0 -2px rgba(22,29,35,.48);
}

.cell.preview {
  background: linear-gradient(145deg, rgba(62, 207, 156, .52), rgba(14, 120, 126, .72)) !important;
  outline: 2px solid #7dffd7;
}

.cell.invalid {
  background: linear-gradient(145deg, rgba(223, 74, 91, .48), rgba(109, 32, 45, .72)) !important;
  outline-color: #ff6b7f;
}

.turn-banner {
  position: fixed;
  left: 50%;
  top: 88px;
  z-index: 30;
  transform: translate(-50%, -16px) scale(.96);
  padding: 14px 28px;
  border-radius: 999px;
  color: #061824;
  font-weight: 1000;
  letter-spacing: .02em;
  background: linear-gradient(135deg, #f9e6a8, #24c4da);
  border: 1px solid rgba(255,255,255,.58);
  box-shadow: 0 18px 44px rgba(0, 18, 28, .34);
  opacity: 0;
  pointer-events: none;
}

.turn-banner.enemy-turn {
  background: linear-gradient(135deg, #f0b35d, #db5e54);
  color: #fff7ef;
}

.turn-banner.show {
  opacity: 1;
  animation: turnBanner 1s ease both;
}

@keyframes turnBanner {
  0% { opacity: 0; transform: translate(-50%, -18px) scale(.94); }
  18%, 78% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(.98); }
}

@media (min-width: 1221px) {
  .board {
    width: min(100%, 560px) !important;
    max-width: 560px !important;
  }
}

/* Tournament bracket and extra performance pass. */
.admin-subtabs {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.admin-subtabs .active {
  color: #fff7df;
  background: linear-gradient(135deg, #0d7892, #0ea7c4 54%, #c9993f);
}

.admin-tournament {
  grid-column: 1 / -1;
}

.tournament-bracket {
  display: grid;
  gap: 16px;
}

.bracket-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px;
  border-radius: 20px;
  background: rgba(15, 55, 72, .82);
  border: 1px solid var(--line);
}

.bracket-summary span {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: var(--muted);
}

.bracket-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(245px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.bracket-round {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 245px;
}

.match-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(8, 30, 44, .74);
  border: 1px solid rgba(214, 173, 85, .24);
}

.match-finished {
  opacity: .86;
}

.match-player {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border-radius: 16px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.08);
}

.match-player span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(13, 166, 194, .28);
  font-weight: 900;
}

.match-player small {
  white-space: nowrap;
}

.match-player.winner {
  outline: 2px solid rgba(214, 173, 85, .72);
  background: linear-gradient(135deg, rgba(15, 166, 194, .24), rgba(214, 173, 85, .18));
}

.match-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.match-actions button {
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13px;
}

.tournament-card {
  flex-wrap: wrap;
}

.board {
  contain: layout paint;
  background:
    linear-gradient(rgba(214,241,248,.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214,241,248,.16) 1px, transparent 1px),
    linear-gradient(135deg, #0d8ab7, #07598d 58%, #063f70) !important;
  box-shadow: inset 0 0 18px rgba(0, 34, 62, .38), 0 10px 22px rgba(0, 18, 28, .18) !important;
}

.cell {
  contain: paint;
  background: linear-gradient(145deg, rgba(42, 157, 197, .72), rgba(7, 91, 151, .84)) !important;
  box-shadow: inset 0 0 0 1px rgba(214,241,248,.16) !important;
  transition: none !important;
}

.cell:hover {
  outline: 2px solid rgba(255,255,255,.34);
  filter: none !important;
}

.cell.ship::before {
  background:
    radial-gradient(circle at 30% 50%, rgba(236,245,246,.72) 0 4%, transparent 5%),
    radial-gradient(circle at 62% 50%, rgba(236,245,246,.58) 0 4%, transparent 5%),
    linear-gradient(135deg, #24303a, #718087 48%, #202b35) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24), inset 0 -3px 0 rgba(0,0,0,.24) !important;
}

.cell.ship:not(.hit):not(.destroyed)::after {
  box-shadow: none !important;
}

.cell.hit:not(.destroyed)::after {
  filter: none !important;
}

body::before {
  opacity: .32 !important;
}

@media (max-width: 720px) {
  .bracket-grid {
    grid-auto-columns: minmax(220px, 86vw);
  }
}

/* Admin safety actions and network hints. */
.server-internet,
.admin-danger {
  display: grid;
  gap: 7px;
  padding: 12px 13px;
  border-radius: 18px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
}

.server-internet small,
.admin-danger small {
  color: var(--muted);
  line-height: 1.35;
}

.admin-danger {
  margin-top: 16px;
  background: linear-gradient(135deg, rgba(184,41,57,.18), rgba(229,123,69,.12));
  border-color: rgba(255, 115, 105, .34);
}

/* Lightweight synchronized battle projectiles. */
.battle-projectile {
  position: fixed;
  z-index: 60;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  pointer-events: none;
  border-radius: 50%;
  color: #fffbe6;
  font-size: 24px;
  font-weight: 1000;
  text-shadow: 0 2px 8px rgba(0,0,0,.45);
  transform: translate(-50%, -50%);
  animation: projectileFlight var(--travel, 620ms) cubic-bezier(.22,.78,.18,1) both;
  will-change: transform, opacity;
}

.battle-projectile::after {
  content: "";
  position: absolute;
  inset: 50% 58% 50% -54px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255,236,154,.74), rgba(255,120,50,.92));
  filter: blur(.3px);
  transform: translateY(-50%);
}

.battle-projectile.from-right::after {
  inset: 50% -54px 50% 58%;
  background: linear-gradient(270deg, transparent, rgba(255,236,154,.74), rgba(255,120,50,.92));
}

.shell-projectile,
.rocket-projectile {
  background: radial-gradient(circle at 35% 30%, #fff6bf, #e77133 48%, #8c2430);
  box-shadow: 0 0 18px rgba(255, 132, 52, .62);
}

.nuclear-projectile {
  background: radial-gradient(circle at 35% 30%, #fffbd0, #d7d938 42%, #273b1c 72%);
  box-shadow: 0 0 26px rgba(213, 226, 56, .78), 0 0 52px rgba(82, 255, 82, .24);
}

.torpedo-projectile {
  background: radial-gradient(circle at 35% 30%, #dff8ff, #2089b3 46%, #0c3550);
  box-shadow: 0 0 22px rgba(109, 222, 255, .58);
}

.airstrike-projectile {
  background: radial-gradient(circle at 35% 30%, #ffffff, #8fb4c5 48%, #2b3f55);
  box-shadow: 0 0 18px rgba(255,255,255,.38);
}

.radar-projectile {
  background: radial-gradient(circle at 35% 30%, #c9ffe7, #1ccaa0 48%, #114b44);
  box-shadow: 0 0 24px rgba(73,255,193,.58);
}

.ship-mega-detonation {
  width: 560%;
  background:
    radial-gradient(circle at 50% 47%, #fffce3 0 7%, #ffd257 8% 18%, #ff6b25 19% 34%, rgba(83,47,34,.78) 35% 54%, transparent 62%),
    conic-gradient(from 20deg, rgba(255,237,136,.88), rgba(255,86,27,.48), rgba(40,36,34,.65), rgba(255,237,136,.78));
  border-radius: 50%;
  filter: drop-shadow(0 0 24px rgba(255,116,24,.84));
  animation: megaDetonation 1.7s ease-out both;
}

.ship-mega-detonation::before,
.ship-mega-detonation::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  border: 2px solid rgba(255, 232, 130, .58);
  animation: shockwave 1.25s ease-out both;
}

.ship-mega-detonation::after {
  inset: 4%;
  animation-delay: .12s;
}

@keyframes projectileFlight {
  0% { opacity: 0; transform: translate3d(0, 0, 0) translate(-50%, -50%) scale(.72) rotate(-18deg); }
  12% { opacity: 1; }
  82% { opacity: 1; transform: translate3d(calc(var(--tx) * .92), calc(var(--ty) * .92), 0) translate(-50%, -50%) scale(1.05) rotate(14deg); }
  100% { opacity: 0; transform: translate3d(var(--tx), var(--ty), 0) translate(-50%, -50%) scale(1.22) rotate(22deg); }
}

@keyframes megaDetonation {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.12) rotate(0deg); }
  18% { opacity: 1; }
  54% { opacity: .94; transform: translate(-50%, -50%) scale(.88) rotate(10deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.45) rotate(24deg); }
}

@keyframes shockwave {
  from { opacity: .86; transform: scale(.35); }
  to { opacity: 0; transform: scale(1.75); }
}

/* Full seasonal interface skins. */
body.season-winter {
  --panel: rgba(13, 36, 55, .86);
  --panel-strong: rgba(230, 247, 255, .14);
  --line: rgba(211, 243, 255, .32);
  --accent: #35b8df;
  --accent-2: #eefbff;
  background:
    radial-gradient(circle at 15% 10%, rgba(214,245,255,.28), transparent 24%),
    linear-gradient(135deg, #071824, #12354e 52%, #dceff7);
}

body.season-winter .panel,
body.season-winter .modal-panel,
body.season-winter .account-strip {
  background: linear-gradient(145deg, rgba(10, 31, 48, .88), rgba(226, 247, 255, .13));
  border-color: rgba(221, 247, 255, .36);
}

body.season-winter .tab,
body.season-winter .primary,
body.season-winter .secondary,
body.season-winter .icon-btn {
  background: linear-gradient(145deg, rgba(235,250,255,.18), rgba(15,64,91,.88));
}

body.season-winter .tab.active,
body.season-winter .primary {
  background: linear-gradient(135deg, #d9f7ff, #31b9dc 58%, #9ed9f0);
  color: #06202d;
}

body.season-winter .board {
  background:
    linear-gradient(rgba(245,252,255,.24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,252,255,.22) 1px, transparent 1px),
    linear-gradient(145deg, #9edbed, #227fac 54%, #0d4f79) !important;
}

body.season-winter .cell {
  background: linear-gradient(145deg, rgba(184,235,247,.78), rgba(28,118,171,.84)) !important;
}

body.season-spring {
  --panel: rgba(19, 48, 42, .84);
  --panel-strong: rgba(237, 255, 239, .14);
  --line: rgba(187, 239, 192, .3);
  --accent: #65d48b;
  --accent-2: #ffd7e6;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,199,221,.22), transparent 25%),
    radial-gradient(circle at 80% 8%, rgba(180,244,187,.2), transparent 26%),
    linear-gradient(135deg, #08241f, #14563f 54%, #d8f7d9);
}

body.season-spring .panel,
body.season-spring .modal-panel,
body.season-spring .account-strip {
  background: linear-gradient(145deg, rgba(11, 42, 35, .88), rgba(255, 218, 234, .11));
  border-color: rgba(195, 242, 201, .34);
}

body.season-spring .tab.active,
body.season-spring .primary {
  background: linear-gradient(135deg, #7ce7a4, #27a76f 58%, #ffd1e2);
  color: #06251b;
}

body.season-spring .board {
  background:
    linear-gradient(rgba(210,255,220,.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(210,255,220,.18) 1px, transparent 1px),
    linear-gradient(145deg, #1ba6a7, #0a6a8f 55%, #104b6f) !important;
}

body.season-summer {
  --panel: rgba(36, 40, 21, .82);
  --panel-strong: rgba(255, 242, 173, .14);
  --line: rgba(255, 217, 118, .32);
  --accent: #1bc2b7;
  --accent-2: #ffd65f;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,222,94,.34), transparent 18%),
    radial-gradient(circle at 78% 20%, rgba(69,218,220,.18), transparent 24%),
    linear-gradient(135deg, #082534, #0b6f8d 52%, #ffe28d);
}

body.season-summer .panel,
body.season-summer .modal-panel,
body.season-summer .account-strip {
  background: linear-gradient(145deg, rgba(8, 43, 57, .86), rgba(255, 220, 89, .13));
  border-color: rgba(255, 221, 100, .36);
}

body.season-summer .tab.active,
body.season-summer .primary {
  background: linear-gradient(135deg, #1fc7d2, #0e8e9c 58%, #ffcf54);
  color: #06212a;
}

body.season-summer .board {
  background:
    linear-gradient(rgba(255,246,180,.17) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,246,180,.15) 1px, transparent 1px),
    linear-gradient(145deg, #25b9d0, #08759f 55%, #06436e) !important;
}

body.season-autumn {
  --panel: rgba(47, 30, 21, .84);
  --panel-strong: rgba(255, 212, 154, .13);
  --line: rgba(229, 145, 72, .34);
  --accent: #d9843c;
  --accent-2: #f7bf54;
  background:
    radial-gradient(circle at 14% 14%, rgba(255,145,65,.26), transparent 22%),
    radial-gradient(circle at 86% 8%, rgba(175,65,42,.16), transparent 25%),
    linear-gradient(135deg, #1d1410, #633a20 54%, #eba35e);
}

body.season-autumn .panel,
body.season-autumn .modal-panel,
body.season-autumn .account-strip {
  background: linear-gradient(145deg, rgba(42, 24, 18, .88), rgba(238, 138, 61, .13));
  border-color: rgba(232, 142, 76, .38);
}

body.season-autumn .tab.active,
body.season-autumn .primary {
  background: linear-gradient(135deg, #e1863b, #9b4826 58%, #f1bc5b);
  color: #fff8e9;
}

body.season-autumn .board {
  background:
    linear-gradient(rgba(255,205,143,.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,205,143,.14) 1px, transparent 1px),
    linear-gradient(145deg, #1f9aae, #0b647f 55%, #50341d) !important;
}

/* Readable rounded selects, animation toggle and polished light/dark seasonal palettes. */
:root {
  --select-bg: #ffffff;
  --select-ink: #142532;
  --select-menu-bg: #ffffff;
  --select-menu-ink: #142532;
}

select {
  min-height: 52px;
  padding: 14px 48px 14px 17px !important;
  border-radius: 999px !important;
  color: var(--select-ink) !important;
  background:
    linear-gradient(135deg, rgba(255,255,255,.34), transparent 42%),
    linear-gradient(45deg, transparent 50%, var(--select-ink) 50%) right 23px center / 8px 8px no-repeat,
    linear-gradient(135deg, var(--select-bg), color-mix(in srgb, var(--select-bg), var(--accent) 10%)) !important;
  border: 1px solid var(--line) !important;
  outline: none !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.26), 0 10px 22px rgba(0,0,0,.08);
  appearance: none;
  color-scheme: light;
}

select:focus {
  border-color: color-mix(in srgb, var(--accent), white 20%) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent), transparent 76%), 0 14px 26px rgba(0,0,0,.12);
}

select option {
  color: var(--select-menu-ink);
  background: var(--select-menu-bg);
}

select option:disabled {
  color: color-mix(in srgb, var(--select-menu-ink), transparent 54%);
}

body.dark select {
  color-scheme: dark;
}

.setting-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 13px 15px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  font-weight: 800;
}

.setting-toggle input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

body:not(.dark).season-winter {
  --ink: #153044;
  --muted: #557286;
  --panel: rgba(249, 253, 255, .91);
  --panel-strong: rgba(255,255,255,.96);
  --line: rgba(118, 178, 205, .3);
  --accent: #33a9d3;
  --accent-2: #b8eaff;
  --select-bg: #f8fdff;
  --select-ink: #143349;
  --select-menu-bg: #f9fdff;
  --select-menu-ink: #143349;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.92), transparent 18rem),
    radial-gradient(circle at 82% 5%, rgba(177,228,247,.38), transparent 20rem),
    linear-gradient(135deg, #f8fdff, #e8f6fc 48%, #cde8f4);
}

body.dark.season-winter {
  --ink: #edfaff;
  --muted: #a9c5d6;
  --panel: rgba(8, 27, 42, .9);
  --panel-strong: rgba(16, 51, 73, .94);
  --line: rgba(180, 229, 250, .28);
  --accent: #61d3ff;
  --accent-2: #dff8ff;
  --select-bg: #14354b;
  --select-ink: #f2fbff;
  --select-menu-bg: #102d41;
  --select-menu-ink: #f2fbff;
  background:
    radial-gradient(circle at 14% 10%, rgba(143,217,255,.23), transparent 21rem),
    radial-gradient(circle at 88% 4%, rgba(255,255,255,.09), transparent 14rem),
    linear-gradient(135deg, #04111d, #0d2b42 55%, #163c55);
}

body:not(.dark).season-spring {
  --ink: #163326;
  --muted: #5a7568;
  --panel: rgba(250, 255, 248, .9);
  --panel-strong: rgba(255,255,255,.95);
  --line: rgba(112, 190, 136, .28);
  --accent: #44b879;
  --accent-2: #ffd0e2;
  --select-bg: #fbfff8;
  --select-ink: #163326;
  --select-menu-bg: #fbfff8;
  --select-menu-ink: #163326;
  background:
    radial-gradient(circle at 12% 14%, rgba(255,196,218,.42), transparent 18rem),
    radial-gradient(circle at 82% 8%, rgba(188,241,194,.48), transparent 19rem),
    linear-gradient(135deg, #fbfff8, #e9f8e9 54%, #ccefd2);
}

body.dark.season-spring {
  --ink: #effff3;
  --muted: #a8ccb7;
  --panel: rgba(9, 35, 29, .9);
  --panel-strong: rgba(18, 64, 49, .92);
  --line: rgba(150, 229, 170, .24);
  --accent: #66dd95;
  --accent-2: #ffb7d2;
  --select-bg: #173b31;
  --select-ink: #effff3;
  --select-menu-bg: #102f28;
  --select-menu-ink: #effff3;
  background:
    radial-gradient(circle at 12% 15%, rgba(255,145,195,.18), transparent 18rem),
    radial-gradient(circle at 84% 10%, rgba(122,234,147,.18), transparent 18rem),
    linear-gradient(135deg, #061814, #113d2e 55%, #174e39);
}

body:not(.dark).season-summer {
  --ink: #17312e;
  --muted: #60766d;
  --panel: rgba(255, 253, 237, .9);
  --panel-strong: rgba(255,255,255,.95);
  --line: rgba(222, 172, 64, .3);
  --accent: #0aaea8;
  --accent-2: #ffc84e;
  --select-bg: #fffdf0;
  --select-ink: #17312e;
  --select-menu-bg: #fffdf0;
  --select-menu-ink: #17312e;
  background:
    radial-gradient(circle at 14% 12%, rgba(255,215,88,.5), transparent 15rem),
    radial-gradient(circle at 82% 12%, rgba(77,215,226,.34), transparent 19rem),
    linear-gradient(135deg, #fffbed, #e9fbf7 48%, #ffe6a1);
}

body.dark.season-summer {
  --ink: #f7fff7;
  --muted: #bed1cc;
  --panel: rgba(9, 39, 49, .9);
  --panel-strong: rgba(17, 72, 82, .93);
  --line: rgba(255, 209, 89, .26);
  --accent: #28d2d0;
  --accent-2: #ffd35c;
  --select-bg: #143f4a;
  --select-ink: #f7fff7;
  --select-menu-bg: #102f39;
  --select-menu-ink: #f7fff7;
  background:
    radial-gradient(circle at 16% 14%, rgba(255,196,55,.22), transparent 17rem),
    radial-gradient(circle at 82% 6%, rgba(45,211,217,.18), transparent 20rem),
    linear-gradient(135deg, #061822, #0d4859 56%, #153a4d);
}

body:not(.dark).season-autumn {
  --ink: #38271b;
  --muted: #7b6657;
  --panel: rgba(255, 248, 238, .91);
  --panel-strong: rgba(255,255,255,.94);
  --line: rgba(206, 122, 61, .32);
  --accent: #c96f34;
  --accent-2: #edb14e;
  --select-bg: #fff8ef;
  --select-ink: #38271b;
  --select-menu-bg: #fff8ef;
  --select-menu-ink: #38271b;
  background:
    radial-gradient(circle at 14% 12%, rgba(255,160,82,.36), transparent 17rem),
    radial-gradient(circle at 84% 8%, rgba(179,79,45,.2), transparent 18rem),
    linear-gradient(135deg, #fff8ef, #f8dfc1 52%, #e7a465);
}

body.dark.season-autumn {
  --ink: #fff4e7;
  --muted: #d1b198;
  --panel: rgba(45, 27, 19, .9);
  --panel-strong: rgba(80, 43, 25, .93);
  --line: rgba(233, 142, 72, .3);
  --accent: #e58b42;
  --accent-2: #ffc55d;
  --select-bg: #4b2a1b;
  --select-ink: #fff4e7;
  --select-menu-bg: #351d14;
  --select-menu-ink: #fff4e7;
  background:
    radial-gradient(circle at 14% 12%, rgba(229,111,55,.23), transparent 18rem),
    radial-gradient(circle at 86% 8%, rgba(255,190,87,.14), transparent 16rem),
    linear-gradient(135deg, #160d0a, #4a2918 56%, #61331d);
}

body:not(.dark).season-winter .panel,
body:not(.dark).season-spring .panel,
body:not(.dark).season-summer .panel,
body:not(.dark).season-autumn .panel,
body:not(.dark).season-winter .modal-panel,
body:not(.dark).season-spring .modal-panel,
body:not(.dark).season-summer .modal-panel,
body:not(.dark).season-autumn .modal-panel,
body:not(.dark).season-winter .account-strip,
body:not(.dark).season-spring .account-strip,
body:not(.dark).season-summer .account-strip,
body:not(.dark).season-autumn .account-strip {
  color: var(--ink);
  background: linear-gradient(145deg, var(--panel), color-mix(in srgb, var(--panel), var(--accent-2) 16%));
}

body:not(.dark) .tab,
body:not(.dark) .secondary,
body:not(.dark) .icon-btn,
body:not(.dark) .list-item,
body:not(.dark) .shop-item,
body:not(.dark) .admin-row,
body:not(.dark) .fleet-item,
body:not(.dark) .bonus-item,
body:not(.dark) .chat-message,
body:not(.dark) .event-item {
  background: var(--panel-strong);
  color: var(--ink);
}

body.dark .tab,
body.dark .secondary,
body.dark .icon-btn,
body.dark .list-item,
body.dark .shop-item,
body.dark .admin-row,
body.dark .fleet-item,
body.dark .bonus-item,
body.dark .chat-message,
body.dark .event-item {
  background: var(--panel-strong);
  color: var(--ink);
}

body:not(.dark).season-winter .primary,
body:not(.dark).season-winter .tab.active { background: linear-gradient(135deg, #ffffff, #8fe1ff 56%, #c7f2ff); color: #10344a; }
body:not(.dark).season-spring .primary,
body:not(.dark).season-spring .tab.active { background: linear-gradient(135deg, #fff7fb, #7be19c 56%, #ffd2e1); color: #153624; }
body:not(.dark).season-summer .primary,
body:not(.dark).season-summer .tab.active { background: linear-gradient(135deg, #fff0a8, #25d2c7 56%, #ffe289); color: #12352f; }
body:not(.dark).season-autumn .primary,
body:not(.dark).season-autumn .tab.active { background: linear-gradient(135deg, #ffd798, #cf7135 56%, #f1b763); color: #3d2112; }

body.dark.season-winter .primary,
body.dark.season-winter .tab.active { background: linear-gradient(135deg, #59cef7, #11698d 58%, #d8f8ff); color: #031825; }
body.dark.season-spring .primary,
body.dark.season-spring .tab.active { background: linear-gradient(135deg, #73e99a, #157a52 58%, #ffadd0); color: #041b12; }
body.dark.season-summer .primary,
body.dark.season-summer .tab.active { background: linear-gradient(135deg, #35d7d4, #0b7d8e 58%, #ffd05a); color: #031c22; }
body.dark.season-autumn .primary,
body.dark.season-autumn .tab.active { background: linear-gradient(135deg, #f09b4d, #863b20 58%, #ffc05a); color: #fff6ea; }

/* Static battle marks that remain on the field after impacts. */
.cell.battle-stain.shell-stain {
  box-shadow: inset 0 0 0 1px rgba(214,241,248,.18), inset 0 0 18px rgba(32, 22, 18, .44) !important;
}

.cell.battle-stain.nuke-stain {
  background:
    radial-gradient(circle at 50% 48%, rgba(52,38,30,.88) 0 25%, rgba(98,76,47,.52) 26% 47%, rgba(20,96,130,.62) 55%),
    linear-gradient(145deg, rgba(35, 117, 144, .64), rgba(8, 64, 101, .86)) !important;
  box-shadow: inset 0 0 20px rgba(22,14,10,.78), 0 0 0 1px rgba(255,211,95,.18) !important;
}

.cell.battle-stain.air-stain {
  background:
    radial-gradient(circle at 50% 50%, rgba(88,47,26,.72) 0 19%, rgba(255,173,75,.22) 20% 38%, transparent 46%),
    linear-gradient(145deg, rgba(42,157,197,.72), rgba(7,91,151,.84)) !important;
}

.cell.battle-stain.torpedo-stain {
  background:
    linear-gradient(90deg, rgba(226,247,255,.45), rgba(15,89,126,.78), rgba(226,247,255,.22)),
    linear-gradient(145deg, rgba(42,157,197,.72), rgba(7,91,151,.84)) !important;
  box-shadow: inset 0 0 18px rgba(217,250,255,.24) !important;
}

.cell.battle-stain.radar-stain {
  outline: 2px solid rgba(104, 255, 207, .58);
  box-shadow: inset 0 0 18px rgba(89, 255, 199, .3), 0 0 14px rgba(89, 255, 199, .18) !important;
}

.cell.battle-stain.wreck-stain {
  background:
    radial-gradient(circle at 45% 44%, rgba(255,102,37,.34) 0 18%, rgba(31,24,21,.82) 19% 44%, transparent 56%),
    linear-gradient(145deg, rgba(36,45,52,.86), rgba(16,22,28,.92)) !important;
  box-shadow: inset 0 0 22px rgba(0,0,0,.72), 0 0 18px rgba(255,84,26,.24) !important;
}

/* More physical, slower battle animation shapes. */
.battle-projectile {
  --dir: 1;
  background: none !important;
  border-radius: 0;
  color: #14170f;
  overflow: visible;
  animation: projectileFlight var(--travel, 900ms) cubic-bezier(.18,.76,.18,1) both;
}

.battle-projectile.from-right {
  --dir: -1;
}

.rocket-projectile,
.shell-projectile {
  width: 74px;
  height: 18px;
  border-radius: 999px 28px 28px 999px;
  background:
    linear-gradient(90deg, #4b5159 0 18%, #d9dee2 19% 58%, #59636c 59% 78%, #be3f2d 79%) !important;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.42), inset 0 -3px 0 rgba(0,0,0,.25), 0 0 18px rgba(255,117,47,.38);
}

.rocket-projectile::before,
.shell-projectile::before {
  content: "";
  position: absolute;
  right: -10px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%) rotate(45deg);
  background: #be3f2d;
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}

.rocket-projectile::after,
.shell-projectile::after {
  inset: 50% auto auto -74px;
  width: 74px;
  height: 13px;
  background: radial-gradient(circle at 92% 50%, #fff4a8 0 12%, #ff9a31 13% 38%, rgba(255,66,25,.35) 39% 64%, transparent 68%);
  filter: blur(.8px);
  transform: translateY(-50%);
}

.nuclear-projectile {
  width: 84px;
  height: 26px;
  border-radius: 60% 28% 28% 60%;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: #1b240c;
  background:
    radial-gradient(circle at 35% 42%, rgba(255,255,210,.9) 0 9%, transparent 10%),
    linear-gradient(90deg, #273119 0 18%, #c8c468 19% 62%, #65712c 63% 84%, #31351b 85%) !important;
  border: 1px solid rgba(255,255,210,.52);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.28), inset 0 -5px 0 rgba(0,0,0,.25), 0 0 24px rgba(210,224,72,.46);
}

.nuclear-projectile::before {
  content: "";
  position: absolute;
  right: -11px;
  top: 50%;
  width: 18px;
  height: 24px;
  transform: translateY(-50%);
  background: #273119;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.nuclear-projectile::after {
  inset: 50% auto auto -64px;
  width: 64px;
  height: 12px;
  background: linear-gradient(90deg, transparent, rgba(231,246,97,.32), rgba(255,239,139,.72));
  transform: translateY(-50%);
  filter: blur(1px);
}

.torpedo-projectile {
  width: 86px;
  height: 20px;
  border-radius: 999px 46px 46px 999px;
  background:
    linear-gradient(90deg, #19232a 0 16%, #778997 17% 60%, #2e414f 61% 84%, #151c22 85%) !important;
  box-shadow: inset 0 2px 0 rgba(236,250,255,.25), inset 0 -4px 0 rgba(0,0,0,.28), 0 0 18px rgba(166,235,255,.28);
}

.torpedo-projectile::before {
  content: "";
  position: absolute;
  right: -10px;
  top: 50%;
  width: 18px;
  height: 20px;
  transform: translateY(-50%);
  background: #151c22;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.torpedo-projectile::after {
  inset: 50% auto auto -86px;
  width: 78px;
  height: 22px;
  background:
    radial-gradient(circle at 12% 48%, rgba(235,253,255,.72) 0 8%, transparent 10%),
    radial-gradient(circle at 38% 60%, rgba(235,253,255,.5) 0 6%, transparent 8%),
    linear-gradient(90deg, transparent, rgba(211,247,255,.28));
  transform: translateY(-50%);
  filter: blur(.6px);
}

.aircraft-projectile {
  width: 96px;
  height: 46px;
  background:
    linear-gradient(90deg, #17222b, #c8d4dd 40%, #475663 70%, #18232c) !important;
  clip-path: polygon(0 44%, 34% 34%, 46% 0, 58% 34%, 100% 42%, 60% 56%, 50% 100%, 39% 56%);
  box-shadow: 0 12px 18px rgba(0,0,0,.22);
}

.aircraft-projectile::before,
.aircraft-projectile::after {
  content: none;
}

.bomb-projectile {
  width: 22px;
  height: 42px;
  border-radius: 48% 48% 58% 58%;
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,.35), transparent 15%),
    linear-gradient(180deg, #2d363f, #77838c 44%, #232a31 78%) !important;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.22), inset 0 -5px 0 rgba(0,0,0,.3), 0 0 14px rgba(0,0,0,.25);
}

.bomb-projectile::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -9px;
  width: 18px;
  height: 14px;
  transform: translateX(-50%);
  background: #242b32;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}

.bomb-projectile::after {
  content: "";
  position: absolute;
  inset: auto auto -18px 50%;
  width: 6px;
  height: 18px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255,210,82,.74), transparent);
}

.radar-projectile {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(228,255,245,.95) 0 17%, rgba(69,255,198,.78) 18% 42%, rgba(21,86,76,.88) 43% 100%) !important;
  box-shadow: 0 0 20px rgba(89,255,199,.52);
}

.radar-projectile::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(96,255,202,.45);
}

.radar-projectile::after {
  content: "";
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  border: 1px solid rgba(96,255,202,.25);
  background: conic-gradient(from 0deg, rgba(96,255,202,.34), transparent 36%);
}

.nuke-burst {
  width: 560%;
  background:
    radial-gradient(circle at 50% 45%, rgba(255,255,235,1) 0 7%, rgba(255,212,82,.96) 8% 17%, rgba(255,88,24,.82) 18% 34%, rgba(74,55,42,.72) 35% 52%, transparent 62%),
    radial-gradient(circle at 50% 78%, rgba(76,55,36,.42) 0 22%, transparent 42%);
  animation: nukeBurst 1.95s ease-out both;
}

.radar-scan {
  animation: radarSweep 1.65s ease-out both;
}

.torpedo-wake {
  width: 240%;
  background:
    radial-gradient(circle at 18% 50%, rgba(238,253,255,.65) 0 10%, transparent 13%),
    linear-gradient(90deg, transparent, rgba(222,250,255,.82), transparent);
  animation: wake .95s ease-out both;
}

.air-burst {
  width: 320%;
  background:
    radial-gradient(circle, rgba(255,248,184,.98) 0 8%, rgba(255,142,46,.78) 9% 28%, rgba(73,45,34,.5) 29% 46%, transparent 58%);
  animation: airBurst 1.05s ease-out both;
}

@keyframes projectileFlight {
  0% { opacity: 0; transform: translate3d(0, 0, 0) translate(-50%, -50%) scale(.72) scaleX(var(--dir)) rotate(-5deg); }
  9% { opacity: 1; }
  72% { opacity: 1; transform: translate3d(calc(var(--tx) * .82), calc(var(--ty) * .84), 0) translate(-50%, -50%) scale(1) scaleX(var(--dir)) rotate(3deg); }
  100% { opacity: 0; transform: translate3d(var(--tx), var(--ty), 0) translate(-50%, -50%) scale(.98) scaleX(var(--dir)) rotate(7deg); }
}

/* Wishes, tactical summary and phone-first playability. */
textarea {
  width: 100%;
  min-height: 116px;
  padding: 14px 16px;
  resize: vertical;
  color: var(--ink);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  outline: none;
  font: inherit;
}

textarea:focus {
  border-color: color-mix(in srgb, var(--accent), white 20%);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent), transparent 78%);
}

.wish-modal-panel {
  width: min(560px, 100%);
  padding: 24px;
  border-radius: 34px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.18), transparent 34%),
    var(--panel);
}

.wish-modal-panel .panel-head {
  align-items: flex-start;
  margin-bottom: 14px;
}

.wish-modal-panel h2 {
  margin-bottom: 0;
}

.modal-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.wish-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 28px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}

.wish-editor .hint {
  margin-bottom: 0;
}

.wish-editor textarea {
  min-height: 144px;
  border-radius: 24px;
  background: color-mix(in srgb, var(--panel-strong), var(--accent) 5%);
}

.wish-modal-panel .modal-actions button {
  min-height: 54px;
  border-radius: 22px;
}

.battle-intel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.intel-card,
.wish-empty,
.wish-card {
  min-width: 0;
  padding: 11px 12px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.intel-card {
  display: grid;
  gap: 3px;
}

.intel-card b,
.wish-card b {
  overflow-wrap: anywhere;
}

.intel-card small,
.intel-card span {
  color: var(--muted);
}

.wishes-panel {
  grid-column: 1 / -1;
}

.wishes-list,
.wish-section {
  display: grid;
  gap: 10px;
}

.wish-section + .wish-section {
  margin-top: 12px;
}

.wish-section h3 {
  margin: 2px 0 0;
}

.wish-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.wish-card p {
  margin: 6px 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.wish-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.wish-actions button {
  min-height: 42px;
  padding: 10px 13px;
  border-radius: 14px;
}

.wish-marker {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  font-weight: 800;
}

.wish-completed,
.wish-exchanged {
  opacity: .78;
}

html,
body,
.app {
  width: 100%;
  max-width: 100%;
}

.topbar,
.panel,
.board-panel,
.battle,
.side,
.chat-panel,
.boards,
.game-grid {
  min-width: 0;
}

@media (max-width: 780px) {
  html,
  body {
    overflow-x: hidden !important;
  }

  body {
    min-width: 0;
  }

  .app {
    padding: 8px;
    overflow-x: clip !important;
  }

  .topbar {
    align-items: stretch;
    gap: 8px;
    flex-direction: column;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 14px;
    font-size: 21px;
  }

  h1 {
    font-size: 24px;
    line-height: 1.05;
  }

  h2 {
    font-size: 20px;
  }

  h3 {
    font-size: 16px;
  }

  .account-strip {
    border-radius: 16px;
    justify-content: flex-start;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .tab,
  .primary,
  .secondary,
  .icon-btn,
  .danger-button {
    min-height: 46px;
    padding: 11px 12px;
    border-radius: 14px;
    font-size: 14px;
    touch-action: manipulation;
  }

  .ghost {
    margin-left: 0;
  }

  .panel,
  .modal-panel {
    padding: 11px;
    border-radius: 16px;
  }

  .modal-backdrop {
    padding: 8px;
    align-items: end;
  }

  .modal-panel {
    width: 100%;
    max-height: 92vh;
  }

  input,
  select,
  textarea {
    min-height: 46px;
    font-size: 16px;
    border-radius: 14px !important;
  }

  .wish-modal-panel {
    padding: 14px;
    border-radius: 28px;
  }

  .wish-editor {
    border-radius: 24px;
  }

  .wish-editor textarea {
    min-height: 132px;
    border-radius: 20px !important;
  }

  .auth-grid,
  .menu-grid,
  .games-grid,
  .shop-grid,
  .settings-grid,
  .profile-grid,
  .admin-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .join-row,
  .list-item,
  .shop-item,
  .admin-row,
  .wish-card {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .game-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .battle {
    order: 1;
  }

  .side {
    order: 2;
  }

  .chat-panel {
    order: 3;
  }

  .status-panel {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .status-panel > div:nth-child(2) {
    text-align: right;
  }

  #rematch {
    grid-column: 1 / -1;
  }

  .battle-intel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .intel-wide {
    grid-column: 1 / -1;
  }

  .boards {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .board-panel {
    padding: 4px;
    overflow: hidden;
  }

  .board-panel:nth-child(2) {
    order: -1;
  }

  .board {
    width: 100% !important;
    max-width: calc(100vw - 16px) !important;
    grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
    gap: 2px !important;
    padding: 5px !important;
    border-radius: 10px !important;
  }

  .coord {
    display: none;
  }

  .cell {
    min-width: 0;
    border-radius: 4px !important;
    touch-action: manipulation;
  }

  .tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .tools button {
    width: 100%;
    min-height: 46px;
  }

  #leave-room {
    grid-column: 1 / -1;
  }

  .fleet,
  .inventory-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fleet-item,
  .bonus-item {
    min-height: 48px;
  }

  .bonus-options,
  .segmented {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .chat-form {
    grid-template-columns: minmax(0, 1fr) 50px;
  }

  .chat-log,
  .event-log {
    max-height: 220px;
  }

  .wish-actions {
    justify-content: stretch;
  }

  .wish-actions button,
  .wish-marker {
    width: 100%;
    justify-content: center;
  }

  .level-row,
  .match-player {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .level-row small,
  .match-player small {
    grid-column: 2;
    white-space: normal;
  }
}

@media (max-width: 390px) {
  .app {
    padding: 6px;
  }

  .board {
    max-width: calc(100vw - 12px) !important;
    grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
    gap: 1px !important;
    padding: 4px !important;
  }

  .coord {
    font-size: 10px;
  }

  .battle-intel,
  .profile-stats,
  .tools,
  .fleet,
  .inventory-list {
    grid-template-columns: 1fr;
  }
}
