/* ============================================================
   Game tile HUD — hover / tap overlay (Play, Demo, Info,
   Favourite star)
   Mirrors the reference lobby: favourite star top-left, info
   button top-right, bottom game name + Demo/Play actions.
   The HUD (and its star) only shows while the overlay is open.
   ============================================================ */

.game-hud {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6px;
    box-sizing: border-box;
    background: radial-gradient(120% 95% at 50% 0%, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0.55) 100%);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.game-tile.hud-open .game-hud {
    opacity: 1;
    visibility: visible;
}

.game-tile.hud-open .game-tile__hover,
.game-tile.hud-open .game-tile__caption {
    opacity: 0;
}

.game-tile.hud-open .game-tile__img {
    transform: scale(1.04);
    filter: brightness(0.78);
}

/* Top toolbar — favourite star top-left, info top-right */
.game-hud__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.game-hud__top-right {
    display: flex;
    gap: 6px;
}

.game-hud__icon-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(10, 12, 20, 0.55);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s, color 0.15s;
}

.game-hud__icon-btn svg {
    width: 13px;
    height: 13px;
    pointer-events: none;
}

.game-hud__icon-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.08);
}

/* Favourite star — sits in the top-left corner */
.game-hud__icon-btn.game-hud__fav {
    color: #fff;
}

.game-hud__icon-btn.game-hud__fav:hover,
.game-hud__icon-btn.game-hud__fav.is-on {
    color: #ffbe2e;
}

.game-hud__icon-btn.game-hud__fav.is-on svg {
    fill: #ffbe2e;
    stroke: #ffbe2e;
}

.fav-pop {
    animation: fav-pop 0.5s ease;
}

@keyframes fav-pop {
    0%   { transform: scale(0.5) rotate(-14deg); }
    60%  { transform: scale(1.2) rotate(9deg); }
    100% { transform: scale(1) rotate(0); }
}

/* Bottom block — game name + actions */
.game-hud__bottom {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.game-hud__name {
    display: block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
    text-align: center;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-hud__actions {
    display: flex;
    gap: 6px;
}

.game-hud__action {
    flex: 1;
    min-width: 0;
    padding: 6px 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: none;
    border-radius: 7px;
    font-family: inherit;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: filter 0.15s, transform 0.15s;
}

.game-hud__action svg {
    width: 9px;
    height: 9px;
    pointer-events: none;
}

.game-hud__action:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

.game-hud__action--demo {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.game-hud__action--play {
    background: #00d4aa;
    color: #05120e;
    box-shadow: 0 2px 10px rgba(0, 212, 170, 0.35);
}

/* Bigger tiles in the games library grid */
.games-grid .game-hud__icon-btn {
    width: 30px;
    height: 30px;
}

.games-grid .game-hud__icon-btn svg {
    width: 15px;
    height: 15px;
}

.games-grid .game-hud__name {
    font-size: 10px;
}

.games-grid .game-hud__action {
    font-size: 10px;
    padding: 7px 6px;
}

/* ============================================================
   Game details modal (in-page popup)
   ============================================================ */

.game-details-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.75);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.game-details-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

body.game-details-open {
    overflow: hidden;
}

.game-details-modal {
    position: relative;
    width: min(100%, 340px);
    max-height: min(90vh, 640px);
    max-height: min(90dvh, 640px);
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
    background: linear-gradient(180deg, #16151d 0%, #0f0e14 100%);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 18px;
    box-shadow: 0 40px 80px -32px rgba(0, 0, 0, 0.85);
    transform: translateY(12px) scale(0.98);
    transition: transform 0.22s ease;
}

.game-details-overlay.is-open .game-details-modal {
    transform: translateY(0) scale(1);
}

.game-details__close {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    z-index: 2;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(10, 12, 20, 0.6);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}

.game-details__close svg {
    width: 15px;
    height: 15px;
    pointer-events: none;
}

.game-details__close:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.06);
}

.game-details__thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    background: #1a1a1a;
}

.game-details__thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 50%, rgba(15, 14, 20, 0.95) 100%);
    pointer-events: none;
}

.game-details__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-details__body {
    padding: 18px 20px 22px;
    margin-top: -34px;
    position: relative;
    z-index: 1;
}

.game-details__title {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fafafa;
}

.game-details__provider {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ca3af;
}

.game-details__actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}

.game-details__action {
    flex: 1;
    padding: 12px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 11px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    cursor: pointer;
    transition: filter 0.15s, transform 0.15s;
}

.game-details__action svg {
    width: 13px;
    height: 13px;
    pointer-events: none;
}

.game-details__action:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

.game-details__action--demo {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.game-details__action--play {
    background: #00d4aa;
    color: #05120e;
    box-shadow: 0 4px 16px rgba(0, 212, 170, 0.35);
}

/* Link copied toast */
.game-hud-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    z-index: 1100;
    padding: 10px 18px;
    border-radius: 10px;
    background: #16151d;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fafafa;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.game-hud-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Small screens — keep the HUD legible on tiny tiles */
@media (max-width: 768px) {
    .game-hud__icon-btn {
        width: 24px;
        height: 24px;
    }

    .game-hud__action {
        font-size: 8px;
        padding: 5px 3px;
    }

    .games-grid .game-hud__action {
        font-size: 9px;
        padding: 6px 4px;
    }

    .games-grid .game-hud__name {
        font-size: 9px;
    }
}