@font-face {
  font-family: "Made Evolve Sans";
  src: url("./assets/fonts/made_evolve_sans_regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Made Evolve Sans";
  src: url("./assets/fonts/made_evolve_sans_medium.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Made Evolve Sans";
  src: url("./assets/fonts/made_evolve_sans_bold.otf") format("opentype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #121018;
  --panel: #201a2a;
  --panel-2: #2b2237;
  --ink: #fbf7ff;
  --muted: #b9aec8;
  --line: rgba(255, 255, 255, 0.12);
  --aether: #b36cff;
  --cyan: #70e8ff;
  --gold: #ffd166;
  --danger: #ff5f7a;
  --accent: #b36cff;
  --accent-2: #70e8ff;
  --accent-soft: rgba(179, 108, 255, 0.16);
  --accent-rgb: 179, 108, 255;
  --accent-2-rgb: 112, 232, 255;
  --brand-font: "Made Evolve Sans", "Bebas Neue", "Gill Sans", "Gill Sans MT", Impact, sans-serif;
  --ui-font: "Made Evolve Sans", "Gill Sans", "Gill Sans MT", Inter, ui-sans-serif, system-ui, sans-serif;
  --tile: min(122px, calc((100vw - 44px) / 14), calc((100vh - 200px) / 7));
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(var(--accent-2-rgb), 0.14), transparent 24rem),
    radial-gradient(circle at 82% 18%, rgba(var(--accent-rgb), 0.16), transparent 22rem),
    linear-gradient(145deg, #111018 0%, #191226 48%, #16171f 100%);
  color: var(--ink);
  font-family: var(--ui-font);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb), 0.1), transparent 34rem);
  background-size: 100% 4px, auto;
  opacity: 0.55;
}

.title-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 28px;
  background:
    radial-gradient(circle at 24% 18%, rgba(var(--accent-2-rgb), 0.24), transparent 20rem),
    radial-gradient(circle at 76% 24%, rgba(var(--accent-rgb), 0.28), transparent 24rem),
    linear-gradient(145deg, rgba(13, 10, 20, 0.96), rgba(28, 18, 42, 0.98));
}

.title-screen.closed {
  display: none;
}

.title-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 100% 5px, 64px 100%;
  opacity: 0.48;
}

.title-floaters {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.title-floater {
  position: absolute;
  width: clamp(92px, 9vw, 160px);
  height: clamp(92px, 9vw, 160px);
  display: grid;
  place-items: center;
  opacity: 0.78;
  filter:
    drop-shadow(0 12px 24px rgba(0, 0, 0, 0.38))
    drop-shadow(0 0 22px rgba(var(--accent-rgb), 0.22));
  animation: titleFloat 5.8s ease-in-out infinite;
}

.title-floater img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.title-floater:nth-child(1) {
  left: 8%;
  top: 16%;
  animation-delay: -1s;
}

.title-floater:nth-child(2) {
  right: 9%;
  top: 13%;
  animation-delay: -2.1s;
}

.title-floater:nth-child(3) {
  left: 14%;
  bottom: 18%;
  animation-delay: -3.4s;
}

.title-floater:nth-child(4) {
  right: 17%;
  bottom: 14%;
  animation-delay: -0.5s;
}

.title-floater:nth-child(5) {
  left: 50%;
  top: 8%;
  width: clamp(74px, 7vw, 122px);
  height: clamp(74px, 7vw, 122px);
  opacity: 0.62;
  animation-delay: -4.6s;
}

.title-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  width: min(720px, calc(100vw - 34px));
  justify-items: center;
  text-align: center;
}

.title-logo {
  width: min(560px, 82vw);
  height: auto;
  filter:
    drop-shadow(0 2px 0 rgba(68, 39, 96, 0.92))
    drop-shadow(0 0 24px rgba(var(--accent-rgb), 0.6))
    drop-shadow(0 0 36px rgba(var(--accent-2-rgb), 0.26));
}

.title-panel h1 {
  color: var(--ink);
  font-size: clamp(2.2rem, 7vw, 6.1rem);
  line-height: 0.92;
  white-space: nowrap;
  text-shadow: 0 0 30px rgba(var(--accent-rgb), 0.34);
}

.title-panel > p {
  width: min(620px, 100%);
  color: var(--muted);
  font-size: clamp(0.98rem, 1.5vw, 1.28rem);
  font-weight: 760;
  line-height: 1.42;
}

.title-actions {
  display: block;
  margin-top: 4px;
  width: min(190px, 100%);
}

.title-hero {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.title-hero img {
  width: clamp(82px, 10vw, 118px);
  height: clamp(82px, 10vw, 118px);
  object-fit: contain;
  image-rendering: pixelated;
  border: 1px solid rgba(var(--accent-rgb), 0.32);
  border-radius: 8px;
  background:
    radial-gradient(circle at center, rgba(var(--accent-rgb), 0.22), transparent 64%),
    rgba(16, 12, 22, 0.62);
  box-shadow: 0 0 26px rgba(var(--accent-rgb), 0.18);
}

.title-hero button {
  width: min(210px, 72vw);
  min-height: 38px;
  font-size: 0.76rem;
}

.title-howto {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
  width: min(690px, 100%);
}

.title-howto div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 8px;
  background: rgba(15, 12, 22, 0.66);
  text-align: left;
}

.title-howto strong {
  color: var(--accent-2);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.title-howto span {
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.32;
}

.title-credit {
  position: absolute;
  left: 18px;
  bottom: 16px;
  z-index: 1;
  color: rgba(251, 247, 255, 0.64);
  font-size: 0.78rem;
  font-weight: 850;
}

@keyframes titleFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-3deg) scale(1);
  }

  50% {
    transform: translate3d(0, -16px, 0) rotate(4deg) scale(1.04);
  }
}

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

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.7);
  opacity: 0.55;
}

.shell {
  width: min(1780px, calc(100vw - 20px));
  margin: 0 auto;
  padding: 14px 0 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-orb {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(var(--accent-rgb), 0.24), rgba(255, 255, 255, 0.03));
  box-shadow: 0 0 24px rgba(var(--accent-rgb), 0.18);
  transition: transform 160ms ease, border-color 160ms ease;
}

.hero-orb:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.hero-orb img {
  width: 62px;
  height: 62px;
  object-fit: contain;
  image-rendering: pixelated;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: var(--brand-font);
  font-size: clamp(1rem, 1.35vw, 1.45rem);
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.nostalgix-logo {
  width: clamp(220px, 28vw, 430px);
  height: auto;
  display: block;
  object-fit: contain;
  filter:
    drop-shadow(0 2px 0 rgba(68, 39, 96, 0.92))
    drop-shadow(0 0 16px rgba(var(--accent-rgb), 0.42))
    drop-shadow(0 0 24px rgba(var(--accent-2-rgb), 0.18));
}

h2 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.shop-head p,
.codex p {
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(82px, 1fr));
  gap: 7px;
  width: min(740px, 100%);
}

.stats div {
  min-height: 54px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(32, 26, 42, 0.82);
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.stats strong {
  display: block;
  margin-top: 4px;
  color: var(--accent);
  font-size: 1.12rem;
}

.command-bar {
  display: grid;
  grid-template-columns: 220px 170px 120px 48px 48px minmax(165px, 260px);
  gap: 10px;
  align-items: stretch;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(32, 26, 42, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 40px rgba(0, 0, 0, 0.18);
  padding: 14px;
}

.wave-preview {
  display: grid;
  min-height: 46px;
  align-items: center;
  justify-self: stretch;
  padding: 10px 12px;
  border: 1px solid rgba(var(--accent-2-rgb), 0.22);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.2;
}

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

.game-layout {
  display: grid;
  justify-items: center;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(32, 26, 42, 0.88);
  padding: 14px;
}

.primary-button,
.secondary-button,
.danger-button {
  width: 100%;
  min-height: 44px;
  border-radius: 8px;
  font-weight: 800;
  font-family: var(--brand-font);
  text-transform: uppercase;
}

.primary-button {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, white 18%), color-mix(in srgb, var(--accent) 70%, black 30%));
  box-shadow: 0 10px 28px rgba(var(--accent-rgb), 0.24);
}

.secondary-button {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(0, 0, 0, 0.02)),
    #30263e;
  border: 1px solid var(--line);
}

.icon-toggle {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 48px;
  padding: 0;
  color: var(--accent-2);
}

