@import url("https://fonts.googleapis.com/css2?family=Exo+2:wght@400;500;600;700&family=Oxanium:wght@500;600;700;800&display=swap");

* {
  box-sizing: border-box;
}

:root {
  --steel-950: #030913;
  --steel-900: #07101d;
  --steel-840: #0d1b2f;
  --steel-800: #12263f;
  --steel-760: #173253;
  --steel-700: #204168;
  --line-soft: rgba(145, 186, 224, 0.22);
  --line-strong: rgba(123, 203, 255, 0.42);
  --cyan-400: #55c9ff;
  --cyan-300: #89dbff;
  --cyan-200: #b4ebff;
  --mint-300: #72e8bf;
  --warn-300: #f9c77a;
  --danger-300: #ff6f8f;
  --text-100: #eaf6ff;
  --text-200: #cae3f4;
  --text-300: #9db7cb;
  --shadow-panel: 0 18px 44px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.32);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --cell-size: 34px;
  --coord-size: 40px;
}

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

body {
  margin: 0;
  color: var(--text-100);
  font-family: "Exo 2", "Trebuchet MS", sans-serif;
  letter-spacing: 0.01em;
  background:
    radial-gradient(circle at 12% 8%, rgba(80, 159, 220, 0.18), transparent 24%),
    radial-gradient(circle at 78% 82%, rgba(68, 143, 212, 0.18), transparent 30%),
    linear-gradient(150deg, var(--steel-950), var(--steel-840) 52%, var(--steel-900));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(rgba(113, 166, 211, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(113, 166, 211, 0.045) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at center, black 48%, transparent 100%);
}

.app {
  width: min(1280px, 95vw);
  margin: 18px auto 24px;
  display: grid;
  gap: 14px;
  animation: section-rise 520ms ease-out;
  padding-bottom: 340px;
}

.mission-header,
.command-strip,
.tactical-status,
.board-card,
.chat-panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(170deg, rgba(19, 42, 69, 0.9), rgba(10, 24, 41, 0.92));
  box-shadow: var(--shadow-panel);
}

.mission-header {
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.mission-header::after {
  content: "";
  position: absolute;
  inset: auto -8% -58% auto;
  width: 420px;
  height: 240px;
  background: radial-gradient(circle at center, rgba(85, 201, 255, 0.16), transparent 70%);
  pointer-events: none;
}

.mission-header__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #e6f8ff;
  border: 1px solid rgba(116, 204, 255, 0.7);
  background:
    radial-gradient(circle at 30% 20%, rgba(180, 233, 255, 0.48), transparent 52%),
    linear-gradient(180deg, rgba(20, 60, 95, 0.96), rgba(13, 39, 63, 0.96));
  box-shadow: 0 0 0 1px rgba(63, 152, 209, 0.35), 0 0 24px rgba(79, 193, 255, 0.35);
}

h1 {
  margin: 0;
  font-family: "Oxanium", "Exo 2", sans-serif;
  font-size: clamp(1.9rem, 3.2vw, 2.7rem);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  text-shadow: 0 4px 16px rgba(53, 147, 208, 0.35);
}

.subtitle {
  margin: 8px 0 12px;
  color: var(--text-300);
  font-size: 0.96rem;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(132, 188, 231, 0.38);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(8, 21, 35, 0.64);
  color: var(--text-200);
  white-space: nowrap;
}

.lang-flag {
  border: 1px solid rgba(151, 198, 236, 0.44);
  border-radius: 999px;
  background: rgba(15, 36, 56, 0.9);
  min-width: 36px;
  height: 30px;
  cursor: pointer;
  transition: border-color 160ms ease, transform 140ms ease, background 160ms ease;
}

.lang-flag:hover {
  border-color: var(--cyan-300);
  background: rgba(35, 79, 116, 0.88);
  transform: translateY(-1px);
}

