:root {
  color-scheme: dark;
  --navy: #062b4f;
  --navy-deep: #041c35;
  --ocean: #087ca7;
  --aqua: #5cdded;
  --foam: #e9fcff;
  --sky: #8be6f3;
  --sun: #ffd166;
  --coral: #ff776d;
  --mint: #76e6b8;
  --ink: #f6fdff;
  --muted: #b6d5e0;
  --muted-deep: #709db0;
  --surface: rgba(9, 58, 91, 0.82);
  --surface-strong: #0a4167;
  --line: rgba(190, 244, 249, 0.22);
  --shadow: rgba(1, 18, 37, 0.34);
  --radius: 22px;
  --cell-size: clamp(31px, 3.1vw, 46px);
  font-family: "Nunito Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--navy-deep);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% -10%, rgba(92, 221, 237, 0.32), transparent 31rem),
    radial-gradient(circle at 90% 5%, rgba(255, 209, 102, 0.16), transparent 26rem),
    linear-gradient(180deg, #0a4d75 0%, var(--navy) 42%, var(--navy-deep) 100%);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  opacity: 0.32;
  background:
    radial-gradient(ellipse at 30% 100%, transparent 0 28%, rgba(137, 234, 246, 0.08) 28.5% 29.5%, transparent 30%),
    repeating-linear-gradient(155deg, rgba(139, 230, 243, 0.045) 0 1px, transparent 1px 42px);
  pointer-events: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

button:not(:disabled) {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2,
.arcade-brand strong {
  font-family: Fredoka, "Arial Rounded MT Bold", ui-rounded, sans-serif;
  letter-spacing: -0.03em;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.05rem, 5.2vw, 4.7rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 7px;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  line-height: 1.05;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--sun);
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

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

.game-shell {
  width: min(1440px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 0 40px;
}

.arcade-topbar {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 70px;
  margin-bottom: 24px;
}

.arcade-brand {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 10px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

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

.arcade-brand small {
  color: var(--sky);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.arcade-brand strong {
  font-size: 1.48rem;
  line-height: 1;
}

.brand-buoy {
  position: relative;
  display: grid;
  width: 47px;
  height: 47px;
  overflow: hidden;
  place-items: center;
  border: 2px solid rgba(233, 252, 255, 0.85);
  border-radius: 16px;
  background: linear-gradient(145deg, #68e7ef, #159cb9);
  box-shadow: 0 10px 22px rgba(1, 26, 51, 0.28);
}

.brand-buoy::before,
.brand-buoy::after,
.brand-buoy i {
  position: absolute;
  content: "";
}

.brand-buoy::before {
  bottom: 9px;
  width: 27px;
  height: 8px;
  border-radius: 0 0 9px 9px;
  background: var(--navy);
}

.brand-buoy::after {
  bottom: 17px;
  width: 20px;
  height: 13px;
  border-radius: 3px 5px 1px 1px;
  background: var(--navy);
}

.brand-buoy i {
  top: 8px;
  left: 15px;
  width: 2px;
  height: 13px;
  background: var(--navy);
}

.arcade-nav,
.top-account,
.account-chip,
.command-actions,
.segmented-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.arcade-nav {
  justify-content: center;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(3, 38, 67, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.top-account {
  justify-content: flex-end;
}

.nav-button,
.mode-pill,
.control-button,
.icon-button,
.signout-button,
.text-button {
  min-height: 42px;
  border-radius: 13px;
  color: var(--ink);
  font-weight: 800;
}

.nav-button {
  padding: 0 16px;
  color: var(--muted);
  background: transparent;
}

.nav-button.active {
  color: var(--navy-deep);
  background: var(--sun);
  box-shadow: 0 5px 11px rgba(255, 209, 102, 0.18);
}

.account-chip,
.live-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid rgba(118, 230, 184, 0.38);
  border-radius: 999px;
  color: var(--foam);
  background: rgba(7, 76, 91, 0.62);
  font-size: 0.82rem;
  font-weight: 900;
}

.presence-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(118, 230, 184, 0.12);
}

.signout-button {
  min-height: 28px;
  padding: 0 7px;
  color: var(--muted);
  background: transparent;
  font-size: 0.72rem;
}

.control-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid rgba(233, 252, 255, 0.29);
  background: rgba(11, 84, 119, 0.75);
  box-shadow: 0 7px 15px rgba(1, 24, 48, 0.16);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.control-button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  background: rgba(16, 111, 149, 0.96);
  box-shadow: 0 10px 18px rgba(1, 24, 48, 0.22);
  transform: translateY(-2px);
}

.control-button.primary {
  border-color: transparent;
  color: var(--navy-deep);
  background: var(--sun);
  box-shadow: 0 8px 0 #db9d31, 0 14px 22px rgba(255, 180, 47, 0.2);
}

.control-button.primary:hover:not(:disabled) {
  background: #ffe093;
  box-shadow: 0 6px 0 #db9d31, 0 14px 22px rgba(255, 180, 47, 0.27);
  transform: translateY(2px);
}

.control-button.primary:active:not(:disabled) {
  box-shadow: 0 2px 0 #db9d31;
  transform: translateY(6px);
}

.control-button.danger {
  border-color: rgba(255, 119, 109, 0.58);
  color: #ffe2df;
  background: rgba(117, 41, 57, 0.72);
}

.control-button.large {
  min-height: 50px;
  padding: 0 22px;
  font-size: 1rem;
}

.text-button {
  min-height: auto;
  padding: 3px 0;
  color: var(--sky);
  background: transparent;
  text-decoration: underline;
  text-decoration-color: rgba(139, 230, 243, 0.45);
  text-underline-offset: 4px;
}

.ready-hero,
.lobby-hero,
.ranks-hero,
.journey-header,
.turn-banner,
.outcome-panel,
.invite-banner,
.online-roster-card,
.harbor-sidecard,
.chat-panel,
.leaderboard-table,
.battle-log-drawer {
  border: 1px solid var(--line);
  box-shadow: 0 18px 42px var(--shadow);
}

.ready-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
  min-height: 306px;
  overflow: hidden;
  border-radius: 30px;
  background:
    radial-gradient(circle at 73% 26%, rgba(255, 209, 102, 0.35), transparent 16rem),
    linear-gradient(112deg, rgba(17, 121, 159, 0.99), rgba(7, 71, 113, 0.94) 50%, rgba(5, 43, 77, 0.92));
}

.hero-copy {
  z-index: 1;
  align-self: center;
  max-width: 680px;
  padding: clamp(28px, 4vw, 58px);
}

.hero-copy p:not(.eyebrow) {
  max-width: 46ch;
  margin-bottom: 20px;
  color: #d5f5f8;
  font-size: 1.05rem;
}

.hero-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(233, 252, 255, 0.2);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--foam);
  background: rgba(2, 43, 74, 0.3);
  font-size: 0.81rem;
  font-weight: 800;
}

.hero-note b {
  color: var(--sun);
}

.hero-seascape {
  position: relative;
  min-height: 250px;
  overflow: hidden;
}

.sun {
  position: absolute;
  top: 38px;
  right: 23%;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 16px rgba(255, 209, 102, 0.12);
}

.cloud {
  position: absolute;
  width: 86px;
  height: 18px;
  border-radius: 99px;
  background: rgba(233, 252, 255, 0.5);
}

.cloud::before,
.cloud::after {
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  content: "";
  background: inherit;
}

.cloud::before {
  left: 13px;
  width: 31px;
  height: 31px;
}

.cloud::after {
  left: 40px;
  width: 37px;
  height: 39px;
}

.cloud-one {
  top: 49px;
  right: 6%;
  opacity: 0.7;
  transform: scale(0.56);
}

.cloud-two {
  top: 102px;
  right: 52%;
  opacity: 0.5;
  transform: scale(0.42);
}

.hero-ship {
  position: absolute;
  right: 21%;
  bottom: 88px;
  width: 153px;
  height: 45px;
  border-radius: 5px 5px 34px 35px;
  background: #f8fcf8;
  box-shadow: inset 0 -8px 0 #d4e6e5, 0 11px 0 rgba(0, 41, 75, 0.12);
  transform: rotate(-3deg);
}

.hero-ship::before {
  position: absolute;
  bottom: 8px;
  left: 21px;
  width: 64px;
  height: 28px;
  border-radius: 4px 4px 0 0;
  content: "";
  background: var(--coral);
}

.hero-ship::after {
  position: absolute;
  bottom: 28px;
  left: 76px;
  width: 3px;
  height: 68px;
  content: "";
  background: #f8fcf8;
}

.hero-ship i {
  position: absolute;
  bottom: 54px;
  left: 79px;
  width: 0;
  height: 0;
  border-right: 50px solid transparent;
  border-bottom: 42px solid var(--sun);
}

.hero-ship b {
  position: absolute;
  right: 21px;
  bottom: 17px;
  width: 15px;
  height: 9px;
  border-radius: 99px;
  background: var(--navy);
}

.wave {
  position: absolute;
  right: -10%;
  bottom: -42px;
  width: 130%;
  height: 123px;
  border: 20px solid rgba(92, 221, 237, 0.43);
  border-right-color: transparent;
  border-left-color: transparent;
  border-radius: 50%;
}

.wave-one {
  transform: rotate(-5deg);
}

.wave-two {
  right: -15%;
  bottom: -66px;
  border-color: rgba(2, 56, 99, 0.45);
  transform: rotate(6deg);
}

.mission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.mission-card {
  position: relative;
  overflow: hidden;
  min-height: 254px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 27px;
  box-shadow: 0 16px 32px var(--shadow);
}

.mission-card p:not(.eyebrow) {
  max-width: 39ch;
  margin-bottom: 22px;
}

.quick-card {
  background:
    radial-gradient(circle at 100% 0%, rgba(118, 230, 184, 0.31), transparent 13rem),
    linear-gradient(130deg, #0c668b, #094467);
}

.fleet-card {
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 209, 102, 0.27), transparent 13rem),
    linear-gradient(130deg, #164b79, #0b365c);
}

.mission-icon {
  position: absolute;
  top: 20px;
  right: 22px;
  color: rgba(233, 252, 255, 0.2);
  font-size: 4.8rem;
  line-height: 1;
}

.mission-card h2,
.mission-card p,
.mission-card button {
  position: relative;
}

.home-footnote {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 18px;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.home-footnote strong {
  color: var(--foam);
}

.journey-header,
.turn-banner,
.lobby-hero,
.ranks-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  border-radius: var(--radius);
  padding: 23px 26px;
  background: linear-gradient(118deg, rgba(12, 105, 143, 0.9), rgba(5, 55, 91, 0.9));
}

.journey-header p:last-child,
.turn-banner p:last-child,
.lobby-hero p:last-child,
.ranks-hero p:last-child {
  max-width: 68ch;
  margin-bottom: 0;
}

.journey-header h1,
.turn-banner h1,
.lobby-hero h1,
.ranks-hero h1 {
  margin-bottom: 5px;
  font-size: clamp(1.8rem, 3.3vw, 3rem);
}

.journey-progress {
  display: grid;
  min-width: 112px;
  place-items: center;
  border: 1px solid rgba(233, 252, 255, 0.27);
  border-radius: 18px;
  padding: 11px 14px;
  color: var(--foam);
  background: rgba(2, 44, 73, 0.34);
}

.journey-progress strong {
  color: var(--sun);
  font-size: 1.35rem;
}

.journey-progress span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.setup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(295px, 0.55fr);
  align-items: start;
  gap: 18px;
  margin-top: 18px;
}

.fleet-deck,
.board-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 40px var(--shadow);
}

.fleet-deck {
  padding: 20px;
}

.deck-heading p:last-child {
  margin-bottom: 18px;
  font-size: 0.9rem;
}

.ship-selector {
  display: grid;
  gap: 8px;
}

.ship-token {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border: 1px solid rgba(233, 252, 255, 0.14);
  border-radius: 13px;
  padding: 7px 10px;
  color: var(--ink);
  background: rgba(3, 45, 75, 0.46);
  text-align: left;
}

.ship-token.selected {
  border-color: var(--sun);
  background: rgba(255, 209, 102, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.22);
}

.ship-code {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 9px;
  color: var(--navy-deep);
  background: var(--aqua);
  font-size: 0.8rem;
  font-weight: 1000;
}

.ship-name {
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ship-status {
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ship-status.ready {
  color: var(--mint);
}

.deck-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 16px;
}

.deck-actions .control-button,
.deck-actions .icon-button {
  min-width: 0;
  padding: 0 10px;
  font-size: 0.84rem;
}

.deck-ranked {
  width: 100%;
  margin-top: 15px;
  font-size: 0.8rem;
}

.icon {
  position: relative;
  display: inline-block;
  width: 17px;
  height: 17px;
}

.rotate-icon::before {
  position: absolute;
  inset: 1px;
  border: 2px solid var(--aqua);
  border-left-color: transparent;
  border-radius: 50%;
  content: "";
}

.rotate-icon::after {
  position: absolute;
  top: 1px;
  right: 0;
  width: 6px;
  height: 6px;
  border-top: 2px solid var(--aqua);
  border-right: 2px solid var(--aqua);
  content: "";
  transform: rotate(34deg);
}

.clear-icon::before,
.clear-icon::after {
  position: absolute;
  top: 0;
  left: 8px;
  width: 2px;
  height: 17px;
  border-radius: 9px;
  content: "";
  background: var(--coral);
}

.clear-icon::before {
  transform: rotate(45deg);
}

.clear-icon::after {
  transform: rotate(-45deg);
}

.board-panel {
  padding: 17px;
}

.primary-board {
  border-color: rgba(92, 221, 237, 0.46);
}

.board-heading,
.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.board-heading h2,
.panel-heading h2 {
  margin-bottom: 3px;
}

.board-heading p,
.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.board-badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  border: 1px solid rgba(92, 221, 237, 0.45);
  border-radius: 999px;
  padding: 0 9px;
  color: var(--aqua);
  background: rgba(4, 70, 96, 0.52);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.board-grid {
  display: grid;
  width: max-content;
  max-width: 100%;
  grid-template-columns: 22px repeat(10, var(--cell-size));
  grid-template-rows: 21px repeat(10, var(--cell-size));
  gap: 3px;
  margin: 0 auto;
  padding: 9px;
  border: 1px solid rgba(139, 230, 243, 0.18);
  border-radius: 17px;
  background:
    radial-gradient(circle at 35% 25%, rgba(92, 221, 237, 0.1), transparent 10rem),
    rgba(2, 41, 69, 0.6);
}

.axis-label {
  display: grid;
  place-items: center;
  color: var(--sky);
  font-size: 0.68rem;
  font-weight: 1000;
}

.grid-cell {
  position: relative;
  display: block;
  width: var(--cell-size);
  height: var(--cell-size);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(139, 230, 243, 0.26);
  border-radius: 9px;
  padding: 0;
  background: #075b7c;
}

.grid-cell::before,
.cell-water {
  position: absolute;
  inset: 0;
  content: "";
}

.grid-cell::before {
  background:
    linear-gradient(135deg, transparent 0 45%, rgba(233, 252, 255, 0.18) 46% 48%, transparent 49%),
    linear-gradient(180deg, rgba(139, 230, 243, 0.17), transparent);
  opacity: 0.75;
}

.grid-cell.interactive:hover {
  z-index: 2;
  border-color: var(--sun);
  background: #0f7fa1;
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.18), 0 0 19px rgba(92, 221, 237, 0.2);
  transform: translateY(-2px);
}

.grid-cell.has-ship .cell-ship {
  position: absolute;
  z-index: 2;
  inset: 27% 10%;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 42% 56% 35% 45%;
  background: linear-gradient(180deg, #f7fbfa, #8fb3c1);
  box-shadow: inset 0 -3px 0 rgba(5, 43, 79, 0.26), 0 2px 4px rgba(1, 31, 55, 0.3);
}

.grid-cell.has-ship .cell-ship::before {
  position: absolute;
  top: -25%;
  left: 36%;
  width: 25%;
  height: 42%;
  border-radius: 3px 3px 0 0;
  content: "";
  background: #d7eaec;
}

.grid-cell.selected-ship-cell {
  border-color: var(--sun);
}

.grid-cell.selected-ship-cell .cell-ship {
  box-shadow: inset 0 -3px 0 rgba(5, 43, 79, 0.26), 0 0 13px rgba(255, 209, 102, 0.75);
}

.grid-cell.preview-valid {
  border-color: var(--mint);
  background: #0d807b;
}

.grid-cell.preview-invalid {
  border-color: var(--coral);
  background: #83404d;
}

.grid-cell.preview-valid .cell-preview,
.grid-cell.preview-invalid .cell-preview {
  position: absolute;
  z-index: 3;
  inset: 18%;
  border-radius: 50%;
}

.grid-cell.preview-valid .cell-preview {
  border: 2px dashed var(--mint);
  background: rgba(118, 230, 184, 0.25);
}

.grid-cell.preview-invalid .cell-preview {
  border: 2px dashed var(--coral);
  background: rgba(255, 119, 109, 0.2);
}

.grid-cell.hit {
  border-color: #ffb261;
  background: #c45745;
}

.grid-cell.hit .cell-hit {
  position: absolute;
  z-index: 4;
  inset: 23%;
  border-radius: 50%;
  background: #fff5c9;
  box-shadow: 0 0 0 4px rgba(255, 177, 89, 0.7), 0 0 17px 6px rgba(255, 111, 74, 0.86);
}

.grid-cell.hit .cell-hit::before,
.grid-cell.hit .cell-hit::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 150%;
  border-radius: 99px;
  content: "";
  background: #fff;
  transform-origin: center;
}

.grid-cell.hit .cell-hit::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.grid-cell.hit .cell-hit::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.grid-cell.miss .cell-miss {
  position: absolute;
  z-index: 3;
  inset: 31%;
  border: 2px solid var(--foam);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(92, 221, 237, 0.3);
}

.grid-cell.sunk {
  background: #733e50;
}

.grid-cell.sunk::after {
  position: absolute;
  z-index: 3;
  inset: 7%;
  border-radius: 8px;
  content: "";
  background: repeating-linear-gradient(135deg, rgba(255, 244, 222, 0.34) 0 2px, transparent 2px 7px);
}

.grid-cell.recent-hit {
  animation: arcade-blast 560ms cubic-bezier(0.2, 0.85, 0.3, 1) both;
}

.grid-cell.recent-hit .cell-hit {
  animation: blast-mark 610ms ease-out both;
}

.grid-cell.recent-miss .cell-miss {
  animation: water-ripple 720ms ease-out both;
}

.grid-cell.recent-sunk {
  animation: ship-sink 900ms ease-out both;
}

.turn-banner {
  margin-bottom: 15px;
}

.turn-banner.player-turn {
  background: linear-gradient(115deg, rgba(14, 122, 145, 0.95), rgba(8, 70, 111, 0.95));
}

.turn-banner.enemy-turn {
  background: linear-gradient(115deg, rgba(106, 76, 112, 0.94), rgba(7, 62, 103, 0.95));
}

.turn-signal {
  display: grid;
  width: 55px;
  height: 55px;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid rgba(233, 252, 255, 0.7);
  border-radius: 50%;
  color: var(--sun);
  background: rgba(2, 42, 73, 0.34);
  font-size: 1.55rem;
}

.battle-mini-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  margin-left: auto;
}