.icon-toggle svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-toggle.off {
  color: #ff6680;
  border-color: rgba(255, 92, 124, 0.46);
  background:
    linear-gradient(180deg, rgba(255, 92, 124, 0.12), rgba(0, 0, 0, 0.02)),
    #30212f;
}

.icon-toggle.off::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 3px;
  border-radius: 999px;
  background: #ff335c;
  box-shadow: 0 0 8px rgba(255, 51, 92, 0.42);
  transform: rotate(-42deg);
}

.danger-button {
  background: #47222d;
  color: #ffdbe2;
  border: 1px solid rgba(255, 95, 122, 0.35);
}

.tower-details img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  image-rendering: pixelated;
}

.board-wrap {
  position: relative;
  min-width: calc(var(--tile) * 14);
  overflow: visible;
}

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(14, var(--tile));
  grid-template-rows: repeat(7, var(--tile));
  width: calc(var(--tile) * 14);
  height: calc(var(--tile) * 7);
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(var(--accent-rgb), 0.06), transparent 40%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(135deg, #1c2634, #211a2b);
  background-size: var(--tile) var(--tile), var(--tile) var(--tile), auto;
  box-shadow:
    inset 0 0 34px rgba(0, 0, 0, 0.4),
    0 18px 55px rgba(0, 0, 0, 0.25);
}

.cell {
  position: relative;
  appearance: none;
  padding: 0;
  background: transparent;
  border-right: 1px solid rgba(255, 255, 255, 0.035);
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}

.cell.path {
  background:
    linear-gradient(90deg, rgba(var(--accent-2-rgb), 0.08), rgba(var(--accent-rgb), 0.08)),
    rgba(var(--accent-2-rgb), 0.08);
}

.cell.obstacle {
  cursor: not-allowed;
  border-color: rgba(255, 214, 91, 0.42);
  background:
    linear-gradient(135deg, rgba(255, 224, 102, 0.14), rgba(89, 46, 143, 0.28)),
    repeating-linear-gradient(45deg, rgba(255, 237, 151, 0.22) 0 6px, rgba(37, 20, 68, 0.34) 6px 12px);
  box-shadow:
    inset 0 0 20px rgba(255, 215, 105, 0.16),
    0 0 10px rgba(104, 69, 185, 0.2);
}

.cell.obstacle.path {
  background:
    linear-gradient(135deg, rgba(255, 224, 102, 0.14), rgba(89, 46, 143, 0.28)),
    repeating-linear-gradient(45deg, rgba(255, 237, 151, 0.22) 0 6px, rgba(37, 20, 68, 0.34) 6px 12px);
}

.cell.invalid {
  background: rgba(255, 95, 122, 0.24);
}

.cell.placeable:hover {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.path-label {
  position: absolute;
  z-index: 5;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.54);
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.path-label.start {
  left: 8px;
  top: calc(var(--tile) * 3 + 14px);
}

.path-label.goal {
  right: 8px;
  top: calc(var(--tile) * 3 + 14px);
}

.enemy-sprite,
.tower-sprite,
.ghost-tower,
.shot {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 8;
}

.enemy-sprite {
  width: 72px;
  height: 72px;
}

.enemy-sprite::after {
  content: "";
  position: absolute;
  inset: 4px 8px 2px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
}

.enemy-sprite img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  image-rendering: pixelated;
  position: relative;
  z-index: 1;
}

.enemy-sprite.poisoned img {
  filter: sepia(0.45) saturate(1.9) hue-rotate(54deg) brightness(1.08);
}

.enemy-sprite.burning img {
  filter: sepia(0.72) saturate(2.55) hue-rotate(326deg) brightness(1.2);
}

.enemy-sprite.poisoned.burning img {
  filter: sepia(0.55) saturate(2.1) hue-rotate(18deg) brightness(1.12);
}

.enemy-sprite.burning::after {
  opacity: 1;
  background:
    radial-gradient(circle at 28% 78%, rgba(255, 63, 34, 0.78) 0 10%, transparent 23%),
    radial-gradient(circle at 54% 66%, rgba(255, 196, 54, 0.78) 0 12%, transparent 27%),
    radial-gradient(circle at 74% 80%, rgba(255, 89, 28, 0.72) 0 9%, transparent 22%);
  filter: blur(1px) drop-shadow(0 0 9px rgba(255, 75, 33, 0.95));
  mix-blend-mode: screen;
  animation: burnFlicker 0.42s ease-in-out infinite alternate;
}

.enemy-sprite.frosted img {
  filter: sepia(0.18) saturate(1.35) hue-rotate(160deg) brightness(1.22);
}

.enemy-sprite.wet img {
  filter: sepia(0.2) saturate(1.6) hue-rotate(154deg) brightness(1.18);
}

.enemy-sprite.wet::before {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: 3;
  pointer-events: none;
  border-radius: 50%;
  border: 2px solid rgba(104, 220, 255, 0.54);
  box-shadow: 0 0 14px rgba(68, 202, 255, 0.62);
  animation: wetPulse 0.72s ease-in-out infinite alternate;
}

.enemy-sprite.confused img {
  filter: sepia(0.28) saturate(1.9) hue-rotate(242deg) brightness(1.2);
}

.enemy-sprite.confused::before {
  content: "";
  position: absolute;
  inset: 3px;
  z-index: 4;
  pointer-events: none;
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, transparent 0 18%, rgba(192, 102, 255, 0.54) 23% 31%, transparent 37% 100%);
  filter: drop-shadow(0 0 10px rgba(199, 88, 255, 0.86));
  animation: confuseSpin 0.54s linear infinite;
}

.enemy-sprite.grabbed {
  z-index: 13;
  filter: drop-shadow(0 0 14px rgba(255, 110, 220, 0.9));
  animation: grabbedWiggle 0.18s steps(2, end) infinite;
}

@keyframes grabbedWiggle {
  50% {
    transform: translate(-50%, -50%) rotate(-4deg) scale(0.92);
  }
}

.enemy-sprite.rewinding img {
  filter: sepia(0.3) saturate(1.7) hue-rotate(150deg) brightness(1.22);
}

.enemy-sprite.rewinding::before {
  content: "";
  position: absolute;
  inset: 6px;
  z-index: 3;
  pointer-events: none;
  border-radius: 50%;
  border: 2px dashed rgba(113, 238, 255, 0.72);
  animation: rewindEnemySpin 0.55s linear infinite reverse;
}

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

@keyframes burnFlicker {
  0% {
    transform: translateY(3px) scale(0.92);
    opacity: 0.62;
  }

  100% {
    transform: translateY(-7px) scale(1.06);
    opacity: 1;
  }
}

@keyframes wetPulse {
  100% {
    opacity: 0.42;
    transform: scale(1.12);
  }
}

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

.tower-sprite {
  width: calc(var(--tile) - 12px);
  height: calc(var(--tile) - 12px);
  display: grid;
  place-items: center;
  pointer-events: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(0, 0, 0, 0.08)),
    rgba(0, 0, 0, 0.24);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
  overflow: visible;
}

.tower-sprite.selected {
  outline: 2px solid var(--gold);
}

.tower-sprite.under-attack {
  border-color: rgba(255, 95, 122, 0.86);
  box-shadow:
    0 0 0 2px rgba(255, 95, 122, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.2);
}

.tower-sprite.critical {
  filter: saturate(0.82) brightness(0.9);
}

.tower-sprite.root-flash {
  animation: rootFlash 0.62s ease-out;
}

@keyframes rootFlash {
  0% {
    box-shadow:
      0 0 0 0 rgba(187, 84, 255, 0.82),
      0 0 22px rgba(104, 255, 196, 0.72);
    transform: translate(-50%, -50%) scale(1.16);
  }

  100% {
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
    transform: translate(-50%, -50%) scale(1);
  }
}

.tower-hpbar {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: -5px;
  z-index: 7;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.52);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.tower-sprite.damaged .tower-hpbar,
.tower-sprite.under-attack .tower-hpbar {
  opacity: 1;
}

.tower-hpbar span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #7bdc65, #ffd166);
}

.tower-sprite.critical .tower-hpbar span {
  background: linear-gradient(90deg, #ff5f7a, #ffd166);
}

.range-ring {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(var(--accent-2-rgb), 0.82);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(var(--accent-2-rgb), 0.12), transparent 58%),
    radial-gradient(circle, transparent 63%, rgba(var(--accent-rgb), 0.18));
  box-shadow:
    inset 0 0 24px rgba(var(--accent-2-rgb), 0.2),
    0 0 18px rgba(var(--accent-2-rgb), 0.34);
}

