@font-face {
  font-family: "Orbitron";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./orbitron-0-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Orbitron";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(./orbitron-1-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Orbitron";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(./orbitron-2-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Orbitron";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(./orbitron-3-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Orbitron";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(./orbitron-4-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Orbitron";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url(./orbitron-5-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Share Tech Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./share-tech-mono-0-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Rajdhani";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./rajdhani-0-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Rajdhani";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(./rajdhani-1-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Rajdhani";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(./rajdhani-2-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Rajdhani";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(./rajdhani-3-latin.woff2) format("woff2");
}
:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --panel: #111620;
  --line: #2a3245;
  --muted: #bdc7d8;
  --cyan: #00e5ff;
  --white: #f0f4f8;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--white);
  font:
    18px Rajdhani,
    system-ui,
    sans-serif;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}
header {
  height: 80px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5vw;
}
.brand {
  color: var(--white);
  text-decoration: none;
  letter-spacing: 2px;
  font:
    600 23px "Orbitron",
    sans-serif;
}
.brand b {
  color: var(--cyan);
  font-weight: 500;
}
.brandmark {
  color: var(--cyan);
  font-size: 30px;
  vertical-align: middle;
  margin-right: 12px;
}
.tag,
.eyebrow {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--muted);
}
.tag i {
  color: var(--cyan);
  margin: 0 10px;
}
main {
  max-width: 1440px;
  padding: 34px 5vw 40px;
  margin: auto;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font:
    600 clamp(32px, 4vw, 48px) "Orbitron",
    sans-serif;
  letter-spacing: 1px;
}
h2 {
  font:
    600 25px "Orbitron",
    sans-serif;
}
h3 {
  font-size: 17px;
}
.subtitle {
  color: var(--muted);
  line-height: 1.6;
  margin-top: 8px;
  font-size: 14px;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}
.step {
  color: var(--cyan);
  font-size: 13px;
  letter-spacing: 1px;
}
.lobby {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
  gap: 32px;
}
.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.section-label span {
  color: var(--cyan);
  font-size: 12px;
  border: 1px solid var(--line);
  padding: 5px 7px;
}
.section {
  margin-bottom: 26px;
}
label {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 9px;
}
input {
  border: 1px solid var(--line);
  background: #0b0e14;
  border-radius: 5px;
  padding: 14px 16px;
  width: 100%;
  color: var(--white);
}
.ship-card.active {
  border-color: var(--cyan);
  background: #00e5ff12;
}
.fleet {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.ship-card {
  position: relative;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 17px 14px;
}
.ship-card .number {
  position: absolute;
  right: 12px;
  top: 12px;
  font-size: 12px;
  color: var(--cyan);
}
.glyph {
  height: 75px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  font-size: 54px;
}
.ship-card h3 {
  margin-bottom: 5px;
}
.role {
  font-size: 12px;
  color: var(--muted);
}
.stats {
  margin-top: 17px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.9;
}
.stats b {
  float: right;
  color: #f0f4f8;
  font-weight: 500;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.panel-head {
  padding: 19px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-body {
  padding: 20px 22px;
}
.arena-mini {
  aspect-ratio: 1;
  position: relative;
  margin: 20px;
  background:
    radial-gradient(ellipse at center, #2a324566, transparent 70%),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent calc(12.5% - 1px),
      #2a324566 calc(12.5% - 1px),
      #2a324566 12.5%
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent calc(12.5% - 1px),
      #2a324566 calc(12.5% - 1px),
      #2a324566 12.5%
    );
  border: 1px solid var(--line);
}
.corner {
  position: absolute;
  text-align: center;
  color: var(--cyan);
  font-size: 26px;
}
.corner small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}
.corner.enemy {
  color: #ff5722;
}
.corner.ally {
  color: #00e5ff;
}
.c0 {
  left: 8%;
  top: 8%;
}
.c1 {
  right: 8%;
  bottom: 8%;
}
.c2 {
  right: 8%;
  top: 8%;
}
.c3 {
  left: 8%;
  bottom: 8%;
}
.center-cross {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #2a3245;
  font-size: 32px;
}
.facts {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--line);
  padding: 18px 5px;
  text-align: center;
}
.facts strong {
  display: block;
  font:
    600 26px "Orbitron",
    sans-serif;
}
.facts span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.primary {
  background: var(--cyan);
  color: #0b0e14;
  border: 0;
  border-radius: 5px;
  padding: 16px 22px;
  font-weight: 700;
  width: 100%;
}
.primary:hover {
  background: #66efff;
}
.secondary {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 11px 16px;
}
.launch {
  margin-top: 18px;
}
.footnote {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  margin-top: 12px;
  line-height: 1.6;
}
.battle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 24px;
  align-items: start;
}
.board-wrap {
  position: relative;
  max-width: calc(100vh - 205px);
  width: 100%;
  margin: auto;
}
.board {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  background: #0b0e14;
  border: 1px solid #2a3245;
  border-radius: 6px;
  touch-action: none;
  cursor: crosshair;
}
.battle-head {
  margin-bottom: 18px;
}
.phase {
  color: var(--cyan);
}
.clock {
  font:
    600 36px "Orbitron",
    sans-serif;
}
.timer {
  height: 3px;
  background: var(--line);
  margin-top: 12px;
}
.timer div {
  height: 100%;
  background: var(--cyan);
  transition: width 0.1s linear;
}
.roster {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}
.unit {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #0b0e14;
  padding: 12px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
}
.unit.active {
  border-color: var(--cyan);
}
.unit .icon {
  font-size: 28px;
  color: var(--cyan);
}
.unit .info {
  flex: 1;
}
.unit small {
  color: var(--muted);
  font-size: 12px;
  display: block;
  margin-top: 5px;
}
.health {
  height: 3px;
  background: #2a3245;
  margin-top: 7px;
}
.health i {
  display: block;
  background: var(--cyan);
  height: 100%;
}
.tools {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}
.tools button {
  flex: 1;
  padding: 12px 4px;
}
.tools .active {
  background: #00e5ff12;
  border-color: var(--cyan);
  color: var(--cyan);
}
.hint {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  min-height: 68px;
}
.players {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.player {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
}
.status {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  margin-top: 14px;
}
.legend {
  display: flex;
  justify-content: center;
  gap: 22px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}
.legend span:first-child {
  color: var(--cyan);
}
.legend span:last-child {
  color: #ffc107;
}
.result {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b0e14e6;
  padding: 24px;
  border-radius: 6px;
  text-align: center;
}
.result h2 {
  font-size: 42px;
  margin: 12px 0;
}
.result p {
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 24px;
}
.result .eyebrow {
  color: var(--cyan);
}
details {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
summary {
  cursor: pointer;
  color: var(--white);
}
.notice {
  color: #ffc107;
  font-size: 13px;
  margin-top: 12px;
}
@media (min-width: 1500px) {
  .board-wrap {
    max-width: 750px;
  }
}
@media (max-width: 900px) {
  header {
    height: 64px;
    padding: 0 22px;
  }
  .tag {
    display: none;
  }
  main {
    padding: 24px 22px;
  }
  .lobby {
    gap: 22px;
    grid-template-columns: 1.25fr 1fr;
  }
  .fleet {
    gap: 7px;
  }
  .ship-card {
    padding: 12px 9px;
  }
  .battle {
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 16px;
  }
  .panel-body {
    padding: 16px;
  }
  .board-wrap {
    max-width: none;
  }
}
@media (max-width: 680px) {
  main {
    padding: 22px 16px;
  }
  .heading {
    margin-bottom: 22px;
  }
  .step {
    display: none;
  }
  .lobby,
  .battle {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .lobby > aside .arena-mini {
    max-width: 290px;
    margin: 18px auto;
  }
  .lobby > aside {
    margin-top: 0;
  }
  .brand {
    font-size: 21px;
  }
  .ship-card h3 {
    font-size: 14px;
  }
  .stats {
    font-size: 12px;
  }
  .section {
    margin-bottom: 24px;
  }
  .battle-head h1 {
    font-size: 28px;
  }
  .battle .panel-head {
    padding: 12px 16px;
  }
  .roster {
    flex-direction: row;
    gap: 6px;
    margin: 12px 0;
  }
  .unit {
    flex: 1;
    padding: 9px 7px;
    display: block;
    min-width: 0;
  }
  .unit .icon {
    display: none;
  }
  .unit .info {
    font-size: 12px;
  }
  .unit small {
    font-size: 12px;
  }
  .hint {
    min-height: 0;
  }
  .players {
    margin-top: 12px;
  }
  .tools {
    margin: 12px 0;
  }
  .legend {
    gap: 12px;
  }
  .battle .panel-body {
    padding: 12px 14px;
  }
  .battle .panel-head h2 {
    font-size: 22px;
  }
}
@media (max-width: 680px) {
  .playing header {
    height: 46px;
  }
  .playing main {
    padding-top: 12px;
  }
  .playing .battle-head {
    margin-bottom: 12px;
  }
  .playing .battle-head .secondary {
    padding: 10px;
    font-size: 12px;
  }
  .playing .battle-head h1 {
    font-size: 25px;
  }
  .playing .legend {
    margin-top: 7px;
    font-size: 11px;
  }
  .playing .panel-head {
    padding: 8px 14px;
  }
  .playing .panel-body {
    padding: 10px 12px;
  }
  .playing .roster {
    margin: 8px 0;
  }
  .playing .hint {
    font-size: 13px;
  }
  .playing .status {
    font-size: 12px;
    margin-top: 8px;
  }
  .playing .tools {
    margin: 8px 0;
  }
  .playing .primary {
    padding: 13px 16px;
  }
  .playing .board-wrap {
    max-width: min(100%, calc(100svh - 405px));
  }
}

/* Battle workspace: arena first, compact fleet panel. */
.playing header {
  height: 48px;
}
.playing main {
  max-width: 1800px;
  padding: 12px 2vw 16px;
}
.playing .battle-head {
  margin-bottom: 12px;
}
.playing .battle-head h1 {
  font-size: 28px;
}
.battle-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.battle-actions .primary,
.battle-actions .secondary {
  width: auto;
  padding: 11px 14px;
  font-size: 14px;
  white-space: nowrap;
}
.playing .battle {
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 16px;
}
.playing .board-wrap {
  max-width: min(100%, calc(100svh - 150px));
}
.playing .panel-head {
  padding: 12px;
  gap: 8px;
}
.playing .panel-head h2 {
  font-size: 21px;
}
.playing .panel-head .eyebrow {
  font-size: 11px;
  letter-spacing: 1px;
}
.playing .clock {
  font-size: 30px;
}
.playing .panel-body {
  padding: 12px;
}
.playing .unit {
  padding: 10px 8px;
  gap: 7px;
}
.playing .unit .icon {
  font-size: 22px;
}
.playing .unit .info {
  font-size: 14px;
}
.playing .hint {
  min-height: 0;
  font-size: 14px;
}
.playing .player {
  gap: 6px;
  font-size: 12px;
}
.playing .player span:first-child {
  overflow-wrap: anywhere;
}
.playing .player span:last-child {
  white-space: nowrap;
}
.playing .status {
  font-size: 12px;
}
@media (max-width: 680px) {
  .playing main {
    padding: 10px 10px 16px;
  }
  .playing .battle {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .playing .board-wrap {
    max-width: 100%;
  }
  .playing .battle-head {
    gap: 8px;
    flex-wrap: wrap;
  }
  .playing .battle-head h1 {
    font-size: 22px;
  }
  .battle-actions .primary,
  .battle-actions .secondary {
    font-size: 12px;
    padding: 10px;
  }
  .playing .battle-head .eyebrow {
    font-size: 10px;
  }
  .playing .panel-head {
    padding: 7px 12px;
  }
  .playing .panel-body {
    padding: 8px 12px;
  }
  .playing .roster {
    margin: 6px 0;
  }
  .playing .unit {
    padding: 8px 6px;
  }
  .playing .unit .info {
    font-size: 12px;
  }
  .playing .hint {
    font-size: 13px;
  }
  .playing .players {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
    margin-top: 8px;
    padding-top: 6px;
  }
  .playing .status {
    margin-top: 6px;
  }
}

.fleet {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ship-card {
  cursor: default;
}
.quantity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.quantity button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #2a3245;
  font-size: 24px;
  color: var(--cyan);
}
.quantity output {
  font-size: 20px;
  font-weight: 700;
}
.quantity button:hover:not(:disabled) {
  border-color: var(--cyan);
}
@media (min-width: 1550px) {
  .fleet {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

[hidden] {
  display: none !important;
}
.account-bar {
  max-width: 1440px;
  margin: auto;
  padding: 16px 5vw 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}
.account-bar p {
  margin-right: auto;
}
.account-bar [data-google-button]:empty {
  display: none;
}
.playing .account-bar {
  display: none;
}
footer {
  max-width: 1440px;
  margin: auto;
  padding: 24px 5vw;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
footer a {
  color: var(--cyan);
}
footer p:last-child {
  flex-basis: 100%;
}
.advertisement {
  max-width: 970px;
  min-height: 120px;
  margin: 180px auto 24px;
  padding: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.privacy-copy {
  max-width: 800px;
  line-height: 1.75;
}
.privacy-copy h2 {
  margin: 28px 0 12px;
}
.privacy-copy a {
  color: var(--cyan);
}

.glyph {
  height: 110px;
}
.glyph img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px #00e5ff44);
}
.mini-ship {
  object-fit: contain;
  vertical-align: middle;
}
.unit .icon img {
  display: block;
  object-fit: contain;
}
.glyph img,
.story-ship-cards img,
.unit .icon img,
.story-ship-panel .unit img,
.mini-ship {
  transform: scale(1.3);
}
.fleet {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}

/* Tactical palette and typography roles. */
:root {
  --hostile: #ff5722;
  --neutral: #ffc107;
  --font-title: "Orbitron", sans-serif;
  --font-data: "Share Tech Mono", monospace;
}
.daily-login {
  padding: 24px;
  margin-top: 24px;
}
.daily-login-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.daily-login-total {
  color: var(--cyan);
  font: 32px var(--font-title);
  white-space: nowrap;
}
.daily-login-total small {
  color: var(--muted);
  font-size: 14px;
}
.daily-login-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.login-day {
  min-height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: var(--bg);
}
.login-day strong {
  font: 16px var(--font-data);
}
.login-day-symbol {
  font-size: 13px;
}
.login-day.target {
  border-color: var(--neutral);
}
.login-day.target .login-day-symbol {
  color: var(--neutral);
}
.login-day.completed {
  background: #00e5ff12;
  border-color: var(--cyan);
  color: var(--cyan);
}
.login-day.completed.target {
  box-shadow: inset 0 -3px 0 var(--neutral);
}
.login-day.next {
  outline: 1px dashed var(--cyan);
  outline-offset: -4px;
}
@media (max-width: 600px) {
  .daily-login {
    padding: 16px;
  }
  .daily-login-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }
  .daily-login-total {
    font-size: 24px;
  }
  .login-day {
    min-height: 54px;
  }
}
h3,
.unit .info {
  font-family: var(--font-title);
  font-size: 14px;
}
.stats,
.clock,
.mode strong,
.facts strong,
.quantity output,
.unit small,
.player span:last-child,
.step {
  font-family: var(--font-data);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.legend span:last-child {
  color: var(--hostile);
}
.brand {
  font-size: clamp(13px, 3.5vw, 23px);
}
.brandmark {
  margin-right: 5px;
}
.ship-card h3 {
  overflow-wrap: anywhere;
}
@media (max-width: 680px) {
  h1 {
    font-size: 26px;
  }
  h2 {
    font-size: 20px;
  }
  .result h2 {
    font-size: 26px;
  }
}

.mini-ship {
  filter: drop-shadow(0 0 5px currentColor);
}
.ranked-panel {
  margin-top: 20px;
}
.ranked-panel .panel-body {
  padding: 20px;
}
.ranked-panel select,
.ranking-dialog select {
  width: 100%;
  padding: 12px;
  background: #111723;
  color: #eee;
  border: 1px solid #526078;
  font: inherit;
}
.rank-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}
.rank-choice input {
  width: 20px;
  height: 20px;
}
.score-rules {
  color: #bbc9da;
  font-size: 14px;
  line-height: 1.7;
}
dialog {
  background: #111723;
  color: #f1f5f9;
  border: 1px solid #00e5ff;
  border-radius: 14px;
  padding: 24px;
  max-width: min(680px, 92vw);
  max-height: 85vh;
  overflow: auto;
}
dialog::backdrop {
  background: #000b;
}
dialog p {
  line-height: 1.6;
}
.surrender-dialog {
  border: 2px solid #ff5722;
}
.danger {
  background: #b9340d;
  color: white;
}
.ranking-dialog table {
  border-collapse: collapse;
  width: 100%;
  margin: 20px 0;
}
.ranking-dialog th,
.ranking-dialog td {
  padding: 10px 6px;
  text-align: left;
  border-bottom: 1px solid #38445a;
  overflow-wrap: anywhere;
}
.ranked-score {
  color: #00e5ff;
  font-weight: bold;
}

.profile-dialog {
  width: min(540px, 92vw);
}
.profile-dialog select {
  width: 100%;
  padding: 10px;
  background: #111723;
  color: #eee;
  border: 1px solid #526078;
  font: inherit;
}
.profile-dialog label {
  display: block;
  margin-top: 12px;
}
.profile-dialog fieldset {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid #526078;
}
.profile-dialog .rank-choice {
  display: flex;
}
.profile-dialog output {
  margin-right: 14px;
}
/* Main navigation and online arena flow */
.main-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  max-width: 1100px;
  margin: 40px auto;
}
.mode-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 36px;
  color: var(--white);
  min-height: 300px;
  background: linear-gradient(145deg, #132c3b, #0a1623);
  border: 1px solid var(--line);
  cursor: pointer;
}
.mode-card:hover {
  border-color: var(--cyan);
  transform: translateY(-2px);
}
.mode-card strong {
  font-size: 36px;
}
.mode-card > span:not(.eyebrow) {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}
.mode-card b {
  margin-top: auto;
  color: var(--cyan);
}
.mp-toolbar,
.arena-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.mp-toolbar {
  margin-bottom: 24px;
}
.arena-list {
  display: grid;
  gap: 14px;
}
.arena-row {
  padding: 24px;
}
.arena-row > div {
  min-width: 0;
}
.arena-row h2,
.arena-name {
  overflow-wrap: anywhere;
}
.waiting {
  max-width: 760px;
  margin: auto;
  text-align: center;
  padding: 40px;
}
.waiting .clock {
  display: block;
  margin: 32px;
}
.waiting .arena-name {
  font-size: 24px;
  margin: 16px 0;
}
.panel-body > .panel-head {
  padding: 0 0 24px;
}
dialog {
  max-width: min(480px, calc(100vw - 32px));
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
  background: var(--panel);
  color: var(--white);
}
dialog::backdrop {
  background: #030b13cc;
}
dialog h2 {
  margin-bottom: 24px;
}
dialog input {
  margin: 12px 0 24px;
}
#network-message:not(:empty) {
  padding: 12px;
  border: 1px solid #765e36;
  border-radius: 6px;
  margin-bottom: 16px;
}
#google-login {
  margin: 20px 0;
}
@media (max-width: 680px) {
  .main-options {
    grid-template-columns: 1fr;
    margin: 20px 0;
    gap: 16px;
  }
  .mode-card {
    min-height: 220px;
    padding: 24px;
    gap: 18px;
  }
  .mode-card strong {
    font-size: 30px;
  }
  .mp-toolbar,
  .arena-row {
    align-items: stretch;
    flex-direction: column;
  }
  .mp-toolbar button {
    width: 100%;
  }
  .waiting {
    padding: 24px 16px;
  }
  .waiting .arena-name {
    font-size: 18px;
  }
  .heading {
    flex-wrap: wrap;
  }
  .battle-actions {
    flex-wrap: wrap;
  }
  .arena-row {
    padding: 18px;
  }
  .panel-head {
    flex-wrap: wrap;
  }
}

/* Responsive command deck: keep time, arena and orders in reading order. */
.playing main {
  --arena-size: min(76rem, calc(100svh - 170px));
  max-width: calc(var(--arena-size) + 340px);
  padding: 12px 16px 20px;
}
.playing .battle {
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
}
.playing .board-wrap {
  max-width: 100%;
}
.battle-stage {
  min-width: 0;
}
.battle-console {
  overflow: hidden;
}
.playing .panel-head {
  padding: 16px;
}
.playing .panel-body {
  padding: 16px;
}
.playing .timer {
  margin-top: 0;
  height: 4px;
}
.playing .battle-head h1 {
  font-size: clamp(20px, 2.3vw, 28px);
}
.playing .eyebrow {
  font-size: 12px;
  letter-spacing: 1px;
}
.playing .unit {
  padding: 12px;
  min-height: 64px;
}
.playing .unit .info {
  font:
    600 16px Rajdhani,
    sans-serif;
  min-width: 0;
}
.playing .unit small {
  font:
    14px "Share Tech Mono",
    monospace;
  line-height: 1.35;
}
.playing .unit.active {
  background: #00e5ff12;
  box-shadow: inset 3px 0 var(--cyan);
}
.playing .unit:disabled {
  opacity: 0.72;
}
.playing .hint {
  font-size: 16px;
  line-height: 1.4;
  color: var(--white);
  border-left: 2px solid var(--cyan);
  padding: 10px 12px;
  background: #00e5ff08;
  margin: 12px 0;
  min-height: 64px;
}
.playing .status,
.playing .player,
.legend {
  font-size: 14px;
}
.battle-actions .primary,
.battle-actions .secondary {
  min-height: 48px;
  font:
    600 16px Rajdhani,
    sans-serif;
  padding: 10px 16px;
}
.command-actions .primary {
  width: 100%;
}
.playing .players {
  margin-top: 14px;
  padding-top: 8px;
}
.playing .player {
  padding: 6px 0;
}
#network-message:empty {
  display: none;
}
.board:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}
.subtitle,
.footnote,
.role,
details,
.account-bar,
.site-footer {
  font-size: 16px;
}
.section-label .step,
.facts span,
.mode span,
.stats {
  font-size: 14px;
}
input,
select {
  min-height: 48px;
}
.quantity button {
  min-width: 48px;
  min-height: 48px;
}
.ship-card h3 {
  font-size: 21px;
}
.menu-card {
  min-height: 220px;
}

@media (max-width: 1000px) {
  .playing main {
    max-width: 760px;
  }
  .playing .battle {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .battle-console {
    display: contents;
  }
  .phase-strip {
    grid-row: 1;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
  }
  .battle-stage {
    grid-row: 1;
  }
  .command-panel {
    grid-row: 2;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
  }
  .playing .phase-strip .panel-head {
    padding: 8px 12px;
  }
  .phase-strip .panel-head > div {
    display: flex;
    align-items: center;
    gap: 16px;
  }
  .playing .phase {
    font-size: 20px;
  }
  .playing .clock {
    font-size: 26px;
  }
  .playing .roster {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 8px 0;
  }
  .playing .unit {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 8px;
  }
  .playing .unit .icon {
    display: none;
  }
  .playing .unit .info {
    font-size: 16px;
  }
  .playing .unit small {
    font-size: 12px;
  }
  .playing .hint {
    min-height: 0;
    margin: 8px 0;
  }
  .playing .players {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
  }
  .playing .status {
    margin-top: 8px;
    font-size: 14px;
  }
}
@media (max-width: 480px) {
  .playing header {
    height: 42px;
    padding: 0 12px;
  }
  .playing .brand {
    font-size: 14px;
    letter-spacing: 1px;
  }
  .playing .brandmark {
    font-size: 19px;
    margin-right: 6px;
  }
  .playing main {
    padding: 8px 10px 16px;
  }
  .playing .battle-head {
    margin-bottom: 8px;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .playing .battle-head h1 {
    font-size: 20px;
  }
  .playing .battle-head .eyebrow {
    font-size: 12px;
  }
  .battle-head .secondary {
    font-size: 14px;
    padding: 8px 12px;
  }
  .phase-strip .panel-head > div {
    gap: 10px;
  }
  .playing .phase {
    font-size: 16px;
  }
  .playing .clock {
    font-size: 22px;
  }
  .playing .panel-body {
    padding: 10px;
  }
  .playing .unit .info {
    font-size: 14px;
  }
  .playing .hint {
    font-size: 14px;
    padding: 8px;
  }
  .legend {
    gap: 14px;
    margin-top: 6px;
    font-size: 12px;
  }
  .playing .players {
    margin-top: 8px;
  }
  .menu-card {
    min-height: 180px;
    padding: 22px;
  }
}
@media (max-height: 540px) and (min-width: 700px) {
  .playing main {
    max-width: 1040px;
  }
  .playing .battle {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
  .playing .board-wrap {
    max-width: calc(100svh - 148px);
  }
  .battle-stage {
    grid-row: auto;
  }
  .battle-console {
    display: block;
  }
  .phase-strip,
  .command-panel {
    border: 0;
  }
  .phase-strip .panel-head > div {
    display: block;
  }
}

.playing .battle-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.playing .battle-head .phase-strip {
  grid-column: 1 / -1;
  grid-row: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.playing .battle-head .phase-strip .panel-head {
  min-height: 44px;
  padding: 6px 12px;
}
.playing .battle-head .phase-strip .panel-head > div {
  display: flex;
  align-items: center;
  gap: 12px;
}
.playing .battle-head #round {
  font-size: 14px;
}
.playing .battle-head .phase {
  font-size: 18px;
}
.playing .battle-head .clock {
  font-size: 24px;
}
.launch-panel {
  padding: 16px;
}
.launch-panel .launch {
  margin-top: 0;
}
@media (max-width: 480px) {
  .playing .battle-head {
    gap: 8px;
  }
  .playing .battle-head .battle-actions {
    gap: 6px;
  }
  .playing .battle-head .battle-actions button {
    padding: 8px 10px;
    font-size: 14px;
  }
}

.audio-controls {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}
.audio-controls summary {
  min-height: 44px;
  padding: 12px 0;
  color: var(--white);
  cursor: pointer;
  font-size: 16px;
}
.audio-settings {
  display: grid;
  gap: 8px;
  padding-bottom: 8px;
}
.audio-settings label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 16px;
}
.audio-settings label:has([type="checkbox"]) {
  justify-content: flex-start;
}
.audio-settings input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  height: 20px;
  accent-color: var(--cyan);
}
.audio-settings input[type="range"] {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  accent-color: var(--cyan);
}
.audio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.audio-actions .secondary {
  min-height: 44px;
  flex: 1;
  padding: 8px;
  font-size: 14px;
}
.audio-settings p {
  font-size: 14px;
  line-height: 1.4;
  color: var(--muted);
}

#menu-sound {
  min-height: 44px;
  min-width: 72px;
  padding: 8px 14px;
  margin-left: 16px;
}
.playing #menu-sound {
  display: none;
}
header .tag {
  margin-left: auto;
}
.ship-description {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
  margin: 10px 0 14px;
}
.ship-card {
  display: flex;
  flex-direction: column;
}
.ship-card .quantity {
  margin-top: 0;
}
.ship-card .stats {
  margin-top: auto;
  margin-bottom: 14px;
}
@media (max-width: 680px) {
  header .brand {
    font-size: 14px;
    letter-spacing: 1px;
  }
  header .brandmark {
    margin-right: 6px;
    font-size: 20px;
  }
  #menu-sound {
    margin-left: 8px;
    min-width: 60px;
    padding: 8px;
  }
}

