html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

.games-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--darker), var(--dark));
    overflow-x: hidden;
    padding: 7rem 1.5rem 5rem;
}

.games-container {
    max-width: 1180px;
    margin: 0 auto;
    min-width: 0;
    width: 100%;
}

.games-hero {
    align-items: center;
    background: rgba(18,18,26,0.95);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 20px 45px rgba(0,0,0,0.25);
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 2rem;
}

.games-hero-copy {
    min-width: 0;
}

.games-hero h1 {
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    line-height: 1.15;
    margin-bottom: 0.8rem;
}

.games-hero p {
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 720px;
}

.games-hero-count {
    align-items: flex-end;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 0.15rem;
    text-align: right;
}

.games-hero-count strong {
    color: var(--primary);
    font-family: 'Orbitron', sans-serif;
    font-size: 2.1rem;
    line-height: 1;
}

.games-hero-count span {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.games-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0,212,255,0.12);
    border-radius: 999px;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding: 0.5rem 0.9rem;
}

.games-gallery {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(190px, 220px));
    justify-content: start;
}

.games-library-header {
    align-items: flex-end;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.games-library-header span {
    color: var(--primary);
    display: block;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.games-library-header h2 {
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.35rem;
    line-height: 1.2;
}

.game-player-panel {
    background: rgba(18,18,26,0.95);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 20px 45px rgba(0,0,0,0.25);
    margin-bottom: 2rem;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.game-player-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1rem 1.25rem;
}

.game-player-header span {
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.game-player-header h2 {
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.15rem;
    margin-top: 0.2rem;
}

.game-player-header h1 {
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.25rem, 3vw, 1.9rem);
    line-height: 1.15;
    margin-top: 0.2rem;
}

.game-player-actions {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 0.7rem;
    justify-content: flex-end;
}

.game-player-reset {
    align-items: center;
    background: var(--card-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    gap: 0.45rem;
    min-height: 38px;
    padding: 0.55rem 0.85rem;
}

.game-player-fullscreen {
    align-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--dark);
    cursor: pointer;
    display: none;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 800;
    gap: 0.45rem;
    justify-content: center;
    min-height: 40px;
    padding: 0.58rem 0.95rem;
    white-space: nowrap;
}

.game-player-fullscreen[hidden] {
    display: none;
}

.game-player-fullscreen:disabled {
    cursor: progress;
    opacity: 0.65;
}

.game-player-fullscreen.active {
    background: var(--card-hover);
    border: 1px solid var(--border);
    color: var(--text);
}

.game-player-fullscreen-error {
    background: rgba(255,71,87,0.16);
    border: 1px solid rgba(255,71,87,0.35);
    color: var(--danger);
}

.game-player-reset:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.game-player-stage {
    aspect-ratio: 16 / 10;
    background: #000;
    border-top: 1px solid var(--border);
    max-width: 100%;
    min-height: 360px;
    min-width: 0;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.game-play-layout {
    display: grid;
    gap: 1rem;
    max-width: 100%;
    min-width: 0;
}

.games-back-link {
    align-items: center;
    color: var(--primary);
    display: inline-flex;
    font-size: 0.9rem;
    font-weight: 700;
    gap: 0.5rem;
    justify-self: start;
    text-decoration: none;
}

.games-back-link:hover {
    color: white;
}

.game-player-panel-live {
    background: #050508;
    border-color: rgba(255,255,255,0.08);
    width: 100%;
}

.game-player-panel-live:fullscreen,
.game-player-panel-live:-webkit-full-screen {
    background: #000;
    border: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin: 0;
    max-height: 100vh;
    max-width: 100vw;
    width: 100vw;
}

.game-player-panel-live:fullscreen .game-player-header,
.game-player-panel-live:-webkit-full-screen .game-player-header {
    background: #050508;
    flex: 0 0 auto;
    padding: 0.75rem 1rem;
}

.game-player-panel-live:fullscreen .game-player-stage,
.game-player-panel-live:-webkit-full-screen .game-player-stage {
    aspect-ratio: auto;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
}

.game-player-panel-live .game-player-stage {
    aspect-ratio: 16 / 9;
    min-height: 560px;
}

.game-player-frame {
    border: 0;
    display: block;
    height: 100%;
    max-width: 100%;
    min-width: 0;
    width: 100%;
}

.game-player-placeholder {
    align-items: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    height: 100%;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
}

.game-player-placeholder i {
    color: var(--primary);
    font-size: 3rem;
}

.game-player-error {
    color: var(--danger);
}

.game-player-error i {
    color: var(--danger);
}

.related-games {
    margin-top: 2rem;
}

.related-games-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.related-games-header h2 {
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.25rem;
}

.related-games-header a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.game-card {
    background: rgba(18,18,26,0.92);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.25);
    overflow: hidden;
    min-width: 0;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
    width: 100%;
}

.game-card:hover {
    border-color: rgba(0,212,255,0.52);
    box-shadow: 0 18px 36px rgba(0,212,255,0.14);
    transform: translateY(-4px);
}

.game-card-link {
    color: inherit;
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100%;
    text-decoration: none;
}

.game-card.active .game-cover {
    border-color: var(--secondary);
    box-shadow: 0 16px 40px rgba(255,107,53,0.22);
}

.game-cover-frame {
    aspect-ratio: 3 / 4;
    background: linear-gradient(135deg, #14141f, #202033);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0.45rem;
    position: relative;
    width: 100%;
}

.game-cover {
    aspect-ratio: 3 / 4;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
    display: block;
    height: 100%;
    object-fit: contain;
    transition: none;
    width: 100%;
}

.game-cover-placeholder {
    align-items: center;
    color: var(--primary);
    display: flex;
    font-size: 2.5rem;
    justify-content: center;
}

.game-core-badge {
    background: rgba(5,5,8,0.78);
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 999px;
    color: var(--primary);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.7px;
    line-height: 1;
    padding: 0.38rem 0.52rem;
    position: absolute;
    right: 0.65rem;
    top: 0.65rem;
}

.game-card-play {
    display: none;
}

.game-card:hover .game-cover {
    transform: none;
}

.game-card:hover .game-card-play {
    display: none;
}

.game-card-body {
    align-content: start;
    display: grid;
    gap: 0.65rem;
    justify-items: center;
    padding: 0.9rem 0.9rem 1rem;
    text-align: center;
}

.game-card-core {
    align-items: center;
    background: rgba(0,212,255,0.12);
    border: 1px solid rgba(0,212,255,0.22);
    border-radius: 999px;
    color: var(--primary);
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 900;
    justify-content: center;
    letter-spacing: 0.6px;
    line-height: 1;
    min-height: 24px;
    padding: 0.35rem 0.6rem;
}

.game-name {
    color: white;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.35;
    margin: 0;
    overflow-wrap: anywhere;
}

.play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: 0;
    border-radius: 8px;
    color: var(--dark);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    margin-top: 0;
    min-height: 40px;
    min-width: 112px;
    padding: 0.52rem 0.95rem;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    white-space: nowrap;
}

.play-btn:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(0,212,255,0.35);
    transform: scale(1.05);
}

.play-btn-disabled {
    background: var(--card-hover);
    color: var(--text-muted);
    cursor: not-allowed;
}

.games-empty {
    align-items: center;
    background: rgba(18,18,26,0.9);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    grid-column: 1 / -1;
    min-height: 220px;
    justify-content: center;
    text-align: center;
}

.games-empty i {
    color: var(--primary);
    font-size: 2.5rem;
}

@media (max-width: 768px) {
    .games-page {
        padding: 6rem 0.75rem 3rem;
    }

    .games-container {
        max-width: 100%;
    }

    .games-hero {
        align-items: flex-start;
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1.5rem;
        padding: 1.2rem;
    }

    .games-hero-count {
        align-items: flex-start;
        text-align: left;
    }

    .games-gallery {
        grid-template-columns: minmax(0, min(230px, 100%));
        gap: 1rem;
        justify-content: center;
    }

    .game-card {
        border-radius: 10px;
        justify-self: center;
        max-width: 230px;
        width: 100%;
    }

    .game-cover-frame {
        padding: 0.4rem;
    }

    .game-card-body {
        padding: 0.85rem;
    }

    .play-btn {
        max-width: 150px;
        width: 100%;
    }

    .games-library-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .game-player-header {
        align-items: stretch;
        flex-direction: column;
    }

    .game-player-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .game-player-fullscreen:not([hidden]) {
        display: inline-flex;
        width: 100%;
    }

    .game-player-reset {
        width: 100%;
    }

    .game-player-stage {
        aspect-ratio: 4 / 3;
        min-height: 0;
    }

    .game-player-panel-live .game-player-stage {
        aspect-ratio: 4 / 3;
        min-height: 0;
    }

    .related-games-header {
        align-items: flex-start;
        flex-direction: column;
    }
}
