/* =========================
   GAMES APP
   uses the --bg / --surface / --border / --curve etc
   tokens already defined in main.css
========================= */

@keyframes gamesFade{
    from{
        opacity:0;
        transform:translateY(8px);
    }
    to{
        opacity:1;
        transform:none;
    }
}

.games-panel.active{
    width:100%;
    height:100%;
}

.games-app{
    width:100%;
    height:100%;
    overflow-y:auto;
    overflow-x:hidden;
    padding:32px;
    animation:gamesFade var(--speed-slow) var(--curve);
}


/* =========================
   TOOLBAR
========================= */

.games-toolbar{
    display:flex;
    flex-direction:column;
    gap:14px;
}

.games-search{
    height:48px;
    max-width:560px;
    display:flex;
    align-items:center;
    gap:12px;
    padding:0 16px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:10px;
    transition:border-color var(--speed) var(--curve), background var(--speed) var(--curve);
}

.games-search:hover{
    border-color:var(--border-strong);
}

.games-search:focus-within{
    background:var(--surface-2);
    border-color:var(--accent);
}

.games-search-icon{
    width:16px;
    height:16px;
    opacity:.55;
    flex-shrink:0;
    display:flex;
    align-items:center;
    justify-content:center;
}

.games-search-icon svg{
    width:16px;
    height:16px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.6;
    stroke-linecap:round;
    stroke-linejoin:round;
}

.games-search input{
    flex:1;
    background:none;
    border:none;
    outline:none;
    color:var(--text);
    font-size:14px;
    font-family:var(--font-body);
}

.games-search input::placeholder{
    color:var(--muted-dim);
}

.games-categories{
    display:flex;
    gap:6px;
    flex-wrap:wrap;
}

.games-cat{
    padding:0 15px;
    height:34px;
    border-radius:8px;
    border:1px solid var(--border);
    color:var(--muted);
    background:transparent;
    font-size:13px;
    font-weight:500;
    cursor:pointer;
    transition:background var(--speed) var(--curve), color var(--speed) var(--curve), border-color var(--speed) var(--curve);
}

.games-cat:hover{
    background:var(--surface);
    color:var(--text);
    border-color:var(--border-strong);
}

.games-cat.active{
    background:var(--surface-2);
    color:var(--text);
    border-color:var(--border-strong);
}


/* =========================
   SECTION HEADINGS
========================= */

.games-section{
    margin-top:34px;
}

.games-section-title{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    margin-bottom:14px;
}

.games-section-title h2{
    font-family:var(--font-display);
    font-size:21px;
    font-weight:600;
    letter-spacing:-.01em;
}

.games-section-title span{
    font-size:11px;
    color:var(--muted-dim);
    font-family:var(--font-mono);
    text-transform:uppercase;
    letter-spacing:.06em;
}


/* =========================
   HOT ROW (horizontal scroll)
========================= */

.games-row-wrap{
    position:relative;
}

.games-row{
    display:flex;
    gap:14px;
    overflow-x:auto;
    scroll-behavior:smooth;
    padding:4px 2px 16px;
}

.games-row::-webkit-scrollbar{
    height:6px;
}

.games-row::-webkit-scrollbar-thumb{
    background:var(--border-strong);
    border-radius:20px;
}

.games-row-arrow{
    position:absolute;
    top:42%;
    transform:translateY(-50%);
    z-index:5;
    width:34px;
    height:56px;
    border-radius:9px;
    background:var(--sidebar);
    border:1px solid var(--border-strong);
    color:var(--text);
    font-size:22px;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    opacity:0;
    transition:opacity var(--speed) var(--curve), background var(--speed) var(--curve), border-color var(--speed) var(--curve);
}

.games-row-wrap:hover .games-row-arrow{
    opacity:1;
}

.games-row-arrow:hover{
    background:var(--surface-2);
    border-color:var(--accent);
    color:var(--accent);
}

.games-row-arrow.left{ left:-4px; }
.games-row-arrow.right{ right:-4px; }


/* =========================
   GAME CARDS
========================= */

.game-card{
    flex:0 0 140px;
    cursor:pointer;
    transition:transform var(--speed-slow) var(--curve);
}

.games-row .game-card{
    flex:0 0 140px;
}

.game-card:hover{
    transform:translateY(-4px);
}

.game-thumb{
    position:relative;
    width:100%;
    height:140px;
    border-radius:11px;
    overflow:hidden;
    border:1px solid var(--border);
    background:var(--surface);
    display:flex;
    align-items:center;
    justify-content:center;
    transition:border-color var(--speed) var(--curve);
}

