




.card {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  position: relative;
  overflow: visible;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    transform var(--transition-med),
    box-shadow var(--transition-med),
    margin var(--transition-med);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6));
}

.card-border {
  width: 100%;
  height: 100%;
  border: 3px solid var(--rarity-common);
  border-radius: var(--card-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.03) 0%, transparent 50%),
    linear-gradient(180deg, #14141f 0%, #1a1a2e 40%, #141422 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -1px 0 rgba(0,0,0,0.3);
}


/* ── COMMON: Clean, subtle ── */
.card[data-rarity="common"] .card-border {
  border-color: var(--rarity-common);
}

/* ── UNCOMMON: Soft elemental glow ── */
.card[data-rarity="uncommon"] .card-border {
  border-color: var(--rarity-uncommon);
  box-shadow:
    0 0 10px rgba(46, 204, 113, 0.25),
    inset 0 0 8px rgba(46, 204, 113, 0.08);
}

/* ── RARE: Vivid blue energy frame ── */
.card[data-rarity="rare"] .card-border {
  border-color: var(--rarity-rare);
  border-width: 3px;
  box-shadow:
    0 0 14px rgba(52, 152, 219, 0.4),
    0 0 4px rgba(52, 152, 219, 0.6),
    inset 0 0 10px rgba(52, 152, 219, 0.1);
}
.card[data-rarity="rare"] .card-art::after {
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(52, 152, 219, 0.15) 35%,
    rgba(100, 200, 255, 0.3) 50%,
    rgba(52, 152, 219, 0.15) 65%,
    transparent 100%
  );
  animation: shimmer 3s ease-in-out infinite;
}

/* ── EPIC: Purple arcane energy with inner fire ── */
.card[data-rarity="epic"] .card-border {
  border-color: var(--rarity-epic);
  border-width: 3px;
  box-shadow:
    0 0 16px rgba(155, 89, 182, 0.5),
    0 0 6px rgba(155, 89, 182, 0.7),
    0 0 30px rgba(120, 50, 180, 0.15),
    inset 0 0 12px rgba(155, 89, 182, 0.12);
}
.card[data-rarity="epic"] {
  animation: epicPulse 3s ease-in-out infinite;
}
.card[data-rarity="epic"] .card-art::after {
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(155, 89, 182, 0.12) 30%,
    rgba(200, 130, 255, 0.3) 45%,
    rgba(255, 200, 255, 0.2) 50%,
    rgba(200, 130, 255, 0.3) 55%,
    rgba(155, 89, 182, 0.12) 70%,
    transparent 100%
  );
  animation: shimmer 2.5s ease-in-out infinite;
}
.card[data-rarity="epic"] .card-header {
  background: linear-gradient(135deg, rgba(80, 30, 120, 0.5), rgba(0, 0, 0, 0.35));
}

/* ══════════════════════════════════════════════════════════════
   ██  LEGENDARY: THE FULL SPECTACLE  ██
   Holographic foil, animated prismatic border, particle shimmer,
   golden inner light, and dramatic presence
   ══════════════════════════════════════════════════════════════ */

.card[data-rarity="legendary"] {
  animation: legendaryFloat 3s ease-in-out infinite;
  z-index: 2;
}

.card[data-rarity="legendary"] .card-border {
  border-color: transparent;
  border-width: 3px;
  background-clip: padding-box;
  box-shadow:
    0 0 25px rgba(255, 215, 0, 0.6),
    0 0 50px rgba(255, 165, 0, 0.2),
    0 0 8px rgba(255, 215, 0, 0.8),
    inset 0 0 20px rgba(255, 215, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, #1a1500 0%, #1a1a2e 40%, #141410 100%);
}

/* Legendary animated prismatic border */
.card[data-rarity="legendary"]::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: calc(var(--card-radius) + 3px);
  background: conic-gradient(
    from var(--legendary-angle, 0deg) at 50% 50%,
    #ffd700 0deg,
    #ff6b35 45deg,
    #ff3366 90deg,
    #cc33ff 135deg,
    #3366ff 180deg,
    #33ccff 225deg,
    #33ff99 270deg,
    #ffcc00 315deg,
    #ffd700 360deg
  );
  z-index: -1;
  animation: legendaryBorderSpin 4s linear infinite;
  filter: blur(0.5px);
}

