@font-face {
  font-family: "Pixelify Sans";
  src: url("/fonts/pixelify-sans-700.woff2") format("woff2");
  font-display: swap;
  font-weight: 700;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-hyperlegible-400.woff2") format("woff2");
  font-display: swap;
  font-weight: 400;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-hyperlegible-700.woff2") format("woff2");
  font-display: swap;
  font-weight: 700;
}

:root {
  color-scheme: dark;
  --navy-950: #030d1c;
  --navy-900: #071a32;
  --navy-800: #0c2c50;
  --navy-700: #134b7e;
  --blue: #1269bd;
  --blue-light: #4bb4f2;
  --sea: #18c2d8;
  --sky: #80d9f5;
  --cloud: #eefaff;
  --gold: #ffc433;
  --gold-light: #ffe58c;
  --red: #dc392d;
  --red-dark: #7f1f24;
  --wood: #8a4e20;
  --wood-light: #c27a34;
  --wood-dark: #3b2116;
  --ink: #f6fbff;
  --muted: #bdd5e3;
  --green: #45d995;
  --kraken: #8d54c7;
  --kraken-dark: #2b1c52;
  --font-display: "Pixelify Sans", "Courier New", monospace;
  --font-body: "Atkinson Hyperlegible", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

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

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 0, #123b67, transparent 34rem),
    var(--navy-950);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 4px solid var(--gold-light);
  outline-offset: 3px;
}

::selection {
  background: var(--gold);
  color: var(--navy-950);
}

.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 1000;
  padding: var(--space-3) var(--space-4);
  translate: 0 -180%;
  background: var(--gold);
  color: var(--navy-950);
  font-family: var(--font-display);
  text-decoration: none;
}

.skip-link:focus {
  translate: 0;
}

.game-shell {
  width: min(100%, 96rem);
  margin-inline: auto;
  padding:
    max(0.5rem, env(safe-area-inset-top))
    max(0.75rem, env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom))
    max(0.75rem, env(safe-area-inset-left));
}

.topbar {
  display: grid;
  min-height: 3.5rem;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.back-to-arcade,
.topbar-button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  border: 2px solid #6f8ea4;
  padding: var(--space-2) var(--space-3);
  background: var(--navy-900);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--navy-950);
}

.back-to-arcade {
  justify-self: start;
}

.back-to-arcade:hover,
.topbar-button:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

.back-to-arcade:active,
.topbar-button:active {
  translate: 2px 2px;
  box-shadow: 1px 1px 0 var(--navy-950);
}

.topbar-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.topbar-button[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--gold-light);
}

.mini-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.45rem);
  letter-spacing: 0.02em;
  line-height: 0.9;
}

.mini-brand img {
  width: 2.75rem;
  height: 2.75rem;
  object-fit: contain;
}

.topbar-actions {
  display: flex;
  justify-self: end;
  gap: var(--space-2);
}

.game-frame {
  overflow: hidden;
  border: 4px solid #d8ecf7;
  clip-path: polygon(0.8rem 0, calc(100% - 0.8rem) 0, 100% 0.8rem, 100% calc(100% - 0.8rem), calc(100% - 0.8rem) 100%, 0.8rem 100%, 0 calc(100% - 0.8rem), 0 0.8rem);
  background: var(--navy-900);
  box-shadow: 0 8px 0 #233d53;
}

.battle-stage {
  position: relative;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--sky);
  image-rendering: pixelated;
  user-select: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.hud,
.screen {
  position: absolute;
  inset: 0;
}

.hud {
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(11rem, 1fr) auto minmax(11rem, 1fr);
  align-items: start;
  gap: clamp(0.5rem, 2vw, 1.5rem);
  padding: clamp(0.5rem, 1.6vw, 1.25rem);
  pointer-events: none;
}

