:root {
  color-scheme: dark;
  --ink: #041115;
  --navy: #07191d;
  --navy-2: #0b2429;
  --navy-3: #10343a;
  --panel: rgba(8, 29, 34, 0.86);
  --line: rgba(188, 229, 222, 0.17);
  --line-strong: rgba(188, 229, 222, 0.34);
  --cream: #f2eadc;
  --muted: #91aaa8;
  --teal: #64dfcf;
  --teal-deep: #1f8f88;
  --coral: #ff7051;
  --coral-soft: #ff9b7f;
  --amber: #f5c36c;
  --cell-gap: clamp(2px, 0.45vw, 4px);
  --radius: 22px;
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--cream);
  background:
    linear-gradient(rgba(100, 223, 207, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 223, 207, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 50% -15%, #164149 0, #071a1f 38%, #041115 78%);
  background-size: 42px 42px, 42px 42px, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: linear-gradient(120deg, rgba(255,255,255,.02), transparent 34%, rgba(100,223,207,.025) 65%, transparent);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
}

::selection {
  color: var(--ink);
  background: var(--teal);
}

.sea-noise {
  position: fixed;
  inset: 0;
  z-index: 20;
  opacity: 0.035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
  mix-blend-mode: screen;
}

.sonar-glow {
  position: fixed;
  width: 440px;
  aspect-ratio: 1;
  border: 1px solid rgba(100, 223, 207, 0.08);
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
}

.sonar-glow::before,
.sonar-glow::after {
  content: "";
  position: absolute;
  border: inherit;
  border-radius: inherit;
  inset: 18%;
}

.sonar-glow::after {
  inset: 36%;
}

.sonar-glow--one {
  top: 135px;
  left: -280px;
}

.sonar-glow--two {
  right: -320px;
  bottom: 5%;
  width: 540px;
}

.app-shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 64px);
}

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--cream);
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: "Oswald", sans-serif;
  font-size: 19px;
  letter-spacing: 0.08em;
  line-height: 1;
}

.brand small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.3em;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  overflow: hidden;
  border: 1px solid rgba(100, 223, 207, 0.46);
  border-radius: 50%;
  background: rgba(100, 223, 207, 0.07);
  box-shadow: 0 0 28px rgba(100, 223, 207, 0.08);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  background: rgba(100, 223, 207, 0.25);
}

.brand-mark::before { width: 1px; height: 100%; }
.brand-mark::after { width: 100%; height: 1px; }

.brand-mark__ring {
  width: 23px;
  height: 23px;
  border: 1px solid rgba(100, 223, 207, 0.3);
  border-radius: 50%;
}

.brand-mark__sweep {
  position: absolute;
  inset: 3px 20px 20px 3px;
  transform-origin: 100% 100%;
  background: linear-gradient(135deg, transparent 45%, rgba(100, 223, 207, .5));
  animation: radarSweep 4s linear infinite;
}

.brand-mark__dot {
  position: absolute;
  top: 11px;
  right: 9px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 8px var(--coral);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.online-pill i,
.board-panel__state i {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 9px var(--teal);
}

.icon-button,
.text-button,
.account-button,
.control-button {
  border: 1px solid var(--line);
  background: rgba(8, 31, 36, 0.6);
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease, transform 180ms ease;
}

.icon-button:hover,
.text-button:hover,
.account-button:hover,
.control-button:hover {
  border-color: var(--line-strong);
  background: rgba(22, 61, 68, 0.7);
  transform: translateY(-1px);
}

.icon-button {
  display: grid;
  width: 39px;
  height: 39px;
  padding: 9px;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
}

.icon-button svg,
.control-button svg,
.submit-button svg,
.field__password button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button.is-muted svg { opacity: .45; }

.text-button {
  min-height: 39px;
  padding: 0 15px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}

.account-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 43px;
  padding: 4px 14px 4px 5px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.account-button__avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: var(--navy);
  background: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
  align-items: end;
  padding: clamp(48px, 7vw, 86px) 0 44px;
}

