* {
    box-sizing: border-box;
}

:root {
    --gold-1: #ffe76a;
    --gold-2: #ffc400;
    --gold-3: #efab00;
    --panel: rgba(255,255,255,.05);
    --panel-border: rgba(255, 215, 0, .16);
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'Kanit', Arial, sans-serif;
    background: radial-gradient(circle at top, #1b1b2e 0%, #0f0f1a 55%, #000 100%);
    color: #fff;
}

.container {
    max-width: 520px;
    margin: 0 auto;
    padding: 18px 14px 40px;
}

.container h1,
h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: .4px;
    margin: 16px 6px 6px;
    text-align: center;
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255,215,0,.6), 0 0 18px rgba(255,215,0,.25);
}

.container h2,
h2 {
    font-size: 15px;
    font-weight: 400;
    margin: 0 12px 16px;
    text-align: center;
    opacity: .78;
    line-height: 1.35;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 8px 0 14px;
}

.button {
    border-radius: 999px;
    padding: 12px 22px;
    margin: 0 5px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    color: rgba(255, 255, 255, .92);
    background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.04));
    border: 1px solid rgba(255, 215, 0, .22);
    box-shadow: 0 6px 14px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.08);
    transition: all .18s ease;
}

.button:hover {
    background: linear-gradient(180deg, #1a1a1a, #000);
    color: #fff;
    border-color: #ffd700;
    box-shadow: 0 6px 18px rgba(255,215,0,.35), inset 0 1px 0 rgba(255,255,255,.2);
    transform: translateY(-1px);
}

.button.secondary {
    background: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .92);
    border: 1px solid rgba(255, 215, 0, .18);
    box-shadow: none;
}

.button.secondary:hover {
    background: rgba(255, 255, 255, .14);
}

.button.active {
    background: linear-gradient(180deg, var(--gold-1) 0%, var(--gold-2) 58%, var(--gold-3) 100%);
    color: #111;
    border: 1px solid rgba(130, 90, 0, .35);
    box-shadow: 0 8px 20px rgba(255, 200, 0, .34), 0 0 14px rgba(255, 208, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .5);
}

.button:active {
    transform: scale(.98);
}

.search-bar {
    display: flex;
    justify-content: center;
    margin: 8px 0 14px;
}

.search-bar input {
    width: 100%;
    max-width: 100%;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, .10);
    background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.04));
    color: #fff;
    outline: none;
    font-family: inherit;
    font-size: 15px;
    transition: .2s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}

.search-bar input::placeholder {
    color: rgba(255, 255, 255, .45);
}

.search-bar input:focus {
    border-color: rgba(255, 215, 0, .45);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, .08);
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.game-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
    border: 1px solid var(--panel-border);
    border-radius: 22px;
    overflow: hidden;
    position: relative;
    width: 100%;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .42), 0 0 0 1px rgba(255, 215, 0, .04) inset;
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
    cursor: pointer;
    animation: fadeUp .35s ease;
}

.game-thumb {
    position: relative;
    overflow: hidden;
}

.game-card::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 76px;
    height: 45%;
    background: linear-gradient(to top, rgba(0, 0, 0, .68), rgba(0, 0, 0, 0));
    pointer-events: none;
    z-index: 1;
}

.game-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,.6), 0 0 18px rgba(255,200,0,.18);
    border-color: rgba(255,215,0,.4);
}

.game-card.is-clicked {
    animation: cardPress .24s ease;
}

.game-card.hidden {
    display: none;
}

.game-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    filter: brightness(1.08) saturate(1.08) contrast(1.04);
    border-radius: 18px 18px 0 0;
    transition: transform .28s ease;
}

.game-card:hover img {
    transform: scale(1.04);
}

.game-card::selection {
    background: transparent;
}

.game-info {
    padding: 14px 12px 16px;
    font-size: 13px;
    line-height: 1.25;
    text-align: center;
    background: linear-gradient(180deg, #02050f 0%, #07101f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 76px;
    position: relative;
    z-index: 2;
}

.game-info p {
    margin: 0;
    font-size: .9em;
}

.game-info p:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 66%;
    min-height: 42px;
    padding: 7px 20px;
    border-radius: 999px;
    border: 1px solid rgba(120, 88, 0, .45);
    background: linear-gradient(180deg, #ffe15a 0%, #ffc400 55%, #f0a500 100%);
    box-shadow: inset 0 2px 0 rgba(255,255,255,.4), inset 0 -2px 6px rgba(0,0,0,.2), 0 6px 14px rgba(255,186,0,.35), 0 0 12px rgba(255,200,0,.25);
    font-weight: 800;
    letter-spacing: .3px;
    font-size: 16px;
    line-height: 1;
    color: #000 !important;
    text-shadow: none !important;
    -webkit-text-fill-color: #000 !important;
}

.loading-screen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(17, 20, 34, .82), rgba(2, 4, 10, .92));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
    transition: opacity .28s ease;
}

