body {
    font-family: 'Poppins', sans-serif;
    background: #333;
    display: flex;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
    margin: 0;
    color: #ddd;
}

.container {
    text-align: center;
    background: #444;
    padding: 20px;
    border-radius: 10px;
    max-width: 800px;
    width: 100%;
    border: 1px solid #666;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

h1 {
    color: #ddd;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 24px;
    margin-bottom: 20px;
}

.upload-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

#nft-id {
    padding: 8px;
    flex: 1;
    max-width: 150px;
    border: 1px solid #666;
    border-radius: 5px;
    background: #555;
    color: #ddd;
    font-size: 14px;
    font-weight: 400;
    transition: border-color 0.3s ease;
}

#nft-id:focus {
    border-color: #87ceeb;
    outline: none;
}

.action-btn {
    padding: 8px 20px;
    border: 1px solid #666;
    border-radius: 5px;
    font-weight: 600;
    color: #ddd;
    background: #666;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
}

.action-btn:hover {
    background: #87ceeb;
    color: #333;
}

.action-btn:disabled {
    background: #888;
    cursor: not-allowed;
    opacity: 0.7;
}

.card-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.pokemon-card {
    width: 300px;
    height: 480px;
    border: 8px solid #555;
    border-radius: 10px;
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    background: #f5f5f5;
    perspective: 1000px;
    transform-style: preserve-3d;
    transition: transform 0.1s ease, box-shadow 0.3s ease;
    position: relative;
}

.pokemon-card.alt-art {
    width: 300px;
    height: 480px; /* Fixed height to enforce vertical orientation */
    position: relative; /* For layering */
    overflow: hidden; /* Ensure content stays within bounds */
}

.pokemon-card.alt-art .image-container {
    width: 100%;
    height: 100%; /* Use the full card height */
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0; /* Behind other elements */
}

.pokemon-card.alt-art .image-container img {
    width: 100%; /* Scale to card width */
    height: auto; /* Maintain aspect ratio */
    object-fit: contain; /* Ensure the entire image fits without cropping */
    object-position: center; /* Center the image */
    position: absolute;
    top: 0;
    left: 0;
}

.pokemon-card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6);
}

.pokemon-card[data-rarity="★"] { border-color: #999; }
.pokemon-card[data-rarity="★★"] { border-color: #87ceeb; }
.pokemon-card[data-rarity="★★★"] { border-color: #f0e68c; }
.pokemon-card[data-rarity="★★★★"] { border-color: #ffa07a; }
.pokemon-card[data-rarity="★★★★★"] { border-color: #ffd700; }

.pokemon-card[data-type="🔥"] { background: linear-gradient(135deg, #ffcccc, #ffb3b3); }
.pokemon-card[data-type="💧"] { background: linear-gradient(135deg, #cce5ff, #b3d9ff); }
.pokemon-card[data-type="⚡"] { background: linear-gradient(135deg, #ffffcc, #fff7b3); }
.pokemon-card[data-type="🪨"] { background: linear-gradient(135deg, #d3d3d3, #c0c0c0); }
.pokemon-card[data-type="🫘"] { background: linear-gradient(135deg, #f5f5f5, #e8e8e8); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #999;
    z-index: 1; /* Ensure it stays above the background */
}

.name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.hp-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.hp {
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.type {
    font-size: 18px;
    color: #666;
}

.image-container {
    width: 100%;
    height: 280px;
    border-bottom: 1px solid #999;
    position: relative;
}

#cardImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.holo-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        45deg,
        rgba(255, 0, 0, 0.4),
        rgba(255, 165, 0, 0.4),
        rgba(255, 255, 0, 0.4),
        rgba(0, 128, 0, 0.4),
        rgba(0, 0, 255, 0.4),
        rgba(75, 0, 130, 0.4),
        rgba(238, 130, 238, 0.4)
    ) 0% 0% / 200% 200%;
    mix-blend-mode: overlay;
    opacity: 0.6;
    pointer-events: none;
    z-index: 2;
}

.traits-subtext {
    font-size: 10px;
    font-style: italic;
    color: #666;
    padding: 5px 8px;
    text-align: center;
    border-bottom: 1px solid #999;
    z-index: 1; /* Ensure it stays above the background */
}

.card-info {
    padding: 8px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    z-index: 1; /* Ensure it stays above the background */
}

.attacks {
    margin-bottom: 5px;
}

.attack {
    display: flex;
    align-items: center;
    padding: 5px 0;
}

.cost {
    margin-right: 8px;
    font-size: 16px;
    color: #666;
}

.attack-name {
    font-weight: 600;
    color: #333;
    font-size: 12px;
    flex-grow: 1;
}

.damage {
    margin-left: 8px;
    font-weight: 600;
    color: #333;
    font-size: 12px;
}

.card-footer {
    border-top: 1px solid #999;
    padding: 8px;
    z-index: 1; /* Ensure it stays above the background */
}

.stats {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    padding-bottom: 5px;
}

.stats .label {
    font-weight: 600;
    color: #666;
}

.stats .value {
    color: #333;
}

.footer-bottom {
    display: flex;
    justify-content: flex-end;
}

.rarity-symbol {
    font-size: 16px;
    color: #666;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    color: #87ceeb;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

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

.loading-overlay.active::after {
    content: "…";
    animation: pulse 1.5s infinite;
    margin-left: 5px;
}

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
    .upload-section {
        flex-direction: column;
        align-items: center;
    }
    #nft-id {
        max-width: 100%;
    }
    .action-btn {
        width: 100%;
        margin-top: 10px;
    }
    .pokemon-card {
        width: 100%;
        max-width: 300px;
        height: auto;
    }
    .image-container {
        height: 200px;
    }
}

/* Full-art card specific styles */
#altCard .card-info {
    justify-content: flex-end; /* Push attacks to bottom */
}

#altCard .card-header,
#altCard .traits-subtext,
#altCard .card-info,
#altCard .card-footer {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.1); /* Slight background for readability */
    padding: 8px;
    border-bottom: 1px solid #999;
}

#altCard .card-footer {
    border-top: 1px solid #999;
    margin-top: auto;
}

#altCard .name,
#altCard .hp,
#altCard .type,
#altCard .attack-name,
#altCard .damage,
#altCard .stats .label,
#altCard .stats .value,
#altCard .rarity-symbol {
    color: #fff; /* Ensure white text */
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.9), 0 0 20px rgba(0, 0, 0, 0.7); /* Enhanced shadow for contrast */
}

/* Add image container for full-art */
#altCard .image-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

#altCard .image-container img {
    width: 100%; /* Scale to card width */
    height: auto; /* Maintain aspect ratio */
    object-fit: contain; /* Ensure the entire image fits without cropping */
    object-position: center; /* Center the image */
    position: absolute;
    top: 0;
    left: 0;
}