:root {
  --bg: #011b1d;
  --panel: #022b2d;
  --line: #0f4d4b;
  --teal: #0e6b67;
  --accent: #3fe0d0;
  --gold: #ffd400;
  --text: #ffffff;
  --muted: #9fbfbc;
  --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: #000c0d;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
img { display: block; max-width: 100%; }

.app {
  max-width: var(--app-width);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  min-height: 62px;
  background: #000 url("assets/12cuci/header.png") center bottom / cover no-repeat;
}
.logo { margin-right: auto; }
.logo img { height: 48px; width: auto; }
.partner img { height: 40px; width: auto; }
.menu-btn img { width: 46px; height: 46px; }

/* ---------- Marquee ---------- */
.marquee { background: #02302f url("assets/12cuci/ticker.png") center / 100% 100% no-repeat; overflow: hidden; white-space: nowrap; font-size: 13px; font-weight: 700; padding: 5px 0; }
.marquee span { display: inline-block; padding-left: 100%; animation: marquee 30s 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%; scroll-snap-align: start; aspect-ratio: 1242 / 500; }
.slide img { width: 100%; height: 100%; object-fit: cover; }
.carousel-dots { position: absolute; bottom: 6px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.carousel-dots button { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .4); }
.carousel-dots button.active { background: #fff; }

.pay-strip img { width: 100%; height: auto; }

/* ---------- Image buttons ---------- */
.img-btn { display: block; padding: 0; cursor: pointer; transition: transform .1s, filter .15s; }
.img-btn img { width: 100%; height: auto; }
.img-btn:hover { filter: brightness(1.15); }
.img-btn:active { transform: scale(.97); }

.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px 10px 4px; }

/* ---------- Wallet ---------- */
.wallet { display: flex; gap: 12px; padding: 8px 12px 14px 14px; align-items: flex-start; }
.wallet-info { flex: 1; font-size: 15px; line-height: 1.6; }
.wallet-label { font-size: 17px; }
.wallet-amount { font-size: 24px; font-weight: 900; color: var(--gold); margin: 6px 0; }
.wallet-actions { flex: 0 0 160px; display: grid; gap: 6px; }

/* ---------- Promo banners ---------- */
.promo { display: block; margin: 10px 6px 0; }
.promo img { width: 100%; height: auto; border-radius: 10px; }

/* Referral: the artwork leaves its lower part empty for the four buttons. */
.referral { position: relative; margin-top: 10px; }
.referral > img { width: 100%; height: auto; }
.referral-actions { position: absolute; left: 3%; right: 3%; top: 69%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.lucky { position: relative; margin: 10px 6px 0; }
.lucky > img { width: 100%; height: auto; border-radius: 10px; }
.lucky .img-btn { position: absolute; left: 3%; top: 69%; width: 40%; }

/* ---------- Game sections ---------- */
.block { margin-top: 20px; }
.block-title { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px; font-size: 17px; font-weight: 900; letter-spacing: .5px; }
.top-badge { background: linear-gradient(180deg, #ffcc00, #ff4a00); color: #fff; font-size: 14px; font-style: italic; padding: 1px 6px; border-radius: 6px; transform: rotate(-6deg); text-shadow: 0 1px 0 #a00; }
.hscroll { display: flex; gap: 10px; overflow-x: auto; padding: 0 12px 6px; scroll-snap-type: x proximity; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hot { flex: 0 0 23%; scroll-snap-align: start; }

.tabs-wrap { display: flex; align-items: center; gap: 6px; padding: 14px 6px 12px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 calc((100% - 18px) / 4); }
.arrow { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; background: #3a4a4a; font-size: 24px; line-height: 1; display: grid; place-items: center; padding-bottom: 3px; }

.game-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 12px 6px 0; }
.game img { width: 100%; aspect-ratio: 324 / 437; object-fit: cover; border-radius: 6px; }
.hot, .tab, .game { transition: transform .1s, filter .15s; }
.hot:hover, .tab:hover, .game:hover { filter: brightness(1.15); }

/* ---------- Testimonials ---------- */
.testi-title { display: inline-block; margin: 0 0 12px; padding: 6px 28px 6px 18px; background: var(--teal); border-radius: 0 20px 0 0; font-size: 18px; font-weight: 500; }
.testi { gap: 12px; align-items: stretch; }
.testi-card { flex: 0 0 82%; scroll-snap-align: center; display: flex; flex-direction: column; padding: 16px; background: #011314; border: 1px solid var(--teal); border-radius: 16px; }
.testi-card h3 { font-size: 16px; margin-bottom: 8px; }
.testi-card p { flex: 1; font-size: 14px; line-height: 1.6; color: #eee; }
.testi-foot { margin-top: 12px; padding-top: 8px; border-top: 1px solid #f0f0f0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.stars { color: var(--gold); font-size: 18px; letter-spacing: 1px; }
.testi-user { background: #fff; color: #011314; font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 14px; }

/* ---------- SEO text + FAQ (also used by the guide pages) ---------- */
.seo { margin: 28px 12px 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); font-size: 14px; line-height: 1.6; }
.seo h1 { font-size: 19px; margin-bottom: 8px; }
.seo h2 { font-size: 16px; color: var(--accent); margin: 18px 0 6px; }
.seo a { color: var(--gold); text-decoration: underline; }
.seo details { border-top: 1px solid var(--line); }
.seo summary { padding: 10px 0; font-weight: 700; cursor: pointer; }
.seo details p { padding-bottom: 10px; }
.seo ol, .seo ul { padding-left: 20px; }
.seo ul { list-style: disc; }
.seo a.post-card { text-decoration: none; }
.seo li { margin-bottom: 6px; }
.guide { margin-top: 14px; }
.guide .crumbs { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.guide .auth-row { padding: 18px 0 0; }
.post-img { width: 100%; height: auto; border-radius: 10px; margin: 12px 0 4px; }
.post-list { display: grid; gap: 14px; margin-top: 14px; }
.post-card { display: block; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #011314; transition: filter .15s; }
.post-card:hover { filter: brightness(1.15); }
.post-card img { width: 100%; aspect-ratio: 2.4 / 1; object-fit: cover; border-radius: 8px; }
.post-card img.fit { object-fit: contain; background: #000; }
.post-card h2 { margin: 10px 0 4px; color: #fff; }
.post-card p { color: var(--muted); font-size: 13px; }

/* Long sections fold to a preview; collapse.js adds the toggle button. */
.collapsible { position: relative; max-height: 320px; overflow: hidden; }
.collapsible:not(.open)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; background: linear-gradient(rgba(2, 43, 45, 0), var(--panel)); pointer-events: none; }
.collapsible.open { max-height: none; }
.toggle-btn { display: block; margin: 10px auto 0; padding: 8px 22px; border: 1px solid var(--accent); border-radius: 20px; color: var(--accent); font-size: 14px; font-weight: 700; }
.toggle-btn:hover { background: rgba(63, 224, 208, .1); }

/* ---------- Footer ---------- */
.footer { padding: 28px 14px 20px; }
.footer h3 { font-size: 15px; font-weight: 400; letter-spacing: 1px; margin: 18px 0 8px; }
.footer-cols { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.footer-cols h3 { margin-top: 0; }
.partners { display: grid; gap: 8px; max-width: 120px; }
.icons { display: flex; flex-wrap: wrap; gap: 8px; }
.icons img { width: 38px; height: 38px; object-fit: contain; border-radius: 8px; background: #fff; }
.copyright { margin-top: 36px; text-align: center; font-size: 13px; }
.read-more { display: block; width: 125px; margin: 28px auto 0; padding: 10px; border-radius: 4px; background: var(--teal); text-align: center; font-size: 16px; font-weight: 700; }
.footer-note { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; font-size: 12px; color: var(--muted); }

/* ---------- Floating partnership tab ---------- */
.side-tab { position: fixed; right: max(0px, calc(50% - var(--app-width) / 2)); top: 50%; transform: translateY(-50%); z-index: 20; width: 30px; }

/* ---------- 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: #011b1d url("assets/12cuci/nav-bg.png") center top / 100% var(--nav-height) no-repeat;
}
.bottom-nav a { position: relative; display: grid; place-items: end center; height: var(--nav-height); padding-bottom: 2px; transition: filter .15s, transform .1s; }
.bottom-nav img { height: calc(var(--nav-height) - 6px); width: auto; }
.bottom-nav a:hover { filter: brightness(1.2); }
.bottom-nav a:active { transform: scale(.95); }
.badge { position: absolute; top: 12px; right: 12%; min-width: 22px; height: 22px; border-radius: 8px; background: #f38120; color: #fff; font-size: 13px; display: grid; place-items: center; }

/* ---------- 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 (max-width: 380px) {
  .logo img { height: 40px; }
  .partner img { height: 34px; }
  .menu-btn img { width: 40px; height: 40px; }
  .wallet-actions { flex-basis: 136px; }
  .wallet-info { font-size: 14px; }
}

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