.eyebrow {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .26em;
  text-transform: uppercase;
}

.eyebrow span { color: var(--teal); }

.hero h1,
.modal h2,
.result-panel h2 {
  margin: 0;
  font-family: "Oswald", sans-serif;
  font-size: clamp(44px, 6.2vw, 84px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: .92;
  text-transform: uppercase;
}

.hero h1 em,
.modal h2 em {
  color: var(--coral);
  font-style: normal;
}

.hero__lead {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.captain-card {
  display: flex;
  align-items: center;
  gap: 36px;
  min-width: min(100%, 485px);
  padding: 21px 24px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(6, 23, 27, .66);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .16);
}

.captain-card__label,
.captain-card strong,
.captain-card small {
  display: block;
}

.captain-card__label {
  margin-bottom: 7px;
  color: var(--teal);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.captain-card strong {
  max-width: 170px;
  overflow: hidden;
  font-family: "Oswald", sans-serif;
  font-size: 19px;
  letter-spacing: .02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.captain-card small {
  max-width: 180px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.captain-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex: 1;
}

.captain-stats span {
  min-width: 58px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.captain-stats b,
.captain-stats small {
  display: block;
}

.captain-stats b {
  font-family: "Oswald", sans-serif;
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}

.captain-stats small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.battle-console {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(11, 37, 42, .88), rgba(5, 21, 25, .94));
  box-shadow: 0 38px 100px rgba(0, 0, 0, .28), inset 0 1px rgba(255, 255, 255, .025);
}

.mission-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 86px;
  padding: 17px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 15, 18, .35);
}

.mission-status {
  display: flex;
  align-items: center;
  gap: 13px;
}

.mission-status__pulse {
  position: relative;
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border: 2px solid var(--teal);
  border-radius: 50%;
}

.mission-status__pulse::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px solid var(--teal);
  border-radius: 50%;
  animation: statusPulse 1.8s ease-out infinite;
}

.mission-status.is-danger .mission-status__pulse { border-color: var(--coral); }
.mission-status.is-danger .mission-status__pulse::after { border-color: var(--coral); }

.mission-status__label,
.mission-status strong {
  display: block;
}

.mission-status__label {
  color: var(--teal);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .2em;
}

.mission-status.is-danger .mission-status__label { color: var(--coral-soft); }

.mission-status strong {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
}

.mission-metrics {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 30px;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.mission-metrics span { text-align: center; }

.mission-metrics small,
.mission-metrics b {
  display: block;
}

.mission-metrics small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.mission-metrics b {
  margin-top: 3px;
  font-family: "Oswald", sans-serif;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.mission-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.control-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 39px;
  padding: 0 14px;
  border-radius: 9px;
  color: #bad0cd;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
}

.control-button svg { width: 15px; height: 15px; }

.control-button--accent {
  border-color: var(--coral);
  color: var(--navy);
  background: var(--coral);
}

.control-button--accent:hover {
  border-color: var(--coral-soft);
  color: var(--navy);
  background: var(--coral-soft);
}

.control-button:disabled {
  opacity: .36;
  transform: none;
}

.boards-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: clamp(24px, 3.4vw, 46px);
}

.board-panel { min-width: 0; }

.board-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  margin-bottom: 13px;
}

.board-panel__header > div {
  display: flex;
  align-items: center;
  gap: 13px;
}

.board-panel__number {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.board-panel__header p,
.board-panel__header h2 {
  margin: 0;
}

.board-panel__header p {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.board-panel__header h2 {
  font-family: "Oswald", sans-serif;
  font-size: clamp(17px, 2vw, 23px);
  letter-spacing: .055em;
}

.board-panel__state {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}

.board-panel__state i {
  width: 5px;
  height: 5px;
  background: var(--coral);
  box-shadow: 0 0 8px var(--coral);
}

.board-panel__state--safe i { background: var(--teal); box-shadow: 0 0 8px var(--teal); }

.fleet-line {
  display: flex;
  min-height: 22px;
  margin: 0 0 11px 49px;
  gap: 8px;
  align-items: center;
}

.fleet-ship {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 4px;
  background: rgba(100, 223, 207, .05);
  transition: opacity 250ms ease, transform 250ms ease;
}

.fleet-ship i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--teal);
}

