:root {
  color-scheme: dark;
  --bg: #08090d;
  --panel: rgba(18, 20, 27, 0.82);
  --panel-strong: rgba(25, 27, 35, 0.94);
  --text: #f4fbf0;
  --muted: #aeb8ad;
  --acid: #9dff47;
  --cyan: #46e6ff;
  --pink: #ff4eb8;
  --amber: #ffbd48;
  --danger: #ff5a5a;
  --line: rgba(255, 255, 255, 0.15);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(8, 9, 13, 0.88), rgba(8, 9, 13, 0.26), rgba(8, 9, 13, 0.82)),
    url("assets/space-bacteria-landscape.png") center / cover fixed no-repeat,
    radial-gradient(circle at 22% 10%, rgba(157, 255, 71, 0.18), transparent 24rem),
    radial-gradient(circle at 82% 26%, rgba(255, 78, 184, 0.18), transparent 20rem),
    linear-gradient(145deg, #08090d 0%, #101018 48%, #090a0f 100%);
  color: var(--text);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

#biofield {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  opacity: 0.34;
  mix-blend-mode: screen;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  place-items: stretch;
}

.app-shell::before {
  display: none;
}

.screen {
  min-height: 100svh;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: none;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.screen.is-active {
  display: flex;
}

.screen-opening {
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

.top-strip,
.status-panel,
.mode-card,
.bottom-nav {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.mode-card,
.bottom-nav,
.primary-action,
.secondary-action,
.icon-action,
.tower-pick,
.upgrade-panel,
.meta-card {
  border-color: rgba(157, 255, 71, 0.22);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 16px 44px rgba(0, 0, 0, 0.44),
    0 0 24px rgba(157, 255, 71, 0.07);
}

.top-strip {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #dfffd1;
  font-size: 0.86rem;
}

.signal-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 18px var(--acid);
  flex: 0 0 auto;
}

.hero-cluster {
  position: relative;
  min-height: clamp(250px, 42svh, 380px);
  display: grid;
  place-items: center;
}

.planet {
  position: relative;
  width: min(72vw, 330px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.34), transparent 11%),
    radial-gradient(circle at 62% 66%, rgba(255, 78, 184, 0.42), transparent 20%),
    linear-gradient(140deg, #41ecff, #7647ff 48%, #17131d);
  box-shadow:
    inset -26px -30px 48px rgba(0, 0, 0, 0.38),
    0 0 58px rgba(70, 230, 255, 0.28),
    0 0 100px rgba(157, 255, 71, 0.16);
  overflow: hidden;
}

.planet::before {
  content: "";
  position: absolute;
  inset: -11%;
  border: 2px solid rgba(157, 255, 71, 0.35);
  border-radius: 50%;
  transform: rotate(-18deg) scaleY(0.28);
}

.continent {
  position: absolute;
  background: linear-gradient(135deg, #9dff47, #2c7a2b);
  box-shadow: 0 0 18px rgba(157, 255, 71, 0.3);
}

.c1 {
  width: 32%;
  height: 22%;
  right: 18%;
  top: 22%;
  border-radius: 48% 52% 32% 68%;
}

.c2 {
  width: 22%;
  height: 30%;
  left: 22%;
  top: 46%;
  border-radius: 68% 32% 60% 40%;
}

.c3 {
  width: 18%;
  height: 13%;
  right: 42%;
  bottom: 18%;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffbd48, #9dff47);
}

.bacteria,
.dna-ring {
  position: absolute;
  pointer-events: none;
}

.bacteria {
  width: 62px;
  height: 86px;
  border-radius: 42% 58% 48% 52%;
  background: radial-gradient(circle at 38% 28%, #f5ffb7 0 7px, transparent 8px), linear-gradient(150deg, var(--acid), #29a76d 58%, #10635a);
  box-shadow: 0 0 26px rgba(157, 255, 71, 0.45);
}

.bacteria::before,
.bacteria::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 2px solid rgba(157, 255, 71, 0.45);
  border-radius: inherit;
}

.b-one {
  right: 7%;
  top: 18%;
  transform: rotate(-19deg);
  animation: floatOne 6s ease-in-out infinite;
}

.b-two {
  left: 8%;
  bottom: 8%;
  width: 48px;
  height: 66px;
  background: radial-gradient(circle at 40% 32%, #fff6bd 0 6px, transparent 7px), linear-gradient(150deg, var(--pink), #8538ff);
  box-shadow: 0 0 24px rgba(255, 78, 184, 0.44);
  transform: rotate(18deg);
  animation: floatTwo 7.5s ease-in-out infinite;
}

.dna-ring {
  width: min(86vw, 390px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  animation: spin 22s linear infinite;
}

.opening-copy {
  display: grid;
  gap: 10px;
}

.eyebrow,
.mode-kicker,
.readout-label {
  margin: 0;
  color: var(--acid);
  font-size: 0.77rem;
  letter-spacing: 0;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(3.2rem, 18vw, 5.8rem);
  line-height: 0.86;
  color: #b9ff6a;
  text-shadow:
    0 2px 0 #142411,
    0 0 22px rgba(157, 255, 71, 0.64),
    0 0 42px rgba(255, 78, 184, 0.26);
}

.tagline {
  max-width: 32rem;
  color: #d9e6d7;
  font-size: 1rem;
  line-height: 1.55;
}

.opening-actions {
  display: grid;
  grid-template-columns: 1fr 54px;
  gap: 10px;
}

.primary-action,
.mode-button {
  min-height: 54px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--acid), #40d873 52%, var(--cyan));
  color: #081008;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 16px 38px rgba(157, 255, 71, 0.22);
}

.primary-action:active,
.mode-button:active,
.icon-action:active,
.nav-item:active {
  transform: translateY(1px) scale(0.99);
}

.btn-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(8, 16, 8, 0.14);
  font-size: 0.86rem;
}

.icon-action {
  min-width: 52px;
  min-height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  font-weight: 900;
  color: #fff;
}

.screen-menu {
  flex-direction: column;
  gap: 14px;
  padding-bottom: max(94px, calc(82px + env(safe-area-inset-bottom)));
}

.screen-game {
  max-width: 960px;
  flex-direction: column;
  gap: 10px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

body.is-playing #biofield {
  opacity: 0.18;
}

.menu-header {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 12px;
  direction: ltr;
}

.menu-header > div {
  direction: rtl;
}

h2 {
  font-size: 1.9rem;
  line-height: 1.05;
}

.status-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
}

.world-readout {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.world-readout strong {
  color: #fff;
  font-size: 1.5rem;
}

.readout-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.readout-bar span {
  display: block;
  width: 72%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--danger), var(--amber), var(--acid));
}

.status-panel p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.mode-list {
  display: grid;
  gap: 12px;
}

.mode-card {
  position: relative;
  display: grid;
  grid-template-columns: 116px 1fr;
  min-height: 184px;
  padding: 12px;
  gap: 12px;
  overflow: hidden;
  border-radius: 8px;
}

.mode-active {
  background:
    linear-gradient(135deg, rgba(157, 255, 71, 0.16), rgba(70, 230, 255, 0.08)),
    var(--panel);
}

.mode-locked {
  background:
    linear-gradient(135deg, rgba(255, 78, 184, 0.12), rgba(255, 189, 72, 0.06)),
    rgba(18, 20, 27, 0.72);
  color: rgba(244, 251, 240, 0.68);
}

.mode-art {
  position: relative;
  min-height: 158px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.mode-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.mode-content h3 {
  font-size: 1.24rem;
  line-height: 1.12;
}

.mode-content p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.42;
}

.mode-button {
  width: 100%;
  min-height: 44px;
  box-shadow: none;
}

.locked-button {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.58);
}