.battle-mini-stats span {
  border: 1px solid rgba(233, 252, 255, 0.22);
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--muted);
  background: rgba(2, 42, 73, 0.28);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.battle-mini-stats b {
  margin-right: 3px;
  color: var(--foam);
  font-size: 1rem;
}

.board-tabs {
  display: none;
}

.battlefield {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(0, 0.86fr);
  align-items: start;
  gap: 18px;
}

.battle-log-drawer {
  margin-top: 16px;
  border-radius: 16px;
  background: rgba(4, 52, 83, 0.75);
}

.battle-log-drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 17px;
  cursor: pointer;
  list-style: none;
}

.battle-log-drawer summary::-webkit-details-marker,
.score-details summary::-webkit-details-marker {
  display: none;
}

.battle-log-drawer summary b,
.battle-log-drawer summary small {
  display: block;
}

.battle-log-drawer summary small {
  margin-top: 1px;
  color: var(--muted);
}

.battle-log {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0 22px 17px 39px;
  color: var(--muted);
  font-size: 0.86rem;
}

.battle-log li::marker {
  color: var(--sun);
}

.outcome-panel {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(190px, 0.75fr) minmax(230px, 0.85fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 15px;
  border-radius: var(--radius);
  padding: 22px;
  background: linear-gradient(118deg, rgba(14, 118, 132, 0.95), rgba(7, 61, 100, 0.95));
  animation: outcome-rise 520ms cubic-bezier(0.18, 0.9, 0.26, 1) both;
}

.outcome-panel.victory {
  border-color: rgba(118, 230, 184, 0.7);
  background:
    radial-gradient(circle at 12% 15%, rgba(255, 209, 102, 0.25), transparent 12rem),
    linear-gradient(118deg, rgba(14, 132, 123, 0.97), rgba(9, 73, 105, 0.97));
}

.outcome-panel.defeat {
  border-color: rgba(255, 119, 109, 0.65);
}

.outcome-panel h1 {
  font-size: clamp(1.7rem, 2.6vw, 2.55rem);
}

.outcome-copy p:last-child {
  margin-bottom: 0;
}

.outcome-score {
  display: grid;
  min-width: 137px;
  place-items: center;
  border: 1px solid rgba(255, 209, 102, 0.62);
  border-radius: 17px;
  padding: 10px;
  background: rgba(2, 43, 67, 0.26);
}

.outcome-score span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.outcome-score strong {
  color: var(--sun);
  font-family: Fredoka, ui-rounded, sans-serif;
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  line-height: 1;
}

.outcome-metrics {
  display: grid;
  gap: 7px;
}

.outcome-metrics span,
.score-details span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.outcome-metrics b,
.score-details b {
  color: var(--foam);
}

.outcome-actions {
  display: grid;
  gap: 8px;
}

.score-details {
  color: var(--muted);
  font-size: 0.78rem;
}

.score-details summary {
  cursor: pointer;
  font-weight: 900;
}

.score-details[open] {
  display: grid;
  gap: 5px;
}

.score-details span {
  padding-top: 4px;
}

.lobby-hero,
.ranks-hero {
  min-height: 190px;
}

.lobby-hero-actions {
  flex: 0 0 auto;
}

.lobby-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(250px, 0.55fr);
  gap: 18px;
  margin-top: 18px;
}

