/* ============================================================
   Readmtlnovels Hub template - "Neon Arcade" dark theme.
   Layout: top ad band -> featured hero -> game sections.
   Ad slots: index 300x250 above-the-fold + 320x50 bottom anchor,
   detail 300x250 above-the-fold. Fully responsive.
   ============================================================ */

:root {
    --bg: #0b1c0d;
    --bg-2: #102a15;
    --surface: #15302b;
    --surface-2: #1b4040;
    --line: rgba(148, 220, 179, 0.14);
    --line-strong: rgba(148, 215, 220, 0.26);
    --ink: #eefbf3;
    --ink-2: #9ac8ba;
    --ink-3: #6b998a;
    --cyan: #22eeb5;
    --cyan-deep: #08b277;
    --violet: #5cf674;
    --violet-deep: #28d9ad;
    --magenta: #3ff446;
    --lime: #35e6d5;
    --grad-hot: linear-gradient(135deg, var(--violet) 0%, #46e5d8 55%, var(--cyan) 130%);
    --grad-cta: linear-gradient(135deg, #06d490 0%, #63f1c7 100%);
    --grad-logo: linear-gradient(92deg, #67e3f9 10%, #a5fcab 55%, #abfceb 100%);
    --glow-cyan: rgba(34, 238, 208, 0.35);
    --glow-violet: rgba(92, 246, 246, 0.35);
    --shadow-sm: 0 4px 14px rgba(2, 23, 4, 0.5);
    --shadow-md: 0 12px 30px rgba(2, 21, 23, 0.55);
    --shadow-lg: 0 24px 56px rgba(2, 23, 12, 0.65);
    --radius: 12px;
    --radius-lg: 18px;
    --ease: cubic-bezier(0.22, 0.7, 0.3, 1);
    --font-body: 'Segoe UI', -apple-system, 'Helvetica Neue', Arial, sans-serif;
    --content-width: 1280px;
    --grid-columns: 6;
    --grid-gap: 14px;
    --thumb-grad-1: linear-gradient(150deg, #234d3e 0%, #16383f 100%);
    --thumb-grad-2: linear-gradient(150deg, #1f4d21 0%, #163f1a 100%);
    --thumb-grad-3: linear-gradient(150deg, #124414 0%, #123d1b 100%);
    --thumb-grad-4: linear-gradient(150deg, #1f3d36 0%, #153318 100%);
    --anchor-h: 60px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { scroll-behavior: smooth; }

html, body {
    min-height: 100%;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body {
    background-image:
        radial-gradient(900px 420px at 85% -10%, rgba(139, 92, 246, 0.14), transparent 60%),
        radial-gradient(760px 380px at -10% 22%, rgba(34, 211, 238, 0.10), transparent 55%),
        radial-gradient(700px 420px at 55% 115%, rgba(79, 70, 229, 0.10), transparent 60%);
    background-attachment: fixed;
}

/* reserve space for the fixed 320x50 bottom anchor ad (home page only) */
body.has-anchor-ad { padding-bottom: var(--anchor-h); }
body.has-anchor-ad .back-to-top { bottom: calc(var(--anchor-h) + 12px); }

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

::selection { background: rgba(34, 211, 238, 0.28); color: #fff; }

:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

.page-wrapper {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------------- Header ---------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(11, 14, 28, 0.86);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 13px 20px;
    max-width: var(--content-width);
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.logo .logo-mark {
    width: 40px;
    height: 40px;
    padding: 6px;
    border-radius: 10px;
    background: var(--grad-hot);
    box-shadow: 0 4px 14px var(--glow-violet), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: transform 0.25s var(--ease);
}

.logo:hover .logo-mark { transform: rotate(-8deg) scale(1.06); }

.logo .logo-text {
    background: var(--grad-logo);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Search sits in the middle on wide screens */
.search-box {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 3px 3px 3px 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

.search-box input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    padding: 10px 16px;
    font-size: 14.5px;
    color: var(--ink);
}

.search-box input::placeholder { color: var(--ink-3); }

.search-box button {
    flex-shrink: 0;
    width: 40px;
    height: 38px;
    border: none;
    border-radius: 9px;
    background: var(--grad-cta);
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.2s ease, transform 0.2s ease;
}

.search-box button:hover { filter: brightness(1.15); }
.search-box button:active { transform: scale(0.94); }

/* ---------------- Nav strip ---------------- */
.main-nav {
    display: flex;
    align-items: stretch;
    gap: 2px;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 12px;
    border-top: 1px solid var(--line);
}

.main-nav a {
    position: relative;
    padding: 11px 15px;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
    color: var(--ink-2);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.main-nav a:hover { color: var(--ink); background: rgba(148, 163, 220, 0.06); }

.main-nav a.active {
    color: var(--cyan);
    border-bottom-color: var(--cyan);
    background: linear-gradient(180deg, transparent 55%, rgba(34, 211, 238, 0.08));
}

/* ---------------- Main ---------------- */
.site-main { padding: 22px 0 48px; }

/* ---------------- Ad slots ---------------- */
.ad-slot-300 {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 250px;
    margin: 0 0 26px;
}

.ad-slot-300 > * { width: 300px; min-height: 250px; }

/* Placeholder look until a real creative fills the slot */
.ad-slot-300:empty::before {
    content: 'ADVERTISEMENT 300 x 250';
    width: 300px;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 3px;
    background: var(--surface);
}

/* Fixed bottom anchor ad, 320x50 */
.ad-anchor-bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 5px 0;
    background: linear-gradient(180deg, rgba(11, 14, 28, 0), rgba(11, 14, 28, 0.92) 45%);
    pointer-events: none;
    min-height: var(--anchor-h);
}

.ad-anchor-bottom > * {
    pointer-events: auto;
    width: 320px;
    height: 50px;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md), 0 0 0 1px var(--line-strong);
}

/* ---------------- Featured hero ---------------- */
.featured-hero {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--grid-gap);
    margin-bottom: 34px;
}

.feat-banner {
    position: relative;
    border-radius: var(--radius-lg);
    background: var(--thumb-grad-2);
    border: 1px solid var(--line);
    overflow: hidden;
    min-height: 300px;
    display: flex;
    align-items: flex-end;
    padding: 26px;
}

.feat-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(420px 260px at 80% 0%, rgba(139, 92, 246, 0.35), transparent 65%),
        radial-gradient(360px 240px at 8% 110%, rgba(34, 211, 238, 0.22), transparent 60%);
    pointer-events: none;
}

.feat-banner-icon {
    position: absolute;
    right: 34px;
    bottom: 30px;
    width: 200px;
    height: 200px;
    object-fit: contain;
    filter: drop-shadow(0 18px 30px rgba(2, 6, 23, 0.6));
    transform: rotate(6deg);
    transition: transform 0.35s var(--ease);
}

.feat-banner:hover .feat-banner-icon { transform: rotate(2deg) scale(1.05); }

.feat-banner-badge {
    position: absolute;
    top: 18px;
    left: 18px;
    padding: 6px 13px;
    border-radius: var(--radius-full);
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid var(--line-strong);
    color: var(--cyan);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
}

.feat-info { position: relative; max-width: 58%; }

.feat-title {
    font-size: 27px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 8px;
    color: #fff;
    text-shadow: 0 2px 16px rgba(2, 6, 23, 0.65);
}

.feat-meta { margin-bottom: 16px; }

.feat-play {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 13px 30px;
    border: none;
    border-radius: var(--radius);
    background: var(--grad-cta);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.3px;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(34, 211, 238, 0.35);
    transition: transform 0.2s var(--ease), box-shadow 0.2s ease, filter 0.2s ease;
}

.feat-play::before { content: '\25B6'; font-size: 13px; }

.feat-play:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 16px 34px rgba(34, 211, 238, 0.45);
}

.feat-play:active { transform: translateY(0) scale(0.97); }

/* Trending side list */
.trend-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
}

.trend-head {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 14px;
    color: var(--ink);
}

.trend-head::before { content: '\1F525'; }

.trend-list { display: flex; flex-direction: column; gap: 8px; flex: 1; }

.trend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.trend-item:hover {
    background: var(--surface-2);
    border-color: var(--line);
}

.trend-item img {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--thumb-grad-1);
    padding: 5px;
    flex-shrink: 0;
}

.trend-item .trend-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.trend-item .trend-rank {
    margin-left: auto;
    font-size: 12px;
    font-weight: 800;
    color: var(--ink-3);
    flex-shrink: 0;
}

.trend-item:nth-child(1) .trend-rank { color: var(--cyan); }
.trend-item:nth-child(2) .trend-rank { color: var(--violet); }
.trend-item:nth-child(3) .trend-rank { color: var(--magenta); }

/* ---------------- Section headers ---------------- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 20px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: 0.2px;
}

.section-title .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    font-size: 17px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line-strong);
    color: var(--ink-2);
    font-weight: 700;
    font-size: 13px;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.view-all::after { content: '\2192'; transition: transform 0.2s var(--ease); }

.view-all:hover {
    color: var(--cyan);
    border-color: var(--cyan);
    background: rgba(34, 211, 238, 0.07);
}

.view-all:hover::after { transform: translateX(3px); }

/* ---------------- Game grid & cards ---------------- */
.games-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-columns), 1fr);
    gap: var(--grid-gap);
}

.game-card {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    overflow: hidden;
    transition: transform 0.25s var(--ease), border-color 0.25s ease, box-shadow 0.25s ease;
}

.game-card:hover {
    transform: translateY(-5px);
    border-color: rgba(34, 211, 238, 0.45);
    box-shadow: var(--shadow-md), 0 0 18px rgba(34, 211, 238, 0.12);
}

.game-card a { display: flex; flex-direction: column; height: 100%; }

.card-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: var(--thumb-grad-1);
    overflow: hidden;
}

.games-grid .game-card:nth-child(4n+2) .card-thumb { background: var(--thumb-grad-2); }
.games-grid .game-card:nth-child(4n+3) .card-thumb { background: var(--thumb-grad-3); }
.games-grid .game-card:nth-child(4n+4) .card-thumb { background: var(--thumb-grad-4); }

.card-thumb img {
    width: 76%;
    height: 76%;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(2, 6, 23, 0.55));
    transition: transform 0.3s var(--ease);
}

.game-card:hover .card-thumb img { transform: scale(1.09) rotate(-2deg); }

.card-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    padding: 11px 13px 13px;
    border-top: 1px solid var(--line);
}