.fleet-line--enemy .fleet-ship i { background: var(--coral-soft); }

.fleet-ship.is-sunk {
  opacity: .22;
  transform: scale(.92);
}

.fleet-ship.is-sunk i { background: var(--muted); }

.board-wrap {
  position: relative;
  width: 100%;
  padding: clamp(11px, 1.4vw, 18px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 20% 10%, rgba(100, 223, 207, .045), transparent 32%),
    rgba(2, 15, 18, .48);
}

.board-wrap--enemy {
  box-shadow: inset 0 0 60px rgba(255, 112, 81, .025);
}

.target-corners {
  position: absolute;
  inset: 7px;
  z-index: 2;
  pointer-events: none;
  border: solid rgba(255, 112, 81, .5);
  border-width: 0;
  background:
    linear-gradient(var(--coral), var(--coral)) 0 0 / 17px 1px no-repeat,
    linear-gradient(var(--coral), var(--coral)) 0 0 / 1px 17px no-repeat,
    linear-gradient(var(--coral), var(--coral)) 100% 0 / 17px 1px no-repeat,
    linear-gradient(var(--coral), var(--coral)) 100% 0 / 1px 17px no-repeat,
    linear-gradient(var(--coral), var(--coral)) 0 100% / 17px 1px no-repeat,
    linear-gradient(var(--coral), var(--coral)) 0 100% / 1px 17px no-repeat,
    linear-gradient(var(--coral), var(--coral)) 100% 100% / 17px 1px no-repeat,
    linear-gradient(var(--coral), var(--coral)) 100% 100% / 1px 17px no-repeat;
  opacity: .45;
}

.battle-board {
  display: grid;
  grid-template-columns: 22px repeat(10, minmax(0, 1fr));
  grid-template-rows: 22px repeat(10, minmax(0, 1fr));
  gap: var(--cell-gap);
  width: 100%;
  aspect-ratio: 1;
  user-select: none;
}

.board-coordinate {
  display: grid;
  place-items: center;
  color: rgba(197, 220, 217, .58);
  font-family: "Oswald", sans-serif;
  font-size: clamp(8px, .8vw, 11px);
  font-weight: 600;
}

.board-corner { opacity: .22; }

.board-cell {
  position: relative;
  display: grid;
  min-width: 0;
  padding: 0;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(150, 210, 203, .13);
  border-radius: clamp(2px, .35vw, 4px);
  background: rgba(31, 94, 99, .19);
  cursor: crosshair;
  transition: border-color 110ms ease, background 110ms ease, transform 110ms ease;
}

.board-cell::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .24;
  background: linear-gradient(140deg, rgba(255,255,255,.05), transparent 44%);
}

.board-cell:not(:disabled):hover {
  z-index: 2;
  border-color: var(--coral);
  background: rgba(255, 112, 81, .15);
  box-shadow: 0 0 0 1px rgba(255, 112, 81, .25), 0 0 18px rgba(255, 112, 81, .17);
  transform: scale(1.09);
}

.board-cell:not(:disabled):hover::after {
  content: "+";
  color: var(--coral-soft);
  font-size: clamp(12px, 1.7vw, 22px);
  font-weight: 300;
}

.battle-board--player .board-cell { cursor: default; }

.board-cell.is-ship {
  border-color: rgba(100, 223, 207, .47);
  background: rgba(100, 223, 207, .2);
  box-shadow: inset 0 0 12px rgba(100, 223, 207, .1);
}