.lock-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(8, 9, 13, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.mini-planet,
.target-planet {
  position: absolute;
  border-radius: 50%;
}

.mini-planet {
  width: 86px;
  height: 86px;
  right: 13px;
  bottom: 13px;
  background: radial-gradient(circle at 34% 26%, #fff7a8, transparent 11px), linear-gradient(135deg, #4cf092, #3170ff 74%);
  box-shadow: 0 0 34px rgba(70, 230, 255, 0.32);
}

.tower {
  position: absolute;
  bottom: 62px;
  width: 18px;
  height: 38px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(#ffbd48, #ff4eb8);
  box-shadow: 0 0 16px rgba(255, 78, 184, 0.35);
}

.t1 {
  right: 36px;
}

.t2 {
  right: 72px;
  height: 28px;
  background: linear-gradient(#9dff47, #46e6ff);
}

.ship {
  position: absolute;
  left: 20px;
  top: 24px;
  width: 46px;
  height: 16px;
  border-radius: 50% 50% 42% 42%;
  background: #d7e2ff;
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.28);
}

.ship::after {
  content: "";
  position: absolute;
  left: -11px;
  top: 5px;
  width: 18px;
  height: 5px;
  border-radius: 999px;
  background: var(--danger);
}

.target-planet {
  width: 76px;
  height: 76px;
  left: 18px;
  top: 20px;
  background: linear-gradient(135deg, #ffbd48, #ff5a5a 56%, #542a2a);
  box-shadow: 0 0 30px rgba(255, 189, 72, 0.3);
}

.orbit-line {
  position: absolute;
  width: 122px;
  height: 122px;
  right: -28px;
  bottom: -16px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.22);
}

.spore {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 40% 60% 50% 50%;
  background: linear-gradient(135deg, #9dff47, #ff4eb8);
}

.sp1 {
  right: 28px;
  bottom: 36px;
}

.sp2 {
  right: 68px;
  top: 78px;
  transform: scale(0.72) rotate(20deg);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 496px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 7px;
  border-radius: 8px;
}

.nav-item {
  min-width: 0;
  min-height: 56px;
  display: grid;
  place-items: center;
  gap: 2px;
  border-radius: 7px;
  background: transparent;
  color: rgba(244, 251, 240, 0.62);
}

.nav-item span {
  font-size: 1.15rem;
}

.nav-item small {
  font-size: 0.68rem;
  white-space: nowrap;
}

.nav-item.is-selected {
  color: #081008;
  background: var(--acid);
  font-weight: 900;
}

.toast {
  position: fixed;
  z-index: 4;
  right: 16px;
  left: 16px;
  bottom: max(96px, calc(86px + env(safe-area-inset-bottom)));
  max-width: 488px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(8, 9, 13, 0.92);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.game-topbar {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 10px;
  direction: ltr;
}

.game-title {
  min-width: 0;
  direction: rtl;
  text-align: center;
}

.game-title strong {
  display: block;
  font-size: 1.18rem;
  line-height: 1.1;
}

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

.hud-grid > div,
.tower-pick,
.secondary-action,
.game-banner,
.upgrade-panel,
.meta-card,
.unit-card,
.banner-unit,
.upgrade-level {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hud-grid > div {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border-radius: 8px;
}

.hud-grid span {
  color: var(--muted);
  font-size: 0.72rem;
}

.hud-grid strong {
  color: #fff;
  font-size: 1.15rem;
}

.game-board {
  position: relative;
  min-height: 0;
  flex: 1;
  display: grid;
  place-items: center;
}

#gameCanvas {
  width: min(100%, 680px);
  max-width: 100%;
  height: auto;
  aspect-ratio: 13 / 9;
  display: block;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #0d1018;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.44);
  touch-action: none;
}

.game-banner {
  position: absolute;
  top: 10px;
  right: 10px;
  left: 10px;
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.game-banner.is-hidden {
  opacity: 0;
  transform: translateY(-8px);
}

.game-banner strong {
  color: #fff;
  font-size: 0.95rem;
}

.game-banner span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

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

.tower-pick {
  min-width: 0;
  min-height: 74px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  padding: 7px 5px;
  border-radius: 8px;
  color: var(--text);
}

.tower-pick.is-selected {
  border-color: rgba(157, 255, 71, 0.82);
  background: rgba(157, 255, 71, 0.12);
}

.tower-pick strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 0.72rem;
  line-height: 1.05;
}

.tower-pick small {
  color: var(--acid);
  font-weight: 900;
}

.pick-icon {
  width: 24px;
  height: 24px;
  display: block;
  border-radius: 50%;
}

.weapon-icon {
  background: radial-gradient(circle at 38% 31%, #fff8ab 0 5px, transparent 6px), linear-gradient(135deg, var(--acid), #2f3540);
}

.hand-icon {
  border-radius: 45% 45% 55% 55%;
  background: radial-gradient(circle at 38% 35%, #fff8ab 0 4px, transparent 5px), linear-gradient(135deg, #ffbd48, #ff4eb8);
}

.mouth-icon {
  background: radial-gradient(circle, #fff8ab 0 4px, transparent 5px), conic-gradient(from 90deg, var(--cyan), var(--pink), var(--acid), var(--cyan));
}

.acid-icon {
  background: radial-gradient(circle at 38% 31%, #fff8ab 0 5px, transparent 6px), linear-gradient(135deg, var(--acid), #15885b);
}

.boxer-icon {
  border-radius: 45% 45% 55% 55%;
  background: radial-gradient(circle at 38% 35%, #fff8ab 0 4px, transparent 5px), linear-gradient(135deg, #ffbd48, #ff4eb8);
}

.web-icon {
  background: radial-gradient(circle, #fff8ab 0 4px, transparent 5px), conic-gradient(from 90deg, var(--cyan), var(--pink), var(--acid), var(--cyan));
}

.game-actions {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 8px;
}

.upgrade-panel {
  display: none;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
}

.upgrade-panel.is-visible {
  display: grid;
}

.upgrade-panel > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.upgrade-panel strong {
  font-size: 0.9rem;
}

.upgrade-levels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.upgrade-level {
  min-height: 46px;
  display: grid;
  place-items: center;
  gap: 2px;
  border-radius: 8px;
  color: #fff;
}

.upgrade-level.is-unlocked {
  border-color: rgba(157, 255, 71, 0.76);
  background: rgba(157, 255, 71, 0.13);
}

.upgrade-level.is-next {
  border-color: rgba(255, 189, 72, 0.86);
  background: rgba(255, 189, 72, 0.14);
}

.upgrade-level span {
  font-weight: 900;
  font-size: 0.78rem;
}

.upgrade-level small {
  color: var(--acid);
  font-weight: 900;
}

.secondary-action {
  min-height: 54px;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
}

.game-over-panel {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 9, 13, 0.72);
}

.game-over-card {
  width: min(100%, 420px);
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(18, 20, 27, 0.95);
  box-shadow: var(--shadow);
  text-align: center;
}

.game-over-card h2 {
  font-size: 1.6rem;
}

.game-over-card p {
  color: var(--muted);
  line-height: 1.45;
}

.meta-panel {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(8, 9, 13, 0.76);
}

.meta-panel.is-visible {
  display: grid;
}

.meta-card {
  width: min(100%, 520px);
  max-height: min(86svh, 720px);
  display: grid;
  gap: 12px;
  padding: 14px;
  overflow: auto;
  border-radius: 8px;
}

.meta-header {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 12px;
  direction: ltr;
}

.meta-header > div {
  direction: rtl;
}

.meta-content {
  display: grid;
  gap: 10px;
}

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

.banner-unit,
.unit-card {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 10px;
  border-radius: 8px;
}

.unit-portrait {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.34), transparent 18%),
    linear-gradient(135deg, rgba(157, 255, 71, 0.8), rgba(70, 230, 255, 0.7));
  box-shadow: inset 0 -18px 30px rgba(0, 0, 0, 0.28);
}

.unit-portrait.sprite {
  background-repeat: no-repeat;
  background-color: rgba(4, 7, 10, 0.82);
  background-size: 300% 100%;
}

.unit-portrait.sprite.enemy-sheet {
  background-size: 300% 200%;
}

.unit-portrait.image-card {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 72%, rgba(157, 255, 71, 0.28), transparent 42%),
    linear-gradient(145deg, rgba(8, 9, 13, 0.88), rgba(37, 22, 55, 0.86));
}

.unit-portrait.image-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.48));
  transform: scale(1.18);
}

.unit-portrait.rare {
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.34), transparent 18%),
    linear-gradient(135deg, rgba(255, 189, 72, 0.86), rgba(255, 78, 184, 0.74));
}

.unit-portrait.legend {
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.44), transparent 18%),
    conic-gradient(from 90deg, #9dff47, #46e6ff, #ff4eb8, #ffbd48, #9dff47);
}

.banner-unit strong,
.unit-card strong {
  font-size: 0.86rem;
  line-height: 1.12;
}

.banner-unit small,
.unit-card small,
.meta-note {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.summon-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.unit-card.is-locked {
  opacity: 0.58;
}

.unit-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.evolve-button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--pink), var(--amber));
  color: #140810;
  font-weight: 900;
}

