:root {
  --bg: #0a1220;
  --bg-2: #101a2b;
  --panel: #151f31;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f3f6fb;
  --muted: #9aa8bd;
  --blue: #2f6fed;
  --blue-2: #1f5ad4;
  --orange: #ff7a18;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 52px;
  --footer-h: 58px;
  --side-w: 58px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: #050b14;
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Noto Sans", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
button, input { font: inherit; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

.app {
  width: min(100vw, 430px);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* Splash / loading screen */
.splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: #1a7fd4;
  transition: opacity .45s ease, visibility .45s ease;
}
.splash.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-inner {
  width: min(100vw, 430px);
  height: 100%;
  max-height: 100dvh;
  position: relative;
  overflow: hidden;
  background: #1a7fd4;
}
.splash-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.splash-loader {
  position: absolute;
  left: 50%;
  bottom: max(28px, calc(18px + var(--safe-bottom)));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.35);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .04em;
}
.splash-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  animation: splash-spin .8s linear infinite;
}
@keyframes splash-spin {
  to { transform: rotate(360deg); }
}

/* Header */
.header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: #0c1524;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #7ec2ff;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}
.logo {
  height: 28px;
  width: auto;
}
.header-spacer { flex: 1; }
.btn-login {
  border: 0;
  background: transparent;
  color: #fff;
  padding: 8px 6px;
  cursor: pointer;
}
.btn-register {
  border: 0;
  background: var(--blue);
  color: #fff;
  border-radius: 6px;
  padding: 7px 12px;
  font-weight: 650;
  cursor: pointer;
}
.btn-register:active { background: var(--blue-2); }

/* Scroll main */
.main {
  height: calc(100vh - var(--header-h) - var(--footer-h) - var(--safe-bottom));
  overflow: auto;
  padding-bottom: 72px;
  scrollbar-width: none;
}
.main::-webkit-scrollbar { display: none; }

/* Banner */
.banner-wrap {
  position: relative;
  margin: 8px 10px 0;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 7.2;
  background: #122036;
}
.banner-track {
  display: flex;
  height: 100%;
  transition: transform .45s ease;
}
.banner-slide {
  min-width: 100%;
  height: 100%;
  object-fit: cover;
}
.online-pill {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,.45);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  backdrop-filter: blur(4px);
}
.online-pill svg { width: 12px; height: 12px; fill: #9ec5ff; }
.dots {
  position: absolute;
  left: 0; right: 0; bottom: 8px;
  display: flex;
  justify-content: center;
  gap: 5px;
}
.dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.35);
}
.dots span.active { background: var(--blue); width: 14px; border-radius: 999px; }

/* Marquee */
.marquee {
  margin: 8px 10px 0;
  height: 30px;
  border-radius: 8px;
  background: #121c2d;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  overflow: hidden;
}
.marquee .bell {
  width: 18px; height: 18px; flex: 0 0 auto;
  color: #4ea1ff;
}
.marquee-track {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}
.marquee-track span {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 18s linear infinite;
  font-size: 12px;
  color: #c9d5e8;
}
@keyframes marquee {
  to { transform: translateX(-100%); }
}

/* Quick actions */
.quick {
  display: flex;
  gap: 10px;
  padding: 12px 10px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.quick::-webkit-scrollbar { display: none; }
.quick-item {
  flex: 0 0 auto;
  width: 64px;
  text-align: center;
  font-size: 11px;
  color: #d7e2f2;
  cursor: pointer;
}
.quick-item .qi {
  width: 48px;
  height: 48px;
  margin: 0 auto 6px;
  border-radius: 14px;
  background: linear-gradient(160deg, #1b2a42, #121c2e);
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.06);
}
.quick-item img { width: 34px; height: 34px; object-fit: contain; }

/* Content split */
.content {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  gap: 8px;
  padding: 8px 10px 0 6px;
  min-height: 420px;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side-item {
  border: 1px solid transparent;
  background: #141e2f;
  border-radius: 10px;
  color: #b7c4d8;
  padding: 8px 4px 6px;
  display: grid;
  place-items: center;
  gap: 4px;
  font-size: 10px;
  cursor: pointer;
}
.side-item img { width: 22px; height: 22px; object-fit: contain; }
.side-item.active {
  border-color: #2f6fed;
  color: #fff;
  background: linear-gradient(180deg, #1a2740, #121b2c);
  box-shadow: inset 0 0 0 1px rgba(47,111,237,.25);
}

.panel { min-width: 0; }

/* Casino video */
.video-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9.2;
}
.video-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-watermark {
  position: absolute;
  left: 8px; top: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: rgba(255,255,255,.85);
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
.video-mute, .video-pause {
  position: absolute;
  border: 0;
  background: rgba(0,0,0,.35);
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.video-mute { top: 8px; right: 8px; }
.video-pause { left: 8px; bottom: 8px; }
.bet-now {
  position: absolute;
  right: 8px; bottom: 8px;
  border: 0;
  background: linear-gradient(180deg, #ff9a3d, #ff6a00);
  color: #fff;
  font-weight: 700;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255,106,0,.35);
}
.bet-now:active { transform: scale(.97); }

.tabs {
  display: flex;
  gap: 14px;
  padding: 10px 2px 8px;
  font-size: 13px;
  color: var(--muted);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0 0 6px;
  position: relative;
  white-space: nowrap;
  cursor: pointer;
}
.tab.active { color: #fff; font-weight: 650; }
.tab.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--blue);
  border-radius: 2px;
}

.game-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.game-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #121b2c;
  aspect-ratio: 1 / 1.15;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.04);
}
.game-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.game-card .badge {
  position: absolute;
  left: 6px; top: 6px;
  background: rgba(0,0,0,.55);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
}
.game-card .rebate {
  position: absolute;
  right: 6px; top: 6px;
  background: #ff4d4f;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
}
.game-card .name {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 8px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  font-size: 12px;
  font-weight: 650;
}

.section-title {
  margin: 14px 2px 8px;
  font-size: 14px;
  font-weight: 700;
}
.provider-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.provider-card {
  background: #121b2c;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.04);
  cursor: pointer;
}
.provider-card .thumb {
  aspect-ratio: 16/10;
  overflow: hidden;
}
.provider-card .thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.provider-card .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  font-size: 12px;
}
.provider-card .meta img { height: 16px; width: auto; }