/* Legendary holographic foil overlay on art */
.card[data-rarity="legendary"] .card-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 215, 0, 0.08) 0px,
      rgba(255, 100, 200, 0.06) 3px,
      rgba(100, 200, 255, 0.06) 6px,
      rgba(100, 255, 100, 0.06) 9px,
      rgba(255, 215, 0, 0.08) 12px
    );
  mix-blend-mode: overlay;
  animation: holoShift 3s linear infinite;
  pointer-events: none;
  z-index: 2;
}

.card[data-rarity="legendary"] .card-art::after {
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 215, 0, 0.15) 25%,
    rgba(255, 255, 255, 0.4) 45%,
    rgba(255, 215, 0, 0.3) 50%,
    rgba(255, 255, 255, 0.4) 55%,
    rgba(255, 215, 0, 0.15) 75%,
    transparent 100%
  );
  animation: shimmer 2s ease-in-out infinite;
  width: 60%;
}

/* Legendary golden header */
.card[data-rarity="legendary"] .card-header {
  background: linear-gradient(135deg, rgba(100, 70, 0, 0.6), rgba(50, 30, 0, 0.5), rgba(100, 70, 0, 0.4));
}

/* Legendary card name glow */
.card[data-rarity="legendary"] .card-name {
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.6), 0 1px 2px rgba(0,0,0,0.8);
}

/* Legendary power stat emphasis */
.card[data-rarity="legendary"] .card-power {
  font-size: 1.2rem;
  color: #1a0d00;
  text-shadow:
    0 1px 0 rgba(255,255,255,0.35),
    0 0 2px rgba(0,0,0,0.4);
}

/* Legendary type bar */
.card[data-rarity="legendary"] .card-type-bar {
  background: linear-gradient(135deg, rgba(80, 60, 0, 0.5), rgba(0, 0, 0, 0.45));
}

/* Legendary stats bar */
.card[data-rarity="legendary"] .card-stats {
  background: linear-gradient(180deg, rgba(60, 40, 0, 0.4), rgba(0, 0, 0, 0.5));
  border-top: 1px solid rgba(255, 215, 0, 0.2);
}


.card-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  min-height: 30px;
}

.card-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 92px;
  letter-spacing: 0.04em;
  line-height: 1.15;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,1), 0 0 6px rgba(0,0,0,0.5);
}

.card-power {
  min-width: 34px;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.95), rgba(255, 155, 0, 0.92));
  border: 1px solid rgba(255, 238, 170, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a0d00;
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 1px 0 rgba(255,255,255,0.35),
    0 0 2px rgba(0,0,0,0.4);
  box-shadow:
    0 0 12px rgba(255, 184, 77, 0.35),
    0 2px 4px rgba(0, 0, 0, 0.4),
    inset 0 1px 1px rgba(255,255,255,0.3),
    inset 0 -1px 1px rgba(0,0,0,0.2);
  flex-shrink: 0;
}


.card-art {
  height: 85px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1a1a30, #25253f);
}

/* ── EMBER ART: Volcanic lava flows with heat distortion ── */
.card[data-element="ember"] .card-art {
  background:
    radial-gradient(ellipse at 30% 80%, rgba(255,80,0,0.9) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 20%, rgba(255,200,0,0.7) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 50%, rgba(200,40,0,0.6) 0%, transparent 60%),
    linear-gradient(180deg, #1a0500 0%, #ff4500 30%, #ff8c00 60%, #ffcc00 85%, #fff5cc 100%);
}
.card[data-element="ember"] .card-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 70%, rgba(255,100,0,0.8) 0%, transparent 30%),
    radial-gradient(circle at 80% 30%, rgba(255,200,50,0.6) 0%, transparent 25%),
    radial-gradient(circle at 50% 90%, rgba(255,60,0,0.9) 0%, transparent 35%);
  animation: emberArtPulse 3s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

