/* =========================================================
   H5 Game List - UI stylesheet (v3, reference-site theme)
   Light, centered mobile-first column. Ads + carousels included.
   ========================================================= */

:root {
    --maxw: 700px;

    /* Ink */
    --ink: #2b2b2b;
    --ink-strong: #333;
    --muted: #767676;
    --muted-2: #9d9d9d;
    --line: #eeeeee;

    /* Brand accents (green, from reference) */
    --green: rgba(45, 100, 15, .95);
    --green-2: rgba(30, 88, 45, .95);
    --green-solid: #2e6a13;
    --star: #e4ad22;
    --accent: #ffe082;
    --link: #d02141;

    --radius: 15px;

    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-l: env(safe-area-inset-left, 0px);
    --safe-r: env(safe-area-inset-right, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: "Fredoka", "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    font-weight: 400;
    color: var(--ink);
    background: #ffffff;
    line-height: 1.5;
    max-width: var(--maxw);
    margin: 0 auto;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: 0;
    background: none;
    color: inherit;
}

ul,
li {
    list-style: none;
}

::selection {
    background: var(--green-solid);
    color: #fff;
}

.container {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding-left: calc(15px + var(--safe-l));
    padding-right: calc(15px + var(--safe-r));
}

/* =========================================================
   Header bar
   ========================================================= */
.headerbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: calc(12px + var(--safe-t)) 18px 12px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.headerbar .htitle {
    flex: 1;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--ink-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.headerbar .hbtn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--ink-strong);
    transition: background .2s;
}

.headerbar .hbtn:active {
    background: #f0f0f0;
}

.headerbar .hbtn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.headerbar .hbtn.copied {
    background: #e6f2df;
    color: var(--green-solid);
}

/* =========================================================
   Drawer menu
   ========================================================= */
.mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s, visibility .3s;
}

.mask.show {
    opacity: 1;
    visibility: visible;
}

.drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 68%;
    max-width: 280px;
    background: #ffffff;
    z-index: 201;
    padding: 20px 30px;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform .3s ease;
    box-shadow: 0 0 24px rgba(0, 0, 0, .12);
}

.drawer.open {
    transform: translateX(0);
}

.drawer-close {
    display: block;
    font-size: 28px;
    font-weight: 600;
    line-height: 1;
    margin-bottom: 20px;
    color: var(--ink-strong);
}

.drawer-nav {
    display: flex;
    flex-direction: column;
}

.drawer-nav a {
    padding: 12px 0;
    font-size: 16px;
    font-weight: 500;
    color: #212121;
    border-bottom: 1px solid #f4f4f4;
}

.drawer-nav a.active {
    color: var(--green-solid);
    font-weight: 600;
}

/* =========================================================
   Blocks & section titles
   ========================================================= */
main {
    padding-bottom: 8px;
}

.block {
    margin-bottom: 15px;
}

.sortTitle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 15px;
}

.sortTitle h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--ink-strong);
}

.sortTitle .more {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}

/* =========================================================
   Horizontal carousels (Popular / Recently Played)
   ========================================================= */
.carousel {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 15px 6px;
}

.carousel::-webkit-scrollbar {
    display: none;
}

.carousel.pop {
    padding-top: 20px;
}

.pop-card {
    flex: 0 0 154px;
    scroll-snap-align: start;
    display: block;
    border-radius: 10px;
    padding: 15px 10px;
    color: #fff;
}

.pop-card:nth-child(odd) {
    background: var(--green);
}

.pop-card:nth-child(even) {
    background: var(--green-2);
}

.pop-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, .12);
}

.pop-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .3s ease;
}

.pop-thumb.is-loaded img {
    opacity: 1;
}