.daily-missions {
  padding: 24px;
  margin-top: 24px;
}
.daily-missions h2 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}
.mission-track {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}
.mission {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.mission > span:first-child {
  font-size: 24px;
  color: var(--cyan);
}
.mission small {
  color: var(--muted);
  font-size: 14px;
}
.mission.earned {
  border-color: var(--cyan);
  background: #00e5ff09;
}
.power-inventory {
  margin-bottom: 20px;
}
.power-inventory h2 {
  font-size: 1.15rem;
}
.power-inventory h3 {
  font-size: 1rem;
  margin: 20px 0 12px;
}
.power-catalog {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.power-catalog button {
  display: flex;
  align-items: center;
  text-align: left;
  gap: 12px;
  padding: 12px;
  width: 100%;
}
.power-catalog button > span:nth-child(2) {
  display: grid;
  gap: 4px;
  flex: 1;
}
.power-catalog small {
  color: var(--muted);
  font-size: 14px;
}
.power-icon {
  color: var(--cyan);
  font-size: 26px;
}
.loadout-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.loadout-slots button {
  display: grid;
  gap: 8px;
  padding: 10px 5px;
  min-height: 100px;
}
.loadout-slots span {
  font-size: 22px;
}
.loadout-slots small {
  font-size: 14px;
}
.arena-with-powers {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}
.arena-with-powers > .board-wrap {
  flex: 1;
  min-width: 0;
}
.battle-power-bar {
  width: 108px;
  flex-shrink: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.battle-power-bar h2 {
  font-size: 14px;
  margin-bottom: 12px;
}
.battle-power-slots {
  display: grid;
  gap: 10px;
}
.battle-power-slots button {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 10px 4px;
  min-height: 95px;
}
.battle-power-slots small {
  font-size: 12px;
}
.power-slot.active {
  outline: 2px solid var(--cyan);
  background: #00e5ff15;
}
.power-slot.assigned {
  border-color: var(--cyan);
}
#power-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
@media (max-width: 680px) {
  .arena-with-powers {
    gap: 6px;
  }
  .battle-power-bar {
    width: 58px;
    padding: 5px;
  }
  .battle-power-bar h2 {
    font-size: 12px;
    overflow-wrap: anywhere;
  }
  .battle-power-slots button {
    padding: 7px 1px;
    min-height: 82px;
  }
  .battle-power-slots small {
    font-size: 12px;
    overflow-wrap: anywhere;
  }
  .mission-track {
    grid-template-columns: 1fr;
  }
}

.unit.power-eligible {
  outline: 2px solid var(--cyan);
}
.ship-power-label {
  color: var(--cyan) !important;
}
.practice-choice {
  margin-bottom: 14px;
}

.arena-with-powers > .board-wrap {
  margin: 0;
  align-self: flex-start;
}
@media (max-width: 680px) {
  .battle-power-bar {
    width: 70px;
  }
  .battle-power-slots small {
    letter-spacing: -0.03em;
  }
}

/* Primary battle surface: prominent time and arena, quiet support panels. */
.playing main {
  --arena-size: min(78rem, calc(100svh - 170px));
  --power-rail: 76px;
  --fleet-rail: 216px;
  max-width: calc(
    var(--arena-size) + var(--power-rail) + var(--fleet-rail) + 64px
  );
  padding: 8px 16px 18px;
}
.playing .battle-head {
  grid-template-columns: minmax(110px, 160px) minmax(0, 1fr) var(--fleet-rail);
  gap: 12px;
  margin-bottom: 12px;
  padding: 6px 0 10px;
}
.playing .battle-context h1 {
  margin-top: 5px;
  font-size: 20px;
  color: var(--muted);
}
.playing .battle-context .eyebrow {
  font-size: 10px;
  letter-spacing: 1px;
  line-height: 1.5;
}
.playing .battle-head .phase-strip {
  grid-column: auto;
  border-color: #00e5ff38;
  border-radius: 8px;
  background: #0d1820;
}
.playing .battle-head .phase-strip .panel-head {
  min-height: 76px;
  flex-wrap: nowrap;
  justify-content: center;
  gap: clamp(20px, 4vw, 64px);
  padding: 8px 18px;
}
.playing .battle-head .phase-strip .panel-head > .round-block {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.playing .battle-head #round {
  font-family: Orbitron, sans-serif;
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.playing .battle-head .phase {
  font:
    500 14px Rajdhani,
    sans-serif;
  color: var(--muted);
}
.playing .battle-head .phase-strip .panel-head > .countdown {
  display: grid;
  justify-items: center;
  gap: 2px;
  flex-shrink: 0;
  min-width: 92px;
}
.countdown-label {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.playing .battle-head .clock {
  color: var(--cyan);
  font-size: 44px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.playing .battle-head .time-critical {
  border-color: #ffb26b80;
}
.time-critical .clock {
  color: #ffb26b !important;
}
.time-critical .timer > div {
  background: #ffb26b;
}
.playing .battle-head .battle-actions {
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
}
.playing .battle-head .battle-actions .primary {
  min-height: 44px;
  padding: 10px;
  font-size: 15px;
}
.playing .battle-head .battle-actions .secondary {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
  border-color: transparent;
  color: var(--muted);
}
.playing .battle-head .battle-actions .secondary:hover {
  border-color: var(--line);
  color: var(--white);
}
.playing .battle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--fleet-rail);
  gap: 12px;
}
.battle-stage {
  grid-row: auto;
}
.arena-with-powers {
  gap: 10px;
}
.playing .board-wrap {
  max-width: var(--arena-size);
}
.playing .board {
  border-color: #59707b;
  border-radius: 8px;
  box-shadow: 0 0 28px #00e5ff08;
}
.battle-power-bar {
  width: var(--power-rail);
  padding: 7px;
  background: #0c1119;
  border-color: #202a36;
}
.battle-power-bar h2 {
  color: var(--muted);
  font:
    500 12px Rajdhani,
    sans-serif;
  margin-bottom: 8px;
  text-align: center;
}
.battle-power-slots {
  gap: 6px;
}
.battle-power-slots button {
  min-height: 78px;
  padding: 7px 2px;
  gap: 4px;
  background: #0b1018;
  border: 1px solid #28323f;
  border-radius: 5px;
}
.battle-power-slots .power-icon {
  font-size: 24px;
  line-height: 1;
}
.battle-power-slots small {
  font-size: 10px;
  line-height: 1.25;
}
#power-hint {
  display: none;
  font-size: 11px;
  line-height: 1.4;
  margin-top: 8px;
}
.picking-power #power-hint {
  display: block;
  color: var(--cyan);
}
.battle-console {
  display: block;
  background: #0c1119;
  border-color: #202a36;
}
.playing .command-panel {
  padding: 12px;
  background: transparent;
  border: 0;
}
.playing .command-panel > .eyebrow {
  font-size: 10px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.playing .roster {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
}
.playing .unit {
  min-height: 56px;
  flex-direction: row;
  align-items: center;
  padding: 8px;
  gap: 7px;
  border-color: #28323f;
}
.playing .unit .icon {
  display: block;
}
.playing .unit .info {
  font-size: 14px;
}
.playing .unit small {
  font-size: 11px;
}
.playing .hint {
  min-height: 0;
  padding: 6px 0;
  margin: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
}
.playing .status {
  margin-top: 5px;
  font-size: 12px;
}
.playing .players {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
  padding-top: 6px;
}
.playing .player {
  font-size: 11px;
  padding: 5px 0;
}
.playing .player span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.playing .audio-controls {
  margin-top: 8px;
}
.playing .audio-controls summary {
  font-size: 13px;
  min-height: 36px;
  padding: 8px 0;
}
.playing .legend {
  font-size: 11px;
  margin-top: 7px;
  padding-left: calc(var(--power-rail) + 10px);
}

@media (max-width: 1000px) {
  .playing main {
    max-width: calc(var(--arena-size) + var(--power-rail) + 42px);
  }
  .playing .battle {
    grid-template-columns: minmax(0, 1fr);
  }
  .playing .battle-head {
    grid-template-columns: minmax(0, 1fr) 150px;
  }
  .battle-context {
    display: none;
  }
  .playing .roster {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .battle-support {
    display: flex;
    align-items: flex-start;
    gap: 20px;
  }
  .battle-support > div {
    flex: 1;
    min-width: 0;
  }
}
@media (max-width: 600px) {
  .playing main {
    --power-rail: 54px;
    --arena-size: min(100vw, calc(100svh - 150px));
    padding: 6px 8px 16px;
  }
  .playing .battle-head {
    grid-template-columns: minmax(0, 1fr) 106px;
    gap: 6px;
    margin-bottom: 8px;
    padding: 4px 0 8px;
  }
  .playing .battle-head .phase-strip .panel-head {
    min-height: 66px;
    padding: 8px;
    gap: 10px;
    justify-content: space-between;
  }
  .playing .battle-head #round {
    font-size: clamp(12px, 3.6vw, 17px);
    letter-spacing: 0;
  }
  .playing .battle-head .phase {
    font-size: 12px;
  }
  .playing .battle-head .phase-strip .panel-head > .countdown {
    min-width: 48px;
  }
  .countdown-label {
    font-size: 8px;
    letter-spacing: 0.06em;
  }
  .playing .battle-head .clock {
    font-size: 32px;
  }
  .playing .battle-head .battle-actions .primary {
    padding: 8px 4px;
    font-size: 12px;
  }
  .arena-with-powers {
    gap: 6px;
  }
  .battle-power-bar {
    padding: 4px;
  }
  .battle-power-bar h2 {
    font-size: 10px;
  }
  .battle-power-slots button {
    min-height: 72px;
    padding: 6px 0;
  }
  .battle-power-slots .power-icon {
    font-size: 20px;
  }
  .battle-power-slots small {
    font-size: 10px;
    overflow-wrap: normal;
    letter-spacing: -0.03em;
  }
  .playing .legend {
    padding-left: calc(var(--power-rail) + 6px);
    gap: 12px;
    font-size: 10px;
  }
  .playing .command-panel {
    padding: 9px;
  }
  .playing .unit {
    flex-direction: column;
    align-items: stretch;
    padding: 7px;
    min-height: 62px;
  }
  .playing .unit .icon {
    display: none;
  }
  .playing .unit .info {
    font-size: 12px;
  }
  .playing .unit small {
    font-size: 10px;
  }
  .playing .hint {
    font-size: 12px;
  }
  .battle-support {
    gap: 10px;
  }
}
@media (max-height: 540px) and (min-width: 700px) {
  .playing header {
    height: 36px;
  }
  .playing main {
    --arena-size: calc(100svh - 128px);
    --power-rail: 68px;
    --fleet-rail: 190px;
    max-width: calc(
      var(--arena-size) + var(--power-rail) + var(--fleet-rail) + 64px
    );
    padding-top: 4px;
  }
  .playing .battle {
    grid-template-columns: minmax(0, 1fr) var(--fleet-rail);
  }
  .playing .battle-head {
    grid-template-columns: minmax(0, 1fr) var(--fleet-rail);
    padding: 4px 0 8px;
    margin-bottom: 8px;
  }
  .battle-context {
    display: none;
  }
  .playing .battle-head .phase-strip .panel-head {
    min-height: 56px;
    padding: 5px 10px;
    gap: 16px;
  }
  .playing .battle-head #round {
    font-size: 16px;
  }
  .playing .battle-head .clock {
    font-size: 30px;
  }
  .playing .battle-head .phase-strip .panel-head > .countdown {
    min-width: 64px;
  }
  .playing .battle-head .battle-actions .primary {
    min-height: 36px;
    padding: 6px;
    font-size: 13px;
  }
  .playing .battle-head .battle-actions .secondary {
    min-height: 22px;
    padding: 2px;
  }
  .battle-power-slots button {
    min-height: 60px;
    padding: 5px 1px;
    gap: 3px;
  }
  .battle-power-slots .power-icon {
    font-size: 18px;
  }
  .playing .roster {
    display: flex;
    flex-direction: column;
  }
  .battle-support {
    display: block;
  }
}

/* Fleet preparation: ships first, optional equipment below the lineup. */
.fleet-lobby {
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: start;
  gap: 24px;
}
body:has(.fleet-lobby) .heading h1 {
  font-size: clamp(26px, 3vw, 40px);
}
.fleet-lobby > div {
  min-width: 0;
}
.fleet-lobby > aside {
  position: sticky;
  top: 16px;
}
.fleet-lobby .ranked-panel .panel-head {
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px;
}
.fleet-lobby .ranked-panel h2 {
  font-size: 18px;
}
.fleet-lobby .ranked-panel .secondary {
  padding: 8px 10px;
  font-size: 14px;
}
.fleet-lobby .fleet,
.fleet-preparation .fleet {
  --fleet-columns: 3;
  --fleet-card-gap: 16px;
}
.fleet-lobby .ship-card,
.fleet-preparation .ship-card {
  padding: 20px 16px 16px;
  background: linear-gradient(160deg, #142330, #0e141d 70%);
  border-color: #344757;
  border-radius: 10px;
}
.fleet-lobby .ship-card.active,
.fleet-preparation .ship-card.active {
  border-color: var(--cyan);
  box-shadow: inset 0 3px var(--cyan);
  background: linear-gradient(160deg, #173746, #0e1822 70%);
}
.fleet-lobby .glyph,
.fleet-preparation .glyph {
  height: 166px;
  margin-bottom: 12px;
  background: radial-gradient(ellipse, #00e5ff12, transparent 70%);
}
.fleet-lobby .glyph img,
.fleet-preparation .glyph img {
  width: 144px;
  height: 144px;
  max-width: 100%;
  filter: drop-shadow(0 0 18px #00e5ff55);
}
.fleet-lobby .ship-card h3,
.fleet-preparation .ship-card h3 {
  font-size: 22px;
}
.fleet-lobby .ship-card .role,
.fleet-preparation .ship-card .role {
  color: var(--cyan);
  font-size: 14px;
}
.fleet-lobby .quantity,
.fleet-preparation .quantity {
  margin-top: auto;
}
.fleet-power-options {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c1119;
}
.fleet-power-options > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 15px;
}
.fleet-power-options > summary::before {
  content: "+";
  color: var(--cyan);
}
.fleet-power-options[open] > summary::before {
  content: "−";
}
.fleet-power-options > summary > span {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}
.fleet-power-options .power-inventory {
  margin-bottom: 0;
  background: transparent;
  border: 0;
}
.fleet-power-options .panel-body {
  padding: 12px 16px;
}
.fleet-power-options .power-catalog {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.fleet-power-options .power-catalog button {
  padding: 10px;
  gap: 8px;
  background: #101721;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.fleet-power-options .power-catalog strong {
  font-size: 14px;
}
.fleet-power-options .power-catalog small {
  font-size: 12px;
}
.fleet-power-options .loadout-slots button {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101721;
}
.fleet-power-options .practice-choice {
  margin: 6px 16px;
}
.launch-panel {
  display: block;
}
.launch-panel #new-battle {
  width: 100%;
  margin-top: 8px;
  font-size: 14px;
}
.saved-battle-note {
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 12px;
  color: var(--cyan);
}
#launch-status:empty {
  display: none;
}
#launch-status {
  color: #ffb26b;
  font-size: 14px;
  line-height: 1.4;
  margin-top: 10px;
}
.launch-panel details[open] {
  max-height: 55svh;
  overflow: auto;
}
@media (max-width: 1100px) {
  .fleet-lobby .fleet,
  .fleet-preparation .fleet {
    --fleet-columns: 2;
  }
  .fleet-power-options .power-catalog {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 680px) {
  body:has(.fleet-lobby) header {
    height: 48px;
  }
  body:has(.fleet-lobby) .account-bar {
    padding: 6px 16px;
  }
  body:has(.fleet-lobby) main {
    padding-top: 12px;
  }
  body:has(.fleet-lobby) .heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    margin-bottom: 16px;
  }
  body:has(.fleet-lobby) .heading h1 {
    font-size: clamp(18px, 5vw, 22px);
  }
  body:has(.fleet-lobby) .heading .eyebrow {
    display: none;
  }
  body:has(.fleet-lobby) .heading .subtitle {
    font-size: 13px;
    margin-top: 4px;
    line-height: 1.4;
  }
  body:has(.fleet-lobby) #main-menu {
    padding: 8px;
    font-size: 13px;
  }
  .fleet-lobby {
    grid-template-columns: minmax(0, 1fr);
  }
  .fleet-lobby > aside {
    position: static;
  }
  body:has(.fleet-lobby) main {
    padding-bottom: 20px;
  }
  .fleet-lobby .launch-panel {
    position: static;
    padding: 12px;
    border-radius: 8px;
  }
  .fleet-lobby .launch-panel > details {
    margin-top: 8px;
    font-size: 13px;
  }
  .fleet-lobby .launch-panel > details > summary {
    padding: 4px 0;
  }
  .fleet-lobby .ship-card,
  .fleet-preparation .ship-card {
    padding: 14px 10px 12px;
  }
  .fleet-lobby .glyph,
  .fleet-preparation .glyph {
    height: 132px;
    margin-bottom: 8px;
  }
  .fleet-lobby .glyph img,
  .fleet-preparation .glyph img {
    width: 120px;
    height: 120px;
  }
  .fleet-lobby .ship-card h3,
  .fleet-preparation .ship-card h3 {
    font-size: 18px;
  }
  .fleet-lobby .ship-description,
  .fleet-preparation .ship-description {
    font-size: 14px;
  }
}
/* Story Mode: mission map and an arena-led, untimed planning surface. */
.mode-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px #00e5ff55);
}
.mission-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.audio-note {
  color: var(--muted);
  font-size: 0.85rem;
}
.single-options:has(.story-mode-card) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.story-mode-card {
  border-color: #496c89;
  background: linear-gradient(135deg, #142b3a, #111620);
}
.main-options:has(.story-mode-card) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.story-heading {
  align-items: flex-start;
  gap: 20px;
}
.story-heading h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}
.story-chapters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.story-chapter h2 {
  font-size: 1.6rem;
}
.story-chapter p {
  font-size: 1rem;
  line-height: 1.6;
  color: #b8c8da;
  min-height: 8em;
}
.story-missions {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}
.story-mission {
  display: flex;
  align-items: center;
  text-align: left;
  gap: 12px;
  padding: 16px 12px;
  background: #0d1420;
  border: 1px solid #2a3b52;
  min-height: 84px;
  width: 100%;
}
.story-mission:not(:disabled):hover {
  border-color: #00e5ff;
}
.story-mission.complete {
  border-color: #347c66;
}
.story-mission-number {
  flex-shrink: 0;
  color: #00e5ff;
  font:
    1.1rem "Share Tech Mono",
    monospace;
}
.story-mission strong {
  display: block;
  font-size: 1rem;
  line-height: 1.4;
}
.story-mission small {
  display: block;
  color: #9aacbd;
  font-size: 0.875rem;
  margin-top: 5px;
}
.story-stars {
  color: #e9bf74;
  font-size: 1.15rem;
  margin-left: auto;
  white-space: nowrap;
}
.story-resume {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  padding: 24px;
  margin-bottom: 24px;
  border-color: #00e5ff;
}
.story-resume div {
  flex: 1;
  min-width: 230px;
}
.story-resume p,
.story-unlocks p {
  color: #b8c8da;
  font-size: 1rem;
}
.story-unlocks {
  margin-top: 24px;
}
.story-unlocks .panel-body > div {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0;
}
.story-unlocks span {
  border: 1px solid #2a3b52;
  padding: 8px 14px;
}
.story-briefing {
  margin-bottom: 24px;
  border-left: 3px solid #e9bf74;
}
.story-briefing p {
  font-size: 1rem;
  line-height: 1.6;
}
.story-reward {
  color: #e9bf74;
}
.story-preparation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px;
}
.story-launch {
  align-self: start;
  position: sticky;
  top: 20px;
}
.story-launch label {
  display: block;
  margin-bottom: 10px;
}
.story-launch select {
  width: 100%;
}
.story-launch p {
  font-size: 1rem;
  line-height: 1.5;
  color: #b8c8da;
}
.story-launch .primary {
  width: 100%;
}
.story-ship-cards {
  display: grid;
  --fleet-columns: 3;
  --fleet-card-gap: 14px;
  padding: 20px;
}
.story-ship-cards .ship-card-art {
  height: 150px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.story-ship-cards img {
  width: 150px;
  height: 150px;
  object-fit: contain;
}
.story-ship-cards p {
  font-size: 0.875rem;
  line-height: 1.5;
}
.story-ship-stats {
  font-size: 0.875rem;
  color: #9aacbd;
  line-height: 1.8;
  margin: 12px 0;
}
.story-locked {
  opacity: 0.55;
}
.story-ship-cards .active {
  border-color: #00e5ff;
  background: #10232e;
}
.story-ship-cards .ship-counter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.story-ship-cards button {
  min-width: 44px;
  min-height: 44px;
}
.story-battle-head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #0b101bec;
  backdrop-filter: blur(12px);
  display: grid;
  grid-template-columns: 210px 1fr auto auto;
  gap: 20px;
  align-items: center;
  border: 1px solid #314763;
  padding: 16px 20px;
}
.story-round {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.story-round strong {
  font:
    1.8rem "Share Tech Mono",
    monospace;
  color: #f0f4f8;
}
.story-round > span:last-child {
  font-size: 0.875rem;
  color: #9aacbd;
}
.story-objective strong {
  display: block;
  font-size: 1rem;
  line-height: 1.5;
}
.story-objective span {
  display: block;
  font-size: 0.875rem;
  color: #e9bf74;
  line-height: 1.5;
}
.story-battle-layout {
  display: grid;
  grid-template-columns: 146px minmax(0, 1fr) 205px;
  align-items: start;
  gap: 18px;
  margin-top: 12px;
}
.story-arena {
  min-width: 0;
  width: 100%;
  max-width: min(100%, calc(100svh - 190px));
  margin-inline: auto;
  position: relative;
}
#story-board {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border: 1px solid #314763;
  touch-action: manipulation;
  background: #0b0e14;
}
.story-arena-key {
  color: #9aacbd;
  font-size: 0.875rem;
  line-height: 1.5;
}
.story-power,
.story-ship-panel {
  padding: 12px;
}
.story-power h2,
.story-ship-panel h2 {
  font-size: 1rem;
  margin: 6px 0 14px;
}
.story-power #battle-power-ups {
  padding: 0;
}
.story-power .battle-power-slots {
  display: grid;
  grid-template-columns: 1fr;
}
.story-power small {
  font-size: 0.875rem;
}
.story-power details {
  margin-top: 20px;
}
.story-ship-panel .unit {
  width: 100%;
  margin-bottom: 8px;
  display: flex;
  flex-direction: row;
  gap: 8px;
  padding: 10px 6px;
  text-align: left;
}
.story-ship-panel .unit img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.story-ship-panel .unit strong {
  font-size: 0.875rem;
}
.story-ship-panel .unit small {
  display: block;
  font-size: 0.875rem;
  color: #9aacbd;
}
.story-ship-panel .selected {
  border-color: #00e5ff;
  background: #10232e;
}
.story-ship-panel > p {
  font-size: 0.875rem;
  color: #9aacbd;
  line-height: 1.5;
}
.story-ship-panel > button {
  width: 100%;
  margin-top: 12px;
  font-size: 0.875rem;
}
.story-special-status {
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid #314763;
  padding-top: 12px;
}
.story-special-status span {
  color: #9aacbd;
}
.story-debrief {
  margin: 20px 0;
  border-color: #e9bf74;
}
.story-debrief p {
  font-size: 1rem;
  line-height: 1.6;
}
.story-debrief button {
  margin: 8px 8px 0 0;
}
@media (max-width: 1050px) {
  .story-chapters {
    grid-template-columns: 1fr;
  }
  .story-chapter p {
    min-height: 0;
  }
  .story-missions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .story-battle-head {
    grid-template-columns: 180px 1fr auto;
    gap: 12px;
  }
  #story-pause {
    grid-column: 3;
  }
  .story-battle-layout {
    grid-template-columns: 110px minmax(0, 1fr);
  }
  .story-ship-panel {
    grid-column: 2;
  }
}
@media (max-width: 650px) {
  .main-options:has(.story-mode-card),
  .story-missions,
  .story-preparation {
    grid-template-columns: 1fr;
  }
  .story-heading {
    flex-direction: column;
  }
  .story-ship-cards {
    --fleet-columns: 2;
    --fleet-card-gap: 10px;
    padding: 10px;
  }
  .story-ship-cards .ship-card-art {
    height: 120px;
  }
  .story-ship-cards img {
    width: 120px;
    height: 120px;
  }
  .story-launch {
    position: static;
    margin-bottom: 20px;
  }
  .story-preparation {
    padding-bottom: 85px;
  }
  #story-start {
    position: fixed;
    z-index: 25;
    left: 16px;
    right: 16px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: auto;
    min-height: 52px;
    box-shadow:
      0 0 0 8px #0b0e14,
      0 -8px 24px #0008;
  }
  #story-start-status:not(:empty) {
    position: fixed;
    z-index: 25;
    bottom: 78px;
    left: 16px;
    right: 16px;
    padding: 12px;
    background: #182334;
    border: 1px solid #ff9566;
  }
  .story-battle-head {
    grid-template-columns: 1fr auto;
    padding: 10px;
    gap: 8px;
  }
  .story-round strong {
    font-size: 1.6rem;
  }
  .story-objective {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  #story-ready {
    grid-column: 2;
    grid-row: 1;
    padding: 12px;
    font-size: 0.875rem;
    min-height: 44px;
  }
  #story-pause {
    grid-column: 1 / -1;
    grid-row: 3;
    padding: 8px;
    min-height: 44px;
  }
  .story-battle-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .story-arena {
    order: 0;
    width: 100%;
    max-width: none;
  }
  .story-power {
    order: 1;
    width: 100%;
  }
  .story-ship-panel {
    order: 2;
    width: 100%;
  }
  #story-units {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .story-ship-panel .unit {
    flex-direction: column;
    min-width: 0;
    padding: 8px 4px;
  }
  .story-ship-panel .unit strong {
    overflow-wrap: anywhere;
  }
  .story-power .battle-power-slots {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .story-arena-key {
    font-size: 0.875rem;
  }
  #story-board {
    max-height: none;
  }
  .story-resume {
    padding: 16px;
  }
}
@media (max-width: 380px) {
  .story-round strong {
    font-size: 1.25rem;
  }
  #story-ready {
    width: 110px;
    white-space: normal;
  }
  .story-mission {
    gap: 8px;
  }
  .story-stars {
    font-size: 1rem;
  }
}