/* ── FROST ART: Crystalline ice with aurora shimmer ── */
.card[data-element="frost"] .card-art {
  background:
    radial-gradient(ellipse at 40% 20%, rgba(180,230,255,0.8) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 70%, rgba(0,180,255,0.6) 0%, transparent 45%),
    radial-gradient(ellipse at 20% 60%, rgba(100,200,255,0.4) 0%, transparent 35%),
    linear-gradient(180deg, #e8f4ff 0%, #87ceeb 20%, #00bfff 50%, #0066aa 80%, #002244 100%);
}
.card[data-element="frost"] .card-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(255,255,255,0.6) 0%, transparent 20%),
    radial-gradient(circle at 60% 60%, rgba(150,220,255,0.5) 0%, transparent 25%),
    radial-gradient(circle at 80% 20%, rgba(200,240,255,0.4) 0%, transparent 20%);
  animation: frostArtShimmer 4s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

/* ── VOLT ART: Electric storm with crackling energy ── */
.card[data-element="volt"] .card-art {
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,255,100,0.7) 0%, transparent 30%),
    radial-gradient(ellipse at 30% 70%, rgba(180,80,255,0.6) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 20%, rgba(100,0,200,0.8) 0%, transparent 35%),
    linear-gradient(160deg, #1a002e 0%, #4400aa 25%, #8800ff 45%, #ffd700 70%, #ffee88 100%);
}
.card[data-element="volt"] .card-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    conic-gradient(from 0deg at 50% 50%, transparent 0deg, rgba(255,215,0,0.3) 60deg, transparent 120deg, rgba(160,80,255,0.3) 200deg, transparent 280deg, rgba(255,255,100,0.2) 340deg, transparent 360deg);
  animation: voltArtCrackle 2s linear infinite;
  pointer-events: none;
  z-index: 0;
}

/* ── SHADOW ART: Void darkness with ethereal wisps ── */
.card[data-element="shadow"] .card-art {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(120,0,180,0.5) 0%, transparent 50%),
    radial-gradient(ellipse at 30% 30%, rgba(80,0,120,0.6) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 70%, rgba(160,0,200,0.4) 0%, transparent 35%),
    linear-gradient(180deg, #000005 0%, #0d001a 20%, #1a0033 40%, #330066 70%, #4a0080 100%);
}
.card[data-element="shadow"] .card-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 40% 50%, rgba(200,100,255,0.15) 0%, transparent 40%),
    radial-gradient(circle at 60% 30%, rgba(150,0,200,0.2) 0%, transparent 30%);
  animation: shadowArtWisp 5s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

/* ── TERRA ART: Ancient forest with dappled light ── */
.card[data-element="terra"] .card-art {
  background:
    radial-gradient(ellipse at 40% 80%, rgba(60,120,20,0.7) 0%, transparent 45%),
    radial-gradient(ellipse at 60% 20%, rgba(180,200,50,0.5) 0%, transparent 35%),
    radial-gradient(ellipse at 30% 40%, rgba(90,60,30,0.6) 0%, transparent 40%),
    linear-gradient(180deg, #0a1a05 0%, #1a3a10 20%, #2d6b1a 45%, #4a8c2a 65%, #8b6914 85%, #5a3a0a 100%);
}
.card[data-element="terra"] .card-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 25% 25%, rgba(200,220,50,0.25) 0%, transparent 20%),
    radial-gradient(circle at 70% 50%, rgba(100,180,40,0.2) 0%, transparent 25%),
    radial-gradient(circle at 45% 75%, rgba(140,100,30,0.25) 0%, transparent 20%);
  animation: terraArtDapple 6s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

/* ── NEUTRAL ART: Metallic workshop with chrome reflections ── */
.card[data-element="neutral"] .card-art {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(200,200,220,0.5) 0%, transparent 40%),
    radial-gradient(ellipse at 30% 70%, rgba(100,110,130,0.4) 0%, transparent 35%),
    linear-gradient(135deg, #2a2a3a 0%, #4a4a5a 25%, #707890 50%, #4a4a5a 75%, #2a2a3a 100%);
}
.card[data-element="neutral"] .card-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.1) 25%, transparent 50%, rgba(255,255,255,0.08) 75%, transparent 100%);
  animation: neutralArtSheen 3s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

/* ── Card art shimmer overlay ── */
.card-art::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 40%,
    rgba(255, 255, 255, 0.18) 50%,
    rgba(255, 255, 255, 0.08) 60%,
    transparent 100%
  );
  animation: shimmer 4s ease-in-out infinite;
  pointer-events: none;
}

.card-art svg {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
}

.card-art img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
}

.art-symbol {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
  user-select: none;
}

.card-art-emoji {
  position: relative;
  z-index: 1;
  font-size: 2.8rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  user-select: none;
}


