
.card-spell-card {
  position: relative;
  width: 320px;
  /* height: 120px; */
  margin: 5px; /* Reduced margin */
  border: 2px solid #FFD700; /* Slightly thinner gold border */
  border-radius: 8px; /* Smaller radius for compact look */
  background: linear-gradient(135deg, #2b1a3f 0%, #4b2e6b 100%); /* Mystical purple gradient */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), inset 0 0 5px rgba(255, 215, 0, 0.3); /* Subtler shadow */
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex; /* Flex for sidebar layout */
}

.card-spell-card:hover {
  transform: scale(1.02); /* Smaller zoom due to tight chat space */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7), inset 0 0 8px rgba(255, 215, 0, 0.5);
}

.card-spell-art {
  position: relative;
  width: 80px; /* Sidebar art */
  height: 100%;
  background: url('https://via.placeholder.com/80x120/3a2c5f/ffffff?text=Spell+Art') center/cover no-repeat; /* Updated placeholder */
  opacity: 0.8;
  z-index: 1;
}

.card-spell-card a {
  text-decoration: none;
  color: inherit;
}

.card-spell-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(0, 0, 0, 0.3) 100%);
  z-index: 2;
  pointer-events: none;
}

.card-spell-cost {
  position: absolute;
  top: 5px;
  right: 5px;
  /* width: 24px; */
  height: 24px;
  /* background: #FFD700; */
  color: #2b1a3f; /* Dark purple text */
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  line-height: 24px;
  border-radius: 50%;
  /* border: 1px solid #DAA520; */
  z-index: 3;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

.card-spell-cost img {
  padding: 2px;
}

.card-spell-content {
  position: relative;
  z-index: 3;
  padding: 8px; /* Reduced padding */
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: start;
  gap: 8px; /* Reduced gap */
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.8);
}

.card-spell-target {
  display: block;
  color: #FFD700 !important;
  font-size: 14px; /* Smaller font */
  font-weight: bold;
  text-align: left;
  text-decoration: none;
  margin: 0;
  transition: color 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-spell-target:hover {
  color: #FFEFBF !important;
  text-decoration: none !important;
}

.card-spell-name {
  display: block;
  color: #E0E0E0 !important;
  font-size: 18px; /* Smaller font */
  font-style: italic;
  text-align: left;
  text-decoration: none;
  margin: 2px 0;
  transition: color 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-spell-name:hover {
  color: #FFFFFF !important;
  text-decoration: none !important;
}

.card-spell-flavor {
  font-size: 10px; /* Tiny font for flavor text */
  color: #D3D3D3;
  text-align: left;
  margin: 2px 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Limit to 2 lines */
  -webkit-box-orient: vertical;
}

.card-spell-duration {
  font-size: 14px; /* Smaller font */
  color: #B0E0E6;
  text-align: left;
  margin: 0;
  padding: 4px; /* Reduced padding */
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  border: 1px solid #4682B4;
  animation: pulse 2s infinite ease-in-out;
  white-space: nowrap;
}

.countdown-date {
  font-weight: bold;
  color: #00CED1;
}

/* Glowing pulse animation for countdown */
@keyframes pulse {
  0% {
    box-shadow: 0 0 3px rgba(0, 206, 209, 0.5);
  }
  50% {
    box-shadow: 0 0 8px rgba(0, 206, 209, 0.8);
  }
  100% {
    box-shadow: 0 0 3px rgba(0, 206, 209, 0.5);
  }
}

/* Decorative border */
.card-spell-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 1px solid #DAA520;
  border-radius: 8px;
  z-index: 0;
  pointer-events: none;
}

@media (max-width: 767px) and (pointer: coarse) and (hover: none) {
    /* Set base font size for consistency (optional, only if not already set) */
    html {
        font-size: 16px; /* Adjust to 14px for smaller scaling if needed */
    }

    .card-spell-card {
        width: 100%; /* Full-width, removes conflicting 768px */
        margin: 0.5rem 0; /* ~8px, unchanged but in rem */
        flex-direction: column; /* Unchanged, stacks art and content */
    }

    .card-spell-art {
        width: 100%; /* Unchanged, full-width */
        height: 6rem; /* ~96px, reduced from 120px */
        background: url('https://via.placeholder.com/400x120/3a2c5f/ffffff?text=Spell+Art') center/cover no-repeat; /* Unchanged */
        opacity: 0.9; /* Unchanged */
    }

    .card-spell-content {
        width: 100%; /* Unchanged, full-width */
        padding: 0.75rem; /* ~12px, unchanged but in rem */
        gap: 0.625rem; /* ~10px, unchanged but in rem */
    }

    .card-spell-target {
        font-size: 1rem; /* ~20px, reduced from 40px */
    }

    .card-spell-name {
        font-size: 1.125rem; /* ~18px, reduced from 32px */
    }

    .card-spell-flavor {
        font-size: 0.875rem; /* ~14px, unchanged */
        -webkit-line-clamp: 3; /* Unchanged */
    }

    .card-spell-duration {
        font-size: 1rem; /* ~16px, unchanged */
        padding: 0.5rem; /* ~8px, slightly increased from 6px for touch */
    }

    .card-spell-cost {
        width: 1.5rem; /* ~24px, reduced from 30px */
        height: 1.5rem;
        font-size: 0.875rem; /* ~14px, reduced from 18px */
        line-height: 1.5rem; /* Matches height */
        top: 0.5rem; /* ~8px, unchanged but in rem */
        right: 0.5rem; /* ~8px, unchanged but in rem */
    }

    .card-spell-card:active { /* Changed from :hover to :active for touch */
        transform: none; /* Unchanged */
        box-shadow: 0 0.125rem 0.625rem rgba(0, 0, 0, 0.5), inset 0 0 0.3125rem rgba(255, 215, 0, 0.3); /* ~2px 10px, 5px */
    }
}