/* Compact fleet and inventory share one secondary panel. The arena stays square. */
.playing main {
  --power-rail: 0px;
  --fleet-rail: 200px;
}
.playing .battle-console {
  align-self: start;
}
.playing .command-panel,
.playing .story-ship-panel {
  padding: 8px;
}
.playing .compact-fleet .eyebrow,
.playing .story-ship-panel h2 {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1.2;
}
.playing .compact-fleet .roster,
#story-units {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  margin: 0 0 8px;
}
.playing .compact-fleet .unit {
  display: flex;
  flex-direction: row;
  align-items: center;
  min-height: 44px;
  width: 100%;
  margin: 0;
  padding: 4px 6px;
  gap: 6px;
  text-align: left;
}
.playing .compact-fleet .unit .icon {
  display: block;
}
.playing .compact-fleet .unit img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.playing .compact-fleet .unit .info,
.playing .compact-fleet .unit strong {
  font-size: 13px;
  line-height: 1.1;
}
.playing .compact-fleet .unit small {
  display: block;
  font-size: 11px;
  line-height: 1.25;
  margin-top: 2px;
}
.playing .compact-fleet .health {
  height: 3px;
  margin-top: 3px;
}
.playing .compact-fleet .battle-power-bar {
  width: 100%;
  padding: 6px 0;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}