.card-type-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 6px;
  background: rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  min-height: 20px;
}

.card-type-text {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #c0c0d0;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.card-element-icon {
  font-size: 0.72rem;
}


.card-description {
  padding: 5px 8px;
  font-size: 0.68rem;
  color: #d0d0e0;
  flex-grow: 1;
  overflow: hidden;
  line-height: 1.45;
  letter-spacing: 0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  background: rgba(0, 0, 0, 0.15);
}

.card-desc-text {
  font-weight: 600;
  color: #e0e0f0;
}

.card-flavor-text {
  color: #a0a0b8;
  font-style: italic;
  font-size: 0.6rem;
  margin-top: 2px;
}


.card-stats {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  min-height: 28px;
  border-top: 1px solid rgba(80, 80, 100, 0.3);
}

.card-cost-bolt {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8fd7ff;
  font-size: 1rem;
  text-shadow: 0 0 12px rgba(52, 152, 219, 0.55), 0 1px 3px rgba(0,0,0,0.9);
}

.card-cost {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #6ab0ee, #4a90d9, #1a5fa0);
  border: 2px solid #4a90dd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 1px 2px rgba(0,0,0,0.95),
    0 0 3px rgba(0,0,0,0.7),
    -1px 0 0 rgba(0,0,0,0.6),
     1px 0 0 rgba(0,0,0,0.6),
     0 -1px 0 rgba(0,0,0,0.6),
     0 1px 0 rgba(0,0,0,0.6);
  box-shadow:
    0 0 8px rgba(52, 152, 219, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.4),
    inset 0 1px 1px rgba(255,255,255,0.3),
    inset 0 -1px 1px rgba(0,0,0,0.2);
  flex-shrink: 0;
}


.card.in-hand {
  width: var(--card-hand-w);
  height: var(--card-hand-h);
  transform-origin: center center;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.25s ease;
  margin-left: -36px;
  position: relative;
  top: 0;
  cursor: pointer;
  transform: rotate(var(--fan-rotate, 0deg)) translateY(var(--fan-lift, 0px));
}

.player-hand-frame .card.in-hand {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

.player-hand-frame .card.in-hand:first-child {
  margin-left: 0;
}

.card.in-hand:hover {
  transform: rotate(var(--fan-rotate, 0deg)) translateY(var(--fan-lift, 0px)) !important;
  z-index: 120 !important;
  filter: drop-shadow(0 14px 30px rgba(0,0,0,0.7))
          drop-shadow(0 0 18px rgba(255, 215, 0, 0.2));
}

.card.in-hand.preview-active {
  transform: rotate(var(--fan-rotate, 0deg)) translateY(var(--fan-lift, 0px)) !important;
  z-index: 120 !important;
  filter: drop-shadow(0 14px 30px rgba(0,0,0,0.72))
          drop-shadow(0 0 18px rgba(255, 215, 0, 0.22));
}

.card.in-hand.playable .card-border {
  box-shadow:
    0 0 12px rgba(46, 204, 113, 0.4),
    0 0 4px rgba(46, 204, 113, 0.2);
}

.card.in-hand.playable::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--card-radius) + 2px);
  border: 2px solid rgba(46, 204, 113, 0.5);
  pointer-events: none;
  animation: glowPulseGreen 1.5s ease-in-out infinite;
}

.card.in-hand.not-playable {
  opacity: 0.55;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6)) grayscale(0.3);
}

.card.in-hand .card-name {
  max-width: 110px;
  font-size: 0.86rem;
}

.card.in-hand .card-description {
  font-size: 0.72rem;
  line-height: 1.45;
  -webkit-line-clamp: 4;
}

.card.in-hand .card-power {
  font-size: 1.3rem;
  min-width: 36px;
  padding: 3px 12px;
}

.card.in-hand .card-cost {
  width: 32px;
  height: 32px;
  min-width: 32px;
  font-size: 1.25rem;
}


.card.on-field {
  width: calc(var(--card-w) - 4px);
  height: calc(var(--card-h) - 4px);
  cursor: default;
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.card.on-field:hover {
  transform: scale(1.04);
  z-index: 5;
}

.card.on-field.can-attack {
  cursor: pointer;
  animation: glowPulseGold 1.5s ease-in-out infinite;
}

.card.on-field.can-attack .card-border {
  border-color: var(--accent-gold) !important;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.5) !important;
}

