.tower-board {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 560px;
  padding: 24px;
  background:
    radial-gradient(500px 500px at 50% 0%, rgb(211 77 255 / 0.18), transparent 70%),
    linear-gradient(180deg, #1a0a26, var(--bg-0) 70%);
}
.tower-board.is-won { background: radial-gradient(500px 500px at 50% 0%, rgb(255 197 61 / 0.2), transparent 70%), linear-gradient(180deg, #1f1406, var(--bg-0) 70%); }

.tower {
  display: grid;
  gap: 8px;
  width: min(100%, 480px);
}
.tower.is-rising .tower-row { animation: row-rise 480ms var(--ease-out) backwards; }
.tower.is-rising .tower-row:nth-last-child(2) { animation-delay: 30ms; }
.tower.is-rising .tower-row:nth-last-child(3) { animation-delay: 60ms; }
.tower.is-rising .tower-row:nth-last-child(4) { animation-delay: 90ms; }
.tower.is-rising .tower-row:nth-last-child(5) { animation-delay: 120ms; }
.tower.is-rising .tower-row:nth-last-child(6) { animation-delay: 150ms; }
.tower.is-rising .tower-row:nth-last-child(7) { animation-delay: 180ms; }
.tower.is-rising .tower-row:nth-last-child(8) { animation-delay: 210ms; }
.tower.is-rising .tower-row:nth-last-child(9) { animation-delay: 240ms; }
@keyframes row-rise { from { opacity: 0; transform: translateY(18px); } }

.tower-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 10px;
  padding: 4px;
  border-radius: 12px;
  transition: background-color 240ms, box-shadow 240ms;
}
.tower-row__mult {
  color: var(--text-3);
  font-weight: 800;
  font-size: 12.5px;
  text-align: right;
  transition: color 200ms;
}
.tower-row__tiles {
  display: grid;
  grid-template-columns: repeat(var(--tiles), 1fr);
  gap: 8px;
}
.tower-row.is-current {
  background: rgb(211 77 255 / 0.12);
  box-shadow: inset 0 0 0 2px rgb(224 107 255 / 0.55), 0 0 30px rgb(211 77 255 / 0.2);
}
.tower-row.is-current .tower-row__mult { color: #f5d0ff; }
.tower-row.is-cleared .tower-row__mult { color: var(--accent); }
.tower-row.is-broken { animation: fx-shake 420ms; --shake: 4px; }

.tower-tile {
  position: relative;
  height: 44px;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(180deg, #5a2378, #4a1a63);
  box-shadow: 0 4px 0 #240a33, inset 0 1px 0 rgb(255 255 255 / 0.1);
  cursor: pointer;
  transition: transform 150ms var(--ease-out), background-color 150ms, box-shadow 150ms, opacity 200ms;
}
.tower-tile:disabled { cursor: default; }
.tower-row:not(.is-current) .tower-tile:not(.is-egg):not(.is-skull) { opacity: 0.55; }
.tower-tile:not(:disabled):hover {
  transform: translateY(-2px);
  background: linear-gradient(180deg, #7a33a0, #642587);
  box-shadow: 0 6px 0 #240a33, 0 10px 20px rgb(0 0 0 / 0.35);
}
.tower-tile:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 #240a33; }
.tower-tile.is-pending { animation: tile-pending-tower 450ms ease-in-out infinite alternate; }
@keyframes tile-pending-tower { to { background: #8a3fb3; } }
.tower-tile.is-egg, .tower-tile.is-skull { box-shadow: none; transform: none; }
.tower-tile.is-egg { background: linear-gradient(180deg, #6b1f7a, #4a1263); box-shadow: inset 0 0 0 2px rgb(255 210 87 / 0.6), 0 0 18px rgb(255 197 61 / 0.25); }
.tower-tile.is-skull { background: #2a0d18; box-shadow: inset 0 0 0 2px rgb(255 77 99 / 0.7), 0 0 20px rgb(255 77 99 / 0.35); }
.tower-tile.is-dim { opacity: 0.45; box-shadow: none; }
.tower-tile__content { position: absolute; inset: 4px; display: grid; place-items: center; pointer-events: none; }
.tower-tile__content .sprite { height: 100%; width: auto; }
.tower-tile.is-flipped .tower-tile__content { animation: sprite-pop 460ms var(--ease-spring); }

@media (max-width: 600px) {
  .tower-board { padding: 14px; min-height: 0; }
  .tower-row { grid-template-columns: 52px 1fr; gap: 6px; }
  .tower-tile { height: 38px; }
}
