@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;800&display=swap");

:root {
  --bg: #070b15;
  --bg-2: #0d1629;
  --panel: #0f1b2f;
  --panel-2: #122037;
  --line: #1f2e4a;
  --text: #e3ecff;
  --muted: #9fb2d1;
  --accent: #4de1c1;
  --accent-2: #f08c42;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Manrope", system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 15% 20%, rgba(77, 225, 193, 0.08), transparent 28%),
    radial-gradient(circle at 80% 15%, rgba(240, 140, 66, 0.1), transparent 32%),
    linear-gradient(160deg, #0b1220, #040812 55%, #05060b);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  line-height: 1.5;
}

.intro-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(77, 225, 193, 0.08), transparent 30%),
    radial-gradient(circle at 80% 30%, rgba(240, 140, 66, 0.08), transparent 30%),
    linear-gradient(135deg, #03060f, #060b1a 55%, #03050c);
  display: grid;
  place-items: center;
  z-index: 999;
  overflow: hidden;
}

.intro-bg::after,
.intro-bg::before {
  content: "";
  position: absolute;
  inset: -30%;
  background: conic-gradient(from 120deg, rgba(77, 225, 193, 0.35), rgba(210, 168, 255, 0.28), rgba(240, 140, 66, 0.32), rgba(77, 225, 193, 0.35));
  filter: blur(90px);
  animation: swirl 18s linear infinite;
  opacity: 0.35;
}

.intro-bg::before {
  animation-duration: 26s;
  animation-direction: reverse;
  mix-blend-mode: screen;
}

.intro-shell {
  position: relative;
  max-width: 520px;
  text-align: center;
  padding: 60px 38px 48px;
  border-radius: 28px;
  background: rgba(11, 18, 32, 0.78);
  border: 1px solid rgba(77, 225, 193, 0.25);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.intro-aura {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(77, 225, 193, 0.12), transparent 60%);
  filter: blur(40px);
  animation: pulse 6s ease-in-out infinite;
  pointer-events: none;
}

.intro-orb {
  width: 120px;
  height: 120px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(77, 225, 193, 0.4) 50%, rgba(3, 6, 15, 0.4) 80%);
  box-shadow: 0 0 80px rgba(77, 225, 193, 0.4), inset 0 0 60px rgba(255, 255, 255, 0.12);
  animation: float 4.5s ease-in-out infinite;
}

.intro-title {
  font-size: 56px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 14px;
  background: linear-gradient(120deg, #4de1c1, #d2a8ff, #f08c42);
  -webkit-background-clip: text;
  color: transparent;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  animation: glow 3s ease-in-out infinite;
}

.intro-sub {
  color: var(--muted);
  margin-bottom: 26px;
  font-size: 15px;
}

.intro-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-play {
  padding: 14px 38px;
  border-radius: 999px;
  border: 1px solid rgba(77, 225, 193, 0.5);
  background: linear-gradient(120deg, #4de1c1, #7cf3da);
  color: #021012;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.06em;
  box-shadow: 0 20px 50px rgba(77, 225, 193, 0.35);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.btn-play.btn-secondary {
  background: linear-gradient(120deg, rgba(77, 225, 193, 0.15), rgba(210, 168, 255, 0.15));
  color: var(--text);
  border: 1px solid rgba(210, 168, 255, 0.5);
  box-shadow: 0 10px 30px rgba(210, 168, 255, 0.2);
}

.btn-play:hover { transform: translateY(-2px) scale(1.01); filter: brightness(1.05); }
.btn-play:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.multi-panel {
  margin-top: 20px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  border: 1px solid var(--line);
}
.multi-panel.hidden { display: none; }
.multi-hint { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.copy-row {
  display: flex;
  gap: 8px;
}
.copy-row input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
}
.btn-copy {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: rgba(77, 225, 193, 0.15);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-copy:hover { background: rgba(77, 225, 193, 0.25); }
.copy-status { font-size: 12px; color: var(--accent); margin-top: 8px; min-height: 18px; }

/* Menu Screens */
.menu-screen {
  display: none;
  animation: fadeIn 0.3s ease;
}
.menu-screen.active {
  display: block;
}

.menu-header {
  margin-bottom: 24px;
}

.menu-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.menu-subtitle {
  font-size: 14px;
  color: var(--muted);
}

/* Pentagram Element Selection */
.pentagram {
  position: relative;
  width: 320px;
  height: 320px;
  margin: 30px auto;
}

.pentagram-lines {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 280px;
  height: 280px;
  margin: -140px 0 0 -140px;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.pentagram.specialization-mode .pentagram-lines {
  opacity: 0.4;
}

.tech-node {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90px;
  height: 90px;
  margin: -45px 0 0 -45px;
  transform: rotate(var(--angle)) translateY(-98px) rotate(calc(-1 * var(--angle)));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 50%;
  background: rgba(15, 27, 47, 0.8);
  border: 2px solid var(--line);
  cursor: pointer;
  transition: all 0.25s ease;
}

.tech-node:hover {
  transform: rotate(var(--angle)) translateY(-98px) rotate(calc(-1 * var(--angle))) scale(1.15);
  border-color: var(--accent);
  box-shadow: 0 0 25px rgba(77, 225, 193, 0.4);
  background: rgba(15, 27, 47, 0.95);
}

.tech-node.active {
  border-color: var(--accent);
  box-shadow: 0 0 30px rgba(77, 225, 193, 0.6);
  background: rgba(77, 225, 193, 0.15);
}

.node-icon {
  font-size: 32px;
}

.node-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.penta-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100px;
  height: 100px;
  margin: -50px 0 0 -50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(77, 225, 193, 0.15), rgba(15, 27, 47, 0.9));
  border: 3px solid var(--line);
  box-shadow: 0 0 40px rgba(77, 225, 193, 0.2);
}

.center-icon {
  font-size: 36px;
}

.center-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.element-info {
  max-width: 400px;
  margin: 20px auto;
  padding: 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  min-height: 100px;
}

.element-info h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}

.element-info p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

/* Specialization Selection */
.spec-element-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(var(--spec-color, 77, 225, 193), 0.15);
  border: 1px solid rgba(var(--spec-color, 77, 225, 193), 0.3);
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 600;
}

.badge-icon {
  font-size: 20px;
}

.badge-name {
  color: var(--text);
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 24px 0;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.spec-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(15, 27, 47, 0.6);
  border: 2px solid var(--line);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.spec-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(77, 225, 193, 0.3);
  background: rgba(15, 27, 47, 0.8);
}

.spec-card.active {
  border-color: var(--accent);
  background: rgba(77, 225, 193, 0.15);
  box-shadow: 0 0 25px rgba(77, 225, 193, 0.4);
}

.spec-icon {
  font-size: 36px;
}

.spec-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.spec-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.game-over-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 15, 0.95);
  display: grid;
  place-items: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}
