/* JFun Gaming UI v1
   Loaded AFTER jfun-brand.css. Dark-first "gaming" look on the same brand colours
   (magenta #F20289 -> coral #FB2B52). New classes start with jg-.
   Page files: assets/brand/game/<name>.css, overrides written as html body.jg-<page> .class */

/* ---------- A. Tokens ---------- */
html:root {
  --jg-font-display: 'Rajdhani', 'Poppins', 'Segoe UI', system-ui, sans-serif;
  --jg-font-body: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  --jg-radius: 18px;
  --jg-radius-sm: 12px;
  --jg-tap: 44px;
  --jg-glow: 0 0 0 1px rgba(242, 2, 137, 0.35), 0 8px 24px rgba(242, 2, 137, 0.35);
  --jg-surface-2: #FFFFFF;
  --jg-ok: #2FBF8B;
  --jg-warn: #FF9A55;
  --jg-bad: #FF4D6D;
}
/* dark = everything except an explicit light theme (light keeps the brand pastel tokens) */
html:root:not([data-theme="light"]) {
  --bg-color: #0E0714;
  --jf-page-bg:
    radial-gradient(700px 420px at 10% -6%, rgba(242, 2, 137, 0.30), transparent 62%),
    radial-gradient(640px 420px at 100% 0%, rgba(251, 43, 82, 0.20), transparent 60%),
    radial-gradient(700px 520px at 50% 110%, rgba(120, 70, 255, 0.22), transparent 62%),
    #0E0714;
  --card-bg: rgba(30, 14, 38, 0.78);
  --text-color: #FDEFF7;
  --text-secondary: #C9A7BD;
  --border-color: rgba(255, 255, 255, 0.09);
  --shadow-color: rgba(0, 0, 0, 0.55);
  --jf-glass: rgba(34, 16, 42, 0.66);
  --jf-glass-strong: rgba(40, 19, 50, 0.88);
  --jf-glass-border: rgba(255, 255, 255, 0.10);
  --jf-glass-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --jf-solid: #1E0F26;
  --jf-nav-bg: rgba(24, 11, 31, 0.92);
  --jf-nav-border: rgba(255, 255, 255, 0.10);
  --jf-nav-shadow: 0 -8px 30px rgba(0, 0, 0, 0.55);
  --jf-active: #FF5AA9;
  --jf-text: #C9A7BD;
  --jf-fg: #FDEFF7;
  --jf-toast-bg: #2E1630;
  --jf-skel-a: #341A36;
  --jf-skel-b: #452446;
  --jg-surface-2: #2A1434;
}

/* ---------- B. Base (kept minimal so games are not affected) ---------- */
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
html body { -webkit-tap-highlight-color: transparent; }

/* ---------- C. Components ---------- */
.jg-display { font-family: var(--jg-font-display); font-weight: 700; letter-spacing: 0.02em; }
.jg-title {
  display: flex; align-items: center; gap: 10px; margin: 18px 0 10px;
  font-family: var(--jg-font-display); font-weight: 700; font-size: 18px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.jg-title::before { content: ''; width: 4px; height: 1.1em; border-radius: 2px; background: var(--jf-grad); flex: 0 0 auto; }
.jg-card {
  background: var(--card-bg); border: 1px solid var(--border-color);
  border-radius: var(--jg-radius); padding: 16px; box-shadow: var(--jf-glass-shadow);
}
.jg-card--glow {
  background: linear-gradient(var(--jf-solid), var(--jf-solid)) padding-box, var(--jf-grad) border-box;
  border: 1.5px solid transparent;
}
.jg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border: 0; border-radius: 14px;
  background: var(--jf-grad); color: #fff; text-decoration: none;
  font: 700 16px var(--jg-font-display); letter-spacing: 0.04em; text-transform: uppercase;
  box-shadow: var(--jg-glow); cursor: pointer; touch-action: manipulation;
}
.jg-btn:active { transform: scale(0.97); }
.jg-btn[disabled] { opacity: 0.55; box-shadow: none; }
.jg-btn--ghost { background: transparent; border: 1.5px solid var(--jf-pink); color: var(--jf-pink); box-shadow: none; }
.jg-btn--block { width: 100%; }
.jg-chip {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px;
  border-radius: 999px; background: var(--jf-grad-soft); font: 600 12px var(--jg-font-body);
}
.jg-badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  font: 700 12px var(--jg-font-body); background: rgba(242, 2, 137, 0.16); color: var(--jf-pink);
}
.jg-badge--ok { background: rgba(47, 191, 139, 0.16); color: var(--jg-ok); }
.jg-badge--warn { background: rgba(255, 154, 85, 0.16); color: var(--jg-warn); }
.jg-badge--bad { background: rgba(255, 77, 109, 0.16); color: var(--jg-bad); }
.jg-list-row {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}
.jg-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.jg-skel { position: relative; overflow: hidden; border-radius: 12px; background: var(--jf-skel-a); }
.jg-skel::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background: linear-gradient(90deg, transparent, var(--jf-skel-b), transparent);
  transform: translateX(-100%);
}
.jg-glow-text { text-shadow: 0 0 14px rgba(242, 2, 137, 0.55); }