.range-ring.invalid {
  border-color: rgba(255, 92, 122, 0.85);
  background:
    radial-gradient(circle, rgba(255, 92, 122, 0.12), transparent 58%),
    radial-gradient(circle, transparent 63%, rgba(255, 92, 122, 0.2));
  box-shadow:
    inset 0 0 24px rgba(255, 92, 122, 0.16),
    0 0 18px rgba(255, 92, 122, 0.26);
}

.tower-sprite.building {
  filter: grayscale(0.7);
}

.tower-sprite.evolving {
  filter: saturate(1.25) brightness(1.08);
}

.tower-sprite.evolving::before,
.tower-sprite.evolving::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 999px;
}

.tower-sprite.evolving::before {
  width: calc(var(--tile) * 1.05);
  height: calc(var(--tile) * 0.42);
  left: 50%;
  bottom: -10px;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 50% 52%, rgba(var(--accent-2-rgb), 0.62), transparent 30%),
    radial-gradient(circle at 50% 52%, rgba(var(--accent-rgb), 0.55), transparent 58%);
  box-shadow:
    0 0 20px rgba(var(--accent-2-rgb), 0.55),
    0 0 42px rgba(var(--accent-rgb), 0.34);
  animation: evolvePulse 0.82s ease-in-out infinite;
  z-index: 0;
}

.tower-sprite.evolving::after {
  width: calc(var(--tile) * 0.78);
  height: calc(var(--tile) * 0.26);
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%);
  border: 2px solid rgba(var(--accent-2-rgb), 0.88);
  box-shadow: 0 0 16px rgba(var(--accent-2-rgb), 0.54);
  animation: evolveRing 1.05s ease-out infinite;
  z-index: 1;
}

.tower-sprite img {
  width: calc(var(--tile) - 18px);
  height: calc(var(--tile) - 18px);
  object-fit: contain;
  image-rendering: pixelated;
  position: relative;
  z-index: 2;
}

.token-tower {
  opacity: 0.84;
  transform: translate(-50%, -50%) scale(0.72);
  border-color: rgba(var(--accent-2-rgb), 0.55);
  box-shadow:
    inset 0 0 18px rgba(var(--accent-rgb), 0.18),
    0 0 18px rgba(var(--accent-2-rgb), 0.35);
  animation: tokenFlicker 0.7s ease-in-out infinite alternate;
}

.token-tower img {
  filter:
    grayscale(0.2)
    drop-shadow(0 0 10px rgba(var(--accent-2-rgb), 0.72));
}

@keyframes tokenFlicker {
  100% {
    opacity: 0.58;
    transform: translate(-50%, -50%) scale(0.66);
  }
}

.stack-badge {
  position: absolute;
  right: -8px;
  top: -9px;
  z-index: 4;
  min-width: 30px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: linear-gradient(180deg, #ffe47a, #cc7c16);
  color: #23110a;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 14px rgba(255, 198, 65, 0.55);
}

.boost-badge {
  position: absolute;
  left: -8px;
  top: -9px;
  z-index: 4;
  min-width: 30px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: linear-gradient(180deg, #b8fff7, #42d7ff);
  color: #092331;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 14px rgba(112, 232, 255, 0.58);
}

.haste-badge {
  position: absolute;
  right: -18px;
  top: -9px;
  z-index: 4;
  min-width: 48px;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  background: linear-gradient(180deg, #ffe6a3, #a95b22);
  color: #2a1309;
  font-size: 9px;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 0 15px rgba(255, 190, 82, 0.68);
}

.aether-bank {
  position: absolute;
  left: 50%;
  bottom: 4px;
  z-index: 6;
  min-width: 58px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.72), transparent 22%),
    linear-gradient(180deg, var(--accent), #5d2bd8);
  color: #ffffff;
  font-size: 16px;
  font-weight: 950;
  line-height: 1;
  transform: translateX(-50%);
  text-shadow: 0 2px 0 rgba(45, 14, 92, 0.65);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 0 18px rgba(var(--accent-rgb), 0.82),
    0 0 30px rgba(var(--accent-2-rgb), 0.3);
  cursor: pointer;
  animation: aetherBankPulse 0.9s ease-in-out infinite alternate;
}

.aether-bank.empty {
  opacity: 0.72;
  filter: grayscale(0.65);
  animation: none;
  cursor: default;
}

@keyframes aetherBankPulse {
  100% {
    transform: translateX(-50%) translateY(-2px) scale(1.04);
  }
}

.build-ring {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: -7px;
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.18);
  z-index: 3;
}

.build-ring span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--gold);
}

@keyframes evolvePulse {
  0%,
  100% {
    opacity: 0.78;
    transform: translateX(-50%) scale(0.9);
  }

  50% {
    opacity: 1;
    transform: translateX(-50%) scale(1.08);
  }
}

@keyframes evolveRing {
  0% {
    opacity: 0.95;
    transform: translateX(-50%) scale(0.72);
  }

  100% {
    opacity: 0;
    transform: translateX(-50%) scale(1.34);
  }
}

.hpbar {
  position: absolute;
  left: 6px;
  right: 6px;
  top: -8px;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
}

.hpbar span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.shot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
}

.enemy-attack-effect {
  position: absolute;
  z-index: 17;
  pointer-events: none;
  width: 18px;
  height: 8px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.7);
  animation: enemyAttackZip 0.24s ease-out forwards;
}