.flag-meter,
.battle-status,
.boss-meter {
  filter: drop-shadow(3px 3px 0 #04101d);
}

.flag-meter__label {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
  font-family: var(--font-display);
  font-size: clamp(0.8rem, 1.6vw, 1.15rem);
}

.flag-meter--red .flag-meter__label {
  flex-direction: row-reverse;
}

.flag-meter__track {
  height: clamp(0.75rem, 1.6vw, 1.25rem);
  overflow: hidden;
  border: 3px solid var(--ink);
  background: var(--navy-950);
}

.flag-meter__track span,
.boss-meter__track span {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left;
  transition: transform 220ms var(--ease-out);
}

.flag-meter--blue .flag-meter__track span {
  background: var(--blue);
}

.flag-meter--red .flag-meter__track span {
  background: var(--red);
  transform-origin: right;
}

.battle-status {
  display: grid;
  min-width: clamp(10rem, 20vw, 15rem);
  justify-items: center;
  gap: 0.1rem;
  padding: 0.4rem var(--space-3);
  border: 3px solid var(--gold-light);
  background: var(--navy-900);
  font-family: var(--font-display);
  text-align: center;
}

.battle-status > span {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: clamp(0.7rem, 1.4vw, 0.9rem);
  font-weight: 700;
}

.battle-status strong {
  color: var(--gold);
  font-size: clamp(1.05rem, 2.2vw, 1.6rem);
  font-variant-numeric: tabular-nums;
}

.battle-status strong span {
  display: inline-block;
  color: var(--gold);
  transform: scaleX(1.15);
}

.battle-status small {
  max-width: 20ch;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(0.68rem, 1.1vw, 0.82rem);
  font-weight: 700;
}

.boss-meter {
  position: absolute;
  top: clamp(4.2rem, 10vw, 6.4rem);
  left: 50%;
  width: min(52%, 36rem);
  translate: -50% 0;
}

.boss-meter > div:first-child {
  display: flex;
  justify-content: space-between;
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: clamp(0.8rem, 1.6vw, 1.15rem);
}

.boss-meter__track {
  height: clamp(0.75rem, 1.5vw, 1.1rem);
  overflow: hidden;
  border: 3px solid var(--ink);
  background: var(--navy-950);
}

.boss-meter__track span {
  background: var(--kraken);
}

.screen {
  z-index: 10;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: clamp(0.75rem, 3vw, 2rem);
  background: #031223d9;
  backdrop-filter: blur(3px);
}

.start-screen {
  background:
    linear-gradient(#03122347, #031223d9),
    transparent;
}

.start-panel,
.message-panel {
  width: min(100%, 48rem);
  padding: clamp(1rem, 3vw, 2rem);
  border: 4px solid var(--gold-light);
  clip-path: polygon(1rem 0, calc(100% - 1rem) 0, 100% 1rem, 100% calc(100% - 1rem), calc(100% - 1rem) 100%, 1rem 100%, 0 calc(100% - 1rem), 0 1rem);
  background: #071a32f2;
  box-shadow: 0 6px 0 #4a2f14;
  text-align: center;
}

.maker-line,
.message-panel > p:first-child,
.upgrade-header p {
  margin: 0 0 var(--space-2);
  color: var(--gold-light);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.start-panel h1 {
  max-width: 12ch;
  margin: 0 auto;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 6rem);
  letter-spacing: -0.035em;
  line-height: 0.78;
  text-wrap: balance;
}

.start-panel h1 span {
  color: var(--gold);
}

.start-lead {
  max-width: 42ch;
  margin: var(--space-4) auto;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 700;
}

.campaign-route {
  display: grid;
  max-width: 35rem;
  grid-template-columns: repeat(10, 1fr);
  gap: clamp(0.2rem, 0.7vw, 0.5rem);
  margin: var(--space-4) auto;
}

.campaign-route span {
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid #62849c;
  background: var(--navy-950);
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(0.8rem, 1.8vw, 1.1rem);
}

.campaign-route span.is-complete {
  border-color: var(--gold);
  background: #6a4712;
  color: var(--gold-light);
}

.campaign-route span.is-current {
  border-color: var(--cloud);
  background: var(--blue);
  color: var(--cloud);
}

.campaign-route .campaign-route__boss {
  border-color: var(--kraken);
  color: #d8b8ff;
}

.start-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}

.big-button,
.text-button {
  min-height: 2.75rem;
  border: 3px solid currentColor;
  padding: 0.65rem 1rem;
  font-family: var(--font-body);
  font-weight: 700;
  cursor: pointer;
  transition: transform 130ms var(--ease-out), filter 130ms, background 130ms, color 130ms;
}

.big-button:active,
.text-button:active {
  transform: scale(0.97);
}

.big-button:disabled,
.text-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.6);
  transform: none;
}

