:root {
  --bg: #070b14;
  --surface: #0f1626;
  --surface-2: #162036;
  --surface-3: #1d2944;
  --primary: #00f2fe;
  --secondary: #8b5cf6;
  --accent: #facc15;
  --hot: #10b981;
  --warm: #f59e0b;
  --cold: #ef4444;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --dim: #94a3b8;
  --line: rgba(148, 163, 184, 0.16);
  --glow: rgba(0, 242, 254, 0.22);
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

[data-theme="jili"] {
  --bg: #100709;
  --surface: #1b0d11;
  --surface-2: #261217;
  --surface-3: #331920;
  --primary: #f59e0b;
  --secondary: #e11d48;
  --accent: #fde047;
  --hot: #10b981;
  --warm: #f59e0b;
  --cold: #fb7185;
  --text: #fffbeb;
  --muted: #e2d5d8;
  --dim: #a8969b;
  --line: rgba(245, 158, 11, 0.22);
  --glow: rgba(245, 158, 11, 0.22);
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'Fira Code', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 75% 45% at 15% -5%, var(--glow), transparent 60%),
    radial-gradient(ellipse 65% 40% at 90% 10%, rgba(139, 92, 246, 0.14), transparent 55%);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  padding-bottom: 108px;
  overflow-x: hidden;
}
[data-theme="jili"] body {
  background-image:
    radial-gradient(ellipse 75% 45% at 15% -5%, rgba(225, 29, 72, 0.22), transparent 60%),
    radial-gradient(ellipse 65% 40% at 90% 10%, rgba(245, 158, 11, 0.16), transparent 55%);
}
a { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; }

/* TOP TELEMETRY TICKER */
.tele-topbar {
  background: rgba(5, 8, 15, 0.94);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 7px 16px;
}
.tele-topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.tele-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--hot);
  box-shadow: 0 0 10px var(--hot); animation: pulseBeat 1.6s infinite; flex-shrink: 0;
}
@keyframes pulseBeat {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.55; }
}
.sync-pill, .audit-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line);
  color: var(--muted); cursor: pointer; transition: border-color .2s, background .2s;
}
.audit-pill:hover { border-color: var(--primary); color: var(--text); }
.sync-bar-wrap {
  width: 68px; height: 5px; background: rgba(255,255,255,0.1); border-radius: 99px; overflow: hidden;
}
.sync-bar-fill {
  height: 100%; width: 100%; background: linear-gradient(90deg, var(--primary), var(--hot));
  transition: width 0.5s linear;
}