.board-cell.is-ship::after {
  content: "";
  position: absolute;
  inset: 25%;
  border-radius: 2px;
  background: var(--teal);
  opacity: .62;
}

.board-cell.is-miss,
.board-cell.is-auto-miss {
  cursor: default;
  background: rgba(53, 92, 96, .1);
}

.board-cell.is-miss::after,
.board-cell.is-auto-miss::after {
  content: "";
  position: relative;
  width: clamp(3px, .5vw, 6px);
  height: clamp(3px, .5vw, 6px);
  border-radius: 50%;
  background: rgba(211, 230, 226, .5);
  box-shadow: 0 0 7px rgba(211, 230, 226, .24);
}

.board-cell.is-auto-miss::after { opacity: .42; transform: scale(.62); }

.board-cell.is-hit,
.board-cell.is-sunk {
  border-color: rgba(255, 112, 81, .8);
  cursor: default;
  background: rgba(255, 112, 81, .2);
}

.board-cell.is-hit::after,
.board-cell.is-sunk::after {
  content: "";
  position: absolute;
  width: 48%;
  height: 48%;
  background:
    linear-gradient(45deg, transparent 43%, var(--coral) 44%, var(--coral) 56%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, var(--coral) 44%, var(--coral) 56%, transparent 57%);
  filter: drop-shadow(0 0 5px rgba(255, 112, 81, .75));
  animation: hitPop 300ms cubic-bezier(.2, 1.4, .4, 1);
}

.board-cell.is-sunk {
  background: rgba(255, 112, 81, .29);
  box-shadow: inset 0 0 9px rgba(255, 112, 81, .25);
}

.board-cell.is-sunk::before {
  opacity: 1;
  border: 1px solid rgba(255, 180, 155, .35);
}

.board-cell.is-reveal {
  border-color: rgba(255, 112, 81, .34);
  background: repeating-linear-gradient(135deg, rgba(255,112,81,.12) 0 4px, rgba(255,112,81,.03) 4px 8px);
}

.board-cell.is-impact {
  animation: impact 520ms ease-out;
}

.board-cell:disabled { transform: none; }

.board-tip {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.board-tip span {
  margin-right: 5px;
  color: var(--teal);
}

.board-panel--target .board-tip span { color: var(--coral); }

.versus {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  color: rgba(242, 234, 220, .3);
}

.versus span {
  width: 1px;
  height: 62px;
  background: linear-gradient(transparent, var(--line-strong));
}

.versus span:last-child { background: linear-gradient(var(--line-strong), transparent); }

.versus b {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: "Oswald", sans-serif;
  font-size: 10px;
}

.command-strip {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 75px;
  padding: 12px 25px;
  gap: 20px;
  border-top: 1px solid var(--line);
  background: rgba(2, 15, 18, .48);
}

.command-strip__title {
  display: flex;
  align-items: center;
  gap: 11px;
}

.command-strip__icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(100, 223, 207, .28);
  border-radius: 50%;
  color: var(--teal);
  background: rgba(100, 223, 207, .06);
  font-size: 20px;
}

.command-strip__title small,
.command-strip__title strong { display: block; }

.command-strip__title small {
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
}

.command-strip__title strong {
  margin-top: 2px;
  font-family: "Oswald", sans-serif;
  font-size: 12px;
  letter-spacing: .12em;
}