.lang-flag.active {
  border-color: rgba(114, 232, 191, 0.76);
  background: rgba(49, 109, 88, 0.55);
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.chip,
.status-pill,
.queue-timer {
  border-radius: 999px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  font-size: 0.91rem;
}

.chip {
  border: 1px solid transparent;
}

.chip--mode,
#modeBadge {
  background: linear-gradient(180deg, rgba(122, 221, 255, 0.95), rgba(82, 180, 226, 0.95));
  color: #042337;
}

.readiness-badge {
  display: inline-flex;
}

.readiness-badge.readiness-wait {
  background: rgba(249, 199, 122, 0.17);
  border: 1px solid rgba(249, 199, 122, 0.42);
  color: #ffe4bc;
}

.readiness-badge.readiness-ready {
  background: rgba(114, 232, 191, 0.16);
  border: 1px solid rgba(114, 232, 191, 0.48);
  color: #d2ffec;
}

.status-pill,
.queue-timer {
  background: rgba(17, 39, 63, 0.88);
  border: 1px solid rgba(123, 171, 209, 0.32);
  color: var(--text-200);
}

.queue-timer:empty {
  display: none;
}

.queue-timer.urgent {
  border-color: rgba(249, 199, 122, 0.68);
  color: #fff0d2;
  box-shadow: 0 0 0 1px rgba(249, 199, 122, 0.32) inset;
}

.command-strip {
  padding: 12px;
  display: grid;
  gap: 10px;
  position: relative;
}

.command-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(102, 194, 255, 0.06), transparent 40%, rgba(102, 194, 255, 0.04));
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(124, 177, 218, 0.2);
  background: rgba(9, 27, 45, 0.74);
  padding: 10px;
}

.toolbar-group label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-300);
  font-size: 0.93rem;
}

.toolbar-group button,
.toolbar-group input {
  border: 1px solid rgba(150, 199, 234, 0.42);
  color: var(--text-100);
  background: rgba(16, 41, 64, 0.9);
  border-radius: var(--radius-sm);
  min-height: 40px;
  padding: 8px 12px;
  transition:
    border-color 160ms ease,
    transform 140ms ease,
    background-color 160ms ease,
    box-shadow 180ms ease;
}

.toolbar-group input {
  min-width: 170px;
}

.toolbar-group button {
  font-family: "Oxanium", "Exo 2", sans-serif;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.toolbar-group button:hover,
.chat-panel__composer button:hover,
.chat-panel__actions button:hover,
.chat-gif:hover {
  border-color: var(--cyan-300);
  background: rgba(25, 67, 101, 0.95);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(103, 199, 255, 0.2) inset;
}

.toolbar-group button:focus-visible,
.toolbar-group input:focus-visible,
.chat-panel button:focus-visible,
.chat-panel input:focus-visible,
.cell:focus-visible,
.lang-flag:focus-visible,
.chat-launcher:focus-visible {
  outline: 2px solid var(--cyan-300);
  outline-offset: 2px;
}

.toolbar-group button:disabled,
.toolbar-group input:disabled,
.chat-panel button:disabled,
.chat-panel input:disabled {
  opacity: 0.53;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-advanced,
#btnAdvancedToggle {
  margin-left: auto;
  border-color: rgba(133, 198, 245, 0.58);
  background: linear-gradient(180deg, rgba(25, 63, 96, 0.98), rgba(16, 44, 70, 0.98));
}

.command-strip__advanced[hidden] {
  display: none;
}

.command-strip__advanced {
  display: grid;
  gap: 10px;
  animation: panel-unfold 240ms ease-out;
}

.orientation-badge {
  border: 1px solid rgba(125, 200, 255, 0.46);
  border-radius: 999px;
  padding: 7px 12px;
  color: #d8f1ff;
  background: rgba(46, 94, 132, 0.4);
  font-weight: 700;
}

.orientation-badge.orientation-active {
  border-color: rgba(114, 232, 191, 0.52);
  background: rgba(43, 111, 90, 0.44);
  color: #ddfff2;
}

.placement-hint {
  color: #b9d9ef;
  font-size: 0.88rem;
}

.tactical-status {
  padding: 12px 14px;
  display: grid;
  gap: 10px;
}

.tactical-status__objective {
  border-radius: var(--radius-md);
  border: 1px solid rgba(123, 200, 250, 0.28);
  background: linear-gradient(130deg, rgba(26, 63, 96, 0.78), rgba(15, 40, 64, 0.82));
  padding: 11px 12px;
  position: relative;
  overflow: hidden;
}

.tactical-status__objective::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(152, 227, 255, 0.11) 42%, transparent 76%);
  transform: translateX(-110%);
  animation: objective-sweep 3200ms ease-in-out infinite;
  pointer-events: none;
}