.pop-card h3 {
    color: #fff;
    font-size: 14px;
    font-weight: 400;
    padding-top: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pop-plays {
    display: inline-block;
    font-size: 12px;
    color: var(--accent);
}

.carousel.recent {
    gap: 8px;
}

.recent-card {
    flex: 0 0 54px;
    scroll-snap-align: start;
    width: 54px;
    height: 54px;
    border-radius: 12px;
    overflow: hidden;
    background: #f2f2f2;
}

.recent-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================================================
   Compact 3-column game grid
   ========================================================= */
.game-list {
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

.game-list li {
    width: calc((100% - 30px) / 3);
    margin-bottom: 15px;
}

.game-list.cols-2 li {
    width: calc((100% - 15px) / 2);
}

.game-list li a {
    display: block;
}

.game-list .thumb {
    aspect-ratio: 1 / 1;
    border-radius: var(--radius);
    overflow: hidden;
    background: #f2f2f2;
}

.game-list .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .3s ease;
}

.game-list .thumb.is-loaded img {
    opacity: 1;
}

.game-list li h3 {
    text-align: center;
    line-height: 18px;
    max-height: 36px;
    margin-top: 6px;
    font-size: 14px;
    font-weight: 400;
    color: rgba(71, 74, 79, .87);
    overflow: hidden;
}

.game-list li p {
    font-size: 12px;
    color: var(--muted-2);
    text-align: center;
}

/* =========================================================
   About / description block
   ========================================================= */
.about {
    padding-bottom: 10px;
}

.about p {
    padding: 0 15px;
    font-size: 14px;
    line-height: 22px;
    color: #4a4a4a;
    text-align: justify;
}

/* =========================================================
   Ads
   ========================================================= */
.ad-slot {
    display: block;
    width: 100%;
    max-width: var(--maxw);
    margin: 18px auto;
    text-align: center;
    overflow: hidden;
}

.ad-slot.is-empty {
    display: none;
}

.ad-slot>ins {
    display: block;
    width: 100%;
    min-height: 250px;
}

ins.adsbygoogle[data-ad-status="unfilled"] {
    display: none !important;
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
    text-align: center;
    padding: 20px 15px calc(30px + var(--safe-b));
    color: var(--muted);
}

.site-footer .foot {
    font-size: 16px;
    font-weight: 600;
    color: #555;
}

.site-footer .foot_link {
    margin-top: 8px;
    font-size: 14px;
    line-height: 20px;
}

.site-footer .foot_link a {
    color: var(--link);
}

.site-footer .copy {
    margin-top: 8px;
    font-size: 13px;
}

/* =========================================================
   Notice / empty states
   ========================================================= */
.notice {
    padding: 40px 15px;
    text-align: center;
    color: var(--muted);
}

.notice h1 {
    font-size: 22px;
    color: var(--ink-strong);
    margin-bottom: 10px;
}

.notice a {
    color: var(--green-solid);
}

/* =========================================================
   Page banner (policy / type headers)
   ========================================================= */
.page-banner {
    padding: 26px 0 18px;
    background: linear-gradient(180deg, #f6faf3 0%, #ffffff 100%);
    text-align: center;
}

.page-banner h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--ink-strong);
}

.page-banner p {
    margin-top: 6px;
    font-size: 14px;
    color: var(--muted);
}

.section {
    padding: 0 0 20px;
}

/* ---- Policy content ---- */
.policy {
    padding: 0 15px;
    color: #444;
}

.policy h1 {
    font-size: 20px;
    margin: 20px 0 12px;
    color: var(--ink-strong);
    line-height: 1.3;
}

.policy h2 {
    font-size: 17px;
    margin: 22px 0 10px;
    color: var(--ink-strong);
}

.policy h3 {
    font-size: 15px;
    margin: 18px 0 8px;
    color: var(--ink-strong);
}

.policy p,
.policy li {
    font-size: 14px;
    line-height: 24px;
    margin-bottom: 12px;
}

.policy ul,
.policy ol {
    padding-left: 20px;
    margin-bottom: 12px;
}

.policy ul li {
    list-style: disc;
}

.policy ol li {
    list-style: decimal;
}

.policy a {
    color: var(--green-solid);
    word-break: break-word;
}

/* =========================================================
   Detail page
   ========================================================= */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 15px 4px;
    font-size: 13px;
    color: var(--muted);
}

.breadcrumb a {
    color: var(--muted);
}

.breadcrumb .current {
    color: var(--ink-strong);
}

.game-detail {
    padding: 12px 15px 4px;
}

.game-detail .cover {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    border-radius: var(--radius);
    overflow: hidden;
    background: #f2f2f2;
}

.game-detail .cover img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.game-detail .info {
    padding-top: 14px;
}

.game-detail .info h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--ink-strong);
    line-height: 1.3;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    font-size: 13px;
    color: var(--muted);
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: #eef5e9;
    color: var(--green-solid);
    font-weight: 600;
}

.stat b {
    color: var(--ink-strong);
}

.desc {
    font-size: 14px;
    line-height: 24px;
    color: #4a4a4a;
    margin: 12px 0 16px;
}

.play-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 30px;
    border-radius: 999px;
    background: var(--green-solid);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(46, 106, 19, .28);
}

.play-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.play-btn:active {
    transform: scale(.97);
}

/* =========================================================
   Play page
   ========================================================= */
.play-body {
    max-width: none;
    background: #171a21;
}

.play-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

.play-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: calc(10px + var(--safe-t)) 14px 10px;
    background: #1f2430;
    color: #fff;
}

.play-bar .back,
.play-bar .fs {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
}

.play-bar .back svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.play-bar .title {
    flex: 1;
    text-align: center;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-frame {
    position: relative;
    flex: 1;
    background: #000;
}

.game-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.frame-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #aaa;
    background: #171a21;
    z-index: 2;
}

.frame-loading img {
    width: 40px;
    height: 40px;
}

.frame-loading.hide {
    display: none;
}

.play-ad {
    background: #10131a;
    margin: 0 auto;
    padding: 12px 0;
}

.play-ad ins {
    display: block;
    width: 100%;
    min-height: 0;
}

/* =========================================================
   In-grid ad row (rendered inside .game-list)
   ========================================================= */
.game-list li.game-ad {
    width: 100%;
    margin-bottom: 15px;
}

.game-list li.game-ad ins {
    display: block;
    width: 100%;
    min-height: 100px;
}