.big-button--gold {
  border-color: var(--gold-light);
  background: var(--gold);
  color: var(--navy-950);
}

.big-button--blue {
  border-color: var(--blue-light);
  background: var(--blue);
  color: var(--ink);
}

.text-button {
  border-color: #7897aa;
  background: var(--navy-900);
  color: var(--muted);
}

.text-button--danger {
  border-color: var(--red);
  color: #ffaaa5;
}

.text-button--link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.start-note {
  margin: var(--space-3) 0 0;
  color: var(--gold-light);
  font-size: 0.9rem;
}

.message-panel {
  width: min(100%, 38rem);
}

.message-panel--wide {
  width: min(100%, 48rem);
}

.message-panel h2,
.upgrade-header h2 {
  margin: 0;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 5rem);
  letter-spacing: -0.035em;
  line-height: 0.84;
  text-wrap: balance;
}

.message-panel > p:not(:first-child) {
  max-width: 52ch;
  margin: var(--space-4) auto;
  color: var(--muted);
}

.rule-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin: var(--space-4) 0;
}

.rule-strip span {
  padding: 0.35rem 0.65rem;
  border: 2px solid #58778e;
  background: var(--navy-950);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 700;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: var(--space-4) 0;
  border-block: 2px solid #496b84;
}

.result-stats span {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
  border-right: 2px solid #496b84;
}

.result-stats span:last-child {
  border-right: 0;
}

.result-stats small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.result-stats strong {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-variant-numeric: tabular-nums;
}

.complete-screen {
  background: #07101eea;
}

.complete-screen .message-panel {
  border-color: var(--kraken);
}

.upgrade-screen {
  z-index: 20;
  align-items: start;
  background: #020b16f2;
}

.upgrade-panel {
  width: min(100%, 68rem);
  margin-block: auto;
  padding: clamp(1rem, 3vw, 2rem);
  border: 4px solid var(--blue-light);
  background: var(--navy-900);
  box-shadow: 0 6px 0 #082948;
}

.upgrade-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid #4d718c;
}

.upgrade-header h2 {
  color: var(--blue-light);
  font-size: clamp(2.2rem, 6vw, 4rem);
}

.upgrade-header > strong {
  flex: 0 0 auto;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-variant-numeric: tabular-nums;
}

.upgrade-help {
  max-width: 65ch;
  color: var(--muted);
}

.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(8.5rem, 1fr));
  gap: var(--space-3);
  margin: var(--space-4) 0;
}

.upgrade-item {
  display: grid;
  min-width: 0;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 2px solid #426985;
  background: var(--navy-950);
}