.enemy-hit-spark {
  background: linear-gradient(90deg, #ffffff, var(--gold));
}

.enemy-hit-fire {
  height: 12px;
  background: linear-gradient(90deg, #fff0a3, #ff8b2f, #d72b14);
  box-shadow: 0 0 14px rgba(255, 91, 31, 0.86);
}

.enemy-hit-blue-fire {
  background: linear-gradient(90deg, #ffffff, #70e8ff, #4d76ff);
  box-shadow: 0 0 14px rgba(112, 232, 255, 0.86);
}

.enemy-hit-poison {
  background: linear-gradient(90deg, #eaff9c, #77e95e, #308c35);
  box-shadow: 0 0 14px rgba(119, 233, 94, 0.78);
}

.enemy-hit-ice {
  background: linear-gradient(90deg, #ffffff, #a8f4ff, #47a7ff);
  box-shadow: 0 0 14px rgba(112, 232, 255, 0.72);
}

.enemy-hit-lightning {
  height: 5px;
  background: linear-gradient(90deg, #ffffff, #f7f1a4, #70e8ff);
  box-shadow: 0 0 16px rgba(247, 241, 164, 0.9);
}

.enemy-hit-slash {
  width: 28px;
  height: 18px;
  border-radius: 50%;
  background: conic-gradient(from 205deg, transparent 0 48%, #ffffff 55%, var(--accent-2) 63%, transparent 72% 100%);
  box-shadow: none;
}

.enemy-hit-pierce,
.enemy-hit-shot {
  width: 22px;
  height: 7px;
  background: linear-gradient(90deg, #ffffff, #d58bff, var(--accent));
}

.enemy-hit-heal {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff, #7bdc65 54%, transparent 68%);
  box-shadow: 0 0 16px rgba(123, 220, 101, 0.82);
}

.enemy-hit-psychic {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff, var(--accent) 45%, transparent 70%);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.82);
}

.enemy-hit-thump {
  width: 26px;
  height: 16px;
  background: linear-gradient(90deg, #fff0a3, #c47b36);
  box-shadow: 0 0 14px rgba(255, 209, 102, 0.78);
}

@keyframes enemyAttackZip {
  70% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.65);
  }
}

.apple-shot {
  width: 13px;
  height: 13px;
  background:
    radial-gradient(circle at 34% 38%, rgba(255, 255, 255, 0.65), transparent 18%),
    radial-gradient(circle at 50% 58%, #ff4848 0 58%, #9f1717 72%);
  box-shadow: 0 0 14px rgba(255, 76, 76, 0.72);
}

.apple-shot::before {
  content: "";
  position: absolute;
  left: 6px;
  top: -5px;
  width: 3px;
  height: 7px;
  border-radius: 999px;
  background: #4c2a10;
  transform: rotate(26deg);
}

.poison-apple-shot {
  background:
    radial-gradient(circle at 34% 38%, rgba(255, 255, 255, 0.7), transparent 18%),
    radial-gradient(circle at 50% 58%, #a8ff4f 0 58%, #2f851f 72%);
  box-shadow: 0 0 18px rgba(164, 255, 79, 0.82);
}

.card-plasma-shot {
  width: 18px;
  height: 24px;
  border-radius: 3px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.8), transparent 28%),
    linear-gradient(180deg, #9cf4ff, #2d91ff 58%, #133dff);
  border: 1px solid rgba(209, 251, 255, 0.8);
  box-shadow:
    0 0 14px rgba(112, 232, 255, 0.9),
    0 0 26px rgba(45, 145, 255, 0.5);
  animation: plasmaPoof 0.18s ease-out infinite alternate;
}

.booster-plasma-shot {
  width: 24px;
  height: 31px;
  box-shadow:
    0 0 18px rgba(112, 232, 255, 1),
    0 0 34px rgba(77, 118, 255, 0.72);
}

.fire-shot {
  width: 26px;
  height: 18px;
  border-radius: 68% 40% 68% 36%;
  background:
    radial-gradient(circle at 64% 34%, rgba(255, 255, 255, 0.84), transparent 18%),
    linear-gradient(135deg, #fff0a3, #ff8b2f 48%, #d72b14);
  box-shadow:
    0 0 15px rgba(255, 126, 43, 0.92),
    0 0 26px rgba(255, 53, 21, 0.42);
}

.hat-shot {
  width: 24px;
  height: 14px;
  border-radius: 4px 4px 50% 50%;
  background:
    linear-gradient(180deg, #26212e, #050507);
  border-bottom: 5px solid #020203;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.08),
    0 0 14px rgba(0, 0, 0, 0.8);
}

.hat-shot::before {
  content: "";
  position: absolute;
  left: -7px;
  right: -7px;
  bottom: -6px;
  height: 7px;
  border-radius: 50%;
  background: #050507;
}

.hat-shot-strong {
  width: 30px;
  height: 17px;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.12),
    0 0 18px rgba(179, 108, 255, 0.45);
}

.leaf-shot {
  width: 26px;
  height: 13px;
  border-radius: 100% 8px 100% 8px;
  background:
    radial-gradient(circle at 72% 28%, rgba(240, 255, 168, 0.8), transparent 20%),
    linear-gradient(135deg, #dcff73 0 22%, #4fcb42 52%, #167b35);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.13),
    0 0 16px rgba(109, 255, 106, 0.64);
}

.leaf-shot::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 5px;
  top: 6px;
  height: 2px;
  border-radius: 999px;
  background: rgba(21, 96, 40, 0.68);
  transform: rotate(-18deg);
}

.leaf-shot-strong {
  width: 31px;
  height: 16px;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.12),
    0 0 20px rgba(159, 255, 92, 0.72);
}

.knife-shot {
  width: 30px;
  height: 8px;
  border-radius: 999px 40% 40% 999px;
  background:
    linear-gradient(90deg, #2d1636 0 20%, #f7f7ff 21% 72%, #9ea8c5 73%);
  box-shadow:
    0 0 12px rgba(255, 255, 255, 0.54),
    0 0 18px rgba(var(--accent-rgb), 0.44);
}

.knife-shot::after {
  content: "";
  position: absolute;
  right: -9px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 11px solid #f7f7ff;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.knife-slash {
  position: absolute;
  z-index: 11;
  width: calc(var(--tile) * 1.05);
  height: calc(var(--tile) * 0.46);
  pointer-events: none;
  border-radius: 50%;
  transform-origin: center;
  background:
    conic-gradient(from 210deg, transparent 0 55%, rgba(255, 255, 255, 0.92) 59%, rgba(var(--accent-2-rgb), 0.74) 66%, transparent 72% 100%);
  filter: drop-shadow(0 0 14px rgba(var(--accent-2-rgb), 0.85));
  animation: knifeSlash 0.3s ease-out forwards;
}

@keyframes knifeSlash {
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(120deg) scale(1.18);
  }
}

.water-splash {
  position: absolute;
  z-index: 11;
  width: calc(var(--tile) * 1.35);
  height: calc(var(--tile) * 0.62);
  pointer-events: none;
  border-radius: 999px 58% 58% 999px;
  transform-origin: center;
  background:
    radial-gradient(circle at 84% 50%, rgba(255, 255, 255, 0.92) 0 8%, transparent 19%),
    radial-gradient(ellipse at 45% 50%, rgba(90, 221, 255, 0.72) 0 42%, rgba(52, 132, 255, 0.34) 64%, transparent 72%);
  border: 2px solid rgba(177, 241, 255, 0.5);
  filter:
    drop-shadow(0 0 10px rgba(90, 221, 255, 0.82))
    drop-shadow(0 0 20px rgba(52, 132, 255, 0.34));
  animation: waterSplash 0.42s ease-out forwards;
}

.gruff-slash {
  position: absolute;
  z-index: 11;
  width: calc(var(--tile) * 1.18);
  height: calc(var(--tile) * 0.56);
  pointer-events: none;
  border-radius: 50%;
  transform-origin: center;
  background:
    conic-gradient(from 210deg, transparent 0 54%, rgba(255, 255, 255, 0.96) 58%, rgba(255, 211, 102, 0.74) 68%, transparent 73% 100%);
  filter: drop-shadow(0 0 13px rgba(255, 211, 102, 0.72));
  animation: gruffSlash 0.36s ease-out forwards;
}

.possess-tether,
.confuse-bolt {
  position: absolute;
  z-index: 12;
  height: 5px;
  pointer-events: none;
  transform-origin: left center;
  border-radius: 999px;
}

.possess-tether {
  background:
    linear-gradient(90deg, rgba(111, 255, 187, 0.95), rgba(196, 92, 255, 0.88), transparent);
  box-shadow:
    0 0 10px rgba(111, 255, 187, 0.72),
    0 0 18px rgba(196, 92, 255, 0.62);
  animation: possessSnap 0.46s ease-out forwards;
}

.confuse-bolt {
  height: 4px;
  background:
    repeating-linear-gradient(90deg, rgba(207, 116, 255, 0.95) 0 8px, rgba(113, 244, 255, 0.9) 8px 13px);
  box-shadow: 0 0 13px rgba(207, 116, 255, 0.82);
  animation: confuseBolt 0.18s ease-out forwards;
}

@keyframes waterSplash {
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--angle, 0deg)) scale(1.22, 0.82);
  }
}

@keyframes gruffSlash {
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--angle, 0deg)) scale(1.2);
  }
}

@keyframes possessSnap {
  100% {
    opacity: 0;
    filter: hue-rotate(90deg);
  }
}

@keyframes confuseBolt {
  100% {
    opacity: 0;
    transform: rotate(var(--angle, 0deg)) scaleX(0.72);
  }
}

.crystal-shot {
  width: 13px;
  height: 13px;
  border-radius: 2px 8px 2px 8px;
  background: linear-gradient(135deg, #ffffff 0 12%, #d58bff 34%, var(--accent) 72%, #5126c9);
  box-shadow:
    0 0 12px rgba(var(--accent-rgb), 0.9),
    0 0 22px rgba(var(--accent-2-rgb), 0.38);
  transform: translate(-50%, -50%) rotate(45deg);
}

.crystal-shot-strong {
  width: 17px;
  height: 17px;
}

.ice-shot {
  width: 26px;
  height: 9px;
  border-radius: 999px 30% 30% 999px;
  background: linear-gradient(90deg, #ffffff, #a8f4ff 55%, #47a7ff);
  box-shadow: 0 0 14px rgba(112, 232, 255, 0.78);
}

.ice-shot::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid #e9fdff;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.ice-shot-strong {
  width: 32px;
  height: 11px;
  box-shadow: 0 0 18px rgba(112, 232, 255, 0.95), 0 0 30px rgba(71, 167, 255, 0.44);
}

.ice-burst {
  position: absolute;
  z-index: 9;
  width: calc(var(--tile) * 1.15);
  height: calc(var(--tile) * 1.15);
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.35);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.88) 0 8%, rgba(136, 234, 255, 0.42) 28%, transparent 68%);
  border: 2px solid rgba(181, 246, 255, 0.72);
  animation: iceBurst 0.44s ease-out forwards;
}

.ice-burst-strong {
  width: calc(var(--tile) * 1.45);
  height: calc(var(--tile) * 1.45);
}

