/* ==========================================
   OliveParty Hub - Responsive Home (mobile + desktop)
   ========================================== */

#home-container {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}

/* === TOP BAR === */
.home-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(26, 36, 26, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(62, 82, 62, 0.25);
    padding-top: env(safe-area-inset-top, 0px);
}

.home-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.25rem;
    max-width: 1280px;
    margin: 0 auto;
}

.home-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.home-brand-logo {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.home-brand-name {
    font-weight: 700;
    color: #F0FFF4;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.login-pill {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #9BD62C;
    color: #1A241A;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 0.5rem 1.05rem;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.login-pill:hover { background: #AEE83E; box-shadow: 0 4px 16px rgba(155, 214, 44, 0.35); }
.login-pill:active { transform: scale(0.93); }

/* === HERO === */
.home-hero {
    position: relative;
    overflow: hidden;
    padding: 1.25rem 1.25rem 0;
}

.home-hero::before {
    content: '';
    position: absolute;
    inset: -80px -40px 0;
    background: radial-gradient(
        ellipse 60% 70% at 50% 30%,
        rgba(155, 214, 44, 0.10) 0%,
        transparent 70%
    );
    pointer-events: none;
}

.home-hero-inner {
    position: relative;
    text-align: center;
    max-width: 1280px;
    margin: 0 auto;
}

.home-hero-img {
    width: 88%;
    max-width: 380px;
    margin: 0 auto;
    display: block;
    border-radius: 1.5rem;
}

.home-greeting {
    font-size: 1rem;
    font-weight: 600;
    color: #A3BFA3;
    margin-top: 0.5rem;
}

.home-greeting .current-username {
    color: #9BD62C;
    font-weight: 700;
}

/* === MAIN CONTENT WRAPPER === */
.home-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 0;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* === MODE CARDS GRID === */
.home-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

/* Salon + Labo full width on mobile */
.home-modes > .mode-card.mode-salon,
.home-modes > .mode-card.mode-labo {
    grid-column: 1 / -1;
}

.mode-card {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 1.15rem;
    border: 2px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    width: 100%;
    transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    background: #222E22;
    color: inherit;
    text-decoration: none;
}
a.mode-card:hover { text-decoration: none; }

.mode-card:hover {
    border-color: rgba(155, 214, 44, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
.mode-card:active { transform: scale(0.97); }

.mode-card-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.mode-card:hover .mode-card-img { transform: scale(1.04); }
.mode-card:active .mode-card-img { transform: scale(1.05); }

.mode-card-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.mode-solo-overlay {
    background: linear-gradient(to top, rgba(109, 40, 217, 0.92) 0%, rgba(139, 92, 246, 0.45) 50%, rgba(139, 92, 246, 0.08) 100%);
}
.mode-online-overlay {
    background: linear-gradient(to top, rgba(37, 99, 235, 0.92) 0%, rgba(6, 182, 212, 0.4) 50%, rgba(6, 182, 212, 0.08) 100%);
}
.mode-salon-overlay {
    background: linear-gradient(to top, rgba(234, 88, 12, 0.9) 0%, rgba(245, 158, 11, 0.35) 50%, rgba(245, 158, 11, 0.05) 100%);
}
.mode-labo-overlay {
    background: linear-gradient(to top, rgba(13, 22, 16, 0.92) 0%, rgba(20, 35, 22, 0.45) 50%, rgba(155, 214, 44, 0.05) 100%);
}

.mode-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.85rem;
    z-index: 2;
    text-align: left;
}

.mode-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: white;
    font-weight: 700;
    font-size: 0.82rem;
    padding: 0.32rem 0.7rem;
    border-radius: 0.55rem;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

.mode-card-badge i { font-size: 0.78rem; }

.mode-card-sub {
    display: block;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.7rem;
    font-weight: 500;
    margin-top: 0.35rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    padding-left: 0.15rem;
}

.mode-card-chevron {
    color: rgba(255, 255, 255, 0.55);
    font-size: 1.05rem;
}

.mode-card.mode-solo { box-shadow: 0 6px 24px rgba(139, 92, 246, 0.22); }
.mode-card.mode-online { box-shadow: 0 6px 24px rgba(6, 182, 212, 0.22); }
.mode-card.mode-salon { box-shadow: 0 6px 24px rgba(245, 158, 11, 0.18); }

/* Salon + Labo : layout horizontal sur mobile */
.mode-card.mode-salon .mode-card-img,
.mode-card.mode-labo .mode-card-img {
    height: 110px;
    object-position: center 30%;
}

.mode-salon-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.mode-salon-badge { font-size: 0.88rem; }

/* Labo : contour rayure jaune/noir anime */
.mode-card.mode-labo {
    border: none;
    border-radius: 0;
    box-shadow: 0 6px 24px rgba(155, 214, 44, 0.2);
}

.mode-card.mode-labo::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    background-image: linear-gradient(
        45deg,
        #facc15 25%,
        #111 25%, #111 50%,
        #facc15 50%, #facc15 75%,
        #111 75%
    );
    background-size: 28px 28px;
    padding: 6px;
    box-sizing: border-box;
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    animation: labo-march 0.7s linear infinite;
}

@keyframes labo-march {
    from { background-position: 0 0; }
    to   { background-position: 28px 0; }
}

@media (prefers-reduced-motion: reduce) {
    .mode-card.mode-labo::after { animation: none; }
}

/* === SECTIONS === */
.home-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.home-section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.home-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #F0FFF4;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
}

.home-section-link {
    font-size: 0.72rem;
    font-weight: 600;
    color: #6E8A6E;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.home-section-link:hover { color: #9BD62C; }
.home-section-link:active { color: #9BD62C; }

/* === GAME GRID (carrousel mobile, grid desktop) ===
   On garde l'id #games-carousel pour que renderGamesCarousel marche.
   La classe .game-grid reagit au breakpoint. */
.game-grid {
    display: flex;
    gap: 0.7rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.4rem;
    scrollbar-width: none;
}
.game-grid::-webkit-scrollbar { display: none; }

/* === GAME MINI CARDS === */
.game-mini {
    position: relative;
    flex-shrink: 0;
    width: 130px;
    border-radius: 0.9rem;
    overflow: hidden;
    background: #222E22;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.2s, box-shadow 0.2s;
    scroll-snap-align: start;
    -webkit-tap-highlight-color: transparent;
}

/* === EXTERNAL GAMES (creations qui ne suivent pas les regles plateforme) === */
.game-mini--external {
    border-color: rgba(244, 63, 94, 0.5);
    box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.2),
                0 4px 16px rgba(244, 63, 94, 0.18);
}
.game-mini--external:hover {
    border-color: #f43f5e !important;
    box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.35),
                0 6px 22px rgba(244, 63, 94, 0.3);
}

.game-mini-ribbon,
.game-card-ribbon {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(244, 63, 94, 0.92);
    color: white;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 0.2rem 0.5rem 0.2rem 0.45rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.game-card-ribbon {
    font-size: 0.62rem;
    padding: 0.25rem 0.6rem 0.25rem 0.55rem;
    top: 0.6rem;
    right: 0.6rem;
}

.ribbon-dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: white;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.9);
    animation: ribbon-pulse 1.6s ease-in-out infinite;
}

