/* ----------------------------------------------------
   DESIGN SYSTEM & VARIABLES
   ---------------------------------------------------- */
:root {
    --bg-dark: #08080d;
    --card-bg: rgba(13, 13, 21, 0.5);
    --border-color: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    /* Neon Gaming Colors */
    --twitch-purple: #9146ff;
    --twitch-purple-glow: rgba(145, 70, 255, 0.4);
    --twitch-purple-hover: #a970ff;
    
    --snap-cyan: #00d2ff;
    --snap-cyan-glow: rgba(0, 210, 255, 0.35);
    --snap-blue: #0072ff;
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Fonts */
    --font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ----------------------------------------------------
   BASE STYLES & RESET
   ---------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ----------------------------------------------------
   DYNAMIC COSMIC BACKGROUND
   ---------------------------------------------------- */
.space-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, #111124 0%, var(--bg-dark) 100%);
    overflow: hidden;
}

.nebula {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.18;
    mix-blend-mode: screen;
    pointer-events: none;
    will-change: transform;
}

.nebula-blue {
    top: -10%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--snap-blue) 0%, rgba(0,0,0,0) 70%);
    animation: drift-slow 25s infinite alternate ease-in-out;
}

.nebula-purple {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--twitch-purple) 0%, rgba(0,0,0,0) 70%);
    animation: drift-slow 30s infinite alternate-reverse ease-in-out;
}

.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(1px 1px at 20px 30px, #fff, rgba(0,0,0,0)),
        radial-gradient(1.5px 1.5px at 100px 150px, rgba(255,255,255,0.8), rgba(0,0,0,0)),
        radial-gradient(1px 1px at 200px 80px, rgba(255,255,255,0.9), rgba(0,0,0,0)),
        radial-gradient(2px 2px at 300px 400px, #fff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 400px 250px, rgba(255,255,255,0.7), rgba(0,0,0,0)),
        radial-gradient(1.5px 1.5px at 600px 50px, #fff, rgba(0,0,0,0));
    background-size: 550px 550px;
    opacity: 0.25;
}

@keyframes drift-slow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 30px) scale(1.15); }
}

/* ----------------------------------------------------
   LAYOUT CONTAINER
   ---------------------------------------------------- */
.container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    z-index: 10;
}

/* ----------------------------------------------------
   THE INTERACTIVE GAMER CARD
   ---------------------------------------------------- */
.card-wrapper {
    width: 100%;
    max-width: 380px;
}

.gamer-card {
    position: relative;
    width: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 35px 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transition: 
        border-color 0.3s ease, 
        box-shadow 0.3s ease,
        transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
    
    /* MANDATORY: Identity properties to avoid sudden stacking context shifts */
    transform: scale(1);
}

.gamer-card:hover {
    border-color: var(--border-hover);
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(0, 210, 255, 0.12),
        0 0 50px rgba(145, 70, 255, 0.08);
    transform: scale(1.03);
}

/* Kursorowa poświata na karcie (delikatny spotlight) */
.card-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 24px;
    background: radial-gradient(350px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(0, 210, 255, 0.1), transparent 80%);
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.5s ease;
    opacity: 0;
}

.gamer-card:hover .card-glow {
    opacity: 1;
}

/* Wewnętrzna warstwa karty */
.card-inner {
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* ----------------------------------------------------
   CARD COMPONENTS (HEADER & AVATAR)
   ---------------------------------------------------- */
.card-header {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.avatar-container {
    position: relative;
    width: 90px;
    height: 90px;
    margin-bottom: 15px;
}

.avatar-ring {
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--snap-cyan) 0%, var(--twitch-purple) 100%);
    animation: rotate-ring 6s linear infinite;
    opacity: 0.85;
}

/* Avatar stylizowany grafiką z Marvel Snap */
.avatar {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #141424;
    background-image: url('avatar.png');
    background-size: 215%; /* Idealny zoom na twarz i pierścienie psychiczne */
    background-position: 53% 16%; /* Perfekcyjne wycentrowanie twarzy Profesora X */
    background-repeat: no-repeat;
    border: 3px solid #08080d;
    user-select: none;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.8);
}

@keyframes rotate-ring {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.gamer-tag {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 40%, #a1a1aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.gamer-class {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ----------------------------------------------------
   MARVEL SNAP BADGES (ENERGY & POWER)
   ---------------------------------------------------- */
.snap-badge {
    position: absolute;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    user-select: none;
    z-index: 10;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    
    /* Subtle 3D look */
    text-shadow: 1px 2px 3px rgba(0, 0, 0, 0.5);
}

.snap-energy {
    top: -15px;
    left: -15px;
    background: radial-gradient(circle at 40% 40%, #00d2ff 0%, #0072ff 50%, #0052d4 100%);
    border: 2px solid #ffffff;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.5),
        0 0 15px var(--snap-cyan-glow);
}

.snap-power {
    top: -15px;
    right: -15px;
    background: radial-gradient(circle at 40% 40%, #ffe259 0%, #ff5e62 60%, #ff416c 100%);
    border: 2px solid #ffffff;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(255, 94, 98, 0.5);
}

.gamer-card:hover .snap-badge {
    transform: scale(1.1);
}

/* ----------------------------------------------------
   INTERACTIVE BUTTONS
   ---------------------------------------------------- */
.gamer-links {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: 
        scale 0.2s ease, 
        box-shadow 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease;
    position: relative;
    overflow: hidden;
    
    /* MANDATORY: Apply base identity transform/scale to prevent stacking context jumps */
    scale: 1;
}

.btn .icon {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

/* Twitch Button Styling */
.btn-twitch {
    background: rgba(145, 70, 255, 0.08);
    border: 1px solid rgba(145, 70, 255, 0.3);
    color: #e6d8ff;
}

.btn-twitch:hover {
    background: var(--twitch-purple);
    color: #ffffff;
    border-color: var(--twitch-purple);
    box-shadow: 0 0 20px var(--twitch-purple-glow);
    scale: 1.02;
}

.btn-twitch:hover .icon {
    transform: rotate(-10deg) scale(1.1);
}

/* Snap.fan Button Styling */
.btn-snap {
    background: rgba(0, 210, 255, 0.06);
    border: 1px solid rgba(0, 210, 255, 0.25);
    color: #d1f7ff;
}

.btn-snap:hover {
    background: linear-gradient(135deg, var(--snap-cyan) 0%, var(--snap-blue) 100%);
    color: #ffffff;
    border-color: var(--snap-cyan);
    box-shadow: 0 0 20px var(--snap-cyan-glow);
    scale: 1.02;
}

.btn-snap:hover .icon {
    transform: rotate(10deg) scale(1.1);
}

/* Active states */
.btn:active {
    scale: 0.98;
}

/* ----------------------------------------------------
   FOOTER
   ---------------------------------------------------- */
.footer {
    padding: 20px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ----------------------------------------------------
   ACCESSIBILITY & REDUCED MOTION
   ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .nebula, .avatar-ring, .btn .icon, .snap-badge {
        animation: none !important;
    }
    
    .gamer-card, .btn {
        transition: none !important;
        transform: none !important;
    }
    
    .gamer-card:hover, .btn:hover {
        scale: 1 !important;
        box-shadow: none !important;
    }
}