@keyframes iceBurst {
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

.orange-fire-shot::after {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  width: 12px;
  height: 10px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: rgba(255, 222, 90, 0.72);
  filter: blur(1px);
}

@keyframes plasmaPoof {
  100% {
    transform: translate(-50%, -50%) scale(1.16) rotate(4deg);
  }
}

.sword-slash {
  position: absolute;
  z-index: 10;
  width: calc(var(--tile) * 1.55);
  height: calc(var(--tile) * 1.55);
  pointer-events: none;
  border-radius: 50%;
  transform-origin: center;
  background:
    conic-gradient(from 10deg, transparent 0deg 196deg, rgba(255, 255, 255, 0.94) 210deg 246deg, rgba(112, 232, 255, 0.72) 258deg 292deg, transparent 310deg 360deg);
  filter: drop-shadow(0 0 13px rgba(112, 232, 255, 0.72));
  animation: swordSpin 0.4s ease-out forwards;
}

.sword-slash::after {
  content: "";
  position: absolute;
  inset: 26%;
  border-radius: 50%;
  background: rgba(251, 247, 255, 0.08);
}

.sword-slash-final {
  width: calc(var(--tile) * 2);
  height: calc(var(--tile) * 2);
  background:
    conic-gradient(from 0deg, transparent 0deg 150deg, rgba(255, 255, 255, 0.98) 165deg 218deg, rgba(255, 209, 102, 0.88) 232deg 294deg, transparent 316deg 360deg);
  filter:
    drop-shadow(0 0 14px rgba(255, 209, 102, 0.82))
    drop-shadow(0 0 28px rgba(112, 232, 255, 0.38));
}

@keyframes swordSpin {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(80deg) scale(0.56);
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-250deg) scale(1.08);
  }
}

.time-whirl {
  position: absolute;
  z-index: 7;
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(0deg) scale(0.72);
  background:
    conic-gradient(from 25deg, transparent 0deg 66deg, rgba(119, 238, 255, 0.88) 80deg 118deg, transparent 132deg 188deg, rgba(255, 231, 116, 0.8) 205deg 248deg, transparent 266deg 360deg);
  filter:
    drop-shadow(0 0 12px rgba(119, 238, 255, 0.72))
    drop-shadow(0 0 24px rgba(179, 108, 255, 0.34));
  animation: timeWhirlSpin 0.72s ease-out forwards;
}

.time-whirl::after {
  content: "";
  position: absolute;
  inset: 24%;
  border: 2px dashed rgba(255, 255, 255, 0.7);
  border-radius: 50%;
}

.time-whirl-final {
  filter:
    drop-shadow(0 0 16px rgba(119, 238, 255, 0.9))
    drop-shadow(0 0 30px rgba(255, 231, 116, 0.5));
}

@keyframes timeWhirlSpin {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(70deg) scale(0.52);
  }

  48% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-300deg) scale(1.08);
  }
}

.lightning-arc {
  position: absolute;
  z-index: 9;
  height: 5px;
  pointer-events: none;
  transform-origin: left center;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.98) 0 8px, rgba(83, 238, 255, 0.92) 8px 15px, rgba(74, 103, 255, 0.9) 15px 22px);
  box-shadow:
    0 0 12px rgba(93, 235, 255, 0.9),
    0 0 22px rgba(96, 104, 255, 0.55);
  animation: lightningZap 0.15s steps(2, end) forwards;
}

.lightning-arc-livewire {
  height: 7px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 1) 0 7px, rgba(255, 236, 99, 0.95) 7px 13px, rgba(75, 238, 255, 0.9) 13px 20px);
}

@keyframes lightningZap {
  50% {
    opacity: 1;
    filter: brightness(1.8);
  }

  100% {
    opacity: 0;
  }
}

.drill-shot {
  position: absolute;
  z-index: 8;
  pointer-events: none;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 12px;
  border-radius: 999px 35% 35% 999px;
  background:
    repeating-linear-gradient(90deg, #f7f7ff 0 4px, #7b86a6 4px 8px),
    linear-gradient(90deg, #dfe8ff, #7d89aa);
  box-shadow: 0 0 16px rgba(112, 232, 255, 0.76);
}

.drill-shot-strong {
  width: 46px;
  height: 15px;
  background:
    repeating-linear-gradient(90deg, #e9fbff 0 7px, #7ce9ff 7px 13px, #4b2aa8 13px 18px);
  box-shadow:
    0 0 14px rgba(124, 233, 255, 0.82),
    0 0 28px rgba(var(--accent-rgb), 0.52);
}

.bullet-bill-shot {
  position: absolute;
  z-index: 8;
  pointer-events: none;
  width: 30px;
  height: 16px;
  border-radius: 999px 40% 40% 999px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle at 78% 50%, #ffffff 0 7%, transparent 12%),
    linear-gradient(90deg, #0b0b13 0 68%, #f3f3ff 69% 100%);
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow:
    0 0 14px rgba(255, 255, 255, 0.45),
    0 0 22px rgba(var(--accent-rgb), 0.36);
}

.bullet-bill-shot::after {
  content: "";
  position: absolute;
  right: -9px;
  top: 50%;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  border-left: 11px solid #0b0b13;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}

.drill-shot::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 50%;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  border-left: 10px solid #f6f7ff;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.cactus-slam {
  position: absolute;
  z-index: 10;
  width: calc(var(--tile) * 0.88);
  height: calc(var(--tile) * 0.88);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.35);
  border-radius: 16px 16px 42% 42%;
  background:
    radial-gradient(circle at 48% 30%, rgba(255, 255, 255, 0.58), transparent 12%),
    linear-gradient(180deg, #9fff64, #238c38);
  box-shadow:
    0 0 18px rgba(164, 255, 79, 0.55),
    inset 0 -8px 0 rgba(16, 67, 24, 0.26);
  animation: cactusDrop 0.38s cubic-bezier(0.2, 1.4, 0.36, 1) forwards;
}

.cactus-slam::before,
.cactus-slam::after {
  content: "";
  position: absolute;
  top: 38%;
  width: 18px;
  height: 30px;
  border-radius: 999px;
  background: #58c94d;
}

.cactus-slam::before {
  left: -10px;
  transform: rotate(-32deg);
}

.cactus-slam::after {
  right: -10px;
  transform: rotate(32deg);
}

.cactus-slam-strong {
  width: calc(var(--tile) * 1.05);
  height: calc(var(--tile) * 1.05);
  background:
    radial-gradient(circle at 48% 30%, rgba(255, 255, 255, 0.7), transparent 12%),
    linear-gradient(180deg, #d8ff75, #2eb94d);
  box-shadow:
    0 0 24px rgba(216, 255, 117, 0.72),
    inset 0 -10px 0 rgba(16, 67, 24, 0.24);
}

@keyframes cactusDrop {
  0% {
    opacity: 0;
    transform: translate(-50%, -96%) scale(0.4);
  }

  55% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.94);
  }
}

.cactus-needle {
  position: absolute;
  z-index: 9;
  width: 22px;
  height: 5px;
  pointer-events: none;
  border-radius: 999px;
  transform-origin: center;
  background: linear-gradient(90deg, #e5ffd0, #6fd64a 54%, #1f8137);
  box-shadow: 0 0 10px rgba(164, 255, 79, 0.62);
}

.cactus-needle::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  border-left: 8px solid #e5ffd0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.cactus-needle-strong {
  width: 28px;
  height: 7px;
  background: linear-gradient(90deg, #fbffd3, #9fff64 54%, #248f38);
  box-shadow: 0 0 14px rgba(216, 255, 117, 0.75);
}

.star-drop {
  position: absolute;
  z-index: 9;
  width: 30px;
  height: 30px;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.4) rotate(0deg);
  background: #ffe66d;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 56%, 79% 92%, 50% 70%, 21% 92%, 32% 56%, 2% 35%, 39% 35%);
  filter: drop-shadow(0 0 12px rgba(255, 224, 96, 0.9));
  animation: starDrop 0.55s ease-in forwards;
}

@keyframes starDrop {
  60% {
    transform: translate(-50%, -50%) scale(1.05) rotate(155deg);
  }

  100% {
    opacity: 0.15;
    transform: translate(-50%, -50%) scale(1.35) rotate(240deg);
  }
}

.chain-tether {
  position: absolute;
  z-index: 7;
  height: 8px;
  pointer-events: none;
  transform-origin: left center;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 236, 160, 0.95) 0 8px, rgba(131, 91, 26, 0.9) 8px 13px);
  box-shadow: 0 0 14px rgba(255, 207, 92, 0.7);
}

.snake-tether {
  height: 10px;
  background:
    radial-gradient(circle at 8px 50%, rgba(225, 255, 120, 0.95) 0 4px, transparent 5px),
    repeating-linear-gradient(90deg, rgba(169, 72, 255, 0.95) 0 9px, rgba(78, 221, 81, 0.92) 9px 17px);
  box-shadow:
    0 0 12px rgba(169, 72, 255, 0.72),
    0 0 18px rgba(78, 221, 81, 0.48);
}

.snake-tether::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 50%;
  width: 14px;
  height: 12px;
  transform: translateY(-50%);
  border-radius: 50% 60% 50% 60%;
  background:
    radial-gradient(circle at 66% 35%, #fff 0 1px, transparent 2px),
    linear-gradient(135deg, #d46fff, #45d951);
}

.marajor-strike {
  position: absolute;
  z-index: 11;
  height: 18px;
  pointer-events: none;
  transform-origin: left center;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(255, 209, 102, 0.95), rgba(255, 95, 122, 0.78));
  box-shadow:
    0 0 18px rgba(255, 209, 102, 0.9),
    0 0 34px rgba(255, 95, 122, 0.5);
  animation: marajorStrike 0.38s ease-out forwards;
}

.mimic-tongue {
  position: absolute;
  z-index: 12;
  height: 14px;
  pointer-events: none;
  transform-origin: left center;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255, 136, 227, 0.95), rgba(146, 57, 210, 0.9));
  box-shadow: 0 0 18px rgba(255, 116, 224, 0.7);
  animation: mimicTongue 0.3s ease-out forwards;
}

