:root {
    --bg: #1a1b1e;
    --bg2: #212226;
    --bg3: #2a2b30;
    --card: #252629;
    --border: #35373d;
    --accent: #f5c518;
    --accent2: #ffd84d;
    --accent3: #ff5c5c;
    --purple: #9b8fff;
    --text: #f0f0f0;
    --muted: #8a8f99;
    --radius: 10px;
    --font: 'DM Sans', sans-serif;
    --font2: 'DM Sans', sans-serif;
    --nav-h: 56px;
    --mob-nav-h: 56px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

html {
    scroll-behavior: smooth;
    height: -webkit-fill-available
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent
}

a {
    color: inherit;
    text-decoration: none
}

button {
    cursor: pointer;
    font-family: var(--font);
    touch-action: manipulation
}

input,
textarea,
select {
    font-family: var(--font);
    color: var(--text)
}

::-webkit-scrollbar {
    width: 4px
}

::-webkit-scrollbar-track {
    background: var(--bg)
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px
}

.page {
    display: none
}

.page.active {
    display: block
}

img {
    max-width: 100%;
    display: block
}

/* ===== NAVBAR ===== */
nav {
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(26, 27, 30, .97);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--nav-h)
}

.nav-logo {
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 1
}

.nav-search {
    flex: 1;
    max-width: 380px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color .2s;
    min-width: 0
}

.nav-search:focus {
    border-color: var(--accent2)
}

.nav-spacer {
    flex: 1
}

.nav-btn {
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    transition: all .2s;
    cursor: pointer;
    white-space: nowrap;
    min-height: 36px
}

.nbg {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text)
}

.nbg:hover,
.nbg:active {
    border-color: var(--accent2);
    color: var(--accent2)
}

.nbp {
    background: linear-gradient(135deg, #f5c518, #ffd84d);
    color: #111;
    font-weight: 700
}

.nbp:hover,
.nbp:active {
    opacity: .85
}

.nbd {
    background: transparent;
    border: 1px solid var(--accent3);
    color: var(--accent3)
}

.nbd:hover {
    background: rgba(255, 92, 92, .08)
}

/* hamburger (mobile only) */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg3);
    flex-shrink: 0;
    cursor: pointer
}

.hamburger span {
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all .3s
}

.hamburger.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px)
}

.hamburger.open span:nth-child(2) {
    opacity: 0
}

.hamburger.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px)
}

/* avatar */
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    color: #fff;
    flex-shrink: 0
}

.user-menu {
    position: relative
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 200px;
    overflow: hidden;
    z-index: 500;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .5)
}

.user-menu:hover .user-dropdown,
.user-menu.open .user-dropdown {
    display: block
}

.user-dropdown a {
    display: block;
    padding: 11px 16px;
    font-size: 14px;
    transition: background .15s;
    cursor: pointer
}

.user-dropdown a:hover,
.user-dropdown a:active {
    background: var(--bg3)
}

.user-dropdown .sep {
    border-top: 1px solid var(--border)
}

.udinfo {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border)
}

.udname {
    font-weight: 700;
    font-size: 14px
}

.udemail {
    font-size: 12px;
    color: var(--muted)
}

.rbadge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 4px;
    text-transform: uppercase
}

.rp {
    background: rgba(245, 197, 24, .12);
    color: var(--accent)
}

.rd {
    background: rgba(155, 143, 255, .12);
    color: var(--purple)
}

.ra {
    background: rgba(255, 92, 92, .12);
    color: var(--accent3)
}

/* mobile search bar row */
.mob-search-bar {
    display: none;
    padding: 8px 16px;
    background: rgba(26, 27, 30, .97);
    border-bottom: 1px solid var(--border)
}

.mob-search-bar .nav-search {
    max-width: 100%;
    width: 100%
}

/* ===== MOBILE DRAWER (slide-in sidebar) ===== */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, .65);
    touch-action: none
}

.drawer-overlay.open {
    display: block
}

.drawer {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: var(--bg2);
    z-index: 400;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
    overflow-y: auto;
    border-right: 1px solid var(--border);
    padding-bottom: 80px
}