/* animations: opacity/transform only, none for reduced-motion users */
@keyframes jg-fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes jg-pulse { 0%, 100% { opacity: 0.25; transform: scale(1); } 50% { opacity: 1; transform: scale(1.03); } }
@keyframes jg-shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: no-preference) {
  .jg-anim { animation: jg-fade-up 0.35s ease-out both; }
  .jg-pulse { position: relative; }
  .jg-pulse::after {
    content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: inherit;
    box-shadow: 0 0 18px 2px rgba(242, 2, 137, 0.55); pointer-events: none;
    animation: jg-pulse 2.4s ease-in-out infinite;
  }
  .jg-skel::after { animation: jg-shimmer 1.3s ease infinite; }
}

/* ---------- D. Restyle of existing shared classes ---------- */
html body .stat-card,
html body .merged-card,
html body .info-card {
  background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--jg-radius);
}
html body .action-btn { min-height: 88px; border-radius: var(--jg-radius); }
html body .action-btn:active { transform: scale(0.97); }
html body .action-btn .action-title { font-family: var(--jg-font-display); font-weight: 700; font-size: 16px; }
html body .action-btn .action-subtitle { font-size: 12px; color: var(--text-secondary); }
html body .btn-login {
  background: var(--jf-grad); min-height: 40px; border-radius: 999px; font-family: var(--jg-font-display);
}
html body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="range"]),
html body select,
html body textarea {
  min-height: 48px; font-size: 16px; border-radius: var(--jg-radius-sm);
}
html body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="range"]):focus,
html body select:focus,
html body textarea:focus {
  box-shadow: 0 0 0 3px rgba(242, 2, 137, 0.30); border-color: var(--jf-pink);
}
/* dropdowns / modals / toasts stay solid */
html body .currency-options,
html body .modal-content,
html body .modal-box,
html body .rules-content,
html body .toast {
  background: var(--jf-solid); color: var(--text-color); border: 1px solid var(--border-color);
}
/* dark mode: big stat numbers use the text colour */
html:not([data-theme="light"]) body .stat-card .stat-card-value,
html:not([data-theme="light"]) body .stat-card.balance-card .stat-card-value,
html:not([data-theme="light"]) body .stat-card.deposit-card .stat-card-value,
html:not([data-theme="light"]) body .stat-card.withdraw-card .stat-card-value,
html:not([data-theme="light"]) body .stat-card.refer-card .stat-card-value,
html:not([data-theme="light"]) body .stat-card.net-card .stat-card-value,
html:not([data-theme="light"]) body .stat-card.earnings-card .stat-card-value { color: var(--text-color); }