.mimic-spit {
  position: absolute;
  z-index: 12;
  width: calc(var(--tile) * 0.9);
  height: calc(var(--tile) * 0.9);
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.25);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.75) 0 10%, rgba(255, 117, 226, 0.5) 26%, transparent 68%);
  animation: mimicSpit 0.42s ease-out forwards;
}

@keyframes mimicTongue {
  0% {
    opacity: 0;
  }

  55% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes mimicSpit {
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

.mirrage-echo {
  position: absolute;
  z-index: 9;
  height: 10px;
  pointer-events: none;
  transform-origin: left center;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.92), rgba(179, 108, 255, 0.8), rgba(112, 232, 255, 0.68));
  box-shadow:
    0 0 14px rgba(179, 108, 255, 0.78),
    0 0 24px rgba(112, 232, 255, 0.42);
  animation: mirrageEcho 0.24s ease-out forwards;
}

.mirrage-copy-shot {
  filter:
    drop-shadow(0 0 8px rgba(179, 108, 255, 0.7))
    drop-shadow(0 0 14px rgba(112, 232, 255, 0.36));
}

@keyframes mirrageEcho {
  100% {
    opacity: 0;
    filter: blur(2px);
  }
}

@keyframes marajorStrike {
  0% {
    opacity: 0;
    filter: brightness(2);
  }

  40% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.quake-ring {
  position: absolute;
  width: calc(var(--tile) * 2.35);
  height: calc(var(--tile) * 2.35);
  z-index: 6;
  pointer-events: none;
  border-radius: 50%;
  border: 3px solid rgba(255, 205, 91, 0.75);
  transform: translate(-50%, -50%) scale(0.2);
  box-shadow:
    inset 0 0 18px rgba(255, 205, 91, 0.28),
    0 0 22px rgba(255, 205, 91, 0.42);
  animation: quakeBurst 0.5s ease-out forwards;
}

@keyframes quakeBurst {
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

.flash-pulse {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  border-radius: 50%;
  border: 3px solid rgba(255, 248, 164, 0.86);
  transform: translate(-50%, -50%) scale(0.18);
  background:
    radial-gradient(circle, rgba(255, 255, 220, 0.72) 0 12%, rgba(117, 231, 255, 0.34) 38%, transparent 70%);
  box-shadow:
    inset 0 0 24px rgba(255, 255, 220, 0.58),
    0 0 30px rgba(111, 225, 255, 0.5);
  animation: flashPulse 0.58s ease-out forwards;
}

.flash-pulse-strong {
  border-color: rgba(255, 224, 98, 0.95);
  background:
    radial-gradient(circle, rgba(255, 255, 238, 0.86) 0 12%, rgba(255, 216, 95, 0.48) 34%, rgba(115, 235, 255, 0.24) 58%, transparent 74%);
  box-shadow:
    inset 0 0 30px rgba(255, 255, 230, 0.72),
    0 0 38px rgba(255, 218, 96, 0.58);
}

@keyframes flashPulse {
  65% {
    opacity: 0.92;
    transform: translate(-50%, -50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.08);
  }
}

.scare-pulse {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  width: calc(var(--tile) * 2.55);
  height: calc(var(--tile) * 2.55);
  transform: translate(-50%, -50%) scale(0.25);
  background:
    linear-gradient(90deg, transparent 0 35%, rgba(214, 185, 255, 0.62) 35% 65%, transparent 65%),
    linear-gradient(0deg, transparent 0 35%, rgba(214, 185, 255, 0.62) 35% 65%, transparent 65%);
  filter: drop-shadow(0 0 16px rgba(190, 120, 255, 0.78));
  animation: scarePulse 0.54s ease-out forwards;
}

.scare-pulse::after {
  content: "!";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-family: "Made Evolve Sans", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: 20px;
  font-weight: 800;
  background: rgba(126, 52, 210, 0.82);
  box-shadow: 0 0 18px rgba(227, 205, 255, 0.78);
}

@keyframes scarePulse {
  55% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.14);
  }
}

.frog-coin {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.72), transparent 17%),
    radial-gradient(circle, #ffe881 0 38%, #f0a929 39% 72%, #9e5c12 73%);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 0 20px rgba(255, 216, 91, 0.72);
  animation: coinFloat 1.25s ease-in-out infinite;
}

.frog-coin.expiring {
  animation: coinFloat 0.55s ease-in-out infinite, coinBlink 0.3s steps(2, end) infinite;
}

@keyframes coinFloat {
  0%,
  100% {
    transform: translate(-50%, -52%);
  }

  50% {
    transform: translate(-50%, -64%);
  }
}

@keyframes coinBlink {
  50% {
    opacity: 0.35;
  }
}

.laser-beam {
  position: absolute;
  z-index: 7;
  height: 7px;
  border-radius: 999px;
  pointer-events: none;
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(var(--accent-2-rgb), 0.95), rgba(var(--accent-rgb), 0.82));
  box-shadow: 0 0 18px rgba(var(--accent-2-rgb), 0.8);
}

.laser-beam-hex {
  height: 9px;
  background: linear-gradient(90deg, rgba(255, 221, 255, 0.95), rgba(160, 48, 255, 0.9), rgba(87, 17, 171, 0.82));
  box-shadow:
    0 0 18px rgba(177, 76, 255, 0.92),
    0 0 30px rgba(87, 17, 171, 0.6);
}

.laser-beam-soul {
  height: 10px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96), rgba(120, 255, 226, 0.9), rgba(var(--accent-rgb), 0.84));
  box-shadow:
    0 0 18px rgba(120, 255, 226, 0.88),
    0 0 34px rgba(var(--accent-rgb), 0.56);
}

.laser-beam-phage {
  height: 8px;
  background: linear-gradient(90deg, rgba(203, 255, 120, 0.95), rgba(94, 255, 157, 0.85), rgba(var(--accent-rgb), 0.72));
  box-shadow:
    0 0 18px rgba(94, 255, 157, 0.78),
    0 0 30px rgba(var(--accent-rgb), 0.42);
}

.laser-beam-xeno {
  height: 12px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.98) 0 10px, rgba(122, 255, 219, 0.96) 10px 18px, rgba(174, 84, 255, 0.9) 18px 28px);
  box-shadow:
    0 0 20px rgba(122, 255, 219, 0.94),
    0 0 42px rgba(174, 84, 255, 0.62);
}

.fire-trap {
  position: absolute;
  z-index: 6;
  width: calc(var(--tile) * 0.82);
  height: calc(var(--tile) * 0.48);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle at 50% 58%, rgba(255, 239, 138, 0.92) 0 14%, rgba(255, 110, 28, 0.72) 32%, transparent 68%),
    radial-gradient(circle at 28% 62%, rgba(255, 47, 22, 0.72), transparent 42%),
    radial-gradient(circle at 72% 62%, rgba(255, 146, 33, 0.72), transparent 44%);
  filter: drop-shadow(0 0 18px rgba(255, 91, 31, 0.9));
  animation: fireTrapFlicker 0.42s ease-in-out infinite alternate;
}