.game-over-overlay.hidden { display: none; }
.game-over-shell {
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 40px;
  border-radius: 20px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  text-align: center;
}
.game-over-title {
  font-size: 42px;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(120deg, #4de1c1, #d2a8ff, #f08c42);
  -webkit-background-clip: text;
  color: transparent;
}
.game-over-subtitle {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}
.game-over-stats {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 20px;
}
.game-over-log-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  text-align: left;
}
.game-over-log {
  flex: 1;
  min-height: 150px;
  max-height: 300px;
  overflow-y: auto;
  background: #0a1222;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  text-align: left;
  line-height: 1.4;
  margin-bottom: 24px;
}
.game-over-log div + div { margin-top: 4px; }

.intro-overlay.hidden { opacity: 0; pointer-events: none; transition: opacity 280ms ease; }
.intro-overlay.hidden * { pointer-events: none !important; }

.glitter-mist-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 998;
  overflow: hidden;
  animation: glitter-fade 2s ease-out forwards;
}

@keyframes glitter-fade {
  0% { opacity: 1; }
  70% { opacity: 0.8; }
  100% { opacity: 0; }
}

.glitter-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.9), rgba(77, 225, 193, 0.6));
  box-shadow: 0 0 8px rgba(77, 225, 193, 0.8), 0 0 16px rgba(210, 168, 255, 0.5);
  animation: glitter-float 1.5s ease-out forwards;
}

@keyframes glitter-float {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translateY(-10px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px) scale(0.3);
  }
}

.phase-pill.urgent, .timer-pill.urgent { border-color: rgba(240, 140, 66, 0.7); color: var(--accent-2); }

.timer-pulse { animation: pulse-fast 1s ease-in-out infinite; }
.timer-live { animation: timer-glow 4s ease-in-out infinite; }

@keyframes swirl {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(77, 225, 193, 0.35)); }
  50% { filter: drop-shadow(0 0 24px rgba(210, 168, 255, 0.5)); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.98); }
  50% { opacity: 0.6; transform: scale(1.04); }
}