.game-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-meta::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--cyan);
    flex-shrink: 0;
}

/* ---------------- Load more ---------------- */
.load-more {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.load-more button {
    padding: 13px 44px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font-size: 14.5px;
    font-weight: 800;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.load-more button:hover {
    border-color: var(--cyan);
    color: var(--cyan);
    background: rgba(34, 211, 238, 0.06);
    transform: translateY(-2px);
}

.load-more button:active { transform: translateY(0) scale(0.97); }
.load-more button:disabled { opacity: 0.45; cursor: default; transform: none; }

/* ---------------- Category page ---------------- */
.category-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 5px;
}

.category-subtitle {
    font-size: 14px;
    color: var(--ink-2);
    margin-bottom: 22px;
}

.no-results {
    text-align: center;
    padding: 70px 20px;
    color: var(--ink-2);
    font-size: 15px;
}

.no-results .view-all { margin-top: 18px; }

/* ---------------- Breadcrumbs ---------------- */
.crumbs {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--ink-3);
    margin-bottom: 16px;
}

.crumbs a {
    color: var(--cyan);
    font-weight: 700;
    transition: color 0.2s ease;
}

.crumbs a:hover { color: #7de9f8; }
.crumbs .sep { color: var(--ink-3); }

/* ---------------- Detail page ---------------- */
.game-hero {
    position: relative;
    display: flex;
    gap: 24px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 26px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.game-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(380px 200px at 100% 0%, rgba(139, 92, 246, 0.16), transparent 60%);
    pointer-events: none;
}

.game-hero-icon {
    flex-shrink: 0;
    width: 150px;
    height: 150px;
    border-radius: var(--radius-lg);
    padding: 14px;
    background: var(--thumb-grad-1);
    border: 1px solid var(--line-strong);
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-hero-icon img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 10px 20px rgba(2, 6, 23, 0.6)); }