.tactical-status__label {
  margin: 0;
  font-family: "Oxanium", "Exo 2", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.74rem;
  color: var(--text-300);
}

.tactical-status__value {
  margin: 6px 0 0;
  font-size: clamp(1rem, 2vw, 1.18rem);
  font-weight: 600;
  color: #ebf8ff;
}

.tactical-status__meta {
  display: grid;
  gap: 6px;
  color: var(--text-200);
}

#status,
#remainingShips {
  margin: 0;
  min-height: 1.3em;
  font-size: 0.98rem;
}

.board-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.board-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  border: 1px solid rgba(124, 179, 220, 0.3);
  background: rgba(12, 31, 50, 0.82);
  padding: 5px 9px;
  color: var(--text-200);
  font-size: 0.86rem;
}

.board-legend span::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: rgba(127, 170, 204, 0.42);
}

#legendShip::before {
  background: repeating-linear-gradient(
    135deg,
    rgba(129, 176, 214, 0.86) 0,
    rgba(129, 176, 214, 0.86) 2px,
    rgba(64, 97, 130, 0.86) 2px,
    rgba(64, 97, 130, 0.86) 4px
  );
}

#legendHit::before {
  background: var(--danger-300);
  clip-path: polygon(40% 0, 60% 0, 60% 40%, 100% 40%, 100% 60%, 60% 60%, 60% 100%, 40% 100%, 40% 60%, 0 60%, 0 40%, 40% 40%);
}

#legendMiss::before {
  border-radius: 50%;
  background: rgba(200, 228, 247, 0.86);
}

#legendSunk::before {
  background: repeating-linear-gradient(
    90deg,
    rgba(249, 199, 122, 0.9) 0,
    rgba(249, 199, 122, 0.9) 2px,
    rgba(85, 49, 25, 0.9) 2px,
    rgba(85, 49, 25, 0.9) 5px
  );
}

.boards-wrap {
  display: grid;
  gap: 10px;
}

.board-helper {
  margin: 0;
  color: var(--text-300);
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

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

.board-card {
  padding: 13px;
  display: grid;
  justify-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.board-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(109, 193, 248, 0.07), transparent 44%);
}

.board-card h2 {
  margin: 0;
  font-family: "Oxanium", "Exo 2", sans-serif;
  font-size: clamp(1.48rem, 2.5vw, 2rem);
  letter-spacing: 0.03em;
  text-align: center;
}

#myBoard,
#enemyBoard {
  display: grid;
  justify-content: center;
}

.grid-row {
  display: grid;
  grid-template-columns: var(--coord-size) repeat(10, var(--cell-size));
  gap: 3px;
  margin-bottom: 3px;
}