@keyframes ribbon-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.45; transform: scale(0.7); }
}

/* Library card external (couleur dominante rose/red + bordure plus visible) */
.game-card--external {
    border-color: rgba(244, 63, 94, 0.55) !important;
}
.game-card--external:hover {
    border-color: #f43f5e !important;
    box-shadow: 0 12px 28px rgba(244, 63, 94, 0.28) !important;
}

@media (prefers-reduced-motion: reduce) {
    .ribbon-dot { animation: none; }
}

/* === DEV STATUS BADGE (top-left) === */
.game-devbadge {
    position: absolute;
    top: 0.45rem;
    left: 0.45rem;
    z-index: 4;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 0.18rem 0.5rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.devbadge--beta {
    background: rgba(245, 158, 11, 0.92);   /* amber-500 */
    color: #1a0e00;
    border: 1px solid rgba(252, 211, 77, 0.55);
}

.devbadge--wip {
    background: rgba(139, 92, 246, 0.9);    /* violet-500 */
    color: white;
    border: 1px solid rgba(196, 181, 253, 0.5);
    animation: dev-blink 2.6s ease-in-out infinite;
}

@keyframes dev-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.65; }
}

/* Library card : badge plus grand */
.group .game-devbadge {
    font-size: 0.62rem;
    padding: 0.22rem 0.6rem;
    top: 0.6rem;
    left: 0.6rem;
}

@media (prefers-reduced-motion: reduce) {
    .devbadge--wip { animation: none; }
}

/* Carte jeu BETA : contour rayure jaune/noir 4px (meme look que la tuile Labo) */
.group:has(> .devbadge--beta),
.game-mini:has(> .devbadge--beta) {
    position: relative;
}

.group:has(> .devbadge--beta)::after,
.game-mini:has(> .devbadge--beta)::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    border-radius: inherit;
    background-image: linear-gradient(
        45deg,
        #facc15 25%,
        #111 25%, #111 50%,
        #facc15 50%, #facc15 75%,
        #111 75%
    );
    background-size: 20px 20px;
    padding: 4px;
    box-sizing: border-box;
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    animation: labo-march 0.7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .group:has(> .devbadge--beta)::after,
    .game-mini:has(> .devbadge--beta)::after { animation: none; }
}