.game-hero-info { flex: 1; display: flex; flex-direction: column; gap: 11px; min-width: 0; }

.game-hero-title {
    font-size: 27px;
    font-weight: 800;
    color: #fff;
    line-height: 1.25;
}

.game-tags { display: flex; flex-wrap: wrap; gap: 7px; }

.game-tag {
    padding: 5px 12px;
    border-radius: var(--radius-full);
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.3);
    color: var(--cyan);
    font-size: 12px;
    font-weight: 700;
}

.game-hero-des {
    font-size: 14.5px;
    color: var(--ink-2);
    max-width: 740px;
}

.play-game-btn {
    position: relative;
    align-self: flex-start;
    padding: 13px 36px;
    border: none;
    border-radius: var(--radius);
    background: var(--grad-cta);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.3px;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(34, 211, 238, 0.35);
    transition: transform 0.2s var(--ease), box-shadow 0.2s ease, filter 0.2s ease;
}

.play-game-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 16px 34px rgba(34, 211, 238, 0.45);
}

.play-game-btn:active { transform: translateY(0) scale(0.97); }

.player-panel {
    border-radius: var(--radius-lg);
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    margin-bottom: 28px;
}

.player-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    background: #05070f;
    border: 1px solid var(--line);
}

.player-frame iframe { width: 100%; height: 100%; border: none; display: block; }