.coord-label {
  width: var(--coord-size);
  min-width: var(--coord-size);
  height: var(--cell-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #bad5e8;
  font-size: 0.76rem;
  border-radius: 6px;
  background: rgba(13, 35, 55, 0.58);
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  border: 1px solid rgba(170, 217, 250, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(15, 40, 63, 0.88), rgba(10, 26, 43, 0.9));
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0;
  position: relative;
  overflow: hidden;
  transition: transform 130ms ease, border-color 160ms ease, background-color 160ms ease, box-shadow 170ms ease;
}

.cell::before,
.cell::after {
  content: "";
  position: absolute;
  opacity: 0;
  transition: opacity 150ms ease;
}

.cell--interactive {
  cursor: pointer;
}

.cell--interactive:hover {
  transform: translateY(-1px);
  border-color: rgba(150, 218, 255, 0.66);
  box-shadow: 0 0 0 1px rgba(115, 189, 237, 0.23) inset;
}

.cell--ship {
  background: linear-gradient(150deg, rgba(53, 86, 116, 0.92), rgba(33, 58, 84, 0.92));
}

.cell--ship::before {
  opacity: 1;
  inset: 4px;
  border-radius: 4px;
  background: repeating-linear-gradient(
    135deg,
    rgba(188, 221, 245, 0.52) 0,
    rgba(188, 221, 245, 0.52) 2px,
    rgba(70, 107, 140, 0.7) 2px,
    rgba(70, 107, 140, 0.7) 4px
  );
}

.cell--miss::before {
  opacity: 1;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(221, 239, 252, 0.95);
}

.cell--hit {
  border-color: rgba(255, 122, 153, 0.82);
  background: linear-gradient(160deg, rgba(76, 30, 45, 0.9), rgba(47, 19, 31, 0.92));
  animation: hit-pulse 680ms ease-out;
}

.cell--hit::before,
.cell--hit::after {
  opacity: 1;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 138, 163, 0.95);
}

.cell--hit::before {
  transform: rotate(45deg);
}

.cell--hit::after {
  transform: rotate(-45deg);
}

.cell--sunk {
  border-color: rgba(249, 199, 122, 0.95);
  background: linear-gradient(160deg, rgba(71, 42, 20, 0.94), rgba(38, 24, 14, 0.94));
  box-shadow: 0 0 0 1px rgba(249, 199, 122, 0.38) inset;
  animation: sunk-flash 820ms ease-out;
}

.cell--sunk::before,
.cell--sunk::after {
  opacity: 1;
  inset: 5px;
  border-radius: 2px;
}

.cell--sunk::before {
  background: repeating-linear-gradient(
    90deg,
    rgba(249, 199, 122, 0.9) 0,
    rgba(249, 199, 122, 0.9) 2px,
    rgba(89, 54, 28, 0.9) 2px,
    rgba(89, 54, 28, 0.9) 5px
  );
}

.cell--sunk::after {
  inset: 3px;
  border: 1px solid rgba(255, 212, 153, 0.5);
}

.cell--preview-valid {
  border-color: rgba(114, 232, 191, 0.88);
  background: linear-gradient(160deg, rgba(29, 77, 62, 0.84), rgba(16, 50, 40, 0.88));
}

.cell--preview-valid::before {
  opacity: 1;
  inset: 5px;
  border: 1px dashed rgba(146, 255, 220, 0.84);
  border-radius: 4px;
}

.cell--preview-invalid {
  border-color: rgba(255, 111, 143, 0.9);
  background: linear-gradient(160deg, rgba(84, 32, 49, 0.84), rgba(51, 19, 29, 0.9));
}

.cell--preview-invalid::before {
  opacity: 1;
  inset: 5px;
  border-radius: 4px;
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 133, 161, 0.74) 0,
    rgba(255, 133, 161, 0.74) 2px,
    rgba(61, 22, 35, 0.74) 2px,
    rgba(61, 22, 35, 0.74) 4px
  );
}

.cell--empty {
  color: transparent;
}

.chat-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(8, 28, 47, 0.97), rgba(8, 23, 40, 0.96));
  border: 1px solid rgba(128, 190, 235, 0.34);
  box-shadow:
    0 16px 46px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(119, 190, 240, 0.1) inset;
}

.chat-panel--disabled {
  opacity: 0.8;
}

.chat-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-panel__title {
  margin: 0;
  font-family: "Oxanium", "Exo 2", sans-serif;
  font-size: 1.1rem;
}

.chat-panel__unread {
  color: var(--warn-300);
  font-weight: 700;
}

.chat-panel__unread--active {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(249, 199, 122, 0.5);
  background: rgba(249, 199, 122, 0.2);
  animation: chat-unread-pulse 900ms ease-in-out infinite;
}

.chat-panel__hint {
  margin: 0;
  color: var(--text-300);
  font-size: 0.84rem;
}

.chat-list {
  max-height: 220px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(140, 208, 255, 0.22);
  background: rgba(5, 18, 31, 0.72);
}