.card.on-field.frozen {
  filter: brightness(0.7) saturate(0.4) hue-rotate(160deg) drop-shadow(0 0 8px rgba(100, 200, 255, 0.6));
}

.card.on-field.frozen::before {
  content: '❄️';
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.8rem;
  z-index: 5;
}

.card.on-field.stealthed {
  opacity: 0.55;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6)) saturate(0.3);
}

.card.on-field.stealthed::before {
  content: '👁️';
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.8rem;
  z-index: 5;
  opacity: 0.7;
}


.card.face-down .card-border {
  background:
    radial-gradient(ellipse at 50% 40%, rgba(180, 80, 20, 0.15) 0%, transparent 50%),
    repeating-linear-gradient(
      45deg,
      #12060a 0px,
      #12060a 4px,
      #1e0c0e 4px,
      #1e0c0e 8px
    );
  border-color: #6a4040;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.card.face-down .card-header,
.card.face-down .card-art,
.card.face-down .card-type-bar,
.card.face-down .card-description,
.card.face-down .card-stats {
  display: none;
}

.card.face-down .card-border::after {
  content: '⚒️';
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 1.8rem;
  filter: drop-shadow(0 0 6px rgba(180, 80, 20, 0.4)) brightness(0.75);
  opacity: 0.6;
}


.damage-number {
  position: absolute;
  font-size: 2.2rem;
  font-weight: 900;
  font-family: 'Cinzel', serif;
  pointer-events: none;
  z-index: 500;
  animation: floatUp 1s ease forwards;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.9), 0 0 15px currentColor, 0 0 30px currentColor;
  white-space: nowrap;
}

.damage-number.damage { color: #ff4444; filter: drop-shadow(0 0 8px rgba(255, 50, 50, 0.6)); }
.damage-number.heal   { color: #44ff88; filter: drop-shadow(0 0 8px rgba(50, 255, 100, 0.6)); }


.status-badge {
  position: absolute;
  bottom: 24px;
  left: 4px;
  display: flex;
  gap: 2px;
  z-index: 3;
}

.status-icon {
  font-size: 0.65rem;
  background: rgba(0,0,0,0.7);
  border-radius: 3px;
  padding: 1px 2px;
}


#card-tooltip {
  position: fixed;
  z-index: 999;
  pointer-events: none;
}

.tooltip-card {
  --card-w: 210px;
  --card-h: 300px;
  width: var(--card-w);
  height: var(--card-h);
  transform: scale(1);
  filter: drop-shadow(0 10px 30px rgba(0,0,0,0.9));
}


@keyframes hpShimmer {
  0%   { left: -60%; }
  100% { left: 130%; }
}


@keyframes shimmer {
  0%   { left: -75%; opacity: 0.6; }
  50%  { opacity: 1; }
  100% { left: 125%; opacity: 0.6; }
}

/* ── Element art animations ── */
@keyframes emberArtPulse {
  0%   { opacity: 0.6; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.05); }
}
@keyframes frostArtShimmer {
  0%   { opacity: 0.5; filter: hue-rotate(0deg); }
  100% { opacity: 0.9; filter: hue-rotate(15deg); }
}
@keyframes voltArtCrackle {
  0%   { transform: rotate(0deg); opacity: 0.7; }
  50%  { opacity: 1; }
  100% { transform: rotate(360deg); opacity: 0.7; }
}
@keyframes shadowArtWisp {
  0%   { opacity: 0.4; transform: translateY(0) scale(1); }
  100% { opacity: 0.8; transform: translateY(-5px) scale(1.1); }
}
@keyframes terraArtDapple {
  0%   { opacity: 0.5; filter: brightness(0.9); }
  100% { opacity: 0.8; filter: brightness(1.1); }
}
@keyframes neutralArtSheen {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes legendaryPulse {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.4));
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8))
            drop-shadow(0 0 35px rgba(255, 165, 0, 0.4));
  }
}

