/* ============================================
   MINI-REMIX — ULTRA-PREMIUM UI
   Holographic Texts, Dynamic Backgrounds, Glassmorphism
   ============================================ */

:root {
    --bg-primary: #050508;
    --bg-secondary: #0a0a10;
    --bg-card: rgba(20, 20, 30, 0.4);
    --bg-tertiary: rgba(255, 255, 255, 0.03);

    --accent: #b8ff00;
    --accent-dim: rgba(184, 255, 0, 0.15);

    --text-primary: #ffffff;
    --text-secondary: #9da3af;
    --text-tertiary: #6b7280;

    --border: rgba(255, 255, 255, 0.05);
    --border-inner: rgba(255, 255, 255, 0.08);

    --font: 'Inter', system-ui, sans-serif;
    --font-head: 'Outfit', sans-serif;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --radius-full: 9999px;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

* {
    box-sizing: border-box;
}

a {
    text-decoration: none;
    color: inherit;
}

/* === Ambient Glows & Background Reactors === */
.ambient-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    pointer-events: none;
    background: radial-gradient(circle at 50% -20%, rgba(184, 255, 0, 0.08) 0%, transparent 60%);
    animation: pulseBg 10s ease-in-out infinite alternate;
}

.ambient-reactor {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: var(--accent);
    filter: blur(150px);
    opacity: 0;
    z-index: -1;
    pointer-events: none;
    transform: translate(-50%, -50%);
    /* Rimuoviamo la transizione su left/top perché le gestiamo in JS via requestAnimationFrame */
    transition: opacity 1.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.1s linear;
    mix-blend-mode: screen;
}

@keyframes pulseBg {
    0% {
        opacity: 0.7;
        transform: scale(1);
    }

    100% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* === Core Structure === */
.profile-container {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 60px 20px 40px;
    position: relative;
    z-index: 10;
}

/* === Sticky Nav === */
.sticky-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(5, 5, 8, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid transparent;
    transform: translateY(-100%);
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sticky-nav.visible {
    transform: translateY(0);
    border-bottom-color: var(--border);
}

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    object-fit: cover;
}

.nav-name {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.5px;
}

/* === Dynamic Holographic Header === */
.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 24px;
    position: relative;
}

.avatar-halo-ring {
    position: relative;
    padding: 4px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), transparent, rgba(255, 255, 255, 0.4), var(--accent));
    background-size: 200% 200%;
    margin-bottom: 24px;
    box-shadow: 0 0 20px rgba(184, 255, 0, 0.05);
}

@keyframes fluidGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.profile-avatar {
    width: 96px;
    height: 96px;
    background: var(--bg-primary);
    border-radius: 50%;
    border: 4px solid var(--bg-primary);
    /* Negative space */
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.profile-avatar:hover {
    transform: scale(1.05) rotate(-2deg);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.holo-text {
    font-family: var(--font-head);
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -1px;
    margin: 0;
    color: #fff;
    /* Soften the strong glass/glow effect for a more premium solid look */
}

.pulse-badge {
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 8px;
    text-transform: uppercase;
    border: 1px solid rgba(184, 255, 0, 0.3);
    box-shadow: 0 0 10px rgba(184, 255, 0, 0.2);
    animation: heartbeat 2s infinite;
    letter-spacing: 0.5px;
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }

    10% {
        transform: scale(1.05);
    }

    20% {
        transform: scale(1);
    }
}

.profile-bio {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 320px;
    line-height: 1.6;
    margin: 0 auto 24px auto;
}

/* === Premium Social & Stats Buttons === */
.profile-socials {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    perspective: 1000px;
}

.magnetic-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 50%;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    /* Curva super fluida UI/UX Pro Max */
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 4px 16px rgba(0, 0, 0, 0.4);
}

.magnetic-btn i {
    width: 18px;
    height: 18px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.magnetic-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-4px) scale(1.05);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2), 0 12px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(184, 255, 0, 0.15);
}

.magnetic-btn:hover i {
    transform: scale(1.1);
}

.glass-panel {
    display: flex;
    gap: 24px;
    padding: 16px 32px;
    border-radius: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 32px rgba(0, 0, 0, 0.2);
}

.p-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.p-stat strong {
    font-family: var(--font-head);
    font-size: 20px;
    color: #fff;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.p-stat span {
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.top-rank strong {
    color: var(--accent);
    text-shadow: 0 0 12px var(--accent-dim);
}

/* === Floating Horizontal Games Grid === */
.feed-section {
    margin-bottom: 60px;
}

.section-title {
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 24px;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: "";
    display: block;
    width: 4px;
    height: 18px;
    background: var(--accent);
    border-radius: 2px;
}

.games-horizontal-scroll {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    /* OVERFLOW FIX: Aumentiamo ampiamente il padding sia sopra che sotto 
       invece che solo `padding: 0 20px 24px 20px`. 
       In questo contenitore l'ombra e lo "scale" esulano dal container nativo.
       Assegnando ad esempio 32px liberi sia in Top che in Bottom la card può 
       scalare e disperdere l'ombra senza essere ghigliottinata dai limiti invisibili dell'overflow. */
    padding: 24px 20px 48px 20px;
    margin: -24px -20px -48px -20px;
    /* Compensiamo il padding coi margini negativi per mantenere il vero layout */
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory;
}

.games-horizontal-scroll::-webkit-scrollbar {
    display: none;
}

.app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-align: center;
    position: relative;
    min-width: 110px;
    max-width: 110px;
    scroll-snap-align: start;
    perspective: 1000px;
}

.app-icon-container {
    position: relative;
    width: 100%;
    margin-bottom: 14px;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transform-style: preserve-3d;
}

.app-card:hover .app-icon-container {
    transform: scale(1.08) translateY(-6px);
}