.chat-message {
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  border: 1px solid rgba(165, 208, 242, 0.22);
  background: rgba(255, 255, 255, 0.03);
  animation: chat-message-in 170ms ease-out;
}

.chat-message--you {
  border-color: rgba(114, 232, 191, 0.45);
  background: rgba(114, 232, 191, 0.11);
}

.chat-message--opponent {
  border-color: rgba(85, 201, 255, 0.4);
  background: rgba(85, 201, 255, 0.09);
}

.chat-message--system {
  border-color: rgba(249, 199, 122, 0.45);
  background: rgba(249, 199, 122, 0.09);
}

.chat-message__head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-300);
  margin-bottom: 4px;
}

.chat-message__author {
  font-weight: 700;
}

.chat-message__body {
  color: var(--text-100);
  font-size: 0.95rem;
  word-break: break-word;
}

.chat-message__gif {
  width: 120px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(170, 218, 250, 0.28);
}

.chat-message__gif-label {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--text-300);
}

.chat-panel__composer {
  display: flex;
  gap: 8px;
}

.chat-panel__shortcut {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-300);
  text-align: right;
}

.chat-panel__composer input,
.chat-panel__composer button,
.chat-panel__actions button,
.chat-gif {
  border: 1px solid rgba(156, 209, 245, 0.44);
  background: rgba(14, 36, 58, 0.95);
  border-radius: var(--radius-sm);
  color: var(--text-100);
  min-height: 34px;
  padding: 6px 10px;
  transition: border-color 160ms ease, transform 130ms ease, background 160ms ease;
}

.chat-panel__composer input {
  flex: 1;
  min-height: 38px;
}

.chat-panel__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.chat-panel__emoji {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-panel__emoji button {
  min-width: 36px;
  padding: 5px 7px;
}

.chat-panel__actions .chat-panel__toggle--active {
  border-color: rgba(249, 199, 122, 0.72);
  background: rgba(249, 199, 122, 0.2);
  color: #ffe9ce;
}

.chat-gif-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 170px;
  overflow-y: auto;
}

.chat-list,
.chat-gif-bar {
  scrollbar-width: thin;
  scrollbar-color: rgba(117, 194, 247, 0.78) rgba(9, 31, 57, 0.75);
}

.chat-list::-webkit-scrollbar,
.chat-gif-bar::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.chat-list::-webkit-scrollbar-track,
.chat-gif-bar::-webkit-scrollbar-track {
  background: rgba(9, 31, 57, 0.75);
  border-radius: 999px;
}

.chat-list::-webkit-scrollbar-thumb,
.chat-gif-bar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(126, 206, 255, 0.92), rgba(74, 143, 214, 0.92));
  border-radius: 999px;
  border: 2px solid rgba(9, 31, 57, 0.92);
}

.chat-gif {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 128px;
  animation: chat-gif-pulse 260ms ease-out;
}

.chat-gif img {
  width: 100%;
  max-width: 120px;
  height: 68px;
  border-radius: 7px;
  object-fit: cover;
}

.chat-gif--broken img {
  opacity: 0.22;
  filter: grayscale(1);
}

.chat-gif__label {
  font-size: 0.72rem;
  color: var(--text-300);
}

.chat-panel.chat-panel--floating {
  position: fixed;
  right: 18px;
  bottom: 82px;
  width: min(460px, calc(100vw - 24px));
  max-height: min(66vh, 560px);
  z-index: 60;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(9px);
}

.chat-panel.chat-panel--floating.chat-panel--collapsed {
  display: none;
}

.chat-panel.chat-panel--floating .chat-list {
  min-height: 130px;
  max-height: 240px;
}