.drawer.open {
    transform: translateX(0)
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 8px
}

.drawer-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer
}

.drawer-section {
    padding: 0 12px 12px
}

.drawer-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--muted);
    text-transform: uppercase;
    padding: 10px 8px 4px;
    display: block
}

.drawer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    color: var(--muted)
}

.drawer-item:hover,
.drawer-item:active {
    background: var(--border);
    color: var(--text)
}

.drawer-item.active {
    background: rgba(245, 197, 24, .08);
    color: var(--accent);
    font-weight: 600
}

.drawer-icon {
    font-size: 17px;
    width: 22px;
    text-align: center
}

.drawer-sep {
    border-top: 1px solid var(--border);
    margin: 8px 12px
}

.drawer-account {
    padding: 14px 12px
}

.drawer-account-btn {
    display: block;
    width: 100%;
    padding: 11px 14px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--border);
    cursor: pointer;
    margin-bottom: 8px;
    transition: all .2s;
    text-align: center;
    background: var(--bg3);
    color: var(--text);
    font-family: var(--font)
}

/* ===== MOBILE BOTTOM NAV ===== */
.mob-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: rgba(26, 27, 30, .98);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    height: calc(var(--mob-nav-h) + env(safe-area-inset-bottom));
    padding: 0 4px env(safe-area-inset-bottom);
    align-items: flex-start
}

.mbn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 8px;
    transition: all .15s;
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    border: none;
    background: none;
    -webkit-appearance: none
}

.mbn-item:active {
    background: rgba(255, 255, 255, .04)
}

.mbn-item.active {
    color: var(--accent)
}

.mbn-icon {
    font-size: 20px;
    line-height: 1
}

/* ===== LAYOUT ===== */
.layout {
    display: flex;
    min-height: calc(100vh - var(--nav-h))
}

.sidebar {
    width: 210px;
    flex-shrink: 0;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: var(--nav-h);
    height: calc(100vh - var(--nav-h));
    overflow-y: auto
}

.sidebar-section {
    padding: 0 12px 12px
}

.slabel {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--muted);
    text-transform: uppercase;
    padding: 8px 8px 4px;
    display: block
}

.sitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    color: var(--muted)
}

.sitem:hover {
    background: var(--border);
    color: var(--text)
}

.sitem.active {
    background: rgba(245, 197, 24, .08);
    color: var(--accent);
    font-weight: 600
}

.sicon {
    font-size: 17px;
    width: 22px;
    text-align: center
}

.main {
    flex: 1;
    padding: 20px 20px 80px;
    overflow: hidden;
    min-width: 0;
    overflow-x: hidden
}

/* ===== HERO ===== */
.hero {
    background: linear-gradient(135deg, #23252a, #1e2024, #252830);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 32px 28px;
    position: relative;
    overflow: hidden;
    margin-bottom: 28px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .3)
}

.hero::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(245, 197, 24, .08), transparent 70%);
    border-radius: 50%
}

.htag {
    display: inline-block;
    background: rgba(245, 197, 24, .1);
    border: 1px solid rgba(245, 197, 24, .35);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 14px;
    text-transform: uppercase
}

.hero h1 {
    font-family: var(--font);
    font-size: 36px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #f0f0f0 30%, #f5c518);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px
}

.hero p {
    font-size: 15px;
    color: var(--muted);
    max-width: 500px;
    line-height: 1.7;
    margin-bottom: 22px
}

.hbtns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap
}

.btn {
    padding: 10px 22px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 14px;
    border: none;
    transition: all .2s;
    cursor: pointer;
    touch-action: manipulation
}

.btn-p {
    background: linear-gradient(135deg, #f5c518, #ffd84d);
    color: #111;
    font-weight: 700
}

.btn-p:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(245, 197, 24, .3)
}

.btn-p:active {
    transform: scale(.97);
    opacity: .85
}

.btn-s {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text)
}

.btn-s:hover {
    border-color: var(--accent2);
    color: var(--accent2)
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px
}