.app-card:hover .app-icon-wrapper {
    box-shadow:
        0 16px 32px rgba(0, 0, 0, 0.6),
        0 8px 16px rgba(184, 255, 0, 0.1),
        inset 0 1px 1px rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.app-card:hover .app-title {
    color: var(--accent);
    transform: translateY(2px);
}

.app-icon-wrapper {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 26px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    /* Curva di Bezier super reattiva (UI/UX Pro Max style) */
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-icon-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-card:hover .app-icon-wrapper img {
    transform: scale(1.05);
}

.app-icon-wrapper::after {
    /* Shiny overlay */
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.15), transparent);
    transform: skewX(-20deg);
    transition: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-card:hover .app-icon-wrapper::after {
    left: 150%;
}

.app-badge {
    position: absolute;
    bottom: 8px;
    /* Spostato all'interno per evitare qualsiasi taglio con border-radius/overflow-hidden nei container padri */
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #000;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(184, 255, 0, 0.3);
    white-space: nowrap;
    z-index: 2;
}

.app-title {
    font-family: var(--font-head);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: 0.3s;
    margin-bottom: 2px;
}

.app-genre {
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    font-weight: 700;
}

.app-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 4px;
}

/* === Premium Devlog (Twitter + Read.cv format) === */
.log-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(20, 20, 30, 0.2);
    backdrop-filter: blur(10px);
}

.log-item {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: background 0.3s;
}

.log-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.log-item:last-child {
    border-bottom: none;
}

.log-t-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border-inner);
}

.log-content {
    flex: 1;
    min-width: 0;
}

.log-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}

.log-author {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.log-author-name {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 15px;
    color: #fff;
}

.log-author-handle {
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.log-date {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.log-related-game {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--backdrop);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.log-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.3;
    color: #fff;
}

.log-excerpt {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    white-space: pre-line;
}

/* === Fluid Immersive Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 16px;
    z-index: 1000;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-blur-bg {
    position: absolute;
    inset: -100px;
    z-index: 0;
    filter: blur(80px) brightness(0.3) saturate(1.5);
    opacity: 0.9;
    pointer-events: none;
    transition: background 0.8s ease;
    transform: scale(1.2);
}

.modal-content {
    background: rgba(15, 15, 20, 0.7);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border-radius: 36px;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 10;
    transform: translateY(60px) scale(0.9);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-content::-webkit-scrollbar {
    display: none;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    backdrop-filter: blur(10px);
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1) rotate(90deg);
}

.m-header {
    padding: 40px 32px 24px;
    display: flex;
    gap: 24px;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

.m-icon {
    width: 104px;
    height: 104px;
    border-radius: 28px;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 2;
}

.m-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.m-info {
    flex: 1;
    z-index: 2;
}

.m-title {
    font-family: var(--font-head);
    font-size: 26px;
    font-weight: 900;
    margin-bottom: 6px;
    line-height: 1;
    letter-spacing: -0.5px;
    color: #fff;
}

.m-genre {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-full);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(to right, var(--accent), #e3ff73);
    color: #000;
    box-shadow: 0 4px 16px rgba(184, 255, 0, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(184, 255, 0, 0.6);
    filter: brightness(1.1);
}

.m-body {
    padding: 28px 32px;
}

.m-desc {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    margin-bottom: 32px;
    font-weight: 400;
}

.m-stats {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 20px;
    margin-bottom: 36px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.m-stat {
    text-align: center;
}

.m-stat-val {
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 4px;
}

.m-stat-lbl {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.m-section-title {
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
}

/* Timeline Changelog */
.cl-item {
    position: relative;
    padding-left: 24px;
    margin-bottom: 32px;
    border-left: 1px dashed rgba(255, 255, 255, 0.1);
}

.cl-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.cl-item:first-child::before {
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
}

.cl-v {
    font-family: var(--font-head);
    font-size: 12px;
    font-weight: 900;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 6px;
    margin-right: 12px;
}

.cl-d {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

.cl-t {
    font-size: 15px;
    font-weight: 600;
    margin: 12px 0;
    color: #fff;
}

.cl-ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cl-ul li {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
    display: flex;
    gap: 10px;
    line-height: 1.4;
}

.cl-ul li svg {
    width: 14px;
    height: 14px;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 3px;
}

/* === Footer === */
.footer {
    text-align: center;
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 60px;
    border-top: 1px solid var(--border);
    padding-top: 32px;
    font-weight: 500;
}

.footer strong {
    color: #fff;
    font-family: var(--font-head);
    font-weight: 800;
}

/* Utility animations */
@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleUpFade {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-up {
    opacity: 0;
    animation: slideUpFade 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.delay-1 {
    animation-delay: 0.2s;
}

/* === Mobile Design Enhancements === */
@media (max-width: 768px) {
    .ambient-reactor {
        display: none;
        /* Disabilitiamo il glow lerp su mobile per performance e batteria */
    }

    .glass-panel {
        padding: 16px;
        gap: 16px;
        justify-content: space-around;
        width: 100%;
    }

    .profile-bio {
        font-size: 16px;
        /* Più leggibile su schermi piccoli */
    }

    .games-horizontal-scroll {
        /* Ottimizzare lo scroll snap per i touch screen */
        padding-left: 20px;
        padding-right: 20px;
        scroll-padding-left: 20px;
        gap: 16px;
    }

    .magnetic-btn {
        width: 54px;
        /* Touch target più grandi su mobile (Standard Apple HIG) */
        height: 54px;
    }

    .modal-content {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }

    .m-header {
        flex-direction: column;
        text-align: center;
        padding-top: 48px;
        /* Spazio per la 'X' */
    }

    .m-icon {
        margin: 0 auto;
    }
}