.evolve-button:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.45);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes floatOne {
  0%,
  100% {
    transform: translateY(0) rotate(-19deg);
  }
  50% {
    transform: translateY(-14px) rotate(-9deg);
  }
}

@keyframes floatTwo {
  0%,
  100% {
    transform: translateY(0) rotate(18deg);
  }
  50% {
    transform: translateY(12px) rotate(8deg);
  }
}

@media (max-width: 380px) {
  .screen {
    padding-inline: 12px;
  }

  .mode-card {
    grid-template-columns: 98px 1fr;
    padding: 10px;
  }

  .mode-content h3 {
    font-size: 1.08rem;
  }

  .mode-content p {
    font-size: 0.8rem;
  }
}

@media (min-width: 760px) {
  .screen {
    max-width: 560px;
  }

  .screen-game {
    max-width: 1040px;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .screen-game {
    display: none;
    grid-template-columns: 132px minmax(0, 1fr) 168px;
    grid-template-rows: 50px minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    max-width: none;
    min-height: 100svh;
    padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom));
  }

  .screen-game.is-active {
    display: grid;
  }

  .game-topbar {
    grid-column: 1 / 4;
    grid-template-columns: 46px 1fr 46px;
    gap: 8px;
  }

  .screen-game .icon-action {
    min-width: 46px;
    min-height: 46px;
  }

  .game-title strong {
    font-size: 1rem;
  }

  .hud-grid {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: 1fr;
    align-content: start;
  }

  .hud-grid > div {
    padding: 8px;
  }

  .game-board {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    min-height: 0;
  }

  #gameCanvas {
    width: min(100%, 74svh * 13 / 9);
    max-height: calc(100svh - 70px);
  }

  .tower-tray {
    grid-column: 3;
    grid-row: 2;
    grid-template-columns: 1fr;
    align-content: start;
    align-self: start;
  }

  .tower-pick {
    min-height: 58px;
    grid-template-columns: 28px 1fr auto;
    justify-items: start;
    align-items: center;
    text-align: right;
    padding: 7px;
  }

  .tower-pick strong {
    font-size: 0.68rem;
  }

  .game-actions {
    grid-column: 3;
    grid-row: 2;
    align-self: end;
    grid-template-columns: 1fr;
  }

  .upgrade-panel {
    grid-column: 1;
    grid-row: 2;
    align-self: end;
  }

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

  .game-actions .primary-action,
  .secondary-action {
    min-height: 42px;
  }

  .game-banner {
    top: 8px;
    right: 8px;
    left: 8px;
    padding: 8px 10px;
  }
}