/* ===== SECTIONS ===== */
.sec {
    margin-bottom: 28px
}

.sech {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px
}

.sect {
    font-family: var(--font);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.2px
}

/* ===== FEATURED ===== */
.feat-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px
}

.feat-main {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition: all .2s
}

.feat-main:hover {
    border-color: var(--accent2);
    transform: translateY(-2px)
}

.feat-main:active {
    transform: scale(.98)
}

.feat-thumb {
    width: 100%;
    aspect-ratio: 16/7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 70px
}

.feat-info {
    padding: 14px 16px
}

.feat-info h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px
}

.feat-info p {
    font-size: 13px;
    color: var(--muted)
}

.feat-side {
    display: flex;
    flex-direction: column;
    gap: 10px
}

.feat-side-card {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px
}

.feat-side-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px)
}

.feat-side-card:active {
    transform: translateY(0)
}

.feat-side-thumb {
    width: 64px;
    height: 54px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2a2d35, #30333d);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0
}

.feat-side-info h4 {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 2px
}

.feat-side-info p {
    font-size: 12px;
    color: var(--muted)
}

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-bottom: 18px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none
}

.filter-bar::-webkit-scrollbar {
    display: none
}

.fchip {
    padding: 7px 16px;
    border-radius: 20px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    flex-shrink: 0
}

.fchip:hover {
    border-color: var(--accent2);
    color: var(--accent2)
}

.fchip:active {
    transform: scale(.95)
}

.fchip:active {
    transform: scale(.96)
}

.fchip.active {
    background: rgba(245, 197, 24, .1);
    border-color: var(--accent);
    color: var(--accent)
}

/* ===== GAME GRID ===== */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 14px
}

.game-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all .2s;
    -webkit-tap-highlight-color: transparent
}

.game-card:active {
    transform: scale(.97);
    opacity: .9
}

.game-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .5), 0 0 0 1px rgba(245, 197, 24, .15)
}

.game-card:active {
    transform: translateY(-1px)
}

.gthumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, var(--bg3), var(--border));
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px
}

.play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 20, 50, .4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s
}

.game-card:hover .play-overlay {
    opacity: 1
}

.play-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: #111
}

.ginfo {
    padding: 9px 11px 11px
}

.gname {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.gmeta {
    display: flex;
    align-items: center;
    gap: 8px
}

.gcat {
    font-size: 11px;
    color: var(--muted);
    background: var(--bg3);
    padding: 2px 7px;
    border-radius: 4px
}

.grat {
    font-size: 11px;
    color: #d4a800;
    margin-left: auto
}

.gbadge {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase
}

.bh {
    background: var(--accent3);
    color: #fff
}

.bn {
    background: var(--accent);
    color: #111
}

.bt {
    background: var(--purple);
    color: #fff
}

/* ===== CATEGORIES ===== */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    overflow-x: hidden
}

.cat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 10px;
    text-align: center;
    cursor: pointer;
    transition: all .2s
}

.cat-card:hover {
    border-color: var(--accent2);
    transform: translateY(-2px)
}

.cat-card:active {
    transform: scale(.95)
}

.cat-icon {
    font-size: 26px;
    margin-bottom: 7px
}

.cat-name {
    font-size: 12px;
    font-weight: 600
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap
}

.pgb {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 7px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s
}

.pgb.active {
    background: var(--accent);
    color: #111;
    border-color: var(--accent);
    font-weight: 700
}

.pgb:hover:not(.active) {
    border-color: var(--accent2);
    color: var(--accent2)
}

/* ===== PLAYER PAGE — CrazyGames immersive style ===== */
/* Full-screen game container */
.player-page-wrap {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--nav-h));
    background: var(--bg)
}

/* Top bar: breadcrumb + game title + controls */
.player-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    min-height: 52px;
    flex-shrink: 0
}

.player-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    flex-shrink: 0
}

.player-back:hover {
    border-color: var(--accent);
    color: var(--accent)
}

.player-topbar-title {
    font-size: 15px;
    font-weight: 700;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.player-ctrl-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0
}

.ctrl-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent
}