.fire-stomp {
  position: absolute;
  z-index: 6;
  width: calc(var(--tile) * 1.55);
  height: calc(var(--tile) * 1.55);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.18);
  border: 3px solid rgba(255, 142, 51, 0.78);
  background:
    radial-gradient(circle, rgba(255, 232, 129, 0.32), transparent 58%),
    radial-gradient(circle, rgba(255, 76, 24, 0.28), transparent 72%);
  box-shadow:
    inset 0 0 18px rgba(255, 151, 54, 0.34),
    0 0 24px rgba(255, 80, 31, 0.55);
  animation: fireStompBurst 0.5s ease-out forwards;
}

.coffee-boost {
  position: absolute;
  z-index: 16;
  pointer-events: none;
  transform: translate(-50%, -75%) scale(0.5);
  color: #fff7d6;
  font-size: 16px;
  font-weight: 950;
  text-shadow:
    0 0 8px rgba(255, 185, 76, 0.95),
    0 2px 0 rgba(59, 26, 8, 0.75);
  animation: coffeePop 0.72s ease-out forwards;
}

.hex-pop {
  position: absolute;
  z-index: 16;
  width: calc(var(--tile) * 0.95);
  height: calc(var(--tile) * 0.95);
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.2);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.76) 0 9%, rgba(177, 76, 255, 0.54) 24%, transparent 68%);
  box-shadow:
    0 0 22px rgba(177, 76, 255, 0.82),
    0 0 42px rgba(87, 17, 171, 0.52);
  animation: hexPop 0.36s ease-out forwards;
}

.heal-pulse {
  position: absolute;
  z-index: 7;
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.18);
  border: 2px solid rgba(123, 220, 101, 0.78);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.32), rgba(123, 220, 101, 0.2) 46%, transparent 68%);
  box-shadow:
    inset 0 0 18px rgba(123, 220, 101, 0.24),
    0 0 24px rgba(123, 220, 101, 0.52);
  animation: healPulse 0.72s ease-out forwards;
}

.heal-pulse-wide {
  border-color: rgba(158, 233, 255, 0.78);
  box-shadow:
    inset 0 0 22px rgba(158, 233, 255, 0.24),
    0 0 30px rgba(123, 220, 101, 0.42);
}

.growth-pop {
  position: absolute;
  z-index: 16;
  pointer-events: none;
  transform: translate(-50%, -70%) scale(0.5);
  color: #d8ff8f;
  font-size: 22px;
  font-weight: 950;
  text-shadow:
    0 0 10px rgba(164, 255, 79, 0.95),
    0 2px 0 rgba(18, 55, 14, 0.82);
  animation: growthPop 0.76s ease-out forwards;
}

.tornadex-whirl {
  position: absolute;
  z-index: 7;
  width: calc(var(--tile) * 5.2);
  height: calc(var(--tile) * 5.2);
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.28);
  background:
    conic-gradient(from 0deg, transparent 0 16%, rgba(255, 255, 255, 0.76) 20%, rgba(var(--accent-2-rgb), 0.46) 28%, transparent 38% 100%),
    radial-gradient(circle, transparent 0 38%, rgba(var(--accent-2-rgb), 0.18) 45%, transparent 68%);
  filter: drop-shadow(0 0 20px rgba(var(--accent-2-rgb), 0.74));
  animation: tornadexWhirl 0.84s ease-out forwards;
}

.psychic-pulse,
.psychic-slam {
  position: absolute;
  z-index: 8;
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.18);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.48), rgba(var(--accent-rgb), 0.26) 45%, transparent 68%);
  border: 2px solid rgba(var(--accent-rgb), 0.7);
  box-shadow:
    inset 0 0 20px rgba(var(--accent-rgb), 0.22),
    0 0 24px rgba(var(--accent-rgb), 0.58);
}

.psychic-pulse {
  width: calc(var(--tile) * 1.4);
  height: calc(var(--tile) * 1.4);
  animation: psychicPulse 0.44s ease-out forwards;
}

.psychic-slam {
  width: calc(var(--tile) * 4.1);
  height: calc(var(--tile) * 4.1);
  animation: psychicSlam 0.76s ease-out forwards;
}

@keyframes fireTrapFlicker {
  0% {
    transform: translate(-50%, -50%) scale(0.92) rotate(-2deg);
  }

  100% {
    transform: translate(-50%, -50%) scale(1.08) rotate(3deg);
  }
}

@keyframes fireStompBurst {
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes coffeePop {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.25);
  }

  35% {
    opacity: 1;
    transform: translate(-50%, -80%) scale(1.05);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -125%) scale(0.72);
  }
}

@keyframes hexPop {
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

@keyframes healPulse {
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes growthPop {
  100% {
    opacity: 0;
    transform: translate(-50%, -135%) scale(1);
  }
}

@keyframes tornadexWhirl {
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-540deg) scale(1);
  }
}

@keyframes psychicPulse {
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes psychicSlam {
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

.ghost-tower {
  display: none;
  z-index: 18;
  width: calc(var(--tile) - 12px);
  height: calc(var(--tile) - 12px);
  place-items: center;
  border: 2px dashed rgba(var(--accent-rgb), 0.72);
  border-radius: 8px;
  background: rgba(var(--accent-rgb), 0.11);
}

.ghost-tower.visible {
  display: grid;
}

.ghost-tower.invalid {
  border-color: rgba(255, 95, 122, 0.8);
  background: rgba(255, 95, 122, 0.16);
}

.ghost-tower img {
  width: calc(var(--tile) - 20px);
  height: calc(var(--tile) - 20px);
  object-fit: contain;
  image-rendering: pixelated;
  opacity: 0.55;
}

.tower-popover {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 20;
  width: 360px;
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(30, 23, 39, 0.95);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.38);
  padding: 14px;
  backdrop-filter: blur(10px);
}

.tower-popover.open {
  display: block;
}

.popover-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
}

.tower-details {
  min-height: 330px;
  margin-top: 12px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.tower-details.empty {
  color: var(--muted);
}

.tower-portrait {
  display: grid;
  place-items: center;
  min-height: 228px;
  border-radius: 8px;
  background:
    radial-gradient(circle at center, rgba(var(--accent-rgb), 0.24), transparent 62%),
    rgba(0, 0, 0, 0.18);
}

.tower-portrait img {
  width: 220px;
  height: 220px;
  object-fit: contain;
  image-rendering: pixelated;
}

.tower-name {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  align-items: center;
}

.tower-name strong {
  font-size: 1.25rem;
}

.tower-stage {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.tower-description {
  margin: 8px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(var(--accent-2-rgb), 0.2);
  border-radius: 7px;
  background: rgba(var(--accent-2-rgb), 0.08);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.28;
}

.tower-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.tower-stat {
  display: grid;
  gap: 2px;
  padding: 8px 6px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.tower-stat b {
  color: var(--ink);
  font-size: 0.95rem;
}

.evolve-cost-card {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 8px;
  background: rgba(var(--accent-rgb), 0.12);
}

.evolve-cost-card span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.evolve-cost-card strong {
  display: block;
  margin-top: 2px;
}

.evolve-cost-card .cost {
  color: var(--accent);
  font-size: 1.65rem;
  font-weight: 950;
}

.tower-details strong {
  color: var(--ink);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.codex {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  line-height: 1.35;
}

.shop-drawer {
  position: fixed;
  inset: auto 16px 16px 16px;
  z-index: 30;
  max-height: min(520px, calc(100vh - 32px));
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 16, 28, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  padding: 16px;
}

.shop-tooltip {
  position: absolute;
  z-index: 8;
  display: none;
  width: min(320px, calc(100% - 24px));
  padding: 10px 12px;
  border: 1px solid rgba(var(--accent-2-rgb), 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(var(--accent-2-rgb), 0.14), rgba(var(--accent-rgb), 0.08)),
    rgba(18, 13, 26, 0.98);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42), 0 0 24px rgba(var(--accent-2-rgb), 0.12);
  color: var(--ink);
  pointer-events: none;
}

.shop-tooltip.visible {
  display: grid;
  gap: 5px;
}

.shop-tooltip strong {
  color: var(--accent-2);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.shop-tooltip span {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.28;
}

.game-over,
.pause-menu,
.unlock-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  background: rgba(12, 9, 17, 0.72);
  backdrop-filter: blur(8px);
}

.pause-menu {
  z-index: 45;
}

.unlock-modal {
  z-index: 59;
}

.game-over.open,
.pause-menu.open,
.unlock-modal.open {
  display: grid;
}

.game-over-card,
.pause-card,
.unlock-card {
  width: min(430px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(32, 26, 42, 0.96);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.5);
}

.game-over-card h2,
.pause-card h2,
.unlock-card h2 {
  font-size: 1.5rem;
}

.unlock-card {
  width: min(720px, calc(100vw - 32px));
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.2), rgba(var(--accent-2-rgb), 0.1)),
    rgba(32, 26, 42, 0.97);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58), 0 0 44px rgba(var(--accent-rgb), 0.16);
}

