:root {
  --bg: #1a0d2b;
  --bg-2: #2a1546;
  --purple: #4b2a78;
  --gold: #e9c27a;
  --gold-2: #c8933f;
  --gold-grad: linear-gradient(92deg, #c38842 10%, #fdd265 50%, #bb7e3b 90%);
  --text: #fff;
  --muted: #b9a9d4;
  --line: #3d2763;
  --app-width: 500px;
  --nav-height: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: "Segoe UI", Arial, Helvetica, sans-serif; background: #0e0718; 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; }
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);
  padding-bottom: calc(var(--nav-height) + 24px + 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 52px; align-items: center; padding: 6px 10px; min-height: 64px; background: linear-gradient(180deg, #3a1d62, #24123d); }
.menu-btn img { width: 44px; height: 44px; }
.logo { justify-self: center; }
.logo img { height: 52px; width: auto; }

/* ---------- Carousel ---------- */
.carousel { position: relative; margin: 10px 10px 0; border-radius: 12px; overflow: hidden; }
.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; }
/* 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); }

/* ---------- Marquee ---------- */
.marquee { display: flex; align-items: center; gap: 6px; margin: 8px 10px 0; padding: 3px 4px 3px 2px; border: 1px solid var(--gold-2); border-radius: 14px; background: #f3e6c9; color: #1a0d2b; }
.mic { flex-shrink: 0; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: #1a0d2b; font-size: 13px; }
.mq { flex: 1; overflow: hidden; white-space: nowrap; }
.mq span { display: inline-block; padding-left: 40%; font-size: 13px; font-weight: 600; animation: marquee 45s linear infinite; }
@keyframes marquee { to { transform: translateX(-100%); } }

/* ---------- Login / Join ---------- */
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin: 14px 10px 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--gold-2); }
.auth-tabs a { padding: 13px 0; text-align: center; font-size: 17px; font-weight: 800; letter-spacing: .5px; }
.auth-tabs .login { background: var(--gold-grad); color: #2a1546; }
.auth-tabs .join { background: var(--purple); }

/* ---------- Cards and referral ---------- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 10px 0; }
.cards img { width: 100%; border-radius: 10px; }
.referral { display: flex; margin: 14px 10px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg-2); }
.ref-title { flex: 0 0 30%; display: flex; flex-direction: column; justify-content: center; padding: 10px 12px; background: linear-gradient(135deg, #3c2266, #2a1546); border-radius: 0 28px 28px 0; }
.ref-title b { font-size: 17px; letter-spacing: .5px; }
.ref-title small { font-size: 11px; font-weight: 700; }
.ref-actions { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); }
.ref-actions > * { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px 2px; font-size: 10.5px; font-weight: 700; white-space: nowrap; border-left: 1px solid var(--line); }
.ref-actions svg { width: 24px; height: 24px; fill: #fff; }

/* ---------- Games ---------- */
.block { margin-top: 16px; }
.head { padding: 0 10px 8px; font-size: 18px; font-weight: 800; }
.hscroll { display: flex; gap: 10px; overflow-x: auto; padding: 0 10px 4px; scroll-snap-type: x proximity; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hot { flex: 0 0 31%; min-width: 0; scroll-snap-align: start; }
.hot img { width: 100%; aspect-ratio: 300 / 335; object-fit: cover; border-radius: 10px; }
.g-name { display: block; margin-top: 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-meta { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 2px; }
.g-prov { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.rtp { flex-shrink: 0; padding: 2px 8px; border-radius: 10px; background: var(--gold-grad); color: #2a1546; font-size: 11px; font-weight: 800; }
.rtp.play { margin: 0 auto; }
.new-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 0 10px; }
.new-card { display: block; padding: 6px; border: 1px solid var(--gold-2); border-radius: 10px; background: var(--bg-2); }
.new-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.new-card b { display: block; margin-top: 6px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.new-card > span:not(.rtp) { display: block; font-size: 11px; color: var(--gold); text-transform: uppercase; }
.rtp.wide { display: block; margin-top: 6px; text-align: center; }

.cat-row { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; padding: 4px 6px 12px; }
.cat img { width: 100%; }
.prov-box { margin: 0 10px; padding: 10px 6px; border: 1px solid var(--gold-2); border-radius: 12px; }
.prov-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.prov img { width: 100%; aspect-ratio: 1; }
.hot, .new-card, .prov, .cards a { transition: transform .1s, filter .15s; }
.hot:active, .new-card:active, .prov:active, .cards a:active { transform: scale(.97); }

.promo { display: block; margin: 12px 10px 0; }
.promo img { width: 100%; border-radius: 10px; }

/* ---------- Keyword text ---------- */
.seo { margin: 20px 10px 0; padding: 14px 16px; border-radius: 14px; background: var(--bg-2); font-size: 14px; line-height: 1.6; color: #ddd3ee; }
.qa-title { text-align: center; font-size: 20px; color: #fff; margin-bottom: 10px; }
.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; }
/* Guide and FAQ 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; }
.seo ol, .seo ul { padding-left: 20px; }
.seo ul { list-style: disc; }
.seo li { margin-bottom: 6px; }
.seo b { color: #fff; }
.guide-auth { margin: 18px 0 4px; }
.guide-auth a { text-decoration: none; }
.guide-auth .join { color: #fff; }
.guide-auth .login { color: #2a1546; }
.faq-list { display: grid; gap: 10px; margin: 14px 0; }
.faq-list details { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.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; }

/* 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(42, 21, 70, 0), var(--bg-2)); pointer-events: none; }
.collapsible.open { max-height: none; }
.toggle-btn { display: block; margin: 12px auto 0; padding: 10px 44px; border: 1px solid var(--gold-2); border-radius: 22px; background: var(--purple); font-size: 15px; font-weight: 800; }

/* ---------- Footer ---------- */
.footer { padding: 20px 12px 10px; }
.footer h3 { margin: 18px 0 10px; font-size: 16px; font-weight: 800; }
.icons { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.icons img { height: 30px; width: auto; }
.copyright { margin-top: 26px; text-align: center; font-size: 14px; }

/* ---------- Floats ---------- */
.side-tab { position: fixed; right: max(0px, calc(50% - var(--app-width) / 2)); top: 48%; z-index: 20; width: 26px; }
.float { position: fixed; z-index: 25; }
.float[hidden] { display: none; }
.change-luck { right: max(0px, calc(50% - var(--app-width) / 2)); top: 210px; width: min(96px, 21vw); }
.free-rm88 { left: max(0px, calc(50% - var(--app-width) / 2)); top: 520px; width: min(120px, 26vw); }
.float .close { position: absolute; top: 0; right: 2px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 0, 0, .6); 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, #4a2a78, #2c1749);
  border-radius: 14px 14px 0 0;
}
.bottom-nav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, .75); }
.bottom-nav a.on { color: var(--gold); }
.bottom-nav img { width: 30px; height: 30px; }
.promo-tab .promo-icon { margin-top: -26px; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #5b3591, #24123d); border: 2px solid var(--gold-2); }
.promo-tab .promo-icon img { width: 34px; height: 34px; }
.badge { position: absolute; top: 2px; right: 18%; min-width: 20px; height: 20px; border-radius: 50%; background: #d1001f; color: #fff; font-size: 12px; display: grid; place-items: center; }
.promo-tab .badge { top: -24px; right: 14%; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-height) + 24px); transform: translateX(-50%); z-index: 50; background: rgba(0, 0, 0, .85); 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) {
  .mq span { animation: none; padding-left: 12px; }
}