/* HEADER */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(7, 11, 20, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
[data-theme="jili"] .site-header { background: rgba(16, 7, 9, 0.9); }
.header-inner {
  max-width: 1320px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.brand-box { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-avatar {
  width: 44px; height: 44px; border-radius: 12px; object-fit: cover;
  border: 1.5px solid var(--primary); flex-shrink: 0;
}
.brand-logo-img { height: 28px; width: auto; display: block; object-fit: contain; }
.brand-title { font-family: var(--font-display); font-weight: 800; font-size: 1.12rem; letter-spacing: -0.02em; }
.brand-title span { color: var(--primary); }
.brand-sub { font-size: 0.74rem; color: var(--dim); }

.header-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.win-switch {
  display: inline-flex; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 3px; gap: 2px;
}
.win-btn {
  border: none; background: transparent; color: var(--dim);
  padding: 5px 10px; border-radius: 7px; font-size: 0.75rem; font-weight: 700; cursor: pointer;
}
.win-btn.active { background: var(--primary); color: #050811; }
.btn-ghost, .btn-primary {
  border-radius: 10px; padding: 8px 13px; font-size: 0.8rem; font-weight: 700;
  cursor: pointer; border: 1px solid var(--line); transition: transform .15s, border-color .15s;
  white-space: nowrap;
}
.btn-ghost { background: var(--surface); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; border-color: transparent;
}
[data-theme="jili"] .btn-primary { color: #16090b; background: linear-gradient(135deg, #fde047, #f59e0b); }
.btn-primary:hover, .btn-ghost:hover { transform: translateY(-1px); }

/* MAIN CONTAINER */
.shell { max-width: 1320px; margin: 0 auto; padding: 20px 16px 40px; }

/* HERO APEX SPOTLIGHT */
.apex-grid {
  display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 18px; margin-bottom: 20px;
}
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px;
  position: relative; overflow: hidden;
}
.apex-card {
  background: linear-gradient(145deg, rgba(22, 32, 54, 0.92), rgba(11, 16, 30, 0.98));
  border-color: rgba(0, 242, 254, 0.35);
}
[data-theme="jili"] .apex-card {
  background: linear-gradient(145deg, rgba(44, 18, 24, 0.94), rgba(16, 7, 9, 0.98));
  border-color: rgba(245, 158, 11, 0.42);
}
.apex-tag-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.apex-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px;
  background: rgba(16, 185, 129, 0.14); border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em;
}
.apex-main {
  display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 18px; align-items: center;
}
.gauge-box {
  position: relative; width: 176px; height: 176px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
}
.gauge-box canvas { position: absolute; inset: 0; width: 176px; height: 176px; }
.gauge-center { position: relative; text-align: center; z-index: 2; }
.gauge-val { font-family: var(--font-mono); font-size: 2.05rem; font-weight: 800; color: var(--hot); line-height: 1; }
.gauge-lbl { font-size: 0.68rem; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }
.gauge-delta {
  margin-top: 5px; display: inline-block; padding: 2px 8px; border-radius: 99px;
  background: rgba(16, 185, 129, 0.16); color: #34d399; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
}

.apex-info h1 { font-family: var(--font-display); font-size: 1.55rem; line-height: 1.18; margin-bottom: 6px; }
.apex-meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.meta-chip {
  font-size: 0.74rem; padding: 3px 9px; border-radius: 8px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line); color: var(--muted);
  font-family: var(--font-mono);
}
.apex-pola {
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 0.82rem; color: var(--muted); margin-bottom: 12px;
}
.apex-pola strong { color: var(--accent); }
.apex-spark-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.apex-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* RIGHT APEX COLUMN: PODIUM + COLD WARNINGS */
.side-stack { display: flex; flex-direction: column; gap: 14px; }
.section-kicker {
  font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--primary); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center;
}
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  cursor: pointer; transition: border-color .15s;
}
.mini-row:hover { border-color: var(--primary); }
.mini-row.cold-row { border-color: rgba(239, 68, 68, 0.32); background: rgba(239, 68, 68, 0.06); }
.mini-name { font-weight: 700; font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { font-size: 0.72rem; color: var(--dim); }
.mini-rtp { font-family: var(--font-mono); font-weight: 800; font-size: 0.92rem; text-align: right; flex-shrink: 0; }
.txt-hot { color: var(--hot); }
.txt-warm { color: var(--warm); }
.txt-cold { color: var(--cold); }

/* LIVE PULSE BAR + PROOF ACTIONS */
.pulse-strip {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 16px; margin-bottom: 20px; display: grid;
  grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center;
}
.pulse-feed {
  display: flex; gap: 10px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px;
}
.pulse-item {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 11px; font-size: 0.76rem;
}
.badge-pecah { background: rgba(16,185,129,0.18); color: #34d399; padding: 2px 6px; border-radius: 6px; font-weight: 800; font-size: 0.68rem; }
.badge-sedut { background: rgba(239,68,68,0.18); color: #f87171; padding: 2px 6px; border-radius: 6px; font-weight: 800; font-size: 0.68rem; }
.badge-replay { background: rgba(56,189,248,0.2); color: #38bdf8; padding: 2px 6px; border-radius: 6px; font-weight: 800; font-size: 0.68rem; }
.pulse-cta-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* AI BANKROLL MATCHER */
.matcher-panel { margin-bottom: 20px; }
.matcher-grid {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: center;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.chip-btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  padding: 6px 12px; border-radius: 99px; font-size: 0.78rem; font-weight: 700; cursor: pointer;
}
.chip-btn.active {
  background: var(--primary); color: #050811; border-color: var(--primary);
}
[data-theme="jili"] .chip-btn.active { color: #16090b; }
.matcher-summary {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  font-size: 0.82rem;
}

/* FILTER BAR & CATALOG */
.filter-bar {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 12px;
}
.filter-top {
  display: grid; grid-template-columns: minmax(0, 1.4fr) auto auto; gap: 10px; align-items: center;
}
.search-input, .select-input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); padding: 9px 13px; border-radius: 10px; font-size: 0.86rem; outline: none;
}
.search-input:focus, .select-input:focus { border-color: var(--primary); }
.cat-pills { display: flex; gap: 7px; flex-wrap: wrap; }
.cat-btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  padding: 6px 12px; border-radius: 99px; font-size: 0.76rem; font-weight: 700; cursor: pointer;
}
.cat-btn.active { background: rgba(0, 242, 254, 0.16); color: var(--primary); border-color: var(--primary); }
[data-theme="jili"] .cat-btn.active { background: rgba(245, 158, 11, 0.18); }

/* GAME CARD GRID */
.games-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 14px;
}
.game-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color .2s, transform .2s;
}
.game-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.game-card.is-hot { border-color: rgba(16, 185, 129, 0.48); box-shadow: 0 0 22px rgba(16, 185, 129, 0.08); }
.game-card.is-cold { border-color: rgba(239, 68, 68, 0.34); }
.gc-head { display: flex; gap: 11px; align-items: center; }
.gc-thumb {
  width: 60px; height: 60px; border-radius: 12px; overflow: hidden; flex-shrink: 0;
  border: 1px solid var(--line); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
}
.gc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gc-title-wrap { min-width: 0; flex: 1; }
.gc-title { font-family: var(--font-display); font-weight: 700; font-size: 0.96rem; line-height: 1.2; margin-bottom: 3px; }
.gc-mech { font-size: 0.72rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.gc-rtp-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface-2); border-radius: 11px; padding: 8px 11px;
}
.gc-live-val { font-family: var(--font-mono); font-size: 1.24rem; font-weight: 800; line-height: 1; }
.gc-off-lbl { font-size: 0.69rem; color: var(--dim); font-family: var(--font-mono); margin-top: 2px; }
.gc-spark { width: 96px; height: 32px; flex-shrink: 0; }