.ctrl-btn:hover,
.ctrl-btn:active {
    border-color: var(--accent);
    color: var(--accent)
}

.ctrl-btn.liked {
    background: rgba(245, 197, 24, .1);
    border-color: var(--accent);
    color: var(--accent)
}

/* Main content area: game + sidebar */
.player-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden
}

/* Game viewport — takes all available width */
.game-viewport {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #000
}

/* The actual iframe wrapper — fills all available height */
.game-stage {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
    min-height: calc(100vh - var(--nav-h) - 52px)
}

.game-stage iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block
}

.game-stage .game-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    padding: 32px;
    text-align: center
}

/* Game action bar below the game */
.game-action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    flex-shrink: 0
}

.like-btn {
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all .2s;
    min-height: 34px;
    -webkit-tap-highlight-color: transparent
}

.like-btn:hover {
    border-color: var(--accent2)
}

.like-btn.liked {
    background: rgba(245, 197, 24, .1);
    border-color: var(--accent);
    color: var(--accent)
}

.game-views {
    margin-left: auto;
    font-size: 12px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 4px
}

/* Right sidebar — game info + related */
.player-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--bg2);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column
}

.player-sidebar-inner {
    padding: 16px;
    flex: 1
}

.game-info-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px
}

.game-info-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px
}

.gdesc {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.7
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px
}

.tag {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 6px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    transition: all .15s
}

.tag:hover {
    border-color: var(--accent);
    color: var(--accent)
}

.related-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text)
}

.related-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all .15s;
    border: 1px solid transparent
}

.related-card:hover {
    background: var(--card);
    border-color: var(--border)
}

.related-card:active {
    transform: scale(.97)
}

.related-thumb {
    width: 52px;
    height: 44px;
    border-radius: 7px;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0
}

.related-info-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.related-info-meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px
}

/* Fullscreen overlay mode */
.game-stage.fullscreen-native {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9900 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: #000;
    border-radius: 0 !important
}

.game-stage.fullscreen-native iframe,
.game-stage.fullscreen-native>div {
    border-radius: 0 !important
}

/* Expand/Theatre mode button states */
.theatre-mode .player-sidebar {
    display: none !important
}

.theatre-mode .game-stage {
    min-height: calc(100vh - var(--nav-h) - 52px - 48px)
}

/* ===== PORTAL / DEV ===== */
.portal-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px
}

.portal-layout {
    display: flex;
    min-height: calc(100vh - var(--nav-h))
}

.portal-sidebar {
    width: 210px;
    flex-shrink: 0;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    padding: 16px 0
}

.portal-main {
    flex: 1;
    padding: 28px 28px 80px;
    overflow: auto;
    min-width: 0
}

.pnav {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    color: var(--muted);
    margin: 1px 8px;
    border-radius: 8px
}

.pnav:hover,
.pnav:active {
    background: var(--border);
    color: var(--text)
}

.pnav.active {
    background: rgba(245, 197, 24, .08);
    color: var(--accent)
}

.psec {
    display: none
}

.psec.active {
    display: block
}

.ptxt {
    font-family: var(--font);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.3px
}

.psub {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 22px
}

/* ===== STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px
}

.slabel2 {
    font-size: 11px;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 6px
}

.sval {
    font-family: var(--font);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px
}

.schg {
    font-size: 12px;
    margin-top: 4px
}

.sup {
    color: #f5c518
}

.sdown {
    color: var(--accent3)
}

/* ===== FORMS ===== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px
}

.fg {
    display: flex;
    flex-direction: column;
    gap: 5px
}

.fg.full {
    grid-column: 1/-1
}

.flabel {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px
}

.finput {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
    width: 100%;
    color: var(--text)
}

.finput:focus {
    border-color: var(--accent2)
}

textarea.finput {
    resize: vertical;
    min-height: 90px
}

/* ===== TABLES ===== */
.table-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: auto
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 480px
}

thead th {
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    background: var(--bg3);
    border-bottom: 1px solid var(--border);
    white-space: nowrap
}