.player-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    background:
        radial-gradient(480px 240px at 50% -10%, rgba(139, 92, 246, 0.4), transparent 65%),
        radial-gradient(400px 220px at 85% 110%, rgba(34, 211, 238, 0.25), transparent 60%),
        #0a0e20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--ink-2);
    font-size: 15px;
    text-align: center;
    padding: 20px;
}

.player-placeholder .big-emoji { font-size: 54px; filter: drop-shadow(0 8px 18px rgba(34, 211, 238, 0.4)); }

/* ---------------- Similar games ---------------- */
.similar-games-section { margin-top: 8px; }

.similar-games-scroll {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--grid-gap);
    margin-top: 16px;
}

.similar-game-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    overflow: hidden;
    text-align: center;
    transition: transform 0.25s var(--ease), border-color 0.25s ease;
}

.similar-game-card:hover {
    transform: translateY(-4px);
    border-color: rgba(139, 92, 246, 0.5);
}

.similar-game-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--thumb-grad-1);
    padding: 13px;
    transition: transform 0.3s var(--ease);
}

.similar-game-card:hover img { transform: scale(1.06); }

.similar-game-card .game-title {
    padding: 10px 11px 13px;
    font-size: 12.5px;
    -webkit-line-clamp: 1;
}

/* ---------------- Footer ---------------- */
.site-footer {
    background: var(--bg-2);
    border-top: 1px solid var(--line);
    padding: 38px 0 30px;
    margin-top: 40px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 30px;
    padding-bottom: 26px;
    border-bottom: 1px solid var(--line);
}

.footer-brand .logo { font-size: 19px; margin-bottom: 10px; }
.footer-brand p { font-size: 13.5px; color: var(--ink-2); max-width: 320px; }

.footer-col h4 {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 12px;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.footer-links a {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-2);
    transition: color 0.2s ease;
}

.footer-links a:hover { color: var(--cyan); }

.site-footer .footer-base {
    text-align: center;
    font-size: 12.5px;
    color: var(--ink-3);
    margin-top: 20px;
}

/* ---------------- Back to top ---------------- */
.back-to-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--cyan);
    font-size: 17px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s var(--ease), visibility 0.25s;
    box-shadow: var(--shadow-sm);
    z-index: 90;
}

.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { border-color: var(--cyan); background: var(--surface-2); }
.back-to-top:active { transform: scale(0.94); }