.playing .compact-fleet .battle-power-bar h2 {
  margin: 0 0 5px;
  text-align: left;
  font-size: 12px;
}
.playing .compact-fleet .battle-power-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}
.playing .compact-fleet .battle-power-slots button {
  min-height: 58px;
  padding: 4px 1px;
  gap: 2px;
}
.playing .compact-fleet .battle-power-slots .power-icon {
  font-size: 18px;
}
.playing .compact-fleet .battle-power-slots small {
  font-size: 10px;
  line-height: 1.2;
}
.playing .compact-fleet .battle-feedback {
  border-top: 1px solid var(--line);
}
.playing .compact-fleet .battle-feedback summary,
.playing .compact-fleet .audio-controls summary {
  padding: 6px 0;
  min-height: 28px;
  font-size: 12px;
  cursor: pointer;
}
.playing .compact-fleet .audio-controls {
  margin-top: 0;
  padding-top: 0;
}
.playing .compact-fleet .battle-support {
  display: block;
}
.playing .legend {
  padding-left: 0;
}
.playing .story-battle-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--fleet-rail);
  gap: 12px;
}
.playing .story-ship-panel {
  grid-column: auto;
}
.story-ship-panel .battle-feedback p {
  font-size: 12px;
  line-height: 1.4;
}
.story-ship-panel .battle-feedback button {
  width: 100%;
  min-height: 44px;
  margin: 4px 0;
  padding: 6px;
  font-size: 12px;
}
@media (max-width: 1000px) and (min-height: 541px) {
  .playing main {
    max-width: calc(var(--arena-size) + 32px);
  }
  .playing .story-battle-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .playing .compact-fleet .roster,
  #story-units {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .playing .compact-fleet .battle-power-bar {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 8px;
    align-items: center;
  }
  .playing .compact-fleet .battle-power-bar #power-hint {
    grid-column: 1 / -1;
  }
}
@media (max-width: 600px) {
  .playing .compact-fleet .unit {
    padding: 4px;
    gap: 4px;
  }
  .playing .compact-fleet .unit img {
    width: 18px;
    height: 18px;
  }
  .playing .compact-fleet .unit .info,
  .playing .compact-fleet .unit strong {
    font-size: 12px;
  }
  .playing .compact-fleet .unit small {
    font-size: 10px;
  }
  .playing .compact-fleet .unit > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

/* Battle occupies the viewport; secondary details scroll only inside their panel. */
body.playing {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.playing > header {
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
}
.playing .brand {
  font-size: 14px;
}
.playing .brandmark {
  font-size: 16px;
  margin-right: 6px;
}
.playing header .tag {
  font-size: 9px;
}
.playing > footer,
.playing > #account {
  display: none;
}
.playing main#app {
  --fleet-rail: 200px;
  --arena-size: 100%;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.playing .battle-head,
.playing .story-battle-head {
  flex: none;
  position: relative;
  top: auto;
  margin: 0;
  padding: 4px 8px;
  gap: 8px;
  min-height: 50px;
  border-radius: 6px;
}
.playing .battle-head {
  grid-template-columns: minmax(0, 1fr) 220px;
}
.playing .battle-context {
  display: none;
}
.playing .battle-head .phase-strip .panel-head {
  min-height: 44px;
  padding: 3px 10px;
  justify-content: space-between;
  gap: 12px;
}
.playing .battle-head #round {
  font-size: 17px;
}
.playing .battle-head .phase {
  font-size: 11px;
}
.playing .battle-head .clock {
  font-size: 26px;
}
.playing .battle-head .battle-actions {
  flex-direction: row;
  align-items: center;
}
.playing .battle-head .battle-actions .primary {
  min-height: 44px;
  padding: 6px 10px;
  font-size: 13px;
}
.playing .battle-head .battle-actions .secondary {
  min-height: 44px;
  padding: 6px;
  font-size: 11px;
}
.playing .story-battle-head {
  grid-template-columns: 150px minmax(0, 1fr) auto auto;
}
.playing .story-round {
  gap: 2px;
}
.playing .story-round .eyebrow {
  font-size: 10px;
}
.playing .story-round strong {
  font-size: 18px;
  line-height: 1.1;
}
.playing .story-round > span:last-child {
  font-size: 10px;
}
.playing .story-objective strong,
.playing .story-objective span {
  font-size: 12px;
  line-height: 1.3;
}
.playing #story-ready,
.playing #story-pause {
  grid-column: auto;
  grid-row: auto;
  min-height: 44px;
  padding: 6px 10px;
  font-size: 13px;
  width: auto;
}
.playing #network-message:empty,
.playing #story-status:empty {
  display: none;
}
.playing #network-message:not(:empty),
.playing #story-status:not(:empty) {
  position: absolute;
  top: 65px;
  left: 12px;
  right: 12px;
  z-index: 24;
  padding: 8px;
  margin: 0;
  background: #182334;
  border: 1px solid #ff9566;
  border-radius: 4px;
  font-size: 12px;
}
.playing .battle,
.playing .story-battle-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--fleet-rail);
  grid-template-rows: minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  align-items: stretch;
}
.playing .battle-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.playing .arena-with-powers {
  flex: 1;
  min-height: 0;
  container-type: size;
  display: grid;
  place-items: center;
}
.playing .arena-with-powers > .board-wrap {
  width: min(100%, 100cqh);
  max-width: none;
  margin: 0;
  flex: none;
}
.playing .board {
  width: 100%;
  height: auto;
}
.playing .legend {
  flex: none;
  font-size: 10px;
  line-height: 14px;
  margin: 2px 0 0;
  padding: 0;
}
.playing .story-arena {
  width: 100%;
  max-width: none;
  min-height: 0;
  height: 100%;
  margin: 0;
  container-type: size;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.playing #story-board {
  width: min(100%, calc(100cqh - 18px));
  height: auto;
  flex: none;
}
.playing .story-arena-key {
  font-size: 10px;
  line-height: 14px;
  margin: 2px 0;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playing .compact-fleet {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  align-self: start;
}
.playing .compact-fleet .battle-feedback,
.playing .compact-fleet .audio-controls {
  font-size: 12px;
}
.playing .compact-fleet .audio-controls summary {
  min-height: 28px;
}
.playing .story-ship-panel .audio-controls {
  margin: 0;
}
#story-result-modal {
  margin: auto;
  padding: 0;
  width: min(520px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  overflow: auto;
  box-shadow: 0 18px 70px #000b;
}
#story-result-modal::backdrop {
  background: #020812bc;
  backdrop-filter: blur(3px);
}
#story-result-modal .panel-body {
  padding: 20px;
}
#story-result-modal .eyebrow {
  font-size: 11px;
}
#story-result-modal h2 {
  font-size: clamp(20px, 4vw, 28px);
  margin: 8px 0;
}
#story-result-modal .story-stars {
  font-size: 22px;
  margin-bottom: 8px;
}
#story-result-modal p {
  font-size: 15px;
  line-height: 1.4;
  margin: 8px 0;
}
.story-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
#story-result-modal button {
  margin: 0;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 15px;
}
#story-result-map {
  flex: 1;
}
@media (max-width: 900px) and (min-height: 541px) {
  .playing .battle,
  .playing .story-battle-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 6px;
  }
  .playing .compact-fleet {
    width: 100%;
    padding: 6px;
    max-height: 190px;
  }
  .playing .compact-fleet > h2,
  .playing .command-panel > .eyebrow {
    display: none;
  }
  .playing .command-panel {
    padding: 0;
  }
  .playing .compact-fleet .roster,
  .playing #story-units {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 4px;
  }
  .playing .compact-fleet .battle-power-bar {
    grid-template-columns: 65px 1fr;
    padding: 4px 0;
    gap: 4px;
  }
  .playing .compact-fleet .battle-power-slots button {
    min-height: 48px;
  }
  .playing .compact-fleet .battle-feedback,
  .playing .compact-fleet .audio-controls {
    width: calc(50% - 4px);
    display: inline-block;
    vertical-align: top;
  }
  .playing .compact-fleet .battle-support,
  .playing #story-audio-controls {
    display: contents;
  }
  .playing .compact-fleet .battle-feedback[open],
  .playing .compact-fleet .audio-controls[open] {
    width: 100%;
  }
  .playing .battle-head {
    padding: 0;
    grid-template-columns: minmax(0, 1fr) 110px;
    gap: 6px;
  }
  .playing .battle-head .battle-actions {
    flex-direction: column;
    gap: 0;
  }
  .playing .battle-head .battle-actions .primary {
    font-size: 11px;
    min-height: 44px;
    padding: 5px;
  }
  .playing .battle-head .battle-actions .secondary {
    font-size: 10px;
    min-height: 24px;
    padding: 2px;
  }
  .playing .battle-head #round {
    font-size: 13px;
  }
  .playing .battle-head .phase-strip .panel-head {
    min-height: 50px;
    padding: 4px 6px;
    gap: 6px;
  }
  .playing .battle-head .phase-strip .panel-head > .countdown {
    min-width: 40px;
  }
  .playing .story-battle-head {
    grid-template-columns: minmax(0, 1fr) auto auto;
    padding: 4px;
    gap: 4px;
  }
  .playing .story-round .eyebrow {
    display: none;
  }
  .playing .story-round strong {
    font-size: 16px;
  }
  .playing #story-ready,
  .playing #story-pause {
    padding: 6px;
    font-size: 11px;
  }
  .playing .story-objective {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .playing .story-objective strong,
  .playing .story-objective span {
    font-size: 11px;
  }
}
@media (max-height: 540px) {
  .playing > header {
    height: 26px;
    min-height: 26px;
  }
  .playing main#app {
    --fleet-rail: 190px;
  }
  .playing .compact-fleet > h2,
  .playing .command-panel > .eyebrow,
  .playing .compact-fleet .battle-power-bar h2 {
    display: none;
  }
  .playing .compact-fleet .roster,
  .playing #story-units {
    grid-template-columns: 1fr;
  }
  .playing .compact-fleet .battle-power-bar {
    display: block;
    padding: 4px 0;
  }
  .playing .compact-fleet .battle-power-slots button {
    min-height: 48px;
  }
  .playing .story-battle-head {
    grid-template-columns: 125px minmax(0, 1fr) auto auto;
  }
  .playing .story-round .eyebrow {
    display: none;
  }
  #story-result-modal .panel-body {
    padding: 12px 16px;
  }
  #story-result-modal p {
    font-size: 13px;
    margin: 5px 0;
  }
}
/* Rewarded-ad Shop shares the command center's palette and cards. */
.shop-progress {
  padding: clamp(16px, 3vw, 28px);
}
.shop-progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.shop-progress-heading h2 {
  margin: 8px 0;
}
.shop-progress-heading > strong {
  color: #00e5ff;
}
.shop-milestones {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 24px 0;
}
.shop-milestones li {
  text-align: center;
  padding: 12px 4px;
  border: 1px solid #00e5ff33;
  border-radius: 10px;
}
.shop-milestones li.completed {
  background: #00e5ff18;
  border-color: #00e5ff;
}
.shop-milestones li[aria-current] {
  border-color: #ffc107;
}
.shop-milestones span {
  display: block;
  font-size: 22px;
  color: #00e5ff;
}
.shop-milestones small {
  display: block;
  margin-top: 6px;
  font-size: 11px;
}
.shop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0;
}
.shop-catalog-section {
  margin-top: 32px;
}
.shop-choices {
  margin-top: 24px;
}
.shop-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.shop-choice-grid button {
  text-align: left;
  white-space: normal;
  font: inherit;
}
.shop-choice-grid button b {
  color: #00e5ff;
}
.shop-milestones {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 600px) {
  .shop-choice-grid {
    grid-template-columns: 1fr;
  }
}
.shop-catalog {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.shop-item {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.shop-item h3,
.shop-item p {
  margin: 0;
}
.shop-item p {
  color: #b2c5d7;
  flex: 1;
  line-height: 1.5;
}
.shop-item .power-icon {
  color: #00e5ff;
  font-size: 32px;
}
.shop-item > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.shop-item strong {
  color: #ffc107;
}
.shop-mode-card {
  border-color: #00e5ff55;
}
.shop-test-ad {
  max-width: min(480px, calc(100vw - 32px));
}
.shop-test-ad button {
  display: block;
  width: 100%;
  margin-top: 12px;
}
.playing #header-shop-button,
.story-playing #header-shop-button {
  display: none;
}
@media (max-width: 800px) {
  .shop-catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .shop-catalog {
    grid-template-columns: 1fr;
  }
  .shop-actions > button {
    flex: 1 1 100%;
  }
}

/* Battle inventory stays separate from the compact arena commands. */
.playing .battle-inventory {
  padding: 8px;
  max-height: none;
  overflow: visible;
  align-self: start;
}
.playing .battle-inventory .battle-power-bar {
  margin: 0;
  border: 0;
  padding: 0;
}
.playing .arena-commands {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  flex: none;
  width: 100%;
  margin: 4px 0 0;
}
.playing .arena-commands .arena-ships,
.playing .arena-commands #story-units {
  display: flex;
  gap: 4px;
  margin: 0;
}
.playing .arena-commands .unit,
.playing .arena-commands > button {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 4px;
  margin: 0;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1;
}
.playing .arena-commands .unit img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  margin: 0;
}
.playing .arena-commands .unit > span {
  position: absolute;
  right: 2px;
  bottom: 2px;
  font-size: 9px;
  background: #0b0e14;
  padding: 1px 2px;
}
.playing .arena-commands .unit[aria-pressed="true"] {
  border-color: var(--cyan);
  background: #00e5ff20;
  box-shadow: inset 0 0 0 1px var(--cyan);
}
.playing #story-board {
  width: min(100%, calc(100cqh - 66px));
}
.battle-ability-dialog,
.battle-info-dialog {
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 16px;
  overflow: auto;
}
.battle-dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.battle-dialog-heading h2 {
  margin: 0;
  font-size: 20px;
}
.battle-dialog-heading button {
  min-width: 44px;
  min-height: 44px;
  padding: 4px;
}
.battle-ability-dialog::backdrop,
.battle-info-dialog::backdrop {
  background: #020812bc;
  backdrop-filter: blur(3px);
}
@media (max-width: 900px) and (min-height: 541px) {
  .playing .battle-inventory {
    padding: 6px;
  }
  .playing .battle-inventory .battle-power-bar {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 2px 6px;
  }
  .playing .battle-inventory .battle-power-bar h2 {
    font-size: 10px;
    margin: 0;
    align-self: center;
  }
  .playing .battle-inventory .battle-power-slots button {
    min-height: 44px;
  }
  .playing .battle-inventory #power-hint {
    grid-column: 2;
    font-size: 10px;
    line-height: 12px;
    margin: 0;
  }
}
@media (max-height: 540px) {
  .playing main#app {
    --fleet-rail: 160px;
  }
  .playing .battle-inventory .battle-power-slots {
    display: grid;
    grid-template-columns: 1fr;
  }
  .playing .battle-inventory .battle-power-slots button {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    gap: 4px;
    min-height: 44px;
    padding: 4px;
  }
  .playing .battle-inventory #power-hint {
    font-size: 10px;
    line-height: 12px;
  }
}
/* Compact preparation cards keep normal-size controls and predictable columns. */
body:has(.fleet-lobby, .fleet-preparation, .story-preparation) main {
  max-width: 1760px;
  padding-inline: clamp(16px, 3vw, 48px);
}
.fleet-lobby,
.story-preparation {
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 20px;
}
.fleet-lobby .fleet,
.fleet-preparation .fleet,
.story-ship-cards {
  --fleet-columns: 3;
  --fleet-card-gap: 12px;
  width: 100%;
  grid-template-columns: repeat(var(--fleet-columns), minmax(0, 1fr));
  gap: var(--fleet-card-gap);
  align-items: stretch;
}
.story-ship-cards {
  padding: 12px;
}
.fleet-lobby .ship-card,
.fleet-preparation .ship-card,
.story-ship-cards .ship-card {
  min-width: 0;
  padding: 12px;
}
.fleet-lobby .glyph,
.fleet-preparation .glyph,
.story-ship-cards .ship-card-art {
  height: 68px;
  margin-bottom: 2px;
}
.fleet-lobby .glyph img,
.fleet-preparation .glyph img,
.story-ship-cards .ship-card-art img {
  width: 64px;
  height: 64px;
  transform: none;
}
.fleet-lobby .ship-card h3,
.fleet-preparation .ship-card h3,
.story-ship-cards .ship-card h3 {
  margin: 2px 0 3px;
  font-size: 16px;
  line-height: 1.35;
}
.fleet-lobby .ship-card .role,
.fleet-preparation .ship-card .role,
.story-ship-cards .ship-card > p:first-of-type {
  color: var(--cyan);
  font-size: 12px;
  line-height: 1.35;
}
.fleet-lobby .ship-description,
.fleet-preparation .ship-description,
.story-ship-cards .ship-card > p.subtitle {
  margin: 6px 0;
  font-size: 13px;
  line-height: 1.4;
}
.fleet-lobby .ship-card .ship-ability,
.fleet-preparation .ship-card .ship-ability,
.story-ship-cards .ship-card .ship-ability {
  margin: 6px 0;
  font-size: 12px;
  line-height: 1.4;
}
.fleet-lobby .ship-card .stats,
.fleet-preparation .ship-card .stats,
.story-ship-cards .story-ship-stats {
  margin-top: auto;
  margin-bottom: 8px;
  padding-top: 8px;
  font-size: 12px;
  line-height: 1.55;
}
.fleet-lobby .quantity,
.fleet-preparation .quantity,
.story-ship-cards .ship-counter {
  margin-top: 0;
  padding-top: 8px;
  gap: 6px;
}
.fleet-lobby .quantity button,
.fleet-preparation .quantity button,
.story-ship-cards .ship-counter button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 22px;
}
.fleet-power-options .power-catalog {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.fleet-power-options .power-catalog button {
  min-width: 0;
  min-height: 72px;
  padding: 8px;
  gap: 8px;
}
.fleet-power-options .power-catalog button > span:nth-child(2) {
  min-width: 0;
  gap: 2px;
}
.fleet-power-options .power-catalog strong {
  font-size: 13px;
  line-height: 1.35;
}
.fleet-power-options .power-catalog small {
  line-height: 1.35;
}
.fleet-power-options .power-icon {
  flex-shrink: 0;
  font-size: 22px;
}
.fleet-power-options .loadout-slots button {
  min-height: 64px;
  gap: 3px;
  padding: 6px;
}
.fleet-power-options .loadout-slots span {
  font-size: 18px;
}
.fleet-power-options .loadout-slots small {
  font-size: 12px;
}
/* Preparation keeps the optional loadout compact beside the fleet. */
.fleet-power-options {
  margin: 0;
}
.story-fleet-panel > .fleet-power-options {
  margin: 12px;
}
.power-up-loadout .loadout-bar {
  display: grid;
  gap: 6px;
  padding: 10px;
}
.loadout-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.loadout-heading h2 {
  font-size: 15px;
  line-height: 1.4;
  margin: 0;
}
.loadout-count {
  color: var(--cyan);
  font-size: 12px;
  white-space: nowrap;
}
.loadout-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}
.loadout-note [data-loadout-count] {
  color: var(--cyan);
}
.loadout-bar > .loadout-note {
  margin-top: 10px;
}
.loadout-bar .loadout-slots {
  width: 100%;
  max-width: none;
  gap: 4px;
}
.loadout-bar .loadout-slots button {
  position: relative;
  min-width: 44px;
  min-height: 44px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 3px;
  padding: 4px 12px 4px 4px;
}
.loadout-bar .loadout-slots small {
  min-width: 0;
  font-size: 11px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.loadout-bar .loadout-slots .loadout-remove {
  position: absolute;
  top: 2px;
  right: 3px;
  color: var(--cyan);
  font-size: 12px;
}
.loadout-bar .power-catalog {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
}
.loadout-bar .power-catalog button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 2px 4px;
  min-width: 44px;
  min-height: 44px;
  max-width: none;
  padding: 4px 6px;
}
.loadout-bar .power-catalog .power-icon {
  grid-column: 1;
  grid-row: 1;
  font-size: 17px;
  line-height: 1;
}
.loadout-bar .power-catalog .power-item-name {
  grid-column: 1 / -1;
  grid-row: 2;
  display: block;
  min-width: 0;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.loadout-bar .power-catalog [data-power-available] {
  grid-column: 2;
  grid-row: 1;
  float: none;
  color: var(--cyan);
  font-size: 11px;
  line-height: 1;
  max-width: 5ch;
  overflow: hidden;
  text-overflow: ellipsis;
}
.power-stock-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin: 0;
}
.power-shop-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}
@media (max-width: 680px) {
  .loadout-heading {
    align-items: center;
  }
  .loadout-bar .loadout-slots {
    max-width: none;
  }
}
.shop-catalog {
  gap: 12px;
}
.shop-item {
  padding: 14px;
  gap: 8px;
}
.shop-item h3 {
  font-size: 17px;
  line-height: 1.35;
}
.shop-item p {
  font-size: 14px;
  line-height: 1.4;
}
.shop-item .power-icon {
  font-size: 26px;
}
@media (min-width: 1280px) {
  .fleet-lobby .fleet,
  .fleet-preparation .fleet,
  .story-ship-cards {
    --fleet-columns: 4;
  }
  .fleet-power-options .power-catalog,
  .shop-catalog {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (min-width: 1760px) {
  .fleet-lobby .fleet,
  .fleet-preparation .fleet,
  .story-ship-cards {
    --fleet-columns: 5;
  }
  .fleet-power-options .power-catalog,
  .shop-catalog {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
@media (max-width: 1000px) {
  .fleet-lobby,
  .story-preparation {
    grid-template-columns: minmax(0, 1fr);
  }
  .story-launch {
    position: static;
  }
}
@media (max-width: 860px) {
  .fleet-lobby .fleet,
  .fleet-preparation .fleet,
  .story-ship-cards {
    --fleet-columns: 2;
  }
  .fleet-power-options .power-catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .fleet-lobby .fleet,
  .fleet-preparation .fleet,
  .story-ship-cards {
    --fleet-columns: 1;
  }
  .fleet-lobby .ship-card,
  .fleet-preparation .ship-card,
  .story-ship-cards .ship-card {
    padding: 12px 14px;
  }
  .fleet-power-options .power-catalog {
    grid-template-columns: minmax(0, 1fr);
  }
}
.fleet-lobby .ship-card.active .glyph img,
.fleet-preparation .ship-card.active .glyph img,
.story-ship-cards .ship-card.active .ship-card-art img {
  animation: selected-ship-rock 4s ease-in-out infinite alternate;
}
@keyframes selected-ship-rock {
  from {
    rotate: -15deg;
  }
  to {
    rotate: 15deg;
  }
}
@media (prefers-reduced-motion: reduce) {
  .fleet-lobby .ship-card.active .glyph img,
  .fleet-preparation .ship-card.active .glyph img,
  .story-ship-cards .ship-card.active .ship-card-art img {
    animation: none;
  }
}
/* Three ship slots and a compact loadout share the preparation sidebar. */
.preparation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 272px;
  align-items: start;
  gap: 16px;
}
.preparation-layout > .preparation-main {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}
.preparation-layout > .preparation-sidebar {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  align-self: start;
  position: sticky;
  top: 16px;
}
.preparation-sidebar.panel-body,
.preparation-sidebar > .panel-body,
.preparation-sidebar .launch-panel {
  padding: 12px;
}
.preparation-sidebar .launch-panel,
.preparation-sidebar.panel {
  margin: 0;
}
.preparation-sidebar > .panel-body,
.preparation-sidebar.panel-body {
  display: grid;
  gap: 8px;
}
.preparation-sidebar .battle-difficulty {
  gap: 4px;
  margin: 10px 0;
}
.preparation-sidebar .battle-difficulty select,
.preparation-sidebar #story-difficulty {
  min-height: 44px;
  padding: 8px;
}
.preparation-sidebar #story-difficulty {
  margin: 0;
}
.preparation-sidebar .power-up-loadout {
  margin: 10px 0 8px;
}
.preparation-sidebar .power-up-loadout .loadout-bar {
  padding: 8px;
}
.preparation-sidebar .power-up-loadout .power-catalog {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.preparation-sidebar .practice-choice,
.preparation-sidebar .ranked-choice {
  font-size: 12px;
  line-height: 1.4;
}
.preparation-sidebar #fleet-status:empty,
.preparation-sidebar #story-start-status:empty {
  display: none;
}
.preparation-sidebar .preparation-start,
.preparation-sidebar #launch {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px;
  font-size: 15px;
}
.preparation-sidebar.story-launch p,
.preparation-sidebar.story-launch label {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}
.fleet-selection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.fleet-selection-header h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}
.fleet-selection-header [data-fleet-count] {
  color: var(--cyan);
  font-size: 12px;
  white-space: nowrap;
}
.fleet-selection-slots {
  display: grid;
  gap: 4px;
}
.fleet-selection-slot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101721;
}
.fleet-selection-slot.active {
  border-color: var(--cyan);
  background: #00e5ff12;
}
.fleet-slot-button {
  display: grid;
  grid-template-columns: 16px 48px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 44px;
  min-height: 56px;
  padding: 4px;
  border: 0;
  background: transparent;
  text-align: left;
}
.fleet-slot-index {
  color: var(--cyan);
  font-size: 12px;
  text-align: center;
}
.fleet-slot-button img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  transform: none;
}
.fleet-slot-empty {
  width: 48px;
  color: var(--muted);
  font-size: 22px;
  text-align: center;
}
.fleet-slot-name {
  min-width: 0;
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.fleet-slot-remove {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  font-size: 20px;
}
.fleet-selection-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.fleet-class-choose {
  width: 100%;
  min-height: 44px;
  margin-top: auto;
  padding: 8px;
  font-size: 13px;
}
.preparation-layout
  :is(
    .fleet-slot-button,
    .fleet-slot-remove,
    .fleet-class-choose
  ):focus-visible,
.loadout-bar button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
@media (max-width: 1000px) {
  .preparation-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .preparation-layout > .preparation-sidebar {
    grid-column: 1;
    grid-row: 1;
    position: static;
    top: auto;
  }
  .preparation-layout > .preparation-main {
    grid-column: 1;
    grid-row: 2;
  }
}
@media (max-width: 680px) {
  .fleet-lobby .glyph,
  .fleet-preparation .glyph,
  .story-ship-cards .ship-card-art {
    height: 52px;
  }
  .fleet-lobby .glyph img,
  .fleet-preparation .glyph img,
  .story-ship-cards .ship-card-art img {
    width: 48px;
    height: 48px;
  }
}
#ranked-mode-control:has(#rank-message:empty) {
  display: none;
}
/* Hero fleet abilities share the existing tactical panels. */
.ship-ability {
  font-size: 0.9rem;
  line-height: 1.45;
  color: #c7d8ec;
  margin: 0.75rem 0;
}
.ship-ability strong {
  display: block;
  color: #79e7ad;
}
.hero-commands {
  margin: 0.85rem 0;
  padding: 0.85rem;
  border: 1px solid #34445d;
  border-radius: 8px;
  background: #101925;
}
.hero-ability > strong {
  color: #79e7ad;
  font-size: 1rem;
}
.hero-ability p,
.hero-help {
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0.5rem 0;
}
.hero-current {
  color: #c7d8ec;
}
.hero-ability-state {
  color: #00e5ff;
}
.hero-target label {
  display: block;
  margin: 0.65rem 0;
  font-size: 0.9rem;
}
.hero-target select {
  width: 100%;
  max-width: 100%;
  margin-top: 0.35rem;
  background: #0b0e14;
  color: #f0f4f8;
  border: 1px solid #34445d;
  padding: 0.5rem;
  font: inherit;
}
.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.hero-buttons button {
  font-size: 0.9rem;
  min-height: 44px;
}
.hero-error {
  color: #ffb469;
}
/* Commander profile */
.main-options:has(#profile-menu) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.main-options:has(#profile-menu) .mode-card {
  padding: 28px;
}
.main-options:has(#profile-menu) .mode-card strong {
  font-size: clamp(24px, 2.4vw, 36px);
}
.commander-profile {
  max-width: 1200px;
  margin: 0 auto;
}
.profile-heading {
  flex-wrap: wrap;
  gap: 18px;
}
.profile-heading > div {
  flex: 1;
}
.profile-identity {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 24px;
}
.profile-identity > div:first-child {
  min-width: 140px;
  overflow-wrap: anywhere;
}
.profile-identity h2 {
  margin: 8px 0;
}
.profile-identity p,
.profile-login p {
  color: var(--muted);
  margin: 8px 0 0;
}
.profile-summary {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
.profile-summary strong {
  display: block;
  color: var(--cyan);
  font: 24px var(--font-data);
  margin-bottom: 8px;
}
.profile-summary span {
  color: var(--muted);
  font-size: 13px;
}
.profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0;
}
.profile-tabs button {
  min-height: 44px;
  width: auto;
}
.profile-item-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.profile-login,
.profile-empty,
.profile-favorite {
  padding: 24px;
}
.profile-item {
  min-width: 0;
  padding: 14px;
}
.profile-item h3 {
  margin: 6px 0;
  font-size: 17px;
  line-height: 1.35;
}
.profile-item p,
.profile-favorite > p {
  color: var(--muted);
  line-height: 1.65;
}
.profile-item-icon {
  color: var(--cyan);
  font-size: 24px;
}
.profile-item p {
  font-size: 14px;
  line-height: 1.4;
}
.profile-item dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 0;
}
.profile-item dl > div {
  min-width: 0;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.profile-item dt {
  font-size: 12px;
  color: var(--muted);
}
.profile-item dd {
  margin: 5px 0 0;
  color: var(--cyan);
  font: 18px var(--font-data);
  overflow-wrap: anywhere;
}
.profile-saved-item {
  overflow-wrap: anywhere;
}
.profile-section {
  margin-top: 32px;
}
.profile-schematics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0;
}
.profile-schematics span {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.profile-hangar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.profile-class {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  padding: 22px;
}
.profile-class img {
  flex-shrink: 0;
  margin-top: 14px;
}
.profile-class h3 {
  margin: 0 0 6px;
}
.profile-class p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  margin: 10px 0 0;
}
.profile-class .profile-class-stats {
  color: var(--cyan);
}
.profile-chapters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.profile-chapter {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
}
.profile-chapter img {
  opacity: 0.35;
  flex-shrink: 0;
}
.profile-chapter.earned img {
  opacity: 1;
}
.profile-chapter h3 {
  font-size: 14px;
  line-height: 1.5;
}
.profile-chapter p {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
}
.profile-missions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.profile-mission .panel-head {
  gap: 14px;
}
.profile-mission h3 {
  margin-top: 8px;
}
.profile-stars {
  color: var(--cyan);
  white-space: nowrap;
  font-size: 22px;
}
.profile-medals {
  display: grid;
  gap: 12px;
}
.profile-medal {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
}
.profile-medal.earned,
.profile-chapter.earned {
  border-color: #79e7ad88;
}
.profile-medal.earned strong {
  color: #79e7ad;
}
.profile-medal span,
.profile-medal small {
  display: block;
  margin-top: 6px;
  line-height: 1.5;
}
.profile-medal small {
  font-size: 11px;
}
.profile-favorite {
  max-width: 850px;
}
.profile-favorite-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.profile-favorite-slot {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #091522;
}
.favorite-sprite {
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.profile-favorite-slot label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
}
.profile-favorite-slot select {
  width: 100%;
  min-height: 44px;
  background: var(--panel);
  color: var(--white);
  border: 1px solid var(--line);
  padding: 10px;
  font: inherit;
}
.favorite-selected {
  animation: selected-ship-rock 4s ease-in-out infinite alternate;
}
@media (max-width: 850px) {
  .main-options:has(#profile-menu) {
    grid-template-columns: 1fr;
  }
  .profile-item-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .profile-identity {
    align-items: flex-start;
    flex-direction: column;
  }
  .profile-summary {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .profile-hangar,
  .profile-missions {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 480px) {
  .profile-item-grid {
    grid-template-columns: 1fr;
  }
  .profile-heading > div {
    flex-basis: 100%;
    order: -1;
  }
  .profile-favorite-slots {
    grid-template-columns: 1fr;
  }
  .profile-favorite-slot {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    column-gap: 14px;
    align-items: center;
  }
  .favorite-sprite {
    grid-row: span 2;
    height: 80px;
  }
  .profile-favorite-slot label {
    margin-bottom: 0;
  }
  .profile-class {
    padding: 18px;
    gap: 18px;
  }
  .profile-class img {
    width: 44px;
    height: 44px;
  }
  .profile-mission .panel-head {
    padding: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .favorite-selected {
    animation: none;
  }
}

/* Header account access and Skirmish preparation */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 24px;
}
.header-actions #menu-sound {
  margin-left: 0;
}
#header-profile-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
}
.playing .header-actions {
  display: none;
}
.header-profile-dialog {
  width: min(1100px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 24px;
}
.header-profile-dialog .profile-heading {
  margin-bottom: 24px;
}
.header-profile-dialog .profile-heading h1 {
  font-size: 30px;
}
.header-profile-dialog #profile-back {
  display: none;
}
.header-profile-dialog .profile-heading {
  padding-right: 46px;
}
.profile-modal-close {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-height: 36px;
  margin: 0 0 -36px auto;
  padding: 0;
  z-index: 5;
  background: var(--panel);
  font-size: 24px;
}
.header-profile-dialog .profile-heading .eyebrow {
  display: none;
}
.battle-difficulty {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.battle-difficulty label {
  color: var(--muted);
  font-size: 14px;
}
.battle-difficulty select {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  background: var(--panel);
  color: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}
#random-fleet {
  margin-left: auto;
  min-height: 44px;
  font-size: 14px;
  padding: 8px 14px;
}
@media (max-width: 680px) {
  body:not(.playing):not(.story-playing) > header {
    height: 64px;
    gap: 10px;
    padding-inline: 16px;
  }
  body:not(.playing):not(.story-playing) > header .brand {
    flex-shrink: 0;
    font-size: 14px;
    line-height: 1.4;
    letter-spacing: 0.6px;
    white-space: nowrap;
  }
  body:not(.playing):not(.story-playing) > header .brand b {
    display: block;
  }
  .header-actions {
    flex-shrink: 0;
    gap: 4px;
    margin-left: 0;
  }
  .header-actions #menu-sound,
  .header-actions #header-shop-button,
  .header-actions #header-ranking-button,
  .header-actions #header-profile-button {
    min-width: 44px;
    min-height: 44px;
    padding: 6px 8px;
    font-size: 13px;
    white-space: nowrap;
  }
  #header-profile-button {
    gap: 5px;
  }
  .header-profile-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    padding: 16px;
  }
  body:has(.fleet-lobby) main {
    padding-bottom: 20px;
  }
  .fleet-lobby .section-label {
    flex-wrap: wrap;
    gap: 10px;
  }
  #random-fleet {
    font-size: 13px;
    padding: 6px 10px;
  }
}
@media (max-width: 360px) {
  body:not(.playing):not(.story-playing) > header {
    gap: 6px;
    padding-inline: 12px;
  }
  body:not(.playing):not(.story-playing) > header .brand {
    font-size: 11px;
    letter-spacing: 0.2px;
  }
  header .brandmark {
    margin-right: 4px;
    font-size: 18px;
  }
  #header-profile-button svg {
    display: none;
  }
  .header-actions {
    gap: 3px;
  }
  .header-actions #menu-sound,
  .header-actions #header-shop-button,
  .header-actions #header-ranking-button,
  .header-actions #header-profile-button {
    font-size: 12px;
    padding-inline: 5px;
  }
}