tbody td {
    padding: 11px 14px;
    font-size: 14px;
    border-bottom: 1px solid var(--border)
}

tbody tr:last-child td {
    border-bottom: none
}

tbody tr:hover {
    background: rgba(255, 255, 255, .02)
}

.tdact {
    display: flex;
    gap: 6px
}

.sbadge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap
}

.slive {
    background: rgba(76, 200, 100, .12);
    color: #4cc864
}

.spending {
    background: rgba(255, 180, 0, .1);
    color: #e09000
}

.srejected {
    background: rgba(255, 92, 92, .12);
    color: var(--accent3)
}

.tb {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap
}

.tbe {
    background: rgba(245, 197, 24, .1);
    color: var(--accent)
}

.tbe:hover {
    background: rgba(245, 197, 24, .18)
}

.tbd {
    background: rgba(255, 92, 92, .1);
    color: var(--accent3)
}

.tbd:hover {
    background: rgba(255, 92, 92, .2)
}

/* ===== CHIPS ===== */
.chip {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center
}

.chip-blue {
    background: rgba(245, 197, 24, .12);
    color: var(--accent)
}

.chip-purple {
    background: rgba(155, 143, 255, .12);
    color: var(--purple)
}

.chip-red {
    background: rgba(255, 92, 92, .12);
    color: var(--accent3)
}

/* ===== UPLOAD ===== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 14px;
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    margin-bottom: 20px
}

.upload-area:hover {
    border-color: var(--accent2);
    background: rgba(245, 197, 24, .03)
}

.upload-icon {
    font-size: 42px;
    margin-bottom: 10px
}

.upload-text {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px
}

.upload-hint {
    font-size: 12px;
    color: var(--muted)
}

/* ===== CHART ===== */
.chart-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 18px
}

.chart-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 90px
}

.bar {
    flex: 1;
    background: linear-gradient(to top, #f5c518, rgba(245, 197, 24, .25));
    border-radius: 4px 4px 0 0;
    transition: all .3s
}

.bar:hover {
    filter: brightness(1.1)
}

.chart-labels {
    display: flex;
    gap: 6px;
    margin-top: 6px
}

.chart-label {
    flex: 1;
    text-align: center;
    font-size: 10px;
    color: var(--muted)
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, .8);
    align-items: flex-end;
    justify-content: center;
    padding: 0
}

.modal-overlay.open {
    display: flex
}

.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    padding: 28px 24px 36px;
    width: 100%;
    max-width: 480px;
    position: relative;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, .6);
    max-height: 90vh;
    overflow-y: auto
}

.modal h2 {
    font-family: var(--font);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px
}

.modal p {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 18px
}

.mclose {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center
}

.mlink {
    color: var(--accent2);
    font-size: 13px;
    text-align: center;
    display: block;
    margin-top: 14px;
    cursor: pointer
}

.mlink:hover {
    text-decoration: underline
}

.mg {
    margin-bottom: 12px
}

.mg label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 5px
}

.errmsg {
    color: var(--accent3);
    font-size: 13px;
    margin-bottom: 10px;
    font-weight: 600;
    display: none
}

.errmsg.show {
    display: block
}

.acchint {
    background: rgba(245, 197, 24, .06);
    border: 1px solid rgba(245, 197, 24, .18);
    border-radius: 10px;
    padding: 13px 15px;
    font-size: 13px;
    line-height: 1.9;
    margin-bottom: 18px;
    color: var(--text)
}

/* Modal pull indicator */
.modal::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 20px;
    flex-shrink: 0
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 72px;
    right: 16px;
    left: 16px;
    z-index: 9999;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 13px 18px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
    transform: translateY(80px);
    opacity: 0;
    transition: all .3s;
    text-align: center
}

.toast.show {
    transform: translateY(0);
    opacity: 1
}

.toast.success {
    border-color: var(--accent)
}

.toast.error {
    border-color: var(--accent3)
}

/* ===== ADMIN ===== */
.admin-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    flex-wrap: wrap;
    background: rgba(255, 92, 92, .05);
    border-bottom: 1px solid rgba(255, 92, 92, .18)
}