.unlock-card > span {
  color: var(--accent-2);
  font-family: var(--brand-font);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.unlock-card p {
  margin-top: 8px;
  color: var(--muted);
}

.unlock-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.unlock-choice {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 238px;
  padding: 14px 12px 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.42);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(var(--accent-rgb), 0.08)),
    #1e1827;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 14px 30px rgba(0, 0, 0, 0.24);
  color: var(--ink);
  text-align: center;
}

.unlock-choice:hover {
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 1px var(--accent-2), 0 0 30px rgba(var(--accent-2-rgb), 0.18);
  transform: translateY(-1px);
}

.unlock-choice img {
  width: 94px;
  height: 94px;
  margin: 24px auto 2px;
  object-fit: contain;
  image-rendering: pixelated;
}

.unlock-choice strong {
  min-height: 34px;
  align-content: center;
  font-size: 1.02rem;
  line-height: 1.08;
}

.unlock-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
}

.unlock-cost {
  position: absolute;
  top: 10px;
  left: 12px;
  color: var(--accent);
  font-size: 1.85rem;
  font-weight: 950;
  line-height: 1;
}

.unlock-role {
  position: absolute;
  top: 12px;
  right: 12px;
  max-width: 84px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-align: right;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.pause-card p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.4;
}

.rules-grid {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.rules-grid div,
.best-run {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.rules-grid strong,
.best-run span {
  color: var(--accent);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.rules-grid span,
.best-run strong {
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.35;
}

.best-run {
  margin-top: 12px;
}

.pause-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.run-stats {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.run-stats div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.run-stats strong {
  color: var(--ink);
}

.level-banner {
  position: fixed;
  inset: 0;
  z-index: 58;
  display: none;
  place-items: center;
  pointer-events: none;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.22), transparent 46%);
}

.level-banner.open {
  display: grid;
}

.level-banner div {
  width: min(560px, calc(100vw - 40px));
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.34), rgba(var(--accent-2-rgb), 0.16)),
    rgba(32, 26, 42, 0.96);
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.56), 0 0 46px rgba(var(--accent-rgb), 0.22);
  text-align: center;
  animation: levelBannerPop 3.6s ease forwards;
}

.level-banner span {
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.level-banner strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: clamp(2rem, 7vw, 4.6rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.level-banner p {
  margin-top: 12px;
  color: var(--muted);
}

@keyframes levelBannerPop {
  0% {
    opacity: 0;
    transform: scale(0.88);
  }

  12%,
  78% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.06);
  }
}

.shop-drawer.open {
  display: block;
}

.shop-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.shop-search {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.shop-search span {
  color: var(--muted);
  font-family: var(--brand-font);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shop-search input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(var(--accent-rgb), 0.34);
  border-radius: 8px;
  outline: 0;
  background: rgba(0, 0, 0, 0.26);
  color: var(--ink);
  font: 850 1rem/1 var(--ui-font);
  padding: 0 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.shop-search input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 18px rgba(var(--accent-2-rgb), 0.16);
}

.shop-search input::placeholder {
  color: rgba(251, 247, 255, 0.42);
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #30263e;
  border: 1px solid var(--line);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 12px;
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

.shop-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  min-height: 190px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)),
    #1e1827;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 10px 22px rgba(0, 0, 0, 0.16);
  text-align: center;
  overflow: hidden;
}

.shop-card::after,
.hero-card::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  pointer-events: none;
}

.shop-card.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.shop-card.unaffordable {
  cursor: not-allowed;
  filter: grayscale(0.9);
  opacity: 0.42;
}

.shop-card.locked {
  border-color: rgba(255, 255, 255, 0.12);
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.36;
}

.shop-card.locked::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(8, 6, 12, 0.18);
  pointer-events: none;
}

.lock-badge {
  position: absolute;
  top: 48px;
  left: 50%;
  z-index: 3;
  display: none;
  transform: translateX(-50%);
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(10, 8, 14, 0.82);
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shop-card.locked .lock-badge {
  display: block;
}

.shop-card.unaffordable .shop-cost {
  color: var(--muted);
}

.shop-card img {
  width: 76px;
  height: 76px;
  margin: 20px auto 0;
  object-fit: contain;
  image-rendering: pixelated;
}

.shop-card strong {
  display: block;
  min-height: 34px;
  align-content: center;
  font-size: 0.92rem;
  line-height: 1.08;
}

.shop-cost {
  position: absolute;
  top: 8px;
  left: 10px;
  color: var(--accent);
  font-size: 1.65rem;
  font-weight: 950;
  line-height: 1;
}

.shop-role {
  position: absolute;
  top: 10px;
  right: 10px;
  max-width: 72px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-align: right;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

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

.shop-stat {
  display: grid;
  min-height: 34px;
  place-items: center;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--muted);
  font-size: 0.72rem;
}

.shop-stat b {
  color: var(--ink);
  font-size: 0.84rem;
}

.hero-picker {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  place-items: center;
  background: rgba(12, 9, 17, 0.7);
  backdrop-filter: blur(8px);
}

.hero-picker.open {
  display: grid;
}

.hero-picker-card {
  width: min(900px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(32, 26, 42, 0.97);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
}

.hero-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.hero-picker-head p {
  margin-top: 4px;
  color: var(--muted);
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
  max-height: 600px;
  overflow: auto;
  padding-right: 4px;
}

.hero-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 178px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(var(--hero-rgb), 0.24), rgba(255, 255, 255, 0.035)),
    #1e1827;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 10px 22px rgba(0, 0, 0, 0.16);
  text-align: center;
}

.hero-card.selected {
  border-color: var(--hero-accent);
  box-shadow: inset 0 0 0 1px var(--hero-accent), 0 0 24px rgba(var(--hero-rgb), 0.22);
}

.hero-card img {
  width: 78px;
  height: 78px;
  margin: 0 auto;
  object-fit: contain;
  image-rendering: pixelated;
}

.hero-card strong {
  display: block;
  line-height: 1.08;
}

.hero-card span {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

@media (max-width: 1180px) {
  .command-bar {
    grid-template-columns: repeat(3, 1fr) 48px 48px;
  }

  .wave-preview {
    grid-column: 1 / -1;
    justify-self: start;
    width: min(100%, 360px);
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .stats {
    width: 100%;
  }
}

@media (max-width: 720px) {
  :root {
    --tile: calc((100vw - 34px) / 14);
  }

  .title-screen {
    padding: 18px;
  }

  .title-panel {
    gap: 13px;
  }

  .title-actions,
  .title-howto {
    grid-template-columns: 1fr;
  }

  .title-floater {
    width: 78px;
    height: 78px;
    opacity: 0.44;
  }

  .title-floater:nth-child(5) {
    display: none;
  }

  .title-credit {
    left: 12px;
    bottom: 10px;
    font-size: 0.68rem;
  }

  .shell {
    width: calc(100vw - 16px);
    padding-top: 10px;
  }

  .stats {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }

  .stats div {
    min-height: 48px;
    padding: 8px 5px;
  }

  .stats span {
    font-size: 0.54rem;
    letter-spacing: 0.02em;
  }

  .stats strong {
    font-size: 0.9rem;
  }

  .command-bar {
    grid-template-columns: 1fr;
  }

  .unlock-choices {
    grid-template-columns: 1fr;
    max-height: min(480px, calc(100vh - 190px));
    overflow: auto;
    padding-right: 4px;
  }

  .unlock-choice {
    min-height: 190px;
  }

  .brand {
    align-items: flex-start;
  }

  .hero-orb {
    width: 58px;
    height: 58px;
  }

  .hero-orb img {
    width: 50px;
    height: 50px;
  }

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

  .enemy-sprite,
  .enemy-sprite img {
    width: calc(var(--tile) - 10px);
    height: calc(var(--tile) - 10px);
  }

  .tower-sprite {
    width: calc(var(--tile) - 6px);
    height: calc(var(--tile) - 6px);
  }

  .tower-sprite img {
    width: calc(var(--tile) - 10px);
    height: calc(var(--tile) - 10px);
  }
}