.upgrade-item__sprite,
.unit-button__sprite {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  background: #0c3258;
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.upgrade-item h3 {
  min-height: 2.2em;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.05;
}

.upgrade-level {
  display: flex;
  gap: var(--space-1);
}

.upgrade-level span {
  height: 0.5rem;
  flex: 1;
  background: #29475d;
}

.upgrade-level span.is-filled {
  background: var(--gold);
}

.upgrade-item button {
  min-height: 2.75rem;
  border: 2px solid var(--blue-light);
  background: var(--blue);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 700;
  cursor: pointer;
}

.upgrade-item button:disabled {
  border-color: #47677c;
  background: #1a3448;
  color: #95a9b5;
  cursor: not-allowed;
}

.command-deck {
  display: grid;
  grid-template-columns: minmax(19rem, 0.86fr) minmax(0, 2.14fr);
  border-top: 4px solid #d8ecf7;
  background: var(--navy-950);
}

.worker-bank,
.pirate-bank {
  min-width: 0;
  padding: var(--space-3);
}

.worker-bank {
  border-right: 3px solid #406279;
}

.command-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.command-heading span {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.command-heading small {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
}

.worker-buttons,
.pirate-buttons {
  display: grid;
  gap: var(--space-2);
}

.worker-buttons,
.pirate-buttons {
  scrollbar-color: var(--gold) #173148;
  scrollbar-width: thin;
}

.worker-buttons::-webkit-scrollbar,
.pirate-buttons::-webkit-scrollbar {
  height: 0.45rem;
}

.worker-buttons::-webkit-scrollbar-track,
.pirate-buttons::-webkit-scrollbar-track {
  background: #173148;
}

.worker-buttons::-webkit-scrollbar-thumb,
.pirate-buttons::-webkit-scrollbar-thumb {
  background: var(--gold);
}

.worker-buttons {
  grid-template-columns: repeat(5, minmax(3.8rem, 1fr));
}

.pirate-buttons {
  grid-template-columns: repeat(10, minmax(4.4rem, 1fr));
}

.unit-button {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 6.25rem;
  grid-template-rows: 1fr auto auto;
  gap: 0.2rem;
  border: 2px solid #476d86;
  padding: 0.35rem;
  background: #0b2137;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 3px 0 #020812;
  transition: transform 130ms var(--ease-out), translate 100ms, border-color 100ms, background 100ms;
}

.unit-button:active:not(:disabled) {
  transform: scale(0.97);
  box-shadow: 0 1px 0 #020812;
}

.unit-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.unit-button.is-ready {
  border-color: var(--gold);
}

.unit-button__sprite {
  min-height: 2.6rem;
  aspect-ratio: auto;
  font-size: 1.2rem;
}

.unit-button__name {
  display: -webkit-box;
  min-height: 2em;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.unit-button__cost {
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.unit-button__key {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  display: grid;
  width: 1.4rem;
  height: 1.4rem;
  place-items: center;
  background: var(--navy-950);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
}

.toast {
  position: absolute;
  z-index: 30;
  bottom: 1rem;
  left: 50%;
  max-width: min(90%, 32rem);
  padding: var(--space-2) var(--space-4);
  translate: -50% 1rem;
  border: 3px solid var(--gold);
  background: var(--navy-950);
  color: var(--gold-light);
  font-family: var(--font-body);
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms, translate 180ms var(--ease-out);
}

.toast.is-visible {
  translate: -50% 0;
  opacity: 1;
}

.toast.is-instant {
  transition: none;
}

.how-to-play {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) var(--space-6);
  padding: var(--space-4);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
}

kbd {
  min-width: 1.55rem;
  border: 2px solid #6b8899;
  padding: 0.12rem 0.32rem;
  background: var(--navy-900);
  color: var(--ink);
  font: inherit;
  text-align: center;
}

.rotate-hint {
  display: none;
  margin: 0;
  padding: var(--space-3);
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

@media (max-width: 70rem) {
  .command-deck {
    grid-template-columns: 1fr;
  }

  .worker-bank {
    border-right: 0;
    border-bottom: 3px solid #406279;
  }

  .worker-buttons {
    grid-template-columns: repeat(5, minmax(5rem, 1fr));
  }

  .pirate-buttons {
    overflow-x: auto;
    grid-template-columns: repeat(10, minmax(5.5rem, 1fr));
    padding-bottom: var(--space-2);
    scroll-snap-type: x proximity;
  }

  .pirate-buttons .unit-button {
    scroll-snap-align: start;
  }

  .upgrade-grid {
    grid-template-columns: repeat(2, minmax(9rem, 1fr));
  }
}

@media (max-width: 48rem) {
  .game-shell {
    padding-inline: 0;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
    padding-inline: var(--space-2);
  }

  .back-to-arcade span,
  .topbar-button span,
  .mini-brand span {
    display: none;
  }

  .mini-brand {
    justify-self: center;
  }

  .game-frame {
    border-inline: 0;
    clip-path: none;
  }

  .hud {
    grid-template-columns: minmax(0, 1fr) 7.75rem minmax(0, 1fr);
    gap: 0.35rem;
    padding: 0.35rem;
  }

  .flag-meter__label {
    font-size: 0.7rem;
  }

  .flag-meter__label span {
    display: none;
  }

  .flag-meter--red .flag-meter__label {
    flex-direction: row;
    justify-content: flex-end;
  }

  .battle-status {
    min-width: 0;
    padding: 0.2rem;
    border-width: 2px;
  }

  .battle-status > span,
  .battle-status small {
    font-size: 0.75rem;
    line-height: 1;
  }

  .battle-status strong {
    font-size: 0.88rem;
  }

  .boss-meter {
    top: 3.3rem;
    width: 62%;
  }

  .screen {
    padding: 0.45rem;
  }

  .start-panel,
  .message-panel {
    padding: 0.75rem;
    border-width: 3px;
  }

  .maker-line,
  .message-panel > p:first-child {
    margin-bottom: 0.2rem;
    font-size: 0.68rem;
  }

  .start-panel h1 {
    font-size: clamp(2.1rem, 11vw, 3.4rem);
  }

  .start-lead,
  .message-panel > p:not(:first-child) {
    margin: 0.45rem auto;
    font-size: 0.85rem;
  }

  .campaign-route {
    margin: 0.5rem auto;
  }

  .campaign-route span {
    font-size: 0.75rem;
  }

  .big-button,
  .text-button {
    min-height: 2.75rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.82rem;
  }

  .start-note {
    display: none;
  }

  .message-panel h2 {
    font-size: clamp(2rem, 10vw, 3.2rem);
  }

  .rule-strip,
  .result-stats {
    margin: 0.5rem 0;
  }

  .rule-strip span {
    padding: 0.2rem 0.4rem;
    font-size: 0.68rem;
  }

  .result-stats span {
    padding: 0.4rem;
  }

  .result-stats small {
    font-size: 0.62rem;
  }

  .result-actions {
    gap: 0.35rem;
  }

  .worker-bank,
  .pirate-bank {
    padding: var(--space-2);
  }

  .worker-buttons,
  .pirate-buttons {
    overflow-x: auto;
    grid-template-columns: repeat(5, minmax(5.25rem, 1fr));
    padding-bottom: var(--space-2);
  }

  .pirate-buttons {
    grid-template-columns: repeat(10, minmax(5.25rem, 1fr));
  }

  .unit-button {
    min-height: 5.8rem;
  }

  .unit-button__name {
    font-size: 0.75rem;
  }

  .how-to-play {
    display: none;
  }

  .rotate-hint {
    display: block;
  }
}

@media (min-width: 70.01rem) and (max-height: 56.25rem) {
  .game-shell {
    width: min(100%, 96rem, calc((100dvh - 14rem) * 16 / 9));
  }

  .worker-bank,
  .pirate-bank {
    padding: var(--space-2);
  }

  .command-heading {
    margin-bottom: var(--space-1);
  }

  .worker-buttons,
  .pirate-buttons {
    gap: var(--space-1);
  }

  .unit-button {
    min-height: 5rem;
    padding: var(--space-1);
  }

  .unit-button__sprite {
    min-height: 2rem;
  }
}

@media (max-width: 48rem) and (orientation: portrait) {
  .battle-stage {
    min-height: 17rem;
    aspect-ratio: 16 / 10;
  }

  .topbar {
    margin-bottom: 0;
  }
}

@media (max-height: 43rem) and (orientation: landscape) {
  .game-shell {
    width: min(100%, 78rem);
    padding-block: 0.2rem;
  }

  .topbar {
    min-height: 2.75rem;
    margin-bottom: 0.2rem;
  }

  .mini-brand img {
    width: 2.25rem;
    height: 2.25rem;
  }

  .back-to-arcade,
  .topbar-button {
    min-height: 2.75rem;
    padding-block: 0.3rem;
  }

  .command-deck {
    grid-template-columns: minmax(17rem, 0.8fr) minmax(0, 2.2fr);
  }

  .worker-bank {
    border-right: 3px solid #406279;
    border-bottom: 0;
  }

  .unit-button {
    min-height: 4.8rem;
  }

  .unit-button__sprite {
    min-height: 1.8rem;
  }

  .how-to-play,
  .rotate-hint {
    display: none;
  }
}

@media (hover: hover) and (pointer: fine) {
  .big-button:hover,
  .text-button:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);
  }

  .unit-button:hover:not(:disabled) {
    border-color: var(--gold);
    background: #123757;
    translate: 0 -2px;
  }

  .unit-button:hover:not(:disabled) .unit-button__sprite {
    background: #14538a;
  }
}

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

  .toast,
  .toast.is-visible {
    translate: -50% 0;
    transition: opacity 120ms var(--ease-out) !important;
  }
}