.rev-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 12px;
    flex-wrap: wrap
}

/* ===== TOGGLE ===== */
.toggle {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--muted);
    transition: all .2s
}

.toggle.on {
    background: rgba(245, 197, 24, .12);
    color: var(--accent);
    border-color: var(--accent)
}

/* ===========================
   RESPONSIVE BREAKPOINTS
   =========================== */

/* Tablet (768px - 1023px) */
@media(max-width:1023px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr
    }

    .portal-sidebar {
        width: 180px
    }

    .portal-main {
        padding: 20px
    }

    .feat-grid {
        grid-template-columns: 3fr 2fr
    }
}

/* Mobile (max 767px) */
@media(max-width:767px) {
    :root {
        --nav-h: 52px
    }

    /* Nav */
    nav {
        padding: 0 14px;
        gap: 8px
    }

    .nav-search {
        display: none
    }

    .hamburger {
        display: flex
    }

    .nav-btn.nbg:not(#devNavBtn):not(#adminNavBtn) {
        display: none !important
    }

    #navGuest .nav-btn:first-child {
        display: none !important
    }

    #navGuest .nav-btn:last-child {
        padding: 7px 14px;
        font-size: 12px
    }

    #devNavBtn,
    #adminNavBtn {
        display: none !important
    }

    .mob-search-bar {
        display: block
    }

    /* Layout */
    .sidebar {
        display: none
    }

    .main {
        padding: 14px 14px calc(80px + env(safe-area-inset-bottom));
        overflow-x: hidden
    }

    /* Hero */
    .hero {
        padding: 24px 18px;
        margin-bottom: 20px;
        border-radius: 12px
    }

    .hero h1 {
        font-size: 26px
    }

    .hero p {
        font-size: 14px;
        margin-bottom: 18px
    }

    .hbtns {
        gap: 8px
    }

    .btn {
        padding: 10px 18px;
        font-size: 13px
    }

    .htag {
        font-size: 10px;
        margin-bottom: 12px
    }

    /* Featured */
    .feat-grid {
        grid-template-columns: 1fr;
        gap: 10px
    }

    .feat-side {
        flex-direction: row;
        gap: 10px
    }

    .feat-side-card {
        flex: 1
    }

    .feat-thumb {
        font-size: 50px
    }

    /* Game grid */
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px
    }

    .gthumb {
        font-size: 30px
    }

    /* Categories */
    .cat-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px
    }

    .cat-card {
        padding: 12px 8px
    }

    .cat-icon {
        font-size: 22px;
        margin-bottom: 5px
    }

    .cat-name {
        font-size: 11px
    }

    /* Player (mobile): full screen layout */
    .player-topbar {
        min-height: 44px;
        flex-wrap: nowrap
    }

    #playerPage.active>.player-page-wrap {
        height: 100vh;
        height: 100dvh
    }

    /* Sections */
    .sect {
        font-size: 16px
    }

    .sec {
        margin-bottom: 22px
    }

    /* Filter bar */
    .filter-bar {
        margin-bottom: 14px
    }

    /* Portal */
    .portal-layout {
        flex-direction: column
    }

    .portal-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 8px 0;
        display: flex;
        overflow-x: auto;
        scrollbar-width: none
    }

    .portal-sidebar::-webkit-scrollbar {
        display: none
    }

    .portal-main {
        padding: 16px 14px 80px
    }

    .pnav {
        padding: 8px 14px;
        margin: 0 4px;
        white-space: nowrap;
        flex-shrink: 0
    }

    .ptxt {
        font-size: 20px
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr
    }

    .form-grid {
        grid-template-columns: 1fr
    }

    .fg.full {
        grid-column: 1
    }

    /* Admin */
    .admin-topbar {
        padding: 10px 14px
    }

    .rev-card {
        flex-direction: column
    }

    /* Modal bottom sheet */
    .modal-overlay {
        align-items: flex-end
    }

    .modal {
        border-radius: 20px 20px 0 0;
        max-height: 88vh
    }

    /* Toast */
    .toast {
        bottom: calc(68px + env(safe-area-inset-bottom));
        right: 12px;
        left: 12px;
        font-size: 13px
    }

    /* Bottom nav show */
    .mob-bottom-nav {
        display: flex
    }

    /* Player page: hide bottom nav to maximise game space */
    #playerPage.active~* .mob-bottom-nav,
    body:has(#playerPage.active) .mob-bottom-nav {
        display: none !important
    }

    /* Player page: game-stage height full on mobile (no bottom nav) */
    #playerPage.active .game-stage {
        height: 60vw;
        min-height: 240px
    }
}