/* Legendary border spin using @property fallback */
@keyframes legendaryBorderSpin {
  from { --legendary-angle: 0deg; filter: blur(0.5px) brightness(1); }
  50%  { filter: blur(0.5px) brightness(1.3); }
  to   { --legendary-angle: 360deg; filter: blur(0.5px) brightness(1); }
}
/* CSS Houdini for smooth conic angle (progressive enhancement) */
@property --legendary-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes legendaryFloat {
  0%, 100% {
    filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.5))
            drop-shadow(0 0 40px rgba(255, 165, 0, 0.2));
  }
  50% {
    filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.8))
            drop-shadow(0 0 60px rgba(255, 165, 0, 0.35))
            drop-shadow(0 0 4px rgba(255, 255, 200, 0.9));
  }
}

@keyframes holoShift {
  0%   { background-position: 0px 0px; opacity: 0.6; }
  50%  { opacity: 0.9; }
  100% { background-position: 24px 24px; opacity: 0.6; }
}

@keyframes epicPulse {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(155, 89, 182, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 16px rgba(155, 89, 182, 0.6))
            drop-shadow(0 0 30px rgba(120, 50, 180, 0.25));
  }
}


@keyframes glowPulse {
  0%, 100% {
    box-shadow:
      0 0 8px rgba(231, 76, 60, 0.4),
      inset 0 0 6px rgba(231, 76, 60, 0.1);
  }
  50% {
    box-shadow:
      0 0 22px rgba(231, 76, 60, 0.7),
      inset 0 0 12px rgba(231, 76, 60, 0.2);
  }
}


@keyframes glowPulseGreen {
  0%, 100% {
    box-shadow:
      0 0 8px rgba(46, 204, 113, 0.4),
      inset 0 0 6px rgba(46, 204, 113, 0.1);
  }
  50% {
    box-shadow:
      0 0 22px rgba(46, 204, 113, 0.7),
      inset 0 0 12px rgba(46, 204, 113, 0.2);
  }
}


@keyframes glowPulseGold {
  0%, 100% {
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 22px rgba(255, 215, 0, 0.65), 0 0 40px rgba(255, 165, 0, 0.2);
  }
}


@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  60% {
    opacity: 0.9;
    transform: translateY(-30px) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translateY(-65px) scale(0.8);
  }
}


@keyframes shakeDamage {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-8px) rotate(-1deg); }
  30%  { transform: translateX(8px)  rotate(1deg); }
  45%  { transform: translateX(-5px) rotate(-0.5deg); }
  60%  { transform: translateX(5px)  rotate(0.5deg); }
  75%  { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}


@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(16px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}


@keyframes victoryBurst {
  0% {
    opacity: 1;
    transform: scale(0.5);
  }
  60% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: scale(2.5);
  }
}


@keyframes defeatDarken {
  0%   { background: rgba(0,0,0,0); }
  100% { background: rgba(40, 0, 0, 0.5); }
}


@keyframes toastIn {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}


@keyframes toastOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}


@keyframes packGlow {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}


@keyframes packGlowSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}


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


@keyframes cardDraw {
  0% {
    opacity: 0;
    transform: translateY(-40px) rotate(-5deg) scale(0.8);
  }
  70% {
    transform: translateY(4px) rotate(0.5deg) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
}


@keyframes cardPlay {
  0% {
    transform: scale(0.3) rotate(-5deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.1) rotate(1deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}
.shake-damage {
  animation: shakeDamage 0.45s ease forwards;
}

.card-drawn {
  animation: cardDraw 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.card-played {
  animation: cardPlay 0.3s ease forwards;
}


.selected {
  outline: 2px solid var(--accent-gold);
  outline-offset: 3px;
}


.exhausted {
  filter: grayscale(0.7) brightness(0.6);
  opacity: 0.6;
}


.card-grid,
#deck-list,
#game-log,
#pack-reveal-area,
#screen-collection,
#screen-packs {
  scrollbar-width: thin;
  scrollbar-color: #2a2a45 #0e0e1e;
}




.card[data-rarity="uncommon"]:hover {
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.7))
          drop-shadow(0 0 14px rgba(46, 204, 113, 0.4));
}

.card[data-rarity="rare"]:hover {
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.7))
          drop-shadow(0 0 18px rgba(52, 152, 219, 0.5))
          drop-shadow(0 0 6px rgba(100, 200, 255, 0.4));
}

.card[data-rarity="epic"]:hover {
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.7))
          drop-shadow(0 0 22px rgba(155, 89, 182, 0.6))
          drop-shadow(0 0 8px rgba(200, 130, 255, 0.5));
}

