/*
 * Shared responsive shell for /mobile.
 * Loaded after global.css, the active color theme, and custom.css.
 * It changes layout only; theme colors and application behavior remain intact.
 */

:root {
  --mobile-shell-width: 480px;
  --mobile-shell-shadow: 0 0 34px rgba(0, 0, 0, 0.48);
}

html {
  min-width: 320px;
  min-height: 100%;
  background-color: var(--navbar-color, #111);
}

body.mobile-site {
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
}

body.mobile-site,
body.mobile-site *,
body.mobile-site *::before,
body.mobile-site *::after {
  box-sizing: border-box;
}

body.mobile-site img {
  max-width: 100%;
}

body.mobile-site #main-route,
body.mobile-site .main-content {
  width: 100%;
  min-width: 0;
}

body.mobile-site .main-content {
  padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
}

body.mobile-site .container {
  width: 100%;
  max-width: 100% !important;
  padding-right: 12px;
  padding-left: 12px;
}

/* Keep both banner sliders proportional and prevent desktop-height stretching. */
body.mobile-site .home .home__slider {
  padding-top: 10px;
}

body.mobile-site .home .home__slider .swiper-container {
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
}

body.mobile-site .home .home__slider .swiper-slide img {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-height: 240px;
  object-fit: cover;
  object-position: center;
}

body.mobile-site .header-mobile__nav,
body.mobile-site .header-mobile-swiper {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

body.mobile-site .header-mobile-swiper .swiper-wrapper {
  flex-wrap: nowrap;
}

/* Stop long content, tables, and forms from forcing horizontal overflow. */
body.mobile-site table {
  max-width: 100%;
}

body.mobile-site .table-responsive,
body.mobile-site .seo-mob-content {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.mobile-site input,
body.mobile-site select,
body.mobile-site textarea,
body.mobile-site button {
  max-width: 100%;
}

/* Desktop/tablet: show the mobile application as a centered phone-width shell. */
@media screen and (min-width: 769px) {
  html {
    background-color: var(--navbar-color, #111);
    background-image: var(--background-theme, none);
    background-repeat: no-repeat;
    background-position: center top;
    background-size: cover;
    background-attachment: fixed;
  }

  body.mobile-site {
    width: var(--mobile-shell-width);
    max-width: var(--mobile-shell-width);
    margin: 0 auto !important;
    position: relative;
    background: var(--navbar-color, #111);
    box-shadow: var(--mobile-shell-shadow);
  }

  body.mobile-site .main-content {
    background-attachment: scroll;
  }

  body.mobile-site .header__top,
  body.mobile-site .header__mid,
  body.mobile-site .header-nav,
  body.mobile-site .footer__provider,
  body.mobile-site .footer__trademark {
    display: none !important;
  }

  body.mobile-site .header-mobile {
    display: block !important;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--navbar-color);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.38);
  }

  body.mobile-site .header-mobile__marquee {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 9px 10px 0;
  }

  body.mobile-site .header-mobile__marquee i {
    flex: 0 0 auto;
    margin-right: 6px;
    padding: 5px;
    border-radius: 999px;
    color: var(--header-text);
    background: var(--third-color);
    font-size: 10px;
  }

  body.mobile-site .header-mobile__marquee .marquee {
    min-width: 0;
    width: 100%;
    color: var(--navbar-text);
    font-size: 11px;
    font-weight: 600;
  }

  body.mobile-site .header-mobile__top {
    display: flex;
    align-items: center;
    min-height: 54px;
    padding: 10px 9px 5px;
    position: relative;
  }

  body.mobile-site .header-mobile__top .mobile-logo {
    width: 150px;
    max-width: 38%;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  body.mobile-site .header-mobile__top .mobile-logo img {
    display: block;
    width: 100% !important;
    height: 30px;
    object-fit: contain;
    object-position: center;
  }

  body.mobile-site .header-mobile__top .mobile-help,
  body.mobile-site .header-mobile__top .mobile-right .mobile-menu .mobile-menu--line {
    width: 35px;
    height: 35px;
    padding: 8px;
    border-radius: 999px;
    background: var(--third-color);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body.mobile-site .header-mobile__top .mobile-help a {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-white);
  }

  body.mobile-site .header-mobile__top .mobile-help i {
    font-size: 15px;
  }

  body.mobile-site .header-mobile__top .mobile-balance {
    display: flex;
    align-items: center;
    max-width: 138px;
    padding: 3px 4px 3px 10px;
    border: 1px solid var(--secondary-color);
    border-radius: 999px;
    background: var(--third-color);
    color: var(--c-white);
    overflow: hidden;
  }

  body.mobile-site .header-mobile__top .mobile-balance .balance-number {
    min-width: 0;
    overflow: hidden;
  }

  body.mobile-site .header-mobile__top .mobile-balance .wallet-amount {
    display: block;
    max-width: 102px;
    overflow: hidden;
    color: var(--c-white);
    font-size: 10px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  body.mobile-site .header-mobile__top .mobile-balance > a {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-left: 4px;
    border-radius: 999px;
    background: var(--secondary-color);
    color: var(--secondary-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
  }

  body.mobile-site .header-mobile__top .mobile-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 5px;
  }

  body.mobile-site .header-mobile__top .mobile-right .mobile-menu {
    position: relative;
    margin-left: 2px;
  }

  body.mobile-site .header-mobile__top .mobile-right .mobile-menu .mobile-menu--line img {
    width: 18px;
    filter: invert(1);
  }

  body.mobile-site .header-mobile__nav {
    padding: 8px 9px 10px;
  }

  body.mobile-site .header-mobile__nav .swiper-wrapper {
    height: auto;
  }

  body.mobile-site .header-mobile__nav .swiper-slide {
    width: auto !important;
    max-width: max-content !important;
  }

  body.mobile-site .header-mobile__nav .header-mobile__item {
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--third-color);
    color: var(--navbar-text);
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
  }

  body.mobile-site .header-mobile__nav .header-mobile__item img {
    width: 15px;
    height: 15px;
    object-fit: contain;
    filter: invert(1);
  }

  body.mobile-site .home__seo .seo-content {
    display: none !important;
  }

  body.mobile-site .home__seo .seo-mobile {
    display: block !important;
  }

  body.mobile-site .footer-mobile {
    display: block !important;
    width: min(100vw, var(--mobile-shell-width));
    max-width: var(--mobile-shell-width);
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 0;
    transform: translateX(-50%);
    z-index: 997;
  }

  body.mobile-site .footer-mobile__login {
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 -2px 9px rgba(0, 0, 0, 0.4);
  }

  body.mobile-site .footer-mobile__login button {
    width: 100%;
    min-height: 50px;
    padding: 10px 15px;
    border: 0;
    outline: 0;
    font-weight: 600;
  }

  body.mobile-site .footer-mobile__login .login-button {
    background: var(--primary-color);
    color: var(--c-white);
  }

  body.mobile-site .footer-mobile__login .register-button {
    background: var(--secondary-color);
    color: var(--secondary-text);
  }

  body.mobile-site .footer-mobile__nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
    padding: 0 5px calc(env(safe-area-inset-bottom, 0px));
    overflow: hidden;
    border-radius: 15px 15px 0 0;
    background: var(--primary-color);
    box-shadow: 0 -2px 9px rgba(0, 0, 0, 0.4);
  }

  body.mobile-site .footer-mobile__nav .nav-link {
    min-width: 0;
    padding: 9px 0 8px;
    position: relative;
    overflow: hidden;
    color: var(--c-white);
    text-overflow: ellipsis;
  }

  body.mobile-site .footer-mobile__nav .nav-link::before {
    content: "";
    display: none;
    width: 60%;
    height: 4px;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0 0 3px 3px;
    background: var(--secondary-color);
  }

  body.mobile-site .footer-mobile__nav .nav-link.active::before {
    display: block;
  }

  body.mobile-site .footer-mobile__nav .nav-item {
    min-width: 0;
    text-align: center;
  }

  body.mobile-site .footer-mobile__nav .nav-icon {
    width: 32px;
    height: 32px;
    margin: auto;
    border-radius: 999px;
    background: var(--third-color);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body.mobile-site .footer-mobile__nav .nav-icon img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    filter: invert(1) brightness(9);
  }

  body.mobile-site .footer-mobile__nav .nav-icon i {
    font-size: 14px;
  }

  body.mobile-site .footer-mobile__nav .member-icon {
    width: 32px;
    height: 32px;
    background: transparent;
  }

  body.mobile-site .footer-mobile__nav .member-icon img {
    width: 30px;
    height: 32px;
    object-fit: contain;
    filter: none;
  }

  body.mobile-site .footer-mobile__nav .nav-label {
    margin-top: 4px;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.15;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  body.mobile-site .footer-mobile__nav .nav-link.active {
    color: var(--secondary-color);
  }

  body.mobile-site .footer-mobile__nav .nav-link.active .nav-icon {
    background: var(--secondary-color);
  }

  body.mobile-site .footer-mobile__nav .nav-link.active .nav-icon i {
    color: var(--c-black);
  }

  body.mobile-site .footer-mobile__nav .nav-link.active .nav-icon img:not(.member-icon img) {
    filter: invert(0);
  }

  body.mobile-site .footer-chat {
    display: flex !important;
    width: 48px;
    height: 48px;
    padding: 10px;
    position: fixed;
    right: max(14px, calc((100vw - var(--mobile-shell-width)) / 2 + 14px));
    bottom: 82px;
    z-index: 997;
    border-radius: 999px;
    background: var(--secondary-color);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
    align-items: center;
    justify-content: center;
  }

  body.mobile-site .footer-chat img {
    width: 28px;
    height: 28px;
    object-fit: contain;
  }

  body.mobile-site .sidenav {
    width: min(100vw, var(--mobile-shell-width));
    max-width: var(--mobile-shell-width);
  }

  body.mobile-site .sidenav.sidenav-open {
    right: max(0px, calc((100vw - var(--mobile-shell-width)) / 2));
  }

  body.mobile-site .home .home__jackpot {
    padding-top: 12px;
    padding-bottom: 4px;
  }

  body.mobile-site .home .home__jackpot .jackpot-background {
    min-height: 105px;
    height: auto;
    background-size: cover;
    border-radius: 14px;
    overflow: hidden;
  }

  body.mobile-site .home .home__jackpot .jackpot-wrapper {
    min-width: 190px;
    margin: 12px 10px 12px auto;
    padding: 10px;
    border-radius: 13px;
  }

  body.mobile-site .home .home__jackpot .jackpot-wrapper h1 {
    margin-bottom: 6px;
    font-size: 13px;
  }

  body.mobile-site .home .home__jackpot .jackpot-wrapper .wrapper-amount {
    font-size: 12px;
  }
}

/* Phone refinements: keep full width and make controls fit narrow screens. */
@media screen and (max-width: 480px) {
  body.mobile-site .container {
    padding-right: 9px;
    padding-left: 9px;
  }

  body.mobile-site .home .home__slider .swiper-container {
    border-radius: 10px;
  }

  body.mobile-site .header-mobile__nav {
    padding-right: 8px;
    padding-left: 8px;
  }

  body.mobile-site .footer-mobile__nav .nav-label {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.mobile-site *,
  body.mobile-site *::before,
  body.mobile-site *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
 * DESKTOP MOBILE-MIRROR MODE
 * Desktop keeps the same visual structure as the phone layout.
 * Mobile behavior below 769px is unchanged.
 * ======================================================= */
@media screen and (min-width: 769px) {
  :root {
    --mobile-shell-width: 480px;
    --mobile-shell-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.04),
      0 20px 60px rgba(0, 0, 0, 0.52);
  }

  html {
    min-height: 100%;
    background-color: #090a10 !important;
    background-image:
      radial-gradient(
        circle at 50% 0%,
        rgba(89, 48, 160, 0.20) 0,
        rgba(89, 48, 160, 0.06) 28%,
        transparent 52%
      ),
      linear-gradient(
        180deg,
        #0b0a11 0%,
        #111019 48%,
        #08090d 100%
      ) !important;
    background-repeat: no-repeat !important;
    background-position: center top !important;
    background-size: cover !important;
    background-attachment: fixed !important;
  }

  body.mobile-site {
    width: min(100%, var(--mobile-shell-width)) !important;
    max-width: var(--mobile-shell-width) !important;
    min-height: 100vh;
    margin: 0 auto !important;
    background: var(--navbar-color, #111) !important;
    box-shadow: var(--mobile-shell-shadow) !important;
  }

  body.mobile-site .header-mobile,
  body.mobile-site #main-route,
  body.mobile-site .main-content,
  body.mobile-site .container {
    max-width: 100% !important;
  }

  body.mobile-site .container {
    padding-right: 9px;
    padding-left: 9px;
  }

  body.mobile-site .home .home__slider .swiper-slide img {
    width: 100% !important;
    height: auto !important;
    max-height: 240px !important;
    object-fit: cover;
    object-position: center;
  }

  body.mobile-site .footer-mobile {
    width: min(100vw, var(--mobile-shell-width)) !important;
    max-width: var(--mobile-shell-width) !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
  }

  body.mobile-site .footer-chat {
    right: max(
      14px,
      calc((100vw - var(--mobile-shell-width)) / 2 + 14px)
    ) !important;
  }

  body.mobile-site .sidenav {
    width: min(100vw, var(--mobile-shell-width)) !important;
    max-width: var(--mobile-shell-width) !important;
  }

  body.mobile-site .sidenav.sidenav-open {
    right: max(
      0px,
      calc((100vw - var(--mobile-shell-width)) / 2)
    ) !important;
  }
}