.chat-launcher {
  position: fixed;
  z-index: 62;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(131, 198, 245, 0.55);
  background: linear-gradient(180deg, rgba(10, 44, 79, 0.96), rgba(8, 31, 58, 0.96));
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(99, 212, 255, 0.22) inset;
  color: #eaf8ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.chat-launcher:active,
.chat-launcher.chat-launcher--dragging {
  cursor: grabbing;
}

.chat-launcher__icon {
  font-size: 22px;
  line-height: 1;
}

.chat-launcher__unread {
  position: absolute;
  top: -5px;
  right: -3px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 217, 173, 0.7);
  background: rgba(255, 132, 101, 0.94);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.chat-launcher__unread.chat-launcher__unread--active {
  display: inline-flex;
}

.chat-corner-bottom-right {
  right: 18px;
  bottom: 18px;
  left: auto;
  top: auto;
}

.chat-corner-bottom-left {
  left: 18px;
  bottom: 18px;
  right: auto;
  top: auto;
}

.chat-corner-top-right {
  right: 18px;
  top: 18px;
  left: auto;
  bottom: auto;
}

.chat-corner-top-left {
  left: 18px;
  top: 18px;
  right: auto;
  bottom: auto;
}

.chat-panel.chat-panel--floating.chat-corner-bottom-right {
  right: 18px;
  bottom: 82px;
  left: auto;
  top: auto;
}

.chat-panel.chat-panel--floating.chat-corner-bottom-left {
  left: 18px;
  bottom: 82px;
  right: auto;
  top: auto;
}

.chat-panel.chat-panel--floating.chat-corner-top-right {
  right: 18px;
  top: 82px;
  left: auto;
  bottom: auto;
}

.chat-panel.chat-panel--floating.chat-corner-top-left {
  left: 18px;
  top: 82px;
  right: auto;
  bottom: auto;
}

.winner-fx {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 240ms ease;
}

.winner-fx.active {
  opacity: 1;
  visibility: visible;
}

.winner-fx__backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(13, 35, 60, 0.52), rgba(2, 8, 14, 0.86));
}

.winner-fx__scene {
  position: absolute;
  inset: 0;
}

.winner-fx__explosion {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0;
  background: radial-gradient(circle, rgba(228, 247, 255, 0.95), rgba(115, 201, 255, 0.62) 50%, rgba(255, 111, 143, 0.2) 85%);
  box-shadow: 0 0 0 0 rgba(103, 199, 255, 0.7);
}

.winner-fx.active .winner-fx__explosion {
  animation: winner-explosion 760ms ease-out 150ms forwards;
}

.winner-fx__center {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%) scale(0.92);
  text-align: center;
  opacity: 0;
  padding: 20px 30px;
  border-radius: 16px;
  border: 1px solid rgba(127, 204, 255, 0.5);
  background: linear-gradient(180deg, rgba(8, 31, 55, 0.94), rgba(11, 45, 74, 0.86));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.48);
}

.winner-fx.active .winner-fx__center {
  animation: winner-card-in 560ms ease-out 250ms forwards;
}

.winner-fx__title {
  font-family: "Oxanium", "Exo 2", sans-serif;
  letter-spacing: 0.15em;
  font-size: 0.84rem;
  color: #9fdcff;
  margin-bottom: 6px;
}

.winner-fx__name {
  font-family: "Oxanium", "Exo 2", sans-serif;
  font-size: clamp(1.56rem, 3.8vw, 2.45rem);
  letter-spacing: 0.05em;
  color: #f6fdff;
  text-shadow: 0 4px 14px rgba(95, 209, 255, 0.45);
}

.winner-fx__confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.winner-fx__confetti-piece {
  position: absolute;
  top: -16px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation-name: confetti-fall;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
}

@keyframes section-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes panel-unfold {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes objective-sweep {
  0%,
  58%,
  100% {
    transform: translateX(-110%);
  }
  72% {
    transform: translateX(110%);
  }
}

@keyframes hit-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 111, 143, 0.44);
  }
  100% {
    box-shadow: 0 0 0 9px rgba(255, 111, 143, 0);
  }
}

@keyframes sunk-flash {
  0% {
    filter: brightness(1.28);
  }
  100% {
    filter: brightness(1);
  }
}

@keyframes winner-explosion {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.25);
    box-shadow: 0 0 0 0 rgba(103, 199, 255, 0.72);
  }
  35% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(3.3);
    box-shadow: 0 0 0 26px rgba(103, 199, 255, 0.24);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(4.9);
    box-shadow: 0 0 0 52px rgba(103, 199, 255, 0);
  }
}