.online-roster-card,
.harbor-sidecard,
.chat-panel {
  border-radius: var(--radius);
  padding: 22px;
  background: var(--surface);
}

.roster-list,
.lobby-messages {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.roster-list {
  max-height: 420px;
  overflow: auto;
  padding-right: 3px;
}

.roster-player {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border: 1px solid rgba(233, 252, 255, 0.13);
  border-radius: 15px;
  padding: 10px;
  background: rgba(4, 45, 75, 0.55);
}

.roster-player.self {
  border-color: rgba(118, 230, 184, 0.47);
  background: rgba(18, 104, 112, 0.35);
}

.message-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 209, 102, 0.68);
  border-radius: 50%;
  color: var(--sun);
  background: rgba(255, 209, 102, 0.1);
  font-size: 0.82rem;
  font-weight: 1000;
}

.roster-name {
  display: grid;
  min-width: 0;
}

.roster-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-name small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
}

.roster-challenge {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--aqua);
  font-size: 0.75rem;
}

.harbor-sidecard {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 209, 102, 0.22), transparent 10rem),
    linear-gradient(148deg, rgba(18, 95, 133, 0.95), rgba(8, 58, 96, 0.95));
}

.harbor-sidecard p:not(.eyebrow) {
  max-width: 32ch;
}