/* Small phones */
@media(max-width:390px) {
    .game-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .cat-grid {
        grid-template-columns: repeat(3, 1fr)
    }

    .hero h1 {
        font-size: 23px
    }

    .feat-side {
        flex-direction: column
    }
}

/* Desktop adjustments */
@media(min-width:1200px) {
    .main {
        padding: 28px 32px 60px
    }

    .hero h1 {
        font-size: 42px
    }

    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(175px, 1fr))
    }

    .toast {
        left: auto;
        right: 24px;
        bottom: 28px;
        text-align: left
    }
}

/* ===== SETTINGS CARDS ===== */
.settings-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 18px
}

.settings-card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0
}

/* ===== VISUAL CUSTOMIZER ===== */
.vc-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 12px
}

.color-pickers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px
}

@media(max-width:600px) {
    .color-pickers-grid {
        grid-template-columns: 1fr
    }
}

.cp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    gap: 10px
}

.cp-row label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    flex: 1;
    min-width: 0
}

.cp-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0
}

.cp-inner input[type=color] {
    width: 36px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: none;
    padding: 0;
    outline: none
}

.cp-inner span {
    font-size: 11px;
    color: var(--muted);
    font-family: monospace;
    min-width: 56px
}

.color-preset {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg3);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    transition: all .15s
}

.color-preset span {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, .1)
}

.color-preset.active,
.color-preset:hover {
    border-color: var(--accent);
    color: var(--accent)
}

.icon-editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px
}

.icon-editor-item {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all .15s
}

.icon-editor-item:hover {
    border-color: var(--accent)
}

.icon-editor-item .ie-emoji {
    font-size: 26px;
    line-height: 1
}

.icon-editor-item .ie-label {
    font-size: 11px;
    color: var(--muted);
    text-align: center
}

.icon-editor-item input {
    width: 100%;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 18px;
    text-align: center;
    color: var(--text);
    outline: none
}

.icon-editor-item input:focus {
    border-color: var(--accent)
}

/* ===== PLAYER PAGE: fullscreen nav override ===== */
#playerPage.active>.player-page-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--nav-h));
    height: calc(100dvh - var(--nav-h));
    overflow: hidden
}

.player-content {
    display: flex;
    flex: 1;
    min-height: 0
}

.game-viewport {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #000;
    overflow: hidden
}

.game-stage {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
    min-height: 200px
}

.game-stage iframe,
.game-stage>div {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none
}

.game-stage>div {
    overflow: auto
}

/* Theatre mode: hide sidebar */
.theatre-mode .player-sidebar {
    display: none !important
}

/* Mobile: sidebar below game */
@media(max-width:900px) {
    .player-sidebar {
        width: 100%;
        max-height: 260px;
        border-left: none;
        border-top: 1px solid var(--border)
    }

    .player-content {
        flex-direction: column
    }

    #playerPage.active>.player-page-wrap {
        height: auto;
        overflow: visible
    }

    .game-stage {
        min-height: 260px;
        flex: none;
        height: 56vw
    }

    .game-viewport {
        flex: none
    }
}

@media(max-width:600px) {
    .game-stage {
        height: 62vw;
        min-height: 220px
    }

    .player-topbar {
        padding: 8px 10px;
        gap: 6px;
        min-height: 44px
    }

    .player-topbar-title {
        font-size: 13px
    }

    .ctrl-btn {
        width: 32px;
        height: 32px;
        font-size: 13px
    }

    .player-back {
        padding: 5px 10px;
        font-size: 12px
    }
}