.gc-stats { display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; color: var(--muted); gap: 6px; }
.vol-bars { display: inline-flex; gap: 2px; align-items: center; }
.vol-bar { width: 4px; height: 10px; border-radius: 2px; background: rgba(255,255,255,0.14); }
.vol-bar.on { background: var(--accent); }

.gc-budget-box {
  background: rgba(56, 189, 248, 0.08); border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 9px; padding: 6px 9px; font-size: 0.73rem; color: var(--muted);
}

.gc-votes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.vote-btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  padding: 6px 8px; border-radius: 9px; font-size: 0.74rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
}
.vote-btn.hit:hover { border-color: var(--hot); color: #34d399; }
.vote-btn.dry:hover { border-color: var(--cold); color: #f87171; }
.vote-btn.voted { border-color: var(--primary); background: rgba(0, 242, 254, 0.1); }

.gc-tools { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; }
.tool-btn {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: 6px 9px; border-radius: 8px; font-size: 0.72rem; font-weight: 700; cursor: pointer;
}
.tool-btn:hover { border-color: var(--primary); color: var(--text); }
.tool-btn.pinned { border-color: var(--accent); color: var(--accent); }

/* BLOOMBERG PRO TABLE VIEW */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.pro-table { width: 100%; border-collapse: collapse; min-width: 780px; font-size: 0.82rem; }
.pro-table th, .pro-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.pro-table th { background: var(--surface-2); color: var(--primary); font-size: 0.74rem; text-transform: uppercase; }
.pro-table tr:hover td { background: rgba(255,255,255,0.03); }

/* STICKY WATCHLIST DOCK */
.watchlist-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  background: rgba(7, 11, 20, 0.95); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 10px 16px;
}
[data-theme="jili"] .watchlist-dock { background: rgba(16, 7, 9, 0.96); }
.dock-inner {
  max-width: 1320px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.dock-pins { display: flex; gap: 8px; overflow-x: auto; align-items: center; flex: 1; min-width: 220px; }
.pin-pill {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px;
  padding: 5px 10px; font-size: 0.75rem; font-weight: 700;
}
.dock-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* MODALS */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; padding: 14px;
}
.modal-backdrop.open { display: flex; }
.modal-card {
  width: 100%; max-width: 680px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--primary); border-radius: 18px; padding: 20px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.modal-head h2 { font-family: var(--font-display); font-size: 1.2rem; }
.close-x {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-weight: 800; cursor: pointer;
}
.sim-canvas {
  width: 100%; height: 180px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; display: block; margin: 12px 0;
}
.sim-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.kpi-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; text-align: center; }
.kpi-val { font-family: var(--font-mono); font-size: 1.02rem; font-weight: 800; }
.kpi-lbl { font-size: 0.68rem; color: var(--dim); }

.duel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.code-pre {
  background: #04070d; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-family: var(--font-mono); font-size: 0.72rem; color: #93c5fd;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all;
}
.toast {
  position: fixed; top: 18px; right: 18px; z-index: 95; background: var(--surface-2);
  border: 1px solid var(--primary); color: var(--text); padding: 10px 14px; border-radius: 10px;
  font-size: 0.8rem; font-weight: 700; display: none; max-width: 340px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.toast.show { display: block; }

@media (max-width: 960px) {
  .apex-grid { grid-template-columns: minmax(0, 1fr); }
  .matcher-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .apex-main { grid-template-columns: minmax(0, 1fr); text-align: center; }
  .apex-meta-row, .apex-actions, .apex-spark-wrap { justify-content: center; }
  .filter-top { grid-template-columns: minmax(0, 1fr); }
  .pulse-strip { grid-template-columns: minmax(0, 1fr); }
  .sim-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .duel-grid { grid-template-columns: minmax(0, 1fr); }
  .header-inner { padding: 10px 12px; }
  .brand-title { font-size: 0.98rem; }
}
