/* ═══════════════════════════════════════════════
   SEASON WRAPPED — Cinematic Editorial Dark Theme
   ═══════════════════════════════════════════════ */

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

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

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(129, 140, 248, 0.15); }
    50% { box-shadow: 0 0 35px rgba(129, 140, 248, 0.3); }
}

/* ── Language switcher ── */
.wrapped-lang-switcher {
    position: fixed;
    top: 0.75rem;
    left: 1rem;
    z-index: 1000;
}

/* ── Close button ── */
.wrapped-close-btn {
    position: fixed;
    top: 0.55rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.3rem;
    line-height: 1;
    text-decoration: none;
    padding-bottom: 0.4rem;
    transition: all 0.2s ease;
}

.wrapped-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.wrapped-lang-switcher a {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
}

.wrapped-lang-switcher a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.3);
}

/* ── Base ── */
.wrapped-body {
    margin: 0;
    padding: 0;
    background: #07071a;
    color: #f1f5f9;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    height: 100dvh;
    color-scheme: dark;
}

/* Ambient light blobs */
.wrapped-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 15% 45%, rgba(99, 102, 241, 0.09) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 15%, rgba(56, 189, 248, 0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 85%, rgba(251, 146, 60, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Grain overlay */
.wrapped-body::after {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* ── Progress bar (top) ── */
.wrapped-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #818cf8, #38bdf8, #fb923c);
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 14px rgba(129, 140, 248, 0.5);
}

/* ── Slide container ── */
.wrapped-container {
    position: relative;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    z-index: 1;
}

.wrapped-slide {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2.5rem 1.5rem 80px;
    opacity: 0;
    transform: translateY(18px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    text-align: center;
}

.wrapped-slide.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Staggered child reveals */
.wrapped-slide.active .wrapped-slide-content > * {
    animation: fadeInUp 0.55s ease both;
}
.wrapped-slide.active .wrapped-slide-content > *:nth-child(1) { animation-delay: 0.06s; }
.wrapped-slide.active .wrapped-slide-content > *:nth-child(2) { animation-delay: 0.16s; }
.wrapped-slide.active .wrapped-slide-content > *:nth-child(3) { animation-delay: 0.26s; }
.wrapped-slide.active .wrapped-slide-content > *:nth-child(4) { animation-delay: 0.36s; }
.wrapped-slide.active .wrapped-slide-content > *:nth-child(5) { animation-delay: 0.44s; }

/* ── Slide content ── */
.wrapped-slide-content {
    max-width: 720px;
    width: 100%;
}

/* ── Typography ── */
.wrapped-slide h2 {
    font-family: 'Unbounded', 'Plus Jakarta Sans', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #fff;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.wrapped-slide p,
.wrapped-slide .slide-text {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #94a3b8;
    margin-bottom: 1.5rem;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Stat cards ── */
.wrapped-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.wrapped-stat-card {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    padding: 1.6rem 1.2rem;
    text-align: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

/* Colored top edge on cards */
.wrapped-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #818cf8, #38bdf8);
    opacity: 0.6;
}

.wrapped-stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(129, 140, 248, 0.25);
}

.wrapped-stat-value {
    font-family: 'Unbounded', sans-serif;
    font-size: 2.6rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #fff;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 40px rgba(129, 140, 248, 0.35);
}

.wrapped-stat-delta {
    font-family: 'Unbounded', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin: -0.3rem 0 0.5rem;
}

.wrapped-stat-delta.up { color: #4ade80; }
.wrapped-stat-delta.down { color: #f87171; }
.wrapped-stat-delta.flat { color: #64748b; } /* same muted tone as .wrapped-stat-label */

.wrapped-stat-label {
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 500;
    letter-spacing: 0.03em;
    line-height: 1.4;
}

/* ── Transition text (big cinematic) ── */
.wrapped-transition-big {
    font-family: 'Unbounded', sans-serif;
    font-size: 3rem !important;
    font-weight: 900 !important;
    background: linear-gradient(135deg, #818cf8, #38bdf8, #fb923c);
    background-size: 200% 200%;
    animation: gradientShift 4s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(129, 140, 248, 0.25));
}

/* ── Tier header ── */
.wrapped-tier-header {
    font-family: 'Unbounded', sans-serif;
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

/* ── Player cards ── */
.wrapped-player-card {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 0.4rem 0.75rem;
    margin: 0.2rem;
    font-size: 0.92rem;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.wrapped-player-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(129, 140, 248, 0.3);
    transform: translateY(-1px);
}

.wrapped-player-card a {
    color: #e2e8f0;
    text-decoration: none;
    font-weight: 500;
}

.wrapped-player-card a:hover {
    color: #a5b4fc;
}

.wrapped-player-card .extra-info {
    font-size: 0.78rem;
    color: #64748b;
    margin-left: 0.25rem;
}

/* ── Players grid ── */
.wrapped-players-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 1.2rem;
}

/* ── Tier gradient backgrounds ── */
.wrapped-slide.tier-low {
    background: radial-gradient(ellipse at 50% 30%, rgba(220, 38, 38, 0.13) 0%, transparent 60%);
}
.wrapped-slide.tier-low .wrapped-tier-header {
    color: #f87171;
    text-shadow: 0 0 40px rgba(248, 113, 113, 0.3);
}

.wrapped-slide.tier-50 {
    background: radial-gradient(ellipse at 50% 30%, rgba(245, 158, 11, 0.12) 0%, transparent 60%);
}
.wrapped-slide.tier-50 .wrapped-tier-header {
    color: #fbbf24;
    text-shadow: 0 0 40px rgba(251, 191, 36, 0.3);
}

.wrapped-slide.tier-60 {
    background: radial-gradient(ellipse at 50% 30%, rgba(132, 204, 22, 0.1) 0%, transparent 60%);
}
.wrapped-slide.tier-60 .wrapped-tier-header {
    color: #a3e635;
    text-shadow: 0 0 40px rgba(163, 230, 53, 0.25);
}

.wrapped-slide.tier-70 {
    background: radial-gradient(ellipse at 50% 30%, rgba(34, 211, 153, 0.1) 0%, transparent 60%);
}
.wrapped-slide.tier-70 .wrapped-tier-header {
    color: #34d399;
    text-shadow: 0 0 40px rgba(52, 211, 153, 0.3);
}

.wrapped-slide.tier-80 {
    background: radial-gradient(ellipse at 50% 30%, rgba(56, 189, 248, 0.12) 0%, transparent 60%);
}
.wrapped-slide.tier-80 .wrapped-tier-header {
    color: #38bdf8;
    text-shadow: 0 0 40px rgba(56, 189, 248, 0.3);
}

.wrapped-slide.tier-90 {
    background: radial-gradient(ellipse at 50% 30%, rgba(251, 191, 36, 0.16) 0%, transparent 55%);
}
.wrapped-slide.tier-90 .wrapped-tier-header {
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #fcd34d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 24px rgba(251, 191, 36, 0.4));
}

/* ── Top-3 list with medals ── */
.wrapped-top-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem auto;
    text-align: left;
    display: inline-block;
    width: 100%;
    max-width: 500px;
}

.wrapped-top-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.7rem 1rem;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    font-size: 1rem;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.wrapped-top-list li:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

/* Gold */
.wrapped-top-list li:nth-child(1) {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.06);
}
.wrapped-top-list li:nth-child(1) .rank-number { color: #fbbf24; }

/* Silver */
.wrapped-top-list li:nth-child(2) {
    border-color: rgba(203, 213, 225, 0.2);
    background: rgba(203, 213, 225, 0.035);
}
.wrapped-top-list li:nth-child(2) .rank-number { color: #cbd5e1; }

/* Bronze */
.wrapped-top-list li:nth-child(3) {
    border-color: rgba(217, 119, 6, 0.25);
    background: rgba(217, 119, 6, 0.05);
}
.wrapped-top-list li:nth-child(3) .rank-number { color: #d97706; }

.wrapped-top-list .rank-number {
    font-family: 'Unbounded', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    min-width: 2rem;
    text-align: center;
}

/* ── Teams table ── */
.wrapped-teams-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.wrapped-teams-table th {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.wrapped-teams-table td {
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.92rem;
}

.wrapped-teams-table .team-rank {
    font-family: 'Unbounded', sans-serif;
    font-weight: 700;
    color: #818cf8;
}

.wrapped-teams-table .team-aura {
    font-size: 1.2rem;
}

/* ── Navigation bar ── */
.wrapped-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(7, 7, 26, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    z-index: 100;
    padding: 0 1.5rem;
}

.wrapped-nav button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
}

.wrapped-nav button:hover:not(:disabled) {
    background: rgba(129, 140, 248, 0.15);
    border-color: rgba(129, 140, 248, 0.35);
    transform: scale(1.08);
}

.wrapped-nav button:active:not(:disabled) {
    transform: scale(0.92);
}

.wrapped-nav button:disabled {
    opacity: 0.15;
    cursor: default;
}

.wrapped-progress {
    color: #475569;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 4rem;
    text-align: center;
    letter-spacing: 0.05em;
}

/* ── Support & back buttons ── */
.wrapped-support-btn {
    display: inline-block;
    padding: 0.9rem 2.5rem;
    background: linear-gradient(135deg, #818cf8, #6366f1);
    color: #fff !important;
    border-radius: 14px;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 1.05rem;
    margin-top: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.3);
    letter-spacing: 0.01em;
}

.wrapped-support-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 36px rgba(99, 102, 241, 0.45);
}

.wrapped-back-btn {
    display: inline-block;
    padding: 0.65rem 1.8rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #94a3b8 !important;
    border-radius: 12px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 0.75rem;
    transition: all 0.2s ease;
}

.wrapped-back-btn:hover {
    border-color: rgba(255, 255, 255, 0.28);
    color: #f1f5f9 !important;
    background: rgba(255, 255, 255, 0.04);
}

.wrapped-share-btn {
    display: inline-block;
    padding: 0.75rem 2.2rem;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff !important;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s ease;
    margin-top: 0.6rem;
    letter-spacing: 0.01em;
}

.wrapped-share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 36px rgba(16, 185, 129, 0.45);
}

.wrapped-share-btn.copied {
    background: linear-gradient(135deg, #6366f1, #818cf8);
}

/* ── Summary slide (scrollable) ── */
.wrapped-slide.summary-slide {
    justify-content: flex-start;
    padding-top: 2rem;
    padding-bottom: 100px;
    text-align: left;
}

.summary-slide .wrapped-slide-content {
    max-width: 650px;
}

.summary-section {
    margin-bottom: 1.8rem;
}

.summary-section h3 {
    font-family: 'Unbounded', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #818cf8;
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(129, 140, 248, 0.12);
    letter-spacing: 0.03em;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.88rem;
    flex-wrap: wrap;
}

.summary-item .label {
    color: #64748b;
    min-width: 140px;
}

.summary-item .label + .wrapped-player-card {
    /* Reset: numbered labels before player cards don't need wide min-width */
}

.summary-item:has(.wrapped-player-card) .label {
    min-width: auto;
}

/* ── Flag override ── */
.wrapped-body .country-flag {
    vertical-align: middle;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .wrapped-slide {
        padding: 1.5rem 1rem 80px;
    }

    .wrapped-slide h2 {
        font-size: 1.45rem;
    }

    .wrapped-stats {
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }

    .wrapped-transition-big {
        font-size: 2rem !important;
    }

    .wrapped-tier-header {
        font-size: 2.5rem;
    }

    .wrapped-player-card {
        font-size: 0.82rem;
        padding: 0.3rem 0.55rem;
    }

    .wrapped-top-list li {
        padding: 0.5rem 0.75rem;
    }

    .wrapped-top-list .rank-number {
        font-size: 1.2rem;
    }

    .wrapped-stat-value {
        font-size: 2rem;
    }

    .wrapped-stat-card {
        padding: 1.2rem 1rem;
        border-radius: 12px;
    }

    .wrapped-nav {
        gap: 1.5rem;
        height: 58px;
    }

    .wrapped-nav button {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }
}