.card[data-rarity="legendary"]:hover {
  filter: drop-shadow(0 8px 25px rgba(0,0,0,0.8))
          drop-shadow(0 0 30px rgba(255, 215, 0, 0.8))
          drop-shadow(0 0 60px rgba(255, 165, 0, 0.4))
          drop-shadow(0 0 8px rgba(255, 255, 200, 0.9));
}


.mana-crystal {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--mana-blue);
  margin: 0 1px;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
  vertical-align: middle;
  transition: background var(--transition-fast);
}

.mana-crystal.empty {
  background: rgba(52, 152, 219, 0.2);
  box-shadow: none;
}



.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(80, 80, 120, 0.4);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}


.card.card-small {
  width: calc(var(--card-w) * 0.85);
  height: calc(var(--card-h) * 0.85);
}

.card.card-small .card-name { font-size: 0.55rem; max-width: 62px; }
.card.card-small .card-art { height: 55px; }
.card.card-small .card-description { font-size: 0.48rem; }
#card-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(20, 10, 40, 0.85) 0%, rgba(0, 0, 0, 0.85) 100%);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#card-detail-modal.visible {
  opacity: 1;
  pointer-events: auto;
}

.card-detail-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 420px;
  animation: cardDetailIn 0.25s ease forwards;
}

@keyframes cardDetailIn {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.card-detail-inner .card {
  width: 300px;
  height: 430px;
  pointer-events: none;
}

.card-detail-inner .card .card-art {
  height: 150px;
}

.card-detail-inner .card .card-art-emoji {
  font-size: 4.2rem;
}

.card-detail-inner .card .card-name {
  font-size: 1.1rem;
  max-width: 210px;
}

.card-detail-inner .card .card-description {
  font-size: 0.88rem;
  -webkit-line-clamp: 5;
}

.card-detail-inner .card .card-power {
  font-size: 1.25rem;
  min-width: 40px;
}

.card-detail-inner .card .card-cost {
  width: 36px;
  height: 36px;
  min-width: 36px;
  font-size: 1.08rem;
}

.card-detail-flavor {
  font-size: 0.88rem;
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  max-width: 340px;
  line-height: 1.4;
}

.card-detail-close-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}


.card-tooltip {
  position: fixed;
  z-index: 998;
  pointer-events: none;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  background: linear-gradient(180deg, rgba(18, 20, 34, 0.98), rgba(10, 12, 22, 0.98));
  border: 1px solid rgba(255, 190, 120, 0.24);
  border-radius: 22px;
  padding: 18px;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.6;
  width: min(680px, calc(100vw - 32px));
  box-shadow: 0 26px 46px rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
}

.card-tooltip .tooltip-card-shell {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.card-tooltip .tooltip-card-shell .card {
  width: 260px;
  height: 374px;
  pointer-events: none;
  transform: none !important;
  margin-left: 0 !important;
}

.card-tooltip .tooltip-card-shell .card .card-art {
  height: 142px;
}

.card-tooltip .tooltip-card-shell .card .card-name {
  font-size: 1.02rem;
  max-width: 180px;
}

.card-tooltip .tooltip-card-shell .card .card-description {
  font-size: 0.84rem;
}

.card-tooltip .tooltip-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.card-tooltip .tooltip-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-tooltip .tooltip-art-panel {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  min-height: 210px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(6,8,14,0.4));
}

.card-tooltip .tooltip-art-panel.element-ember { background: linear-gradient(180deg, rgba(255,114,59,0.34), rgba(18,20,34,0.42)); }
.card-tooltip .tooltip-art-panel.element-frost { background: linear-gradient(180deg, rgba(86,188,255,0.3), rgba(18,20,34,0.42)); }
.card-tooltip .tooltip-art-panel.element-volt { background: linear-gradient(180deg, rgba(192,96,255,0.32), rgba(18,20,34,0.42)); }
.card-tooltip .tooltip-art-panel.element-shadow { background: linear-gradient(180deg, rgba(122,74,198,0.34), rgba(14,10,24,0.5)); }
.card-tooltip .tooltip-art-panel.element-terra { background: linear-gradient(180deg, rgba(86,178,72,0.3), rgba(18,20,34,0.42)); }
.card-tooltip .tooltip-art-panel.element-neutral { background: linear-gradient(180deg, rgba(144,150,174,0.24), rgba(18,20,34,0.42)); }

