/* Core overlay container for upgrade flow */
.upgrade-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0, 20, 32, 0.92), rgba(0, 0, 0, 0.98));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(12px);
    animation: fadeIn 0.4s ease;
}

/* Celebration state (wave complete) */
.upgrade-overlay.celebration-overlay {
    animation: fadeIn 0.5s ease;
    background: radial-gradient(circle at center, rgba(0, 30, 48, 0.94), rgba(0, 0, 0, 0.99));
}

/* Interstitial "wave incoming" state */
.upgrade-overlay.interstitial-overlay {
    animation: fadeIn 0.3s ease;
}

.celebration-message {
    font-size: 72px;
    font-weight: 900;
    color: #00ffcc;
    text-transform: uppercase;
    letter-spacing: 8px;
    text-shadow:
        0 0 16px #00ffcc,
        0 0 40px rgba(0, 255, 204, 0.8),
        0 0 80px rgba(0, 255, 204, 0.5);
    animation: celebrationPulse 1.5s ease-in-out;
    pointer-events: none;
}

.interstitial-message {
    font-size: 64px;
    font-weight: 800;
    color: #e6f7ff;
    text-transform: uppercase;
    letter-spacing: 6px;
    text-shadow:
        0 0 12px rgba(136, 204, 255, 0.7),
        0 0 32px rgba(136, 204, 255, 0.4);
    animation: interstitialPulse 1.2s ease-in-out;
    pointer-events: none;
}

/* Upgrade phase titles */
.upgrade-title {
    color: #e6f7ff;
    font-size: 32px;
    margin-bottom: 40px;
    text-transform: uppercase;
    letter-spacing: 4px;
    font-weight: 700;
    text-shadow:
        0 0 12px rgba(0, 255, 204, 0.6),
        0 0 24px rgba(0, 255, 204, 0.3);
}

/* Card layout container */
.cards-container {
    display: flex;
    gap: 24px;
    padding: 20px;
    max-width: 100%;
    overflow-x: auto;
    animation: slideUp 0.4s ease;
    justify-content: center;
    flex-wrap: wrap;
}

/* Individual upgrade card */
.upgrade-card {
    background: radial-gradient(circle at top-left, rgba(12, 16, 28, 0.92), rgba(5, 6, 15, 0.96));
    border: 1px solid rgba(136, 204, 255, 0.3);
    border-radius: 12px;
    width: 240px;
    height: 320px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 12px rgba(0, 255, 204, 0.06);
}

.upgrade-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top-right, rgba(0, 255, 204, 0.08), transparent 60%);
    pointer-events: none;
}

.upgrade-card:hover {
    transform: translateY(-12px);
    border-color: rgba(0, 255, 204, 0.7);
    box-shadow:
        inset 0 0 16px rgba(0, 255, 204, 0.1),
        0 12px 32px rgba(0, 255, 204, 0.25),
        0 0 40px rgba(136, 204, 255, 0.15);
}

/* Card text elements */
.card-name {
    font-size: 18px;
    font-weight: 700;
    color: #00ffcc;
    margin-bottom: 12px;
    text-shadow: 0 0 8px rgba(0, 255, 204, 0.4);
    position: relative;
    z-index: 1;
}

.card-desc {
    font-size: 14px;
    color: #cce6f0;
    line-height: 1.5;
    flex-grow: 1;
    position: relative;
    z-index: 1;
}

.card-flavor {
    font-size: 12px;
    font-style: italic;
    color: #7a94ac;
    margin-top: 16px;
    border-top: 1px solid rgba(136, 204, 255, 0.2);
    padding-top: 12px;
    position: relative;
    z-index: 1;
}

/* Rarity indicator dot */
.card-rarity {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    z-index: 2;
}

.rarity-common {
    background: #9fb3c7;
    box-shadow: 0 0 8px #9fb3c7;
}

.rarity-uncommon {
    background: #00ffcc;
    box-shadow: 0 0 10px #00ffcc;
}

.rarity-rare {
    background: #ffaa00;
    box-shadow: 0 0 12px #ffaa00;
}

/* Shared animations for overlay transitions */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes celebrationPulse {
    0% { opacity: 0; transform: scale(0.4); }
    50% { opacity: 1; transform: scale(1.12); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes interstitialPulse {
    0% { opacity: 0; transform: scale(0.75); }
    50% { opacity: 1; transform: scale(1.08); }
    100% { opacity: 1; transform: scale(1); }
}