.side-icon {
  position: absolute;
  top: 8px;
  right: 16px;
  color: rgba(255, 209, 102, 0.3);
  font-size: 5.5rem;
}

.harbor-sidecard > :not(.side-icon) {
  position: relative;
}

.chat-panel {
  margin-top: 18px;
}

.lobby-messages {
  max-height: 300px;
  overflow: auto;
}

.lobby-messages li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  border: 1px solid rgba(233, 252, 255, 0.1);
  border-radius: 13px;
  padding: 9px;
  background: rgba(4, 45, 75, 0.42);
}

.lobby-messages strong {
  font-size: 0.83rem;
}

.lobby-messages p {
  margin: 2px 0 0;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  margin-top: 12px;
}

.chat-form input,
.profile-dialog input {
  min-width: 0;
  min-height: 43px;
  border: 1px solid rgba(233, 252, 255, 0.28);
  border-radius: 12px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(3, 39, 67, 0.8);
}

.chat-form input::placeholder {
  color: var(--muted-deep);
}

.viewer-note,
.empty-state {
  color: var(--muted);
  font-size: 0.86rem;
}

.invite-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  border-radius: var(--radius);
  padding: 18px 21px;
  background: linear-gradient(100deg, rgba(255, 209, 102, 0.2), rgba(7, 68, 102, 0.86));
  animation: outcome-rise 300ms ease-out both;
}