.loading-ring {
    position: absolute;
    width: 118px;
    height: 118px;
    border: 3px solid rgba(255,255,255,.08);
    border-top-color: rgba(255,215,0,.9);
    border-right-color: rgba(255,215,0,.35);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}


.loading-logo {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    object-fit: cover;
    margin-bottom: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .32);
    animation: floatLogo 1.8s ease-in-out infinite;
    position: relative;
    z-index: 1;
}


.loading-text,
.loading-screen p.loading-text {
    margin: 0;
    margin-top: 14px;
    font-size: 15px;
    font-weight: 700;
    color: #ffd54a;
    letter-spacing: .3px;
    text-shadow: 0 0 8px rgba(255, 213, 74, .18);
}


.loading-dots {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}


.loading-dots span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffe45a, #ffc400);
    box-shadow: 0 0 12px rgba(255, 196, 0, .35);
    animation: bounceDot 1s infinite ease-in-out;
}


.loading-dots span:nth-child(2) { animation-delay: .15s; }
.loading-dots span:nth-child(3) { animation-delay: .3s; }

.pg-popup-overlay,
.launch-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .78);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}

.pg-popup,
.launch-modal {
    width: min(360px, 90vw);
    max-height: min(78vh, 620px);
    background: rgba(18, 18, 22, .98);
    border: 1px solid rgba(255, 215, 0, .18);
    border-radius: 18px;
    box-shadow: 0 18px 55px rgba(0, 0, 0, .55);
    overflow: hidden;
    position: relative;
    animation: pgFadeIn .24s ease;
}


.pg-popup img {
    width: 100%;
    height: auto;
    display: block;
}

.pg-popup-close,
.launch-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 999px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.pg-popup-hint {
    padding: 12px 16px 16px;
    color: rgba(255, 255, 255, .75);
    font-size: 14px;
    text-align: center;
}

.launch-modal-overlay.show {
    display: flex;
}

.launch-modal-thumb-wrap {
    position: relative;
    background: #0a0d15;
    padding: 14px 14px 0;
}


.launch-modal-thumb-wrap img {
    width: 100%;
    display: block;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    object-position: center;
    background: #111522;
    border-radius: 14px;
}




.launch-modal-body {
    padding: 16px 18px 18px;
    text-align: center;
}


.launch-modal-subtitle {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.6px;
    color: #ffd700;
    opacity: .92;
}


.launch-modal h3 {
    margin: 8px 0 8px;
    font-size: 22px;
    line-height: 1.08;
}


.launch-modal p {
    margin: 0 0 14px;
    color: rgba(255,255,255,.75);
    font-size: 14px;
    line-height: 1.4;
}


.launch-play-btn {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 13px 18px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    color: #111;
    background: linear-gradient(180deg, var(--gold-1), var(--gold-2), var(--gold-3));
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(255,186,0,.22), inset 0 1px 0 rgba(255,255,255,.45);
    transition: transform .16s ease, box-shadow .16s ease;
}


.launch-play-btn:hover {
    transform: translateY(-1px);
}

.launch-play-btn:active,
.pg-popup-close:active,
.launch-modal-close:active {
    transform: scale(.98);
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .72);
    display: none;
}

@keyframes pgFadeIn {
    from { opacity: 0; transform: scale(.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes floatLogo {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes bounceDot {
    0%, 80%, 100% { transform: scale(.78); opacity: .4; }
    40% { transform: scale(1); opacity: 1; }
}

@keyframes cardPress {
    0% { transform: scale(1); }
    35% { transform: scale(.96); }
    100% { transform: scale(1); }
}

@media (min-width: 600px) {
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .game-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 400px) {
    .launch-modal {
        width: min(340px, 92vw);
    }

    .launch-modal h3 {
        font-size: 20px;
    }

    .launch-modal-thumb-wrap img {
        aspect-ratio: 1 / 1;
    }
}