/* ---------- NAVIGATION: bottom nav pill, top bar, home footer ---------- */
html body .jf-nav,
html body .bottom-footer {
  left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  width: auto; min-width: 0; max-width: 520px; margin-left: auto; margin-right: auto;
  height: 64px; padding: 0 6px; border-radius: 22px; transform: none;
  background: var(--jf-nav-bg); border: 1px solid var(--jf-nav-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(242, 2, 137, 0.18);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
html body.modal-open .jf-nav,
html body.modal-open .bottom-footer { transform: translateY(150%); }
html body .jf-nav-inner,
html body .footer-container { height: 100%; max-width: none; margin: 0; gap: 2px; align-items: stretch; justify-content: space-around; }
html body .jf-nav-item,
html body .footer-btn {
  min-height: 56px; flex: 1 1 0; max-width: none; min-width: 0; padding: 4px 2px; margin: auto 0;
  border-radius: 16px; overflow: visible; gap: 3px; background: transparent;
}
html body .jf-nav-text,
html body .footer-text {
  font: 700 11px var(--jg-font-display); text-transform: uppercase; letter-spacing: 0.04em;
}
html body .jf-nav-icon,
html body .footer-icon { font-size: 20px; height: 24px; }
html body .jf-nav-item::before,
html body .footer-btn::before {
  top: 2px; left: 50%; width: 0; height: 3px; border-radius: 999px; background: var(--jf-grad);
}
html body .jf-nav-item:hover::before { width: 0; }
html body .jf-nav-item.active,
html body .footer-btn.active { background: transparent; }
html body .jf-nav-item.active::before,
html body .footer-btn.active::before { width: 22px; height: 3px; }
html body .footer-btn.active::after { display: none; }
html body .jf-nav-item.active .jf-nav-icon,
html body .footer-btn.active .footer-icon { color: var(--jf-active); text-shadow: 0 0 12px rgba(242, 2, 137, 0.6); animation: none; }
html body .jf-nav-item.active .jf-nav-text,
html body .footer-btn.active .footer-text { color: var(--jf-active); }
html body .footer-btn .footer-icon { color: var(--jf-text); }
html body .footer-text { color: var(--jf-text); }
html body .footer-btn:active { transform: scale(0.96); }

/* centre "play" item (Games) */
html body .jf-nav-item.jf-nav-play::before { display: none; }
html body .jf-nav-item.jf-nav-play .jf-nav-icon {
  width: 56px; height: 56px; margin-top: -26px; border-radius: 50%; font-size: 22px;
  background: var(--jf-grad); color: #fff; text-shadow: none; transform: none;
  box-shadow: 0 0 0 5px var(--jf-nav-bg), 0 8px 22px rgba(242, 2, 137, 0.55);
}
html body .jf-nav-item.jf-nav-play.active .jf-nav-icon {
  color: #fff; transform: none;
  box-shadow: 0 0 0 5px var(--jf-nav-bg), 0 8px 28px rgba(242, 2, 137, 0.85);
}
html body .jf-nav-item.jf-nav-play:active .jf-nav-icon { transform: scale(0.94); }

/* spacing so content and floating buttons clear the pill */
html body.jf-has-nav { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important; }
html body .jf-theme-btn { width: 44px; height: 44px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
html body .jf-install.jf-has-bar { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

/* top bar (visual only) */
html body .navbar {
  min-height: 56px; padding: 8px 12px; background: var(--jf-glass-strong);
  border-bottom: 1px solid var(--jf-glass-border);
  box-shadow: 0 1px 0 rgba(242, 2, 137, 0.35), 0 8px 24px rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: var(--jf-blur); backdrop-filter: var(--jf-blur);
}
html body .menu-toggle { min-width: 44px; min-height: 44px; justify-content: center; }
html body .balance-display {
  min-height: 40px; padding: 0 14px; border-radius: 999px; color: var(--text-color);
  background: linear-gradient(var(--jf-solid), var(--jf-solid)) padding-box, var(--jf-grad) border-box;
  border: 1.5px solid transparent; font: 700 16px var(--jg-font-display);
}
html body .balance-display i { color: var(--jf-pink); }
html body .balance-text,
html body .currency-text { font-family: var(--jg-font-display); font-variant-numeric: tabular-nums; }
html body .currency-text { position: relative; }
html body .currency-text::after { content: ''; position: absolute; top: -12px; bottom: -12px; left: -6px; right: -6px; }
html body.jg-sticky .navbar { position: sticky; top: 0; z-index: 60; }