.invite-banner.outgoing {
  background: linear-gradient(100deg, rgba(92, 221, 237, 0.16), rgba(7, 68, 102, 0.86));
}

.invite-banner h2,
.invite-banner p {
  margin-bottom: 0;
}

.notice-banner {
  margin-top: 18px;
  border: 1px solid rgba(92, 221, 237, 0.26);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--muted);
  background: rgba(4, 55, 87, 0.7);
  font-size: 0.86rem;
}

.notice-banner.error {
  border-color: rgba(255, 119, 109, 0.58);
  color: #ffe1dd;
}

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(1, 19, 40, 0.76);
  backdrop-filter: blur(8px);
}

.profile-dialog {
  display: grid;
  width: min(430px, 100%);
  gap: 11px;
  border: 1px solid rgba(255, 209, 102, 0.6);
  border-radius: 23px;
  padding: 24px;
  background: #0c527a;
  box-shadow: 0 24px 62px rgba(0, 15, 32, 0.45);
}

.profile-dialog p {
  margin-bottom: 0;
}

.profile-dialog label {
  color: var(--foam);
  font-size: 0.82rem;
  font-weight: 900;
}

.leave-match,
.back-lobby {
  display: block;
  width: fit-content;
  margin: 16px auto 0;
}

.ranks-hero {
  margin-bottom: 18px;
}