@keyframes winner-card-in {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.88);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes confetti-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -10px, 0) rotate(0deg);
  }
  10% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift, 0px), 92vh, 0) rotate(700deg);
  }
}

@keyframes chat-message-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chat-gif-pulse {
  0% {
    transform: scale(0.97);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes chat-unread-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(249, 199, 122, 0.36);
  }
  100% {
    box-shadow: 0 0 0 8px rgba(249, 199, 122, 0);
  }
}

.app[data-mode="online"] .mission-header {
  border-color: rgba(120, 199, 247, 0.34);
}

.app[data-phase="playing"] .command-strip {
  border-color: rgba(112, 213, 255, 0.34);
}

.app[data-phase="over"] .tactical-status__objective {
  border-color: rgba(249, 199, 122, 0.44);
}

@media (max-width: 1080px) {
  .boards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  :root {
    --cell-size: 28px;
    --coord-size: 30px;
  }

  .app {
    width: min(1280px, 96vw);
    gap: 12px;
  }

  .mission-header__top {
    flex-direction: column;
    align-items: flex-start;
  }

  .lang-switch {
    align-self: flex-start;
  }

  .status-line {
    gap: 7px;
  }

  .chip,
  .status-pill,
  .queue-timer {
    font-size: 0.84rem;
    padding: 5px 10px;
  }

  .toolbar-group {
    padding: 8px;
  }

  .toolbar-group input {
    min-width: 140px;
  }

  .board-card {
    padding: 10px;
  }

  .coord-label {
    font-size: 0.7rem;
  }

  .chat-gif img {
    max-width: 96px;
    height: 56px;
  }
}

@media (max-width: 860px) {
  .app {
    padding-bottom: 380px;
  }

  .toolbar-group--primary {
    gap: 7px;
  }

  .toolbar-group--primary button {
    flex: 1 1 calc(50% - 7px);
    min-width: 150px;
  }

  .btn-advanced,
  #btnAdvancedToggle {
    margin-left: 0;
  }

  .toolbar-group--secondary label {
    width: 100%;
    justify-content: space-between;
  }

  .toolbar-group--secondary input {
    flex: 1;
    min-width: 0;
  }

  .chat-panel.chat-panel--floating {
    width: min(420px, calc(100vw - 20px));
    max-height: min(62vh, 520px);
  }

  .chat-launcher.chat-corner-bottom-right {
    right: 10px;
    bottom: 10px;
  }

  .chat-launcher.chat-corner-bottom-left {
    left: 10px;
    bottom: 10px;
  }

  .chat-launcher.chat-corner-top-right {
    right: 10px;
    top: 10px;
  }

  .chat-launcher.chat-corner-top-left {
    left: 10px;
    top: 10px;
  }

  .chat-panel.chat-panel--floating.chat-corner-bottom-right {
    right: 10px;
    bottom: 68px;
    left: auto;
    top: auto;
  }

  .chat-panel.chat-panel--floating.chat-corner-bottom-left {
    left: 10px;
    bottom: 68px;
    right: auto;
    top: auto;
  }

  .chat-panel.chat-panel--floating.chat-corner-top-right {
    right: 10px;
    top: 68px;
    left: auto;
    bottom: auto;
  }

  .chat-panel.chat-panel--floating.chat-corner-top-left {
    left: 10px;
    top: 68px;
    right: auto;
    bottom: auto;
  }
}

@media (max-width: 560px) {
  .toolbar-group--primary button {
    min-width: 0;
    flex-basis: 100%;
  }

  .board-legend span {
    font-size: 0.8rem;
  }

  .status-line {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }

  .app,
  .command-strip__advanced,
  .tactical-status__objective::after,
  .cell--hit,
  .cell--sunk,
  .winner-fx.active .winner-fx__center,
  .winner-fx.active .winner-fx__explosion,
  .winner-fx__confetti-piece,
  .chat-message,
  .chat-gif,
  .chat-panel__unread--active {
    animation: none !important;
  }
}

body.chat-collapsed .app {
  padding-bottom: 110px;
}