.battle-log {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.battle-log li {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.battle-log li:not(:last-child)::after {
  content: "";
  width: 3px;
  height: 3px;
  margin-left: 10px;
  border-radius: 50%;
  background: var(--line-strong);
}

.battle-log i {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--teal);
}

.battle-log li.is-hit i { background: var(--coral); box-shadow: 0 0 8px rgba(255,112,81,.6); }
.battle-log li.is-info i { background: var(--amber); }

.command-strip__code {
  margin: 0;
  color: rgba(145, 170, 168, .42);
  font-family: monospace;
  font-size: 8px;
  letter-spacing: .08em;
  white-space: nowrap;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 25px 2px 42px;
  color: rgba(145, 170, 168, .44);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.modal {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 22px;
  border: 0;
  color: var(--cream);
  background: transparent;
}

.modal[open] {
  display: grid;
  place-items: center;
  animation: modalFade 180ms ease-out;
}

.modal::backdrop {
  background: rgba(1, 10, 12, .82);
  backdrop-filter: blur(10px);
}

.modal__panel {
  position: relative;
  width: min(100%, 460px);
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: clamp(28px, 5vw, 48px);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(18, 54, 60, .96), rgba(5, 22, 26, .98));
  box-shadow: 0 40px 110px rgba(0,0,0,.55);
  animation: modalRise 260ms cubic-bezier(.2,.85,.3,1);
}

.modal__panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(100,223,207,.05), transparent 40%);
}