@keyframes pulse-fast {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes timer-glow {
  0%, 100% { box-shadow: 0 0 0 rgba(77, 225, 193, 0); }
  50% { box-shadow: 0 0 20px rgba(77, 225, 193, 0.28); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Card movement whoosh animation */
@keyframes card-whoosh {
  0% { transform: translateX(0) scale(1); opacity: 1; }
  15% { transform: translateX(-8px) scale(1.05); }
  50% { transform: translateX(40px) scale(0.95); opacity: 0.8; filter: blur(2px); }
  85% { transform: translateX(8px) scale(1.02); }
  100% { transform: translateX(0) scale(1); opacity: 1; filter: blur(0); }
}

@keyframes card-enter {
  0% { transform: translateY(-20px) scale(0.8); opacity: 0; }
  60% { transform: translateY(5px) scale(1.05); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}

@keyframes card-deploy {
  0% { transform: scale(0.3) rotate(-10deg); opacity: 0; box-shadow: 0 0 0 rgba(77, 225, 193, 0); }
  50% { transform: scale(1.15) rotate(2deg); opacity: 1; box-shadow: 0 0 40px rgba(77, 225, 193, 0.6); }
  100% { transform: scale(1) rotate(0); box-shadow: 0 0 0 rgba(77, 225, 193, 0); }
}

@keyframes battle-clash {
  0%, 100% { transform: scale(1); }
  10% { transform: scale(1.1) rotate(-3deg); }
  20% { transform: scale(0.95) rotate(3deg); }
  30% { transform: scale(1.08) rotate(-2deg); }
  40% { transform: scale(0.97) rotate(2deg); }
  50% { transform: scale(1.05); filter: brightness(1.3); }
  60% { transform: scale(0.98); }
  80% { transform: scale(1.02); }
}

@keyframes battle-shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
  20%, 40%, 60%, 80% { transform: translateX(3px); }
}

@keyframes damage-flash {
  0%, 100% { filter: brightness(1); }
  25% { filter: brightness(1.5) saturate(1.5); }
  50% { filter: brightness(0.8) hue-rotate(10deg); }
  75% { filter: brightness(1.3); }
}

@keyframes card-death {
  0% { transform: scale(1) rotate(0); opacity: 1; }
  30% { transform: scale(1.1) rotate(-5deg); opacity: 0.8; }
  100% { transform: scale(0) rotate(180deg); opacity: 0; }
}

@keyframes slot-pulse {
  0% { box-shadow: 0 0 0 rgba(77, 225, 193, 0); }
  50% { box-shadow: 0 0 15px rgba(77, 225, 193, 0.4), inset 0 0 10px rgba(77, 225, 193, 0.1); }
  100% { box-shadow: 0 0 0 rgba(77, 225, 193, 0); }
}

@keyframes trail-whoosh {
  0% { opacity: 0; transform: scaleX(0); }
  30% { opacity: 0.6; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(1.5) translateX(20px); }
}

.slot .card-face.just-moved { animation: card-whoosh 0.6s ease-out; }
.slot .card-face.just-deployed { animation: card-deploy 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.slot .card-face.in-battle { animation: battle-clash 0.8s ease-in-out; }
.slot .card-face.taking-damage { animation: damage-flash 0.4s ease-out, battle-shake 0.4s ease-out; }
.slot .card-face.dying { animation: card-death 0.6s ease-in forwards; }

/* Phase transition glow on the board */
@keyframes phase-glow {
  0% { box-shadow: inset 0 0 0 rgba(77, 225, 193, 0); }
  30% { box-shadow: inset 0 0 60px rgba(77, 225, 193, 0.15), 0 0 30px rgba(77, 225, 193, 0.1); }
  100% { box-shadow: inset 0 0 0 rgba(77, 225, 193, 0); }
}
.board.phase-transition { animation: phase-glow 0.8s ease-out; }

/* Battle glow on slots where combat occurred */
@keyframes battle-slot-glow {
  0% { box-shadow: 0 0 0 rgba(240, 140, 66, 0); }
  30% { box-shadow: 0 0 25px rgba(240, 140, 66, 0.5), inset 0 0 15px rgba(240, 140, 66, 0.2); }
  100% { box-shadow: 0 0 0 rgba(240, 140, 66, 0); }
}
.slot.battle-glow { animation: battle-slot-glow 1s ease-out; }

.card-pill { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
.card-pill:hover { transform: translateY(-4px) scale(1.02); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3); }
.card-pill.dragging { transform: scale(1.05) rotate(-2deg); box-shadow: 0 15px 40px rgba(77, 225, 193, 0.4); opacity: 0.9; }

.spawn-slot { transition: all 0.2s ease; }
.spawn-slot:hover { border-color: rgba(77, 225, 193, 0.5); background: rgba(77, 225, 193, 0.05); }
.spawn-slot.spawn-hover { 
  animation: slot-pulse 0.5s ease-in-out infinite; 
  background: rgba(77, 225, 193, 0.1);
  transform: scale(1.02);
}

.masthead {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 6px;
}

.lede { color: var(--muted); max-width: 640px; }

.masthead-meta { display: flex; gap: 10px; align-items: center; }

.pill {
  background: rgba(77, 225, 193, 0.12);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(77, 225, 193, 0.35);
  font-weight: 600;
  font-size: 13px;
}

.pill.soft { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.1); }
.pill.mini { padding: 4px 8px; font-size: 11px; }
.pill.up { border-color: rgba(77, 225, 193, 0.7); color: var(--accent); }
.pill.down { border-color: rgba(240, 140, 66, 0.7); color: var(--accent-2); }
.phase-pill.draw { border-color: rgba(77, 225, 193, 0.7); color: var(--accent); }
.phase-pill.deploy { border-color: rgba(240, 140, 66, 0.7); color: var(--accent-2); }
.timer-live { animation: timer-glow 4s ease-in-out infinite; }

.card-surface {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.controls { display: flex; flex-direction: column; gap: 12px; }
.control-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.phase-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.info-trigger { position: relative; display: flex; align-items: center; }
#how-to-play { padding: 8px 12px; font-size: 12px; background: rgba(255, 255, 255, 0.04); color: var(--text); border-color: var(--line); }
#how-to-play:hover { background: rgba(255, 255, 255, 0.08); }
.info-popup {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  z-index: 20;
}
.info-popup.visible { display: block; }
.info-popup::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 24px;
  width: 12px;
  height: 12px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}
.info-popup-title { font-weight: 700; margin-bottom: 8px; color: var(--text); }
.info-popup-list { margin-left: 16px; color: var(--muted); font-size: 13px; display: grid; gap: 6px; }

.hands.solo { display: flex; flex-direction: column; }
.hands.solo .hand-panel { max-width: 820px; }

button {
  border: 1px solid transparent;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  color: #03121a;
  background: var(--accent);
  box-shadow: 0 10px 30px rgba(77, 225, 193, 0.25);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.ghost { background: transparent; border-color: var(--line); color: var(--text); box-shadow: none; }
.primary { background: linear-gradient(120deg, #4de1c1, #7cf3da); color: #052022; }
.deploy { background: linear-gradient(120deg, #f08c42, #f6c452); color: #1a0f05; }

.board-shell { display: flex; flex-direction: column; gap: 12px; }

.board { display: grid; gap: 10px; }
.lane { display: grid; grid-template-columns: repeat(12, minmax(70px, 1fr)); gap: 6px; }
@keyframes lane-highlight-fade {
  0% { box-shadow: 0 0 0 2px rgba(77, 225, 193, 0.5); }
  70% { box-shadow: 0 0 0 2px rgba(77, 225, 193, 0.3); }
  100% { box-shadow: 0 0 0 0 rgba(77, 225, 193, 0); }
}
.lane.lane-selected { animation: lane-highlight-fade 1.2s ease-out forwards; border-radius: 10px; padding: 2px; }

/* Event animations */
@keyframes lightning-flash {
  0%, 100% { background: transparent; }
  10%, 30%, 50% { background: rgba(255, 255, 100, 0.3); }
  20%, 40% { background: transparent; }
}
@keyframes lightning-strike {
  0% { opacity: 1; transform: scale(1); box-shadow: 0 0 20px 10px rgba(255, 255, 100, 0.8); }
  50% { opacity: 0.5; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(0.8); box-shadow: 0 0 0 0 transparent; }
}
@keyframes earthquake-shake {
  0%, 100% { transform: translateX(0) translateY(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-3px) translateY(2px); }
  20%, 40%, 60%, 80% { transform: translateX(3px) translateY(-2px); }
}
@keyframes earthquake-scatter {
  0% { transform: scale(1) rotate(0deg); opacity: 1; }
  50% { transform: scale(0.5) rotate(180deg); opacity: 0.5; }
  100% { transform: scale(1) rotate(360deg); opacity: 1; }
}
@keyframes speed-pulse {
  0%, 100% { box-shadow: inset 0 0 20px rgba(77, 225, 193, 0.1); }
  50% { box-shadow: inset 0 0 40px rgba(77, 225, 193, 0.25); }
}

.board.lightning-active { animation: lightning-flash 0.8s ease-in-out; }
.board.earthquake-active { animation: earthquake-shake 0.6s ease-in-out; }
.board.speed-active { animation: speed-pulse 1s ease-in-out infinite; }
.slot.lightning-hit { animation: lightning-strike 0.5s ease-out forwards; }
.slot.earthquake-scatter { animation: earthquake-scatter 0.8s ease-in-out; }

.event-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 20px 40px;
  border-radius: 16px;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  z-index: 500;
  pointer-events: none;
  animation: event-banner-pop 2s ease-out forwards;
}
@keyframes event-banner-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  30% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}
.event-banner.speed { background: linear-gradient(135deg, #4de1c1, #2a9d8f); color: #fff; }
.event-banner.earthquake { background: linear-gradient(135deg, #8b4513, #d2691e); color: #fff; }
.event-banner.lightning { background: linear-gradient(135deg, #ffd700, #ffaa00); color: #1a1a1a; }
.event-banner.flood { background: linear-gradient(135deg, #1e90ff, #4169e1); color: #fff; }
.event-banner.comet { background: linear-gradient(135deg, #ff4500, #ff6347); color: #fff; }
.event-banner.fullmoon { background: linear-gradient(135deg, #c0c0c0, #e0e0ff); color: #1a1a1a; }
.event-banner.tornado { background: linear-gradient(135deg, #708090, #b0c4de); color: #fff; }

@keyframes flood-wave {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-5px); }
  75% { transform: translateY(5px); }
}
@keyframes comet-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 69, 0, 0.5); }
  50% { box-shadow: 0 0 30px rgba(255, 69, 0, 0.8); }
}
@keyframes fullmoon-shimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}
@keyframes tornado-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.board.flood-active { animation: flood-wave 0.6s ease-in-out 3; }
.board.comet-active .element-fire { animation: comet-glow 0.5s ease-in-out 3; }
.board.fullmoon-active .element-water { animation: fullmoon-shimmer 0.5s ease-in-out 3; }
.board.tornado-active { animation: tornado-spin 0.3s ease-in-out; }

.event-indicator {
  position: fixed;
  top: 80px;
  right: 20px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  z-index: 100;
  pointer-events: none;
}
.event-indicator.speed { background: rgba(77, 225, 193, 0.2); border: 1px solid #4de1c1; color: #4de1c1; }
.event-indicator.earthquake { background: rgba(210, 105, 30, 0.2); border: 1px solid #d2691e; color: #d2691e; }
.event-indicator.lightning { background: rgba(255, 215, 0, 0.2); border: 1px solid #ffd700; color: #ffd700; }

.slot {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 130px;
  background: #0d1728;
  position: relative;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.spawn-slot { border-style: dashed; }

/* Pulsating pink highlight on the column where the player takes damage */
@keyframes dmg-pulse {
  0%, 100% { box-shadow: inset 0 0 12px rgba(255, 80, 130, 0.15); background: rgba(255, 80, 130, 0.04); }
  50%      { box-shadow: inset 0 0 22px rgba(255, 80, 130, 0.35); background: rgba(255, 80, 130, 0.10); }
}
.damage-zone {
  animation: dmg-pulse 2.4s ease-in-out infinite;
  border-color: rgba(255, 80, 130, 0.25) !important;
}

.slot:hover { border-color: rgba(255, 255, 255, 0.2); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25); }
.slot .slot-index { position: absolute; top: 6px; right: 8px; color: var(--muted); font-size: 11px; }

.card-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2px;
  min-height: 80px;
  position: relative;
  z-index: 2;
}
.card-name-line {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  color: var(--text);
}
.stat-line {
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted);
}

.card-face { position: relative; padding: 18px 8px 8px; display: flex; flex-direction: column; justify-content: center; min-height: 100px; }
.card-emoji-back {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 42px;
  opacity: 0.2;
  pointer-events: none;
}
.card-face.face-up .card-emoji-back { opacity: 0; }
.card-emoji-corners { position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 2; }
.card-face.face-up .card-emoji-corners { opacity: 1; }
.card-emoji-corners span {
  position: absolute;
  font-size: 14px;
  opacity: 0.45;
  line-height: 1;
}
.card-emoji-corners .tl { top: 6px; left: 8px; }
.card-emoji-corners .tr { top: 6px; right: 8px; }
.card-emoji-corners .bl { bottom: 6px; left: 8px; }
.card-emoji-corners .br { bottom: 6px; right: 8px; }

.card-owner-tooltip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 10;
}
.card-face:hover .card-owner-tooltip { opacity: 1; }

.hand-panel { flex: 1 1 50%; display: flex; flex-direction: column; gap: 10px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hint { color: var(--muted); font-size: 12px; }

.hand { display: flex; flex-wrap: wrap; gap: 8px; }
.card-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 12px;
  min-width: 180px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}

.card-pill:hover { transform: translateY(-1px); border-color: rgba(255, 255, 255, 0.25); }
.card-pill.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card-pill.specialty-card { border-color: #ffd700; background: rgba(255, 215, 0, 0.08); }
.card-pill .subtitle { color: var(--muted); font-size: 12px; }
.specialty-badge { color: #ffd700; font-size: 11px; font-weight: bold; margin-left: 4px; }

.deploy-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
label { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; }
select, input[type="checkbox"] { accent-color: var(--accent); }
select {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}
.toggle { gap: 8px; }

.deploy-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: linear-gradient(135deg, rgba(77, 225, 193, 0.15), rgba(240, 140, 66, 0.1));
  border: 2px solid var(--accent);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}
.deploy-toggle:hover {
  background: linear-gradient(135deg, rgba(77, 225, 193, 0.25), rgba(240, 140, 66, 0.2));
  transform: scale(1.02);
}
.deploy-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}
.deploy-toggle .toggle-label {
  font-size: 15px;
  color: var(--text);
}
.deploy-toggle:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(77, 225, 193, 0.3);
}
.deploy-toggle:has(input:not(:checked)) {
  border-color: var(--accent-2);
  background: linear-gradient(135deg, rgba(240, 140, 66, 0.15), rgba(77, 225, 193, 0.05));
}
.deploy-toggle:has(input:not(:checked)) .toggle-label::before {
  content: "🔒 ";
}
.deploy-toggle:has(input:checked) .toggle-label::before {
  content: "";
}

.stack-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stack-pill {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.panel { display: flex; flex-direction: column; gap: 10px; }

.graveyard { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; color: var(--muted); font-size: 13px; }
.graveyard .entry { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.03); }

.log {
  background: #0a1222;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  max-height: 260px;
  overflow-y: auto;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}
.log div + div { margin-top: 6px; }

.footer { color: var(--muted); font-size: 13px; text-align: center; padding: 12px 0 30px; }
.copyright { color: var(--muted); font-size: 11px; text-align: center; margin-top: -10px; padding-bottom: 10px; }

.hands { display: flex; gap: 14px; flex-wrap: wrap; }

.element-water { border-color: #4fc3f7; background: linear-gradient(180deg, rgba(79, 195, 247, 0.2), rgba(13, 23, 40, 0.9)); }
.element-fire { border-color: #f08c42; background: linear-gradient(180deg, rgba(240, 140, 66, 0.24), rgba(13, 23, 40, 0.9)); }
.element-earth { border-color: #7ec77b; background: linear-gradient(180deg, rgba(126, 199, 123, 0.22), rgba(13, 23, 40, 0.9)); }
.element-air { border-color: #a3b4ff; background: linear-gradient(180deg, rgba(163, 180, 255, 0.22), rgba(13, 23, 40, 0.9)); }
.element-spirit { border-color: #d2a8ff; background: linear-gradient(180deg, rgba(210, 168, 255, 0.25), rgba(13, 23, 40, 0.9)); }

/* Mirror-match P2 stripe: diagonal lines so you can tell P2 apart */
.card-face.mirror-p2 {
  position: relative;
}
.card-face.mirror-p2::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 5px,
    rgba(255, 215, 0, 0.22) 5px,
    rgba(255, 215, 0, 0.22) 8px
  );
  pointer-events: none;
  z-index: 1;
}

/* Specialization Colors - Water variants */
.spec-Blood { border-color: #ff5252; background: linear-gradient(180deg, rgba(255, 82, 82, 0.28), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(255, 82, 82, 0.15); }
.spec-Plant { border-color: #69f0ae; background: linear-gradient(180deg, rgba(105, 240, 174, 0.26), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(105, 240, 174, 0.15); }
.spec-Ice { border-color: #80d8ff; background: linear-gradient(180deg, rgba(128, 216, 255, 0.28), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(128, 216, 255, 0.15); }
.spec-Healing { border-color: #64ffda; background: linear-gradient(180deg, rgba(100, 255, 218, 0.24), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(100, 255, 218, 0.15); }
.spec-Depths { border-color: #1e88e5; background: linear-gradient(180deg, rgba(30, 136, 229, 0.3), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(30, 136, 229, 0.18); }

/* Specialization Colors - Earth variants */
.spec-Lava { border-color: #ff6e40; background: linear-gradient(180deg, rgba(255, 110, 64, 0.3), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(255, 110, 64, 0.18); }
.spec-Metal { border-color: #9e9e9e; background: linear-gradient(180deg, rgba(158, 158, 158, 0.28), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(158, 158, 158, 0.15); }
.spec-Seer { border-color: #ab47bc; background: linear-gradient(180deg, rgba(171, 71, 188, 0.26), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(171, 71, 188, 0.15); }
.spec-Growth { border-color: #ffc107; background: linear-gradient(180deg, rgba(255, 193, 7, 0.28), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(255, 193, 7, 0.15); }
.spec-Gravel { border-color: #8d6e63; background: linear-gradient(180deg, rgba(141, 110, 99, 0.3), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(141, 110, 99, 0.18); }

/* Specialization Colors - Fire variants */
.spec-Dragon { border-color: #ff5722; background: linear-gradient(180deg, rgba(255, 87, 34, 0.32), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(255, 87, 34, 0.2); }
.spec-Lightning { border-color: #ffeb3b; background: linear-gradient(180deg, rgba(255, 235, 59, 0.3), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(255, 235, 59, 0.18); }
.spec-Rainbow { border-color: #f48fb1; background: linear-gradient(135deg, rgba(244, 143, 177, 0.25), rgba(156, 39, 176, 0.2), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 14px rgba(244, 143, 177, 0.2); }
.spec-Light { border-color: #fff176; background: linear-gradient(180deg, rgba(255, 241, 118, 0.28), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 14px rgba(255, 241, 118, 0.18); }
.spec-Cobalt { border-color: #448aff; background: linear-gradient(180deg, rgba(68, 138, 255, 0.3), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(68, 138, 255, 0.18); }

/* Specialization Colors - Air variants */
.spec-Force { border-color: #7c3aed; background: linear-gradient(180deg, rgba(124, 58, 237, 0.32), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(124, 58, 237, 0.2); }
.spec-Psychic { border-color: #ce93d8; background: linear-gradient(180deg, rgba(206, 147, 216, 0.28), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(206, 147, 216, 0.15); }
.spec-Apparition { border-color: #b19cd9; background: linear-gradient(180deg, rgba(177, 156, 217, 0.28), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(177, 156, 217, 0.16); }
.spec-Void { border-color: #3d3f8f; background: linear-gradient(180deg, rgba(50, 60, 140, 0.4), rgba(13, 23, 40, 0.95)); box-shadow: 0 0 12px rgba(50, 60, 140, 0.2); }
.spec-Darkness { border-color: #424242; background: linear-gradient(180deg, rgba(66, 66, 66, 0.35), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(66, 66, 66, 0.2); }

/* Specialization Colors - Spirit variants */
.spec-Ether { border-color: #e1bee7; background: linear-gradient(180deg, rgba(225, 190, 231, 0.26), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(225, 190, 231, 0.15); }
.spec-Chaos { border-color: #ff4081; background: linear-gradient(180deg, rgba(255, 64, 129, 0.3), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 14px rgba(255, 64, 129, 0.18); }
.spec-Necro { border-color: #7e57c2; background: linear-gradient(180deg, rgba(126, 87, 194, 0.3), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(126, 87, 194, 0.18); }
.spec-Soul { border-color: #ba68c8; background: linear-gradient(180deg, rgba(186, 104, 200, 0.28), rgba(13, 23, 40, 0.9)); box-shadow: 0 0 12px rgba(186, 104, 200, 0.15); }

/* Power-Up Buttons */
.powerup-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.powerup-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

.passive-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}
.passive-info:empty { display: none; }
.passive-tag {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.passive-tag .passive-icon { font-size: 14px; }
.passive-tag .passive-label { font-weight: 600; color: var(--text); }
.passive-tag .passive-desc { opacity: 0.7; }

.powerup-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.powerup-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  overflow: visible;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  --cooldown-percent: 0%;
}

.powerup-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.powerup-btn:active {
  transform: translateY(0) scale(0.98);
}

.powerup-icon {
  font-size: 18px;
  transition: transform 300ms ease;
}

.powerup-btn:hover .powerup-icon {
  transform: scale(1.3);
}

.powerup-text {
  transition: letter-spacing 200ms ease;
}

.powerup-cooldown {
  position: absolute;
  bottom: 2px;
  right: 6px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  z-index: 2;
}

/* Cooldown overlay */
.powerup-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.55));
  height: var(--cooldown-percent);
  border-radius: 10px;
  pointer-events: none;
  transition: height 1s linear;
  z-index: 1;
}

.powerup-icon, .powerup-text { position: relative; z-index: 2; }

/* Water */
.powerup-btn.water {
  border-color: #4fc3f7;
  background: linear-gradient(135deg, rgba(79, 195, 247, 0.2), rgba(79, 195, 247, 0.08));
}
.powerup-btn.water:hover {
  background: linear-gradient(135deg, rgba(79, 195, 247, 0.4), rgba(79, 195, 247, 0.2));
  box-shadow: 0 12px 40px rgba(79, 195, 247, 0.35);
}
.powerup-btn.water:hover .powerup-icon { animation: water-wave 600ms ease-in-out infinite; }
@keyframes water-wave { 0%, 100% { transform: scale(1.3) translateY(0); } 50% { transform: scale(1.3) translateY(-4px); } }

/* Earth */
.powerup-btn.earth {
  border-color: #7ec77b;
  background: linear-gradient(135deg, rgba(126, 199, 123, 0.2), rgba(126, 199, 123, 0.08));
}
.powerup-btn.earth:hover {
  background: linear-gradient(135deg, rgba(126, 199, 123, 0.4), rgba(126, 199, 123, 0.2));
  box-shadow: 0 12px 40px rgba(126, 199, 123, 0.35);
}
.powerup-btn.earth:hover .powerup-icon { animation: earth-shake 150ms ease-in-out infinite; }
@keyframes earth-shake { 0%, 100% { transform: scale(1.3) translateX(0); } 50% { transform: scale(1.3) translateX(-3px); } }

/* Fire */
.powerup-btn.fire {
  border-color: #f08c42;
  background: linear-gradient(135deg, rgba(240, 140, 66, 0.2), rgba(240, 140, 66, 0.08));
}
.powerup-btn.fire:hover {
  background: linear-gradient(135deg, rgba(240, 140, 66, 0.4), rgba(240, 140, 66, 0.2));
  box-shadow: 0 12px 40px rgba(240, 140, 66, 0.35);
}
.powerup-btn.fire:hover .powerup-icon { animation: fire-flicker 120ms ease-in-out infinite alternate; }
@keyframes fire-flicker { 0% { transform: scale(1.3) rotate(-5deg); } 100% { transform: scale(1.4) rotate(5deg); } }

/* Air */
.powerup-btn.air {
  border-color: #a3b4ff;
  background: linear-gradient(135deg, rgba(163, 180, 255, 0.2), rgba(163, 180, 255, 0.08));
}
.powerup-btn.air:hover {
  background: linear-gradient(135deg, rgba(163, 180, 255, 0.4), rgba(163, 180, 255, 0.2));
  box-shadow: 0 12px 40px rgba(163, 180, 255, 0.35);
}
.powerup-btn.air:hover .powerup-icon { animation: air-swirl 700ms linear infinite; }
@keyframes air-swirl { 0% { transform: scale(1.3) rotate(0deg); } 100% { transform: scale(1.3) rotate(360deg); } }

/* Spirit */
.powerup-btn.spirit {
  border-color: #d2a8ff;
  background: linear-gradient(135deg, rgba(210, 168, 255, 0.2), rgba(210, 168, 255, 0.08));
}
.powerup-btn.spirit:hover {
  background: linear-gradient(135deg, rgba(210, 168, 255, 0.4), rgba(210, 168, 255, 0.2));
  box-shadow: 0 12px 40px rgba(210, 168, 255, 0.35);
}
.powerup-btn.spirit:hover .powerup-icon { animation: spirit-float 800ms ease-in-out infinite; }
@keyframes spirit-float { 0%, 100% { transform: scale(1.3) translateY(0); opacity: 1; } 50% { transform: scale(1.4) translateY(-5px); opacity: 0.7; } }

/* Tooltip styles */
.powerup-tooltip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: linear-gradient(145deg, rgba(20, 20, 35, 0.98), rgba(30, 30, 50, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 200px;
  max-width: 260px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(100, 100, 255, 0.1);
  opacity: 0;
  visibility: hidden;
  transition: all 200ms ease;
  pointer-events: none;
  z-index: 1000;
}
.powerup-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: rgba(30, 30, 50, 0.95);
}
.powerup-btn:hover .powerup-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}
.tooltip-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.tooltip-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.45;
}
.tooltip-desc b {
  color: #ffd966;
  font-weight: 600;
}
.powerup-btn.water:hover .powerup-tooltip { border-color: rgba(64, 164, 223, 0.4); }
.powerup-btn.earth:hover .powerup-tooltip { border-color: rgba(139, 119, 42, 0.4); }
.powerup-btn.fire:hover .powerup-tooltip { border-color: rgba(255, 107, 53, 0.4); }
.powerup-btn.air:hover .powerup-tooltip { border-color: rgba(163, 180, 255, 0.4); }
.powerup-btn.spirit:hover .powerup-tooltip { border-color: rgba(210, 168, 255, 0.4); }

/* On cooldown state */
.powerup-btn.on-cooldown {
  cursor: not-allowed;
  opacity: 0.7;
}
.powerup-btn.on-cooldown:hover {
  transform: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.powerup-btn.on-cooldown .powerup-icon {
  animation: none !important;
  filter: grayscale(0.5);
}

/* Activation animation */
.powerup-btn.activating {
  animation: powerup-activate 400ms ease-out;
}
@keyframes powerup-activate {
  0% { transform: scale(1); }
  30% { transform: scale(1.2); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@media (max-width: 900px) {
  body { padding: 18px; }
  .masthead { flex-direction: column; }
  .lane { grid-template-columns: repeat(6, minmax(64px, 1fr)); }
  .powerup-btn { padding: 8px 12px; font-size: 11px; }
  .powerup-icon { font-size: 16px; }
}