/* ---------------- Loading overlay ---------------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 999;
    transition: opacity 0.4s ease, visibility 0.4s;
}

.loading-overlay.hidden { opacity: 0; visibility: hidden; }

.loading-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 12px var(--glow-cyan);
    animation: dot-bounce 1.1s infinite ease-in-out;
}

.loading-dot:nth-child(2) { animation-delay: 0.16s; background: var(--violet); box-shadow: 0 0 12px var(--glow-violet); }
.loading-dot:nth-child(3) { animation-delay: 0.32s; background: var(--magenta); box-shadow: 0 0 12px rgba(244, 63, 94, 0.4); }

@keyframes dot-bounce {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.5; }
    50% { transform: translateY(-11px) scale(1.12); opacity: 1; }
}

/* ---------------- 404 / error page ---------------- */
.error-page {
    position: relative;
    text-align: center;
    padding: 90px 20px;
}

.error-page .code {
    font-size: 100px;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(120deg, var(--cyan), var(--violet) 60%, var(--magenta));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 10px 24px rgba(34, 211, 238, 0.2));
}

.error-page h2 { margin: 14px 0 6px; }
.error-page p { color: var(--ink-2); font-size: 15px; margin-bottom: 26px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1100px) {
    .games-grid, .similar-games-scroll { grid-template-columns: repeat(5, 1fr); }
    .featured-hero { grid-template-columns: 1fr 300px; }
}

@media (max-width: 992px) {
    .games-grid, .similar-games-scroll { grid-template-columns: repeat(4, 1fr); }
    .featured-hero { grid-template-columns: 1fr; }
    .feat-banner { min-height: 240px; }
    .trend-list { display: grid; grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .games-grid, .similar-games-scroll { grid-template-columns: repeat(3, 1fr); }
    .header-top { flex-wrap: wrap; }
    .search-box { order: 3; max-width: none; }
    .main-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .main-nav::-webkit-scrollbar { display: none; }
    .game-hero { flex-direction: column; align-items: center; text-align: center; }
    .game-hero-icon { width: 122px; height: 122px; }
    .play-game-btn { align-self: center; }
    .game-hero-des { max-width: none; }
    .feat-info { max-width: 100%; }
    .feat-banner-icon { width: 150px; height: 150px; opacity: 0.5; }
}

@media (max-width: 576px) {
    .games-grid { grid-template-columns: 1fr; gap: 10px; }
    .similar-games-scroll { grid-template-columns: 1fr; gap: 10px; }
    .game-card a { flex-direction: row; align-items: stretch; }
    .card-thumb { width: 106px; flex-shrink: 0; aspect-ratio: 1; padding: 9px; }
    .card-thumb img { width: 84%; height: 84%; }
    .card-info { padding: 11px 13px; justify-content: center; gap: 4px; }
    .game-title { font-size: 14.5px; -webkit-line-clamp: 1; }
    .game-meta { font-size: 10px; }
    .similar-game-card { display: flex; align-items: center; text-align: left; }
    .similar-game-card img { width: 84px; aspect-ratio: 1; padding: 9px; }
    .similar-game-card .game-title { flex: 1; padding: 11px 13px; font-size: 14px; -webkit-line-clamp: 1; }
    .section-title { font-size: 17px; }
    .section-title .icon { width: 32px; height: 32px; font-size: 15px; }
    .page-wrapper { padding: 0 14px; }
    .game-hero { padding: 20px 16px; }
    .game-hero-title { font-size: 22px; }
    .feat-title { font-size: 21px; }
    .feat-banner { padding: 20px; min-height: 200px; }
    .trend-list { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; gap: 22px; }
    .category-title { font-size: 22px; }
    .error-page .code { font-size: 72px; }
    .header-top { padding: 11px 14px; }
    .logo { font-size: 18px; gap: 8px; }
    .logo .logo-mark { width: 36px; height: 36px; padding: 5px; }
    .site-main { padding-top: 16px; }
    .ad-slot-300 { min-height: 250px; margin-bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