.modal__close {
  position: absolute;
  top: 17px;
  right: 17px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(4,17,21,.35);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.modal__close:hover { color: var(--cream); border-color: var(--line-strong); }

.modal__radar {
  position: absolute;
  top: -90px;
  right: -90px;
  width: 230px;
  height: 230px;
  overflow: hidden;
  border: 1px solid rgba(100,223,207,.12);
  border-radius: 50%;
  opacity: .6;
}

.modal__radar::before,
.modal__radar::after {
  content: "";
  position: absolute;
  inset: 24%;
  border: inherit;
  border-radius: 50%;
}

.modal__radar::after { inset: 44%; }

.modal__radar span {
  position: absolute;
  inset: 0 50% 50% 0;
  transform-origin: 100% 100%;
  background: linear-gradient(135deg, transparent, rgba(100,223,207,.16));
  animation: radarSweep 5s linear infinite;
}

.modal h2 {
  position: relative;
  font-size: clamp(38px, 8vw, 54px);
}

.modal__lead {
  position: relative;
  margin: 17px 0 27px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 23px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(2,15,18,.45);
}

.auth-tab {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
}

.auth-tab.is-active {
  color: var(--navy);
  background: var(--teal);
  box-shadow: 0 4px 20px rgba(100,223,207,.12);
}

.auth-form {
  position: relative;
  display: grid;
  gap: 15px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span:first-child {
  color: #bad0cd;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  color: var(--cream);
  background: rgba(2, 15, 18, .56);
  font-size: 13px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input::placeholder { color: rgba(145,170,168,.46); }
.field input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(100,223,207,.08); }

.field__password {
  position: relative;
  display: block;
}

.field__password input { padding-right: 48px; }

.field__password button {
  position: absolute;
  top: 50%;
  right: 7px;
  display: grid;
  width: 36px;
  height: 36px;
  padding: 8px;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.form-error {
  min-height: 16px;
  margin: -2px 0;
  color: var(--coral-soft);
  font-size: 10px;
  line-height: 1.5;
}

.submit-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 53px;
  padding: 0 18px;
  border: 1px solid var(--coral);
  border-radius: 10px;
  color: var(--navy);
  background: var(--coral);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.submit-button:hover { background: var(--coral-soft); transform: translateY(-1px); }
.submit-button:disabled { opacity: .58; transform: none; }

.guest-link {
  position: relative;
  display: block;
  margin: 18px auto 0;
  padding: 5px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  text-decoration: underline;
  text-decoration-color: rgba(145,170,168,.35);
  text-underline-offset: 4px;
  cursor: pointer;
}

.guest-link:hover { color: var(--cream); }

.profile-actions {
  position: relative;
  text-align: center;
}

.profile-actions__badge {
  display: grid;
  width: 74px;
  height: 74px;
  margin: 3px auto 15px;
  place-items: center;
  border: 1px solid rgba(100,223,207,.48);
  border-radius: 50%;
  color: var(--navy);
  background: var(--teal);
  box-shadow: 0 0 38px rgba(100,223,207,.15);
  font-family: "Oswald", sans-serif;
  font-size: 28px;
}

.profile-actions strong,
.profile-actions > span {
  display: block;
}

.profile-actions strong {
  font-family: "Oswald", sans-serif;
  font-size: 24px;
}

.profile-actions > span {
  margin: 5px 0 25px;
  color: var(--muted);
  font-size: 11px;
}

.profile-actions .submit-button {
  width: 100%;
  border-color: var(--line-strong);
  color: var(--cream);
  background: rgba(2,15,18,.45);
}

.profile-actions .submit-button:hover { background: rgba(255,112,81,.12); border-color: var(--coral); }

.leaderboard-panel { width: min(100%, 540px); }

.leaderboard-table {
  position: relative;
  display: grid;
  gap: 7px;
  margin-top: 27px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 68px 68px;
  align-items: center;
  min-height: 52px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(2,15,18,.34);
}

.leaderboard-row:first-child { border-color: rgba(245,195,108,.45); background: rgba(245,195,108,.06); }
.leaderboard-row__rank { color: var(--muted); font-family: "Oswald", sans-serif; font-size: 13px; }
.leaderboard-row:first-child .leaderboard-row__rank { color: var(--amber); }
.leaderboard-row__name { overflow: hidden; font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-row__metric { text-align: right; }
.leaderboard-row__metric b,
.leaderboard-row__metric small { display: block; }
.leaderboard-row__metric b { font-family: "Oswald", sans-serif; font-size: 15px; }
.leaderboard-row__metric small { color: var(--muted); font-size: 7px; text-transform: uppercase; }
.leaderboard-note,
.leaderboard-empty { margin: 17px 0 0; color: var(--muted); font-size: 9px; text-align: center; }
.leaderboard-empty { padding: 28px 10px; border: 1px dashed var(--line); border-radius: 10px; font-size: 11px; }

.result-panel { width: min(100%, 480px); text-align: center; }
.result-emblem {
  display: grid;
  width: 74px;
  height: 74px;
  margin: 0 auto 22px;
  place-items: center;
  border: 1px solid rgba(100,223,207,.45);
  border-radius: 50%;
  color: var(--teal);
  background: rgba(100,223,207,.08);
  box-shadow: 0 0 45px rgba(100,223,207,.12);
  font-size: 29px;
}

.result-panel.is-loss .result-emblem { border-color: rgba(255,112,81,.5); color: var(--coral); background: rgba(255,112,81,.08); }
.result-panel h2 { font-size: clamp(54px, 12vw, 76px); }
.result-panel.is-loss h2 { color: var(--coral); }

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 27px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(2,15,18,.35);
}

.result-stats span { padding: 14px 8px; }
.result-stats span + span { border-left: 1px solid var(--line); }
.result-stats b,
.result-stats small { display: block; }
.result-stats b { font-family: "Oswald", sans-serif; font-size: 23px; }
.result-stats small { margin-top: 2px; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.result-panel .submit-button { width: 100%; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  max-width: min(360px, calc(100% - 44px));
  padding: 13px 17px;
  transform: translateY(20px);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  color: var(--cream);
  background: rgba(7,25,29,.96);
  box-shadow: 0 15px 45px rgba(0,0,0,.35);
  font-size: 11px;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { border-color: rgba(255,112,81,.55); }

@keyframes radarSweep { to { transform: rotate(360deg); } }
@keyframes statusPulse { 0% { opacity: .8; transform: scale(.45); } 75%, 100% { opacity: 0; transform: scale(1.3); } }
@keyframes hitPop { from { opacity: 0; transform: scale(.2) rotate(-45deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes impact { 0% { box-shadow: 0 0 0 0 rgba(255,112,81,.8); } 100% { box-shadow: 0 0 0 20px rgba(255,112,81,0); } }
@keyframes modalFade { from { opacity: 0; } }
@keyframes modalRise { from { opacity: 0; transform: translateY(18px) scale(.98); } }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr; }
  .captain-card { width: 100%; }
  .mission-bar { grid-template-columns: 1fr auto; row-gap: 14px; }
  .mission-metrics { justify-self: end; border-right: 0; }
  .mission-actions { grid-column: 1 / -1; }
  .boards-layout { grid-template-columns: minmax(0, 1fr) 35px minmax(0, 1fr); padding: 30px 22px; }
  .command-strip { grid-template-columns: 190px minmax(0, 1fr); }
  .command-strip__code { display: none; }
  .board-panel__state { display: none; }
}

@media (max-width: 760px) {
  .app-shell { padding: 0 14px; }
  .topbar { min-height: 76px; }
  .online-pill,
  .text-button--muted { display: none; }
  .brand strong { font-size: 16px; }
  .brand small { font-size: 7px; }
  .brand-mark { width: 38px; height: 38px; }
  .account-button { padding-right: 10px; }
  .account-button #accountLabel { display: none; }
  .hero { gap: 28px; padding: 43px 3px 32px; }
  .hero h1 { font-size: clamp(42px, 15.2vw, 67px); }
  .hero__lead { font-size: 11px; }
  .captain-card { gap: 20px; padding: 17px; }
  .captain-card > div:first-child { flex: 1; min-width: 0; }
  .captain-card small { max-width: 135px; }
  .captain-stats { flex: initial; }
  .captain-stats span { min-width: 47px; padding-left: 9px; }
  .captain-stats b { font-size: 18px; }
  .mission-bar { grid-template-columns: 1fr auto; padding: 15px; }
  .mission-status strong { max-width: 180px; font-size: 9px; line-height: 1.4; }
  .mission-metrics { gap: 13px; padding: 0 0 0 15px; border-left: 1px solid var(--line); }
  .mission-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .control-button { padding: 0 8px; font-size: 8px; }
  .boards-layout { display: flex; flex-direction: column; gap: 34px; padding: 26px 12px; }
  .board-panel { width: 100%; max-width: 560px; }
  .board-panel--target { order: 1; }
  .versus { order: 2; flex-direction: row; width: 70%; }
  .versus span { width: 100%; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong)); }
  .versus span:last-child { background: linear-gradient(90deg, var(--line-strong), transparent); }
  .board-panel--home { order: 3; }
  .fleet-line { margin-left: 49px; }
  .battle-board { grid-template-columns: 18px repeat(10, minmax(0, 1fr)); grid-template-rows: 18px repeat(10, minmax(0, 1fr)); }
  .board-wrap { padding: 10px; }
  .command-strip { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .battle-log { overflow: hidden; gap: 8px; }
  .battle-log li:nth-last-child(n+3) { display: none; }
  footer { gap: 20px; line-height: 1.5; }
}

@media (max-width: 430px) {
  .icon-button { width: 36px; height: 36px; }
  .brand { gap: 8px; }
  .brand-mark { width: 34px; height: 34px; }
  .captain-card { align-items: stretch; flex-direction: column; }
  .captain-card small { max-width: none; }
  .captain-stats span:first-child { border-left: 0; padding-left: 0; }
  .mission-status strong { max-width: 135px; }
  .mission-metrics small { display: none; }
  .mission-metrics b { font-size: 16px; }
  .control-button svg { display: none; }
  .boards-layout { padding-right: 8px; padding-left: 8px; }
  .board-panel__header { margin-right: 3px; margin-left: 3px; }
  .fleet-line { gap: 4px; margin-left: 47px; }
  .fleet-ship { gap: 1px; padding: 2px; }
  .fleet-ship i { width: 4px; height: 4px; }
  .modal { padding: 10px; }
  .modal__panel { max-height: calc(100vh - 20px); padding: 32px 22px; border-radius: 17px; }
  .leaderboard-row { grid-template-columns: 30px minmax(0, 1fr) 54px 54px; padding: 0 8px; }
  footer span:last-child { display: none; }
}

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