/* Bottom nav */
.footer {
  position: sticky;
  bottom: 0;
  height: calc(var(--footer-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: #0c1524;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  z-index: 40;
}
.nav-item {
  border: 0;
  background: transparent;
  color: #8fa0b8;
  display: grid;
  place-items: center;
  gap: 2px;
  font-size: 10px;
  cursor: pointer;
  padding: 6px 2px 8px;
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item.active { color: #4ea1ff; }

/* Float buttons */
.floats {
  position: fixed;
  right: max(10px, calc(50% - 215px + 10px));
  bottom: calc(var(--footer-h) + 18px + var(--safe-bottom));
  display: grid;
  gap: 10px;
  z-index: 45;
}
.float-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  position: relative;
  box-shadow: 0 8px 18px rgba(0,0,0,.35);
}
.float-btn.chat { background: linear-gradient(180deg,#ff9a3d,#ff6a00); color:#fff; }
.float-btn.cs { background: linear-gradient(180deg,#ff5d8f,#e11d63); color:#fff; }
.float-btn.bag { background: linear-gradient(180deg,#ff5a5a,#d91010); color:#fff; }
.float-btn .count {
  position: absolute;
  top: -4px; right: -4px;
  background: #ff3b30;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

/* App download bar */
.download-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, 430px);
  bottom: calc(var(--footer-h) + var(--safe-bottom));
  background: rgba(18, 48, 96, .92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  z-index: 42;
}
.download-bar.hidden { display: none; }
.download-bar img { width: 34px; height: 34px; border-radius: 8px; }
.download-bar .txt { flex: 1; font-size: 11px; line-height: 1.25; }
.download-bar .txt b { display: block; font-size: 12px; }
.dl-btn {
  border: 0;
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}
.dl-btn.primary { background: var(--blue); color: #fff; }
.dl-btn.ghost { background: rgba(255,255,255,.12); color: #fff; }
.dl-close {
  border: 0;
  background: transparent;
  color: #9fb0c8;
  font-size: 18px;
  cursor: pointer;
}

/* Drawer */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  opacity: 0;
  pointer-events: none;
  transition: .25s;
  z-index: 60;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: min(82vw, 320px);
  background: #0e1726;
  transform: translateX(-105%);
  transition: .28s ease;
  z-index: 70;
  overflow: auto;
  padding: 14px 12px 24px;
}
.drawer.open { transform: translateX(0); }
.drawer h3 {
  margin: 14px 0 8px;
  font-size: 13px;
  color: #7f92ad;
  font-weight: 650;
}
.drawer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 8px;
  border-radius: 8px;
  color: #e8eef8;
  font-size: 14px;
  cursor: pointer;
}
.drawer-row:active { background: rgba(255,255,255,.05); }
.drawer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.drawer-chip {
  background: #152033;
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}

/* Popup promo */
.popup-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px 20px;
}
.popup-mask.hidden { display: none; }
.popup {
  width: min(72vw, 286px);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.popup-frame {
  width: 100%;
  max-height: calc(100dvh - 110px);
  border-radius: 10px;
  overflow: hidden;
  background: transparent;
  line-height: 0;
  box-shadow: 0 10px 32px rgba(0,0,0,.4);
}
.popup-frame img {
  width: 100%;
  height: auto;
  max-height: calc(100dvh - 110px);
  object-fit: contain;
  object-position: center;
  display: block;
}
.popup-dots {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.popup-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,.35);
}
.popup-dots span.active { background: #4ea1ff; }
.popup-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.6);
  background: transparent;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  flex-shrink: 0;
}

@media (min-width: 431px) {
  .popup-mask {
    /* Keep popup centered over the phone-width app column */
    left: 50%;
    right: auto;
    width: 430px;
    transform: translateX(-50%);
  }
  .popup {
    width: 286px;
  }
}

/* Auth modal — match Onbet mobile login */
.auth-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 12px 20px;
}
.auth-mask.hidden { display: none; }
.auth-wrap {
  width: min(94vw, 366px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-height: calc(100dvh - 24px);
}
.auth-card {
  width: 100%;
  background: #081f2d;
  border-radius: 12px;
  padding: 14px 14px 12px;
  overflow: auto;
  max-height: calc(100dvh - 80px);
  box-shadow: 0 16px 48px rgba(0,0,0,.45);
}
.auth-hero {
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
  margin-bottom: 10px;
  aspect-ratio: 16 / 5.2;
  background: #0a2a3d;
}
.auth-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.auth-tabs {
  display: flex;
  height: 30px;
  border-bottom: 1px solid #184258;
  margin-bottom: 10px;
}
.auth-tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: #6f8795;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  padding-bottom: 8px;
  cursor: pointer;
}
.auth-tab svg { opacity: .75; }
.auth-tab.active {
  color: #2278ff;
  font-weight: 600;
}
.auth-tab.active svg { opacity: 1; color: #2278ff; }
.auth-tab.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  width: 96px;
  height: 2px;
  background: #2278ff;
  border-radius: 2px;
}
.auth-promo {
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
  line-height: 0;
  height: 72px;
  background: #0a2a3d;
}
.auth-promo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.auth-pane { display: none; }
.auth-pane.active { display: block; }
.auth-field {
  display: block;
  position: relative;
  background: #061823;
  border: 1px solid #1a4a62;
  border-radius: 8px;
  margin-bottom: 8px;
  padding: 0 12px;
}
.auth-field:focus-within {
  border-color: #2278ff;
}
.auth-float {
  position: absolute;
  top: 4px;
  left: 12px;
  font-size: 10px;
  color: #6f8795;
  pointer-events: none;
}
.auth-float.ghost { display: none; }
.auth-field:focus-within .auth-float,
.auth-field.has-value .auth-float {
  display: inline-block;
}
.auth-field:focus-within .auth-float.ghost,
.auth-field.has-value .auth-float.ghost {
  display: inline-block;
}
.auth-field input {
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 14px;
  line-height: 16px;
  padding: 18px 28px 8px 0;
  outline: none;
}
.auth-field input::placeholder { color: #6f8795; }
.auth-field:focus-within input::placeholder,
.auth-field.has-value input::placeholder {
  color: transparent;
}
.auth-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #7da1b4;
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
}
.auth-remember {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #7da1b4;
  margin: 4px 0 16px;
  cursor: pointer;
  user-select: none;
}
.auth-remember input { display: none; }
.auth-check {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #7da1b4;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.auth-remember input:checked + .auth-check {
  border-color: #2278ff;
  background: #2278ff;
  box-shadow: inset 0 0 0 2px #081f2d;
}
.auth-submit {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: #2278ff;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  padding: 12px;
  cursor: pointer;
  margin-bottom: 12px;
}
.auth-submit:active { filter: brightness(.92); }
.auth-quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding-top: 2px;
}
.auth-quick-item {
  border: 0;
  background: transparent;
  color: #9eb6c6;
  font-size: 11px;
  display: grid;
  justify-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 0;
}
.aq-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  background: #0d2c3d;
  border: 1px solid #1a4a62;
}
.aq-icon.google {
  background: #fff;
  color: #4285f4;
  font-family: Arial, sans-serif;
}
.aq-icon.vip {
  background: linear-gradient(160deg, #3a2a10, #1a1408);
  border-color: #8a6a22;
  color: #f5d76e;
  font-size: 14px;
}
.auth-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.55);
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
}

@media (min-width: 431px) {
  .auth-mask {
    left: 50%;
    right: auto;
    width: 430px;
    transform: translateX(-50%);
  }
}

/* legacy modal kept unused */
.modal { display: none !important; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translate(-50%, -10px);
  background: rgba(0,0,0,.82);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: .25s;
  z-index: 120;
  max-width: 80vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Pages */
.page { display: none; padding: 16px 12px 24px; }
.page.active { display: block; }
.page h2 { margin: 0 0 8px; font-size: 18px; }
.page p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.empty-card {
  background: #121b2c;
  border-radius: 12px;
  padding: 18px;
  margin-top: 12px;
  border: 1px solid rgba(255,255,255,.05);
}

@media (min-width: 431px) {
  .app {
    box-shadow: 0 0 0 1px rgba(255,255,255,.05), 0 20px 60px rgba(0,0,0,.45);
    min-height: 100vh;
  }
  .floats { right: calc(50% - 215px + 10px); }
}