.segmented-control {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mode-pill {
  padding: 0 15px;
  border: 1px solid rgba(233, 252, 255, 0.24);
  background: rgba(3, 45, 75, 0.46);
}

.mode-pill.active {
  border-color: var(--sun);
  color: var(--navy-deep);
  background: var(--sun);
}

.rank-podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
}

.podium-card {
  display: grid;
  min-height: 150px;
  place-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 16px;
  background: rgba(8, 68, 103, 0.79);
  box-shadow: 0 14px 26px var(--shadow);
  text-align: center;
}

.podium-card.podium-1 {
  min-height: 182px;
  border-color: rgba(255, 209, 102, 0.7);
  background: linear-gradient(160deg, rgba(255, 209, 102, 0.24), rgba(10, 75, 107, 0.85));
}

.podium-card .message-avatar {
  width: 45px;
  height: 45px;
  font-size: 1rem;
}

.podium-card strong {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-card small {
  color: var(--muted);
}

.podium-rank {
  color: var(--sun);
  font-family: Fredoka, ui-rounded, sans-serif;
  font-size: 1.2rem;
}

.leaderboard-table {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
}

.leaderboard-head,
.leaderboard-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 145px 120px;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
}

.leaderboard-head {
  color: var(--sky);
  background: rgba(92, 221, 237, 0.08);
  font-size: 0.7rem;
  font-weight: 1000;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.leaderboard-row {
  min-height: 62px;
  border-top: 1px solid rgba(233, 252, 255, 0.11);
}

.leaderboard-row > strong:last-of-type {
  color: var(--sun);
}

.leaderboard-player {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
  font-weight: 900;
}

.leaderboard-empty {
  padding: 28px;
}

@keyframes arcade-blast {
  0% {
    filter: brightness(1);
    transform: scale(1);
  }
  42% {
    filter: brightness(1.9);
    transform: scale(1.12) rotate(4deg);
  }
  100% {
    filter: brightness(1);
    transform: scale(1);
  }
}

@keyframes blast-mark {
  from {
    opacity: 0;
    transform: scale(0.15) rotate(-45deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes water-ripple {
  0% {
    opacity: 0;
    transform: scale(0.25);
    box-shadow: 0 0 0 0 rgba(92, 221, 237, 0.78);
  }
  65% {
    opacity: 1;
    transform: scale(1.55);
    box-shadow: 0 0 0 11px rgba(92, 221, 237, 0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes ship-sink {
  0% {
    filter: brightness(2);
    transform: translateY(-3px);
  }
  100% {
    filter: brightness(1);
    transform: translateY(0);
  }
}

@keyframes outcome-rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1040px) {
  .arcade-topbar {
    grid-template-columns: 1fr auto;
  }

  .arcade-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: stretch;
  }

  .nav-button {
    flex: 1;
  }

  .top-account {
    justify-content: flex-end;
  }

  .setup-layout,
  .lobby-layout {
    grid-template-columns: 1fr;
  }

  .fleet-deck {
    display: grid;
    grid-template-columns: minmax(180px, 0.6fr) minmax(0, 1fr);
    gap: 16px;
  }

  .deck-heading {
    grid-column: 1;
  }

  .fleet-deck .ship-selector {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .fleet-deck .deck-actions,
  .fleet-deck .deck-ranked {
    grid-column: 1;
  }

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

  .outcome-panel {
    grid-template-columns: minmax(190px, 1fr) auto;
  }

  .outcome-metrics,
  .outcome-actions {
    grid-column: span 1;
  }
}

@media (max-width: 700px) {
  :root {
    --cell-size: min(7.45vw, 40px);
  }

  .game-shell {
    width: min(100% - 22px, 520px);
    padding-top: 10px;
  }

  .arcade-topbar {
    gap: 10px;
    margin-bottom: 16px;
  }

  .arcade-brand strong {
    font-size: 1.2rem;
  }

  .brand-buoy {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .arcade-nav {
    width: 100%;
  }

  .nav-button {
    min-height: 38px;
    padding: 0 9px;
    font-size: 0.84rem;
  }

  .top-account {
    min-width: 0;
  }

  .top-account .account-chip {
    max-width: 144px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ready-hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero-copy {
    padding: 30px 23px;
  }

  .hero-seascape {
    min-height: 142px;
  }

  .sun {
    top: 5px;
    right: 20%;
    width: 62px;
    height: 62px;
  }

  .hero-ship {
    right: 21%;
    bottom: 48px;
    transform: scale(0.82) rotate(-3deg);
    transform-origin: bottom right;
  }

  .cloud-one {
    top: 17px;
  }

  .cloud-two {
    top: 38px;
  }

  .mission-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 12px;
  }

  .mission-card {
    min-height: 0;
    padding: 22px;
  }

  .home-footnote,
  .journey-header,
  .turn-banner,
  .lobby-hero,
  .ranks-hero,
  .invite-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-footnote {
    padding: 9px 2px;
  }

  .journey-header,
  .turn-banner,
  .lobby-hero,
  .ranks-hero {
    gap: 12px;
    padding: 20px;
  }

  .journey-progress,
  .battle-mini-stats {
    width: 100%;
  }

  .journey-progress {
    display: flex;
    justify-content: center;
    gap: 5px;
  }

  .battle-mini-stats {
    justify-content: flex-start;
    margin-left: 0;
  }

  .setup-layout {
    gap: 12px;
    margin-top: 12px;
  }

  .fleet-deck {
    display: block;
    padding: 17px;
  }

  .fleet-deck .ship-selector {
    margin-top: 14px;
  }

  .fleet-deck .deck-actions {
    margin-top: 14px;
  }

  .board-panel {
    padding: 11px;
    border-radius: 18px;
  }

  .board-grid {
    gap: 2px;
    padding: 6px;
  }

  .board-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin: 12px 0;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(3, 43, 72, 0.54);
  }

  .board-tabs button {
    min-height: 40px;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    font-weight: 900;
    font-size: 0.81rem;
  }

  .board-tabs button.active {
    color: var(--navy-deep);
    background: var(--sun);
  }

  .battlefield {
    display: block;
  }

  .battlefield .board-panel {
    display: none;
  }

  .battlefield.showing-enemy .enemy-panel,
  .battlefield.showing-player .player-panel {
    display: block;
  }

  .battle-log-drawer {
    margin-top: 12px;
  }

  .outcome-panel {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 20px;
  }

  .outcome-score {
    width: 100%;
  }

  .outcome-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .outcome-metrics span {
    display: grid;
    gap: 3px;
    font-size: 0.72rem;
  }

  .outcome-actions .control-button {
    width: 100%;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .rank-podium {
    gap: 6px;
  }

  .podium-card {
    min-height: 128px;
    padding: 12px 7px;
    font-size: 0.82rem;
  }

  .podium-card.podium-1 {
    min-height: 148px;
  }

  .podium-card .message-avatar {
    width: 37px;
    height: 37px;
  }

  .leaderboard-head,
  .leaderboard-row {
    grid-template-columns: 48px minmax(0, 1fr) 78px;
    gap: 8px;
    padding: 11px;
  }

  .leaderboard-head span:last-child,
  .leaderboard-row span:last-child {
    display: none;
  }
}

@media (max-width: 390px) {
  :root {
    --cell-size: min(7.15vw, 34px);
  }

  .arcade-topbar {
    grid-template-columns: 1fr;
  }

  .top-account {
    position: absolute;
    top: 13px;
    right: 14px;
  }

  .arcade-brand {
    min-height: 42px;
  }

  .arcade-nav {
    grid-column: auto;
    grid-row: auto;
  }

  .brand-buoy {
    width: 37px;
    height: 37px;
  }

  .hero-copy h1,
  .journey-header h1,
  .turn-banner h1,
  .lobby-hero h1,
  .ranks-hero h1 {
    font-size: 1.83rem;
  }

  .deck-actions {
    grid-template-columns: 1fr;
  }

  .board-heading {
    margin-bottom: 8px;
  }

  .board-heading h2 {
    font-size: 1.18rem;
  }
}

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