/* ==========================================================================
   client - mobile (< 900px): an app shell
   fixed header (51px) + scroll area + fixed tab bar (54px)
   ========================================================================== */

:root {
    --m-head: 51px;
    --m-tab: 54px;
    --m-rail: 128px;
}

body.c2 {
    background: url('../../images/client/bg_layout.jpg') 50% 0 / cover no-repeat fixed, var(--c2-bg);
    font-size: 13px;
}

/* --- header -------------------------------------------------------------------- */
.m-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--m-head);
    padding: 0 12px 0 16px;
    background: linear-gradient(180deg, #1a1712 0%, #0d0c10 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}
.m-header::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: var(--c2-gold-line);
}
.m-login-btn {
    width: 100px;
    height: 28px;
    border-radius: 26px;
    font-size: 12px;
    font-weight: 600;
    color: #000;
    background: var(--c2-gold-grad);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .15), 0 2px 6px rgba(0, 0, 0, .4);
}
.m-user { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.m-user__name { font-size: 12px; color: var(--c2-dim); }
.m-user__balance { display: flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 700; color: var(--c2-gold-text); }
.m-user__balance i { color: var(--c2-gold-1); font-size: 12px; }

/* --- scroll area --------------------------------------------------------------- */
.c2-main {
    padding-top: var(--m-head);
    padding-bottom: calc(var(--m-tab) + var(--c2-safe-bottom));
    min-height: 100vh;
}
/* home and game list: the page does not scroll, their panels do (as an app) */
.c2-page-home .c2-main,
.c2-page-games .c2-main {
    position: fixed;
    top: var(--m-head);
    bottom: calc(var(--m-tab) + var(--c2-safe-bottom));
    left: 0;
    right: 0;
    min-height: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}
.c2-page-home .c2-main > .c2-m { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
/* the page itself must not move either: a swipe that starts outside the panels (on the
   banner, the rail edge) would otherwise bounce / pull the whole page and the background
   with it (iOS rubber band, Android pull-to-refresh). The panels keep their own scroll and
   do not hand it on to the page when they reach an end */
html:has(body.c2-page-home),
html:has(body.c2-page-games),
body.c2-page-home,
body.c2-page-games {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}
.m-games,
.c2m .are_subnav,
.c2m .blk_gamepage,
.c2m .panel_filter { overscroll-behavior: contain; }
.c2-main > .c2-m:empty { display: none; }

/* --- banner (3:1) ------------------------------------------------------------ */
.m-banner { flex: none; aspect-ratio: 3 / 1; overflow: hidden; }
.m-banner__swiper, .m-banner__swiper .swiper-slide { height: 100%; }
.m-banner img { width: 100%; height: 100%; object-fit: cover; }

/* --- lobby: category rail + games --------------------------------------------- */
.m-lobby { flex: 1 1 auto; min-height: 0; display: flex; }
.m-rail__tab i { background-image: var(--icon); }
/* unselected categories greyed out, the selected one in colour (as the provider rail) */
.m-rail__tab:not(.active) i { filter: grayscale(1) brightness(.9); opacity: .5; transition: filter .2s, opacity .2s; }

.m-games { flex: 1 1 auto; min-width: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.m-games__panel {
    display: none;
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
    padding: 13px 13px 20px 9px;
    align-content: start;
}
.m-games__panel.is-active { display: grid; }
.m-games__empty { grid-column: 1 / -1; padding: 60px 0; text-align: center; color: var(--c2-dim); }
.m-games .c2-lobby.is-long { grid-column: 1 / -1; }

/* --- rail width: wider than the reference (106.5px) so every provider icon and name fits --- */
.c2m .are_subnav {
    width: var(--m-rail);
    flex: 0 0 var(--m-rail);
    background-size: calc(var(--m-rail) - 12px) auto;
    /* the rail only scrolls up and down; it must never drag sideways */
    overflow-x: hidden;
    touch-action: pan-y;
}
/* 3px left margin + link + 6.5px right padding must fit the rail (it was 0.5px over,
   which made the rail sideways-scrollable on iOS) */
.c2m .are_subnav a {
    width: calc(var(--m-rail) - 10px);
    min-height: 46px;
    gap: 2px;
    cursor: pointer;
}
.c2m .are_subnav a i {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    margin-left: 3px;
    background-position: 50%;
    background-size: contain;
}
.c2m .are_subnav a .txt_subnav {
    flex: 1;
    width: auto;
    padding-right: 4px;
    font-size: 11px;
    line-height: 1.2;
    word-break: normal;
    overflow-wrap: anywhere;
}
.c2m .are_gamepage { width: calc(100% - var(--m-rail)); }

/* --- tab bar (reference .foot, mobile-ref.css) ------------------------------------ */
.c2-tabbar .foot {
    z-index: 100;
    font-size: 12px;
    text-align: center;
    padding-bottom: var(--c2-safe-bottom);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, .45);
}
.c2-tabbar .foot a { color: inherit; }

/* --- menu drawer ----------------------------------------------------------------- */
.m-menu { position: fixed; inset: 0; z-index: 900; visibility: hidden; }
.m-menu.is-open { visibility: visible; }
.m-menu__mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); opacity: 0; transition: opacity .25s; }
.m-menu.is-open .m-menu__mask { opacity: 1; }
.m-menu__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 78%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    padding: 16px 16px calc(16px + var(--c2-safe-bottom));
    overflow-y: auto;
    background: linear-gradient(180deg, #25232a 0%, #121116 100%);
    box-shadow: -6px 0 20px rgba(0, 0, 0, .5);
    transform: translateX(100%);
    transition: transform .28s ease;
}
.m-menu.is-open .m-menu__panel { transform: none; }
.m-menu__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(212, 181, 126, .2);
}
/* logged-in head: username and balance */
.m-menu__account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.m-menu__account > i { font-size: 34px; color: var(--c2-gold-1); }
.m-menu__name { font-size: 15px; font-weight: 600; color: #fff; }
.m-menu__balance { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 15px; font-weight: 700; color: var(--c2-gold-text); }
.m-menu__balance i { font-size: 12px; color: var(--c2-gold-1); }
.m-menu__close { width: 32px; height: 32px; font-size: 18px; color: var(--c2-dim); }
.m-menu__list a {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 46px;
    padding: 0 6px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.m-menu__list i { width: 20px; text-align: center; color: var(--c2-gold-1); }
.m-menu__lang { margin-top: 6px; }
.m-menu__list { margin-top: 16px; border-top: 1px solid rgba(212, 181, 126, .2); }
.m-menu__label { margin-bottom: 10px; font-size: 12px; color: var(--c2-dim); }
.m-menu__langs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.m-menu__langs a {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 12px;
    background: rgba(0, 0, 0, .25);
}
.m-menu__langs a.is-active { box-shadow: inset 0 0 0 1px var(--c2-gold-1); color: var(--c2-gold-text); }
.m-menu__langs img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.m-menu__logout { margin-top: auto; padding-top: 20px; }
.m-menu__logout .c2-btn { width: 100%; }

/* --- game list (reference .reg_gamepage, mobile-ref.css) ----------------------------- */
.c2-page-games .c2-gl-root { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.c2-page-games .c2-gamelist { flex: 1 1 auto; min-height: 0; }
.c2m .reg_gamepage { width: 100%; font-size: 12px; text-align: center; }
.c2m .are_subnav a.is-soon { opacity: .45; cursor: default; }
.c2m [hidden] { display: none !important; }
/* maintenance / coming-soon cover: the desktop game page look (grey veil, bold spaced words), sized for
   the small tile; lines break between words only */
.c2m .panel_gamelist .txt_maintain { padding: 0 4px; background: rgba(40, 40, 40, .7); font-size: 12px; font-weight: 700; letter-spacing: 1px; text-align: center; word-break: normal; overflow-wrap: anywhere; }
/* open search: covers the whole tab row (no tabs peeking out) but stops short of the
   magnifier button, which stays on top so tapping it again closes the search; the
   button is the only magnifier, so the bar drops the reference's own icon */
.c2m .panel_searchBar { top: 0; bottom: 0; left: 5px; right: 44px; width: auto; height: auto; background-image: none; background-color: #0e0d11; box-shadow: inset 0 0 0 1px rgba(212, 181, 126, .35); }
.c2m .panel_searchBar input {
    width: 100%;
    height: 100%;
    padding: 0 12px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff;
    font-size: 13px;
}
/* search button: pinned to the right of the tab row, as on the reference */
.c2m .btn_filter.cpn_search { top: 4px; height: 23px; display: flex; align-items: center; z-index: 2; }
.c2m .btn_filter.cpn_search img { display: block; height: 22px; width: auto; }

/* card: image on top, name in a tan bar underneath (same as the desktop card) */
.c2m .panel_gamelist { border-radius: 9px; background: #c59c63; }
.c2m .img_box {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}
.c2m .img_box .img_game { width: 100%; height: 100%; border-radius: 0; }
.c2m .txt_game {
    position: static;
    height: 30px;
    padding: 0 5px;
    /* the reference scales names to 120% at 569-1024px, which overflowed the tablet
       cards; ours stay 13px at every mobile width */
    transform: none;
    font-size: 13px;
    line-height: 30px;
    color: #120b02;
    background: #c59c63;
    box-shadow: inset 1px 0 3px #ffd78b;
}
.c2m .img_game { display: block; object-fit: cover; }
/* the reference aligns cards on the text baseline, which offsets a row when an image is missing */
.c2m .blk_gamepage { align-items: flex-start; }
.c2-gl__empty { padding: 60px 0; text-align: center; color: var(--c2-dim); }

/* tablets: more columns, and a wide (long) tile takes two of them instead of the
   whole row, so pictures stay near phone size; dense packing fills the gaps */
@media (min-width: 600px) {
    .m-games__panel { grid-template-columns: repeat(3, 1fr); grid-auto-flow: row dense; }
    .m-games .c2-lobby.is-long { grid-column: span 2; }
}
@media (min-width: 760px) {
    .m-games__panel { grid-template-columns: repeat(4, 1fr); }
}