.game-card:hover .game-thumb{
    border-color:var(--border-strong);
}

.game-thumb img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
}

.game-thumb-fallback{
    font-family:var(--font-display);
    font-size:26px;
    font-weight:600;
    color:var(--muted);
    opacity:.5;
}

.game-badge{
    position:absolute;
    top:8px;
    left:8px;
    padding:4px 8px;
    border-radius:6px;
    background:var(--sidebar);
    border:1px solid var(--border-strong);
    color:var(--accent);
    font-family:var(--font-mono);
    font-size:10px;
    font-weight:500;
    letter-spacing:.03em;
    text-transform:uppercase;
}

.game-fav-btn{
    position:absolute;
    top:8px;
    right:8px;
    width:28px;
    height:28px;
    border-radius:7px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:var(--sidebar);
    border:1px solid var(--border-strong);
    opacity:0;
    cursor:pointer;
    z-index:2;
    transition:opacity var(--speed) var(--curve), background var(--speed) var(--curve), border-color var(--speed) var(--curve);
}

.game-card:hover .game-fav-btn,
.game-fav-btn.active{
    opacity:1;
}

.game-fav-btn svg{
    width:14px;
    height:14px;
    fill:none;
    stroke:var(--text);
    stroke-width:1.6;
    stroke-linecap:round;
    stroke-linejoin:round;
    transition:stroke var(--speed) var(--curve), fill var(--speed) var(--curve);
}

.game-fav-btn:hover{
    background:var(--surface-2);
    border-color:var(--accent);
}

.game-fav-btn.active{
    background:var(--accent-dim);
    border-color:var(--accent);
}

.game-fav-btn.active svg{
    fill:var(--accent);
    stroke:var(--accent);
}

.game-card-info{
    padding:9px 2px 0;
}

.game-card-info strong{
    display:block;
    font-size:13px;
    font-weight:600;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.game-card-info span{
    display:block;
    margin-top:2px;
    font-family:var(--font-mono);
    font-size:10.5px;
    color:var(--muted-dim);
    text-transform:capitalize;
}


/* =========================
   MAIN GRID
========================= */

.games-grid{
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(140px,1fr));
    gap:18px 14px;
}

.games-empty{
    grid-column:1/-1;
    text-align:center;
    padding:56px 20px;
    color:var(--muted);
}

.games-empty strong{
    display:block;
    font-family:var(--font-display);
    font-weight:600;
    font-size:18px;
    color:var(--text);
    margin-bottom:6px;
}


/* =========================
   PLAYER MODAL
========================= */

.game-modal{
    position:fixed;
    inset:0;
    background:rgba(6,6,5,.8);
    backdrop-filter:blur(10px);
    z-index:200;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:36px;
}

.game-modal.hidden{
    display:none;
}

.game-box{
    width:min(1040px,95%);
    background:#000;
    border-radius:14px;
    overflow:hidden;
    border:1px solid var(--border-strong);
    position:relative;
}

.game-header{
    padding:18px 84px 18px 24px;
    display:flex;
    align-items:center;
    gap:12px;
    min-height:62px;
    position:relative;
    z-index:1;
}

.game-header img{
    width:26px;
    height:26px;
    border-radius:7px;
    background:var(--white);
    padding:3px;
    flex-shrink:0;
}

.game-header h2{
    font-family:var(--font-display);
    font-weight:600;
    font-size:20px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    max-width:80%;
}

.game-fullscreen,
.game-close{
    position:absolute;
    top:14px;
    width:34px;
    height:34px;
    border-radius:8px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:var(--surface-2);
    border:1px solid var(--border-strong);
    color:var(--text);
    cursor:pointer;
    transition:background var(--speed) var(--curve), border-color var(--speed) var(--curve);
    z-index:20;
}

.game-fullscreen{ right:60px; }
.game-close{ right:14px; }

.game-fullscreen:hover,
.game-close:hover{
    background:var(--surface-3);
    border-color:var(--accent);
    color:var(--accent);
}

.game-frame{
    aspect-ratio:16/10;
    background:#000;
}

.game-frame iframe{
    width:100%;
    height:100%;
    border:0;
    display:block;
}


/* =========================
   MOBILE
========================= */

@media(max-width:900px){

    .games-app{
        padding:20px;
    }

    .game-card,
    .games-row .game-card{
        flex:0 0 116px;
    }

    .game-thumb{
        height:116px;
    }

    .games-grid{
        grid-template-columns:repeat(auto-fill,minmax(116px,1fr));
    }

    .game-header h2{
        font-size:17px;
    }
}