.game-mini:hover {
    border-color: #9BD62C;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}
.game-mini:active { transform: scale(0.95); }

.game-mini-cover {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
}

.game-mini-info { padding: 0.5rem 0.6rem; }

.game-mini-name {
    font-size: 0.74rem;
    font-weight: 700;
    color: #F0FFF4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-mini-players {
    font-size: 0.6rem;
    color: #6E8A6E;
    margin-top: 1px;
}

/* === NEWS GRID === */
.news-grid {
    display: flex;
    gap: 0.65rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.4rem;
    scrollbar-width: none;
}
.news-grid::-webkit-scrollbar { display: none; }

.news-card {
    flex-shrink: 0;
    width: 200px;
    border-radius: 0.9rem;
    overflow: hidden;
    background: #222E22;
    border: 1px solid #2B3A2B;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.2s, box-shadow 0.2s;
    scroll-snap-align: start;
    -webkit-tap-highlight-color: transparent;
}
.news-card:hover {
    border-color: #9BD62C;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}
.news-card:active { transform: scale(0.96); }

/* === FOOTER === */
.home-footer {
    text-align: center;
    color: #3E523E;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    padding: 2.5rem 1rem 2rem;
}

/* === FADE IN === */
.fade-in { animation: homeSlideUp 0.35s ease-out; }
@keyframes homeSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* === SCROLLBAR === */
#home-container::-webkit-scrollbar { width: 6px; }
#home-container::-webkit-scrollbar-track { background: transparent; }
#home-container::-webkit-scrollbar-thumb {
    background: #2B3A2B;
    border-radius: 3px;
}
#home-container::-webkit-scrollbar-thumb:hover { background: #3E523E; }


/* ============================================================
   RESPONSIVE
   ============================================================ */

/* === Tablette : 640px+ === */
@media (min-width: 640px) {
    .home-hero-img { max-width: 460px; }

    .mode-card-img { height: 180px; }
    .mode-card-badge { font-size: 0.92rem; padding: 0.4rem 0.85rem; }
    .mode-card-sub { font-size: 0.78rem; }
}

/* === Desktop (>= 1024px) : grid 4 colonnes pour les modes,
       grid 5 colonnes pour les jeux, news 3-4 colonnes === */
@media (min-width: 1024px) {

    .home-content {
        padding: 2rem 2rem 0;
        gap: 2.5rem;
    }

    .home-hero {
        padding: 2rem 2rem 0;
    }
    .home-hero-img {
        max-width: 520px;
    }
    .home-greeting {
        font-size: 1.15rem;
        margin-top: 0.85rem;
    }

    /* Modes : 4 colonnes egales */
    .home-modes {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.1rem;
    }
    .home-modes > .mode-card.mode-salon,
    .home-modes > .mode-card.mode-labo {
        grid-column: auto;
    }

    /* Toutes les modes-cards : meme hauteur image (220px) */
    .mode-card-img,
    .mode-card.mode-salon .mode-card-img,
    .mode-card.mode-labo .mode-card-img {
        height: 220px;
    }
    .mode-card-badge { font-size: 1rem; padding: 0.45rem 0.95rem; }
    .mode-card-sub { font-size: 0.82rem; }

    /* Salon + Labo : revenir au layout vertical (badge en bas) au lieu de horizontal */
    .mode-salon-content {
        display: block;
    }
    .mode-card-chevron { display: none; }

    /* Section titles plus grands */
    .home-section-title { font-size: 1.2rem; }
    .home-section-link { font-size: 0.8rem; }
    .home-section { gap: 1rem; }

    /* === GAMES : grille 5 colonnes (plus de carousel horizontal) === */
    .game-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 1rem;
        overflow: visible;
    }
    .game-mini {
        width: 100%;
    }
    .game-mini-cover { height: 130px; }
    .game-mini-name { font-size: 0.85rem; }
    .game-mini-players { font-size: 0.72rem; }
    .game-mini-info { padding: 0.7rem 0.85rem; }

    /* === NEWS : grille 3 colonnes === */
    .news-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        overflow: visible;
    }
    .news-card {
        width: 100%;
    }

    .home-footer {
        font-size: 0.78rem;
        padding: 4rem 2rem 2.5rem;
    }
}

/* === Large desktop (>= 1280px) : 6 colonnes pour les jeux === */
@media (min-width: 1280px) {
    .game-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    .news-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