.card-tooltip .tooltip-art {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 210px;
  padding: 16px;
}

.card-tooltip .tooltip-art svg,
.card-tooltip .tooltip-art img {
  width: 100%;
  height: 178px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.42));
}

.card-tooltip .tooltip-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(7, 10, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f4f6ff;
}

.card-tooltip .tooltip-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.card-tooltip .tooltip-name {
  font-family: 'Cinzel', serif;
  font-size: 1.36rem;
  font-weight: 700;
  color: #fff4d1;
  margin-bottom: 4px;
}

.card-tooltip .tooltip-element {
  font-size: 1rem;
  color: #d8dbef;
  line-height: 1.6;
}

.card-tooltip .tooltip-badge-row {
  flex-shrink: 0;
}

.card-tooltip .tooltip-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.card-tooltip .tooltip-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.card-tooltip .tooltip-stat strong {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.card-tooltip .tooltip-stat span {
  font-size: 1.12rem;
  font-weight: 700;
  color: #ffffff;
}

.card-tooltip .tooltip-rules {
  font-size: 0.92rem;
  color: #eef0ff;
}

.card-tooltip .tooltip-rules.muted {
  color: var(--text-dim);
}

.card-tooltip .tooltip-badge {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
}

.card-tooltip .tooltip-badge-reveal {
  background: rgba(255, 180, 40, 0.18);
  color: #ffd067;
  border: 1px solid rgba(255, 180, 40, 0.3);
}

.card-tooltip .tooltip-badge-ongoing {
  background: rgba(80, 200, 120, 0.14);
  color: #7df7a0;
  border: 1px solid rgba(80, 200, 120, 0.28);
}

.card-tooltip .tooltip-flavor {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #9ea4bb;
  font-style: italic;
  font-size: 0.92rem;
}

/* ── Readable Hand-Card Effects ─────────────────────────────── */

/* Tighter type-bar so effect tag fits on the right */
.card-type-bar {
  justify-content: flex-start;
  gap: 5px;
  padding: 3px 8px;
}

.card-effect-tag {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.3;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-effect-tag-reveal {
  background: rgba(255, 180, 40, 0.22);
  color: #ffd070;
  border: 1px solid rgba(255, 180, 40, 0.5);
  text-shadow: 0 0 4px rgba(255, 180, 40, 0.5);
}

.card-effect-tag-ongoing {
  background: rgba(80, 200, 120, 0.2);
  color: #7fffac;
  border: 1px solid rgba(80, 200, 120, 0.5);
  text-shadow: 0 0 4px rgba(80, 200, 120, 0.5);
}

/* Description a touch more readable on hand cards */
.card.in-hand .card-description {
  -webkit-line-clamp: 5;
  font-size: 0.74rem;
  color: #e8e8f0;
}

.card.in-hand .card-desc-text {
  color: #f0f0ff;
}

/* ──────────────────────────────────────────────────────────────
   Mute rarity motion during active gameplay (hand + board).
   Rarity borders/colors stay; spinning/floating/shimmer is
   reserved for pack-open and collection contexts.
   ────────────────────────────────────────────────────────────── */
.card.in-hand[data-rarity="epic"],
.card.in-hand[data-rarity="legendary"],
.card.on-field[data-rarity="epic"],
.card.on-field[data-rarity="legendary"] {
  animation: none;
}

.card.in-hand[data-rarity="rare"] .card-art::after,
.card.in-hand[data-rarity="epic"] .card-art::after,
.card.in-hand[data-rarity="legendary"] .card-art::after,
.card.on-field[data-rarity="rare"] .card-art::after,
.card.on-field[data-rarity="epic"] .card-art::after,
.card.on-field[data-rarity="legendary"] .card-art::after {
  animation: none;
  background: none;
}

.card.in-hand[data-rarity="legendary"]::before,
.card.on-field[data-rarity="legendary"]::before {
  animation: none;
  filter: none;
  background: linear-gradient(135deg, #ffd700 0%, #ff9730 50%, #ffd700 100%);
}

.card.in-hand[data-rarity="legendary"] .card-art::before,
.card.on-field[data-rarity="legendary"] .card-art::before {
  animation: none;
}
