:root {
  --bg: #000;
  --red: #d10e1e;
  --red-dark: #7d0008;
  --gold: #f2c24a;
  --gold-grad: linear-gradient(180deg, #fff3b0, #f2c24a 45%, #b9861c);
  --text: #fff;
  --muted: #b5b5b5;
  --app-width: 500px;
  --nav-height: 62px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: Arial, Helvetica, sans-serif; background: #111; color: var(--text); -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; max-width: 100%; height: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app {
  display: block;
  max-width: var(--app-width);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg) url("assets/ui/body.jpg") center top / 100% auto repeat-y;
  padding-bottom: calc(var(--nav-height) + 30px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: 52px 1fr 80px; align-items: center; gap: 6px; padding: 6px 10px; min-height: 64px; background: #000 url("assets/ui/header-bg.jpg") center / cover no-repeat; }
.menu-btn img { width: 40px; height: auto; }
.logo { justify-self: center; }
.logo img { height: 44px; width: auto; }
.partner img { width: 76px; margin-left: auto; }

.auth { display: grid; grid-template-columns: 1fr 1fr; }
.auth a { padding: 10px 0; text-align: center; font-size: 22px; font-weight: 900; letter-spacing: 4px; background: center / 100% 100% no-repeat; }
.auth .login { color: #fff; background-image: url("assets/ui/bg-login.png"); background-color: var(--red); }
.auth .register { color: #1a1a1a; background-image: url("assets/ui/bg-register.png"); background-color: var(--gold); }

.marquee { background: #000 url("assets/ui/marquee-bg.png") center / 100% 100% no-repeat; overflow: hidden; white-space: nowrap; font-size: 14px; font-weight: 700; padding: 6px 0; }
.marquee span { display: inline-block; padding-left: 40%; animation: marquee 40s linear infinite; }
@keyframes marquee { to { transform: translateX(-100%); } }

/* ---------- Carousel ---------- */
.carousel { position: relative; }
.carousel-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.carousel-track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; aspect-ratio: 5 / 2; overflow: hidden; }
.slide img { width: 100%; height: 100%; max-width: none; object-fit: cover; }
.carousel-dots { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; flex-wrap: wrap; }
/* Small dot, but a 24px tap area around it. */
.carousel-dots button { width: 24px; height: 24px; padding: 8.5px; border-radius: 50%; background-color: rgba(255, 255, 255, .55); background-clip: content-box; }
.carousel-dots button.active { background-color: var(--gold); }
.pay-strip img { width: 100%; }

/* ---------- Wallet ---------- */
.wallet { display: flex; align-items: center; gap: 10px; padding: 12px 10px 8px; }
.balance { flex: 0 0 44%; display: flex; flex-direction: column; align-items: center; padding: 10px 6px; border: 3px solid #b9861c; border-radius: 10px; background: linear-gradient(180deg, #2a2a2a, #0d0d0d); }
.balance span { font-size: 17px; }
.balance b { font-size: 24px; }
.limits p { font-size: 14px; margin: 8px 0; white-space: nowrap; }
.wallet-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 6px; }
.wallet-btns img { width: 100%; }
.wallet-btns > *:active { transform: scale(.96); }

/* ---------- Referral and app banner ---------- */
.referral { position: relative; margin-top: 12px; }
.referral > img { width: 100%; }
/* The artwork leaves its lower part empty for the four buttons. */
.ref-actions { position: absolute; left: 4%; right: 4%; top: 64%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22%; }
.ref-actions img { width: 100%; }
.app-banner img { width: 100%; }

/* ---------- Games ---------- */
.games-block { margin-top: 10px; }
.cats { display: flex; overflow-x: auto; scrollbar-width: none; background: #1a1a1a; }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: 0 0 25%; display: flex; flex-direction: column; align-items: center; padding: 4px 0 6px; border-right: 1px solid #333; }
.cat img { height: 42px; width: auto; }
.cat span { font-size: 13px; }
.cat.on { background: linear-gradient(180deg, #8b0d15, #3a0005); }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 10px 8px 0; }
.game img { width: 100%; aspect-ratio: 1; }
.game:active { transform: scale(.97); }

/* ---------- Keyword text ---------- */
.seo { margin: 20px 10px 0; padding: 14px 16px; border-radius: 12px; background: #151515; font-size: 14px; line-height: 1.6; color: #ddd; }
.seo h1 { font-size: 17px; color: #fff; margin-bottom: 8px; }
.seo h2 { font-size: 16px; color: var(--gold); margin: 16px 0 6px; }
.seo h3 { font-size: 14px; color: #fff; margin: 12px 0 4px; }
.seo a { color: var(--gold); text-decoration: underline; }
.seo ol, .seo ul { padding-left: 20px; }
.seo ul { list-style: disc; }
.seo li { margin-bottom: 6px; }
.seo b { color: #fff; }
/* Long sections fold to a preview; collapse.js adds the toggle button. */
.collapsible { position: relative; max-height: 280px; overflow: hidden; }
.collapsible:not(.open)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; background: linear-gradient(rgba(21, 21, 21, 0), #151515); pointer-events: none; }
.collapsible.open { max-height: none; }
.toggle-btn { display: block; margin: 12px auto 0; padding: 10px 48px; border-radius: 10px; background: var(--red); font-size: 15px; font-weight: 900; letter-spacing: 2px; }

/* ---------- Footer ---------- */
.footer { padding: 20px 14px 10px; }
.foot-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.footer h3 { margin-bottom: 10px; font-size: 14px; font-weight: 400; }
.icons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.icons img { height: 30px; width: auto; }
.agent { width: 44px; }
.copyright { margin-top: 24px; text-align: center; font-size: 13px; color: var(--muted); }

/* ---------- Guide pages ---------- */
.guide { margin-top: 14px; }
.guide .crumbs { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.guide .crumbs a { color: var(--muted); text-decoration: none; }
.guide-auth { margin: 18px 0 4px; border-radius: 10px; overflow: hidden; }
.guide-auth a { text-decoration: none; font-size: 18px; }
.guide-auth .login { color: #fff; }
.guide-auth .register { color: #1a1a1a; }
.faq-list { display: grid; gap: 10px; margin: 14px 0; }
.faq-list details { border: 1px solid #333; border-radius: 12px; background: #000; }
.faq-list summary { padding: 14px 16px; font-weight: 700; color: #fff; cursor: pointer; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; float: right; color: var(--gold); }
.faq-list details[open] summary::after { content: "−"; }
.faq-list details p { padding: 0 16px 14px; }

.table-wrap { overflow-x: auto; margin: 10px 0; }
.seo table { width: 100%; border-collapse: collapse; font-size: 13px; }
.seo th { background: var(--red); color: #fff; text-align: left; padding: 8px; }
.seo td { padding: 8px; border: 1px solid #333; vertical-align: top; }
.seo tbody tr:nth-child(even) td { background: #1c1c1c; }

/* ---------- Floats ---------- */
.side-tabs { position: fixed; right: max(0px, calc(50% - var(--app-width) / 2)); top: 40%; z-index: 20; display: grid; gap: 6px; }
.side-tabs img { width: 30px; }
.float { position: fixed; z-index: 25; }
.float[hidden] { display: none; }
.free-credit { left: max(0px, calc(50% - var(--app-width) / 2)); bottom: calc(var(--nav-height) + 40px); width: min(96px, 21vw); }
.welcome { right: max(30px, calc(50% - var(--app-width) / 2 + 30px)); top: 360px; width: min(80px, 17vw); }
.float .close { position: absolute; top: 0; right: 0; width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; font-size: 14px; line-height: 1; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 40;
  width: 100%;
  max-width: var(--app-width);
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: linear-gradient(180deg, #3a3a3a, #000);
  border-top: 2px solid #b9861c;
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; }
.bottom-nav img { width: 28px; height: 28px; }
.bottom-nav .deposit-tab img { width: 84px; height: 84px; margin-top: -34px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-height) + 24px); transform: translateX(-50%); z-index: 50; background: rgba(40, 40, 40, .95); color: #fff; padding: 10px 18px; border-radius: 20px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .marquee span { animation: none; padding-left: 12px; }
}
