:root {
  --bg-color: #0b0c10;
  --surface-color: #1a1c23;
  --surface-light: #101114;
  --surface-lighter: #343846;
  --text-primary: #ffffff;
  --text-secondary: #8b92a5;
  --accent-color: #ff4655;
  --gold-color: #f0b232;
  --cyan-color: #00d2ff;
  --purple-color: #b05cff;
  
  --font-main: 'Prompt', sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 999px;
  
  --nav-height: 80px;
  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

[data-theme='light'] {
  --bg-color: #f4f6f8;
  --surface-color: #ffffff;
  --surface-light: #e5e8ec;
  --surface-lighter: #d1d5db;
  --text-primary: #11141a;
  --text-secondary: #6e7687;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body > div:not(.bottom-nav-wrap):not(.toast):not(.connect-wrap), body > main {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  background-color: var(--bg-color);
  min-height: 100vh;
}

.hidden { display: none !important; }
button { background: none; border: none; font-family: inherit; cursor: pointer; color: inherit; }
a { text-decoration: none; color: inherit; }

/* SVG Icons */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.vp-icon, .rp-icon, .kc-icon {
  display: inline-block;
  width: 14px; height: 14px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 4px;
  flex: none;
}

/* ----------------------------------------------------
   Login Page
---------------------------------------------------- */
.connect-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg-color);
}
.panel {
  width: 100%;
  max-width: 440px;
  background: var(--surface-light);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 48px 32px 36px;
  text-align: center;
}

/* Brand row */
.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
}
.logo-ring {
  width: 48px; height: 48px;
  background: var(--accent-color);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 900; color: #fff;
  flex-shrink: 0;
}
.login-brand-label {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-primary);
}

.panel h1 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.panel .desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.7;
}

/* Security badge */
.login-security {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: #4ade80;
  margin-bottom: 16px;
  opacity: 0.85;
}
.login-security svg { flex-shrink: 0; stroke: #4ade80; }

/* Primary button */
.btn-primary {
  background: var(--accent-color);
  color: #fff;
  width: 100%;
  padding: 15px 24px;
  border-radius: var(--radius-md);
  font-size: 15px; font-weight: 700;
  transition: filter 0.15s, transform 0.1s;
  cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 13px; font-weight: 600;
  width: 100%; padding: 14px;
  cursor: pointer;
}

/* Status message */
.form-msg {
  font-size: 13px;
  margin-top: 20px;
  color: #e9c13e;
  background: rgba(233, 193, 62, 0.08);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  display: none;
  line-height: 1.6;
}
.form-msg:not(:empty) { display: block; }
.form-msg.error {
  color: var(--accent-color);
  background: rgba(255, 70, 85, 0.08);
}

/* Feature highlights */
.login-features {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.login-feature-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}
.login-feature-item svg {
  stroke: var(--text-secondary);
  opacity: 0.6;
}

/* Privacy disclaimer */
.login-privacy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.55;
}
.login-privacy svg {
  flex-shrink: 0;
  stroke: var(--text-secondary);
}
.empty {
  display: block;
  padding: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
}
.theme-fab {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px;
  background: var(--surface-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.theme-fab::before { content: '☾'; }
[data-theme='light'] .theme-fab::before { content: '☀'; }

/* ----------------------------------------------------
   App Page Base
---------------------------------------------------- */
.app-page {
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
}

/* ----------------------------------------------------
   TRACKER Page
---------------------------------------------------- */
.TRACKER-banner {
  height: 150px;
  background-color: var(--surface-light);
  background-size: cover;
  background-position: center top;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  border-radius: 0 0 32px 32px;
}
.TRACKER-banner-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 40%;
  background: linear-gradient(to top, var(--bg-color) 0%, transparent 100%);
  border-radius: 0 0 32px 32px;
}
.TRACKER-profile-top {
  position: relative; z-index: 1;
  display: flex; justify-content: flex-end;
}
.TRACKER-level-badge {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700;
  border: 1px solid rgba(255,255,255,0.1);
}
.TRACKER-profile-row {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 16px;
}
.TRACKER-avatar {
  width: 64px; height: 64px;
  border-radius: 20px;
  background: var(--surface-light);
  background-size: cover; background-position: center;
  border: 2px solid rgba(255,255,255,0.1);
}
.TRACKER-user-info { display: flex; flex-direction: column; }
.TRACKER-name { font-size: 20px; font-weight: 800; line-height: 1.2; }
.TRACKER-tag { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.TRACKER-status { font-size: 11px; color: #4ade80; font-weight: 600; }

.TRACKER-section { padding: 24px 24px 0; }
.section-label {
  display: block; font-size: 12px; color: var(--text-secondary);
  font-weight: 700; letter-spacing: 1px; margin-bottom: 16px;
}

.TRACKER-ranks-card {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  display: flex;
  overflow: hidden;
}
.rank-col {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 20px 12px 24px;
}
.rank-col:first-child {
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 100%);
}
.rank-divider {
  width: 1px; flex: none;
  background: rgba(255,255,255,0.07);
}
.rank-act { font-size: 10px; color: var(--text-secondary); letter-spacing: 1px; margin-bottom: 12px; }
.rank-icon-wrap {
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 8px;
  margin-bottom: 14px;
}
.rank-icon { width: 100%; height: 100%; object-fit: contain; }
.rank-name { font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.rank-rr { font-size: 11px; color: var(--text-secondary); }

.TRACKER-stats {
  display: flex;
  background: var(--surface-color);
  border-radius: var(--radius-md);
  padding: 14px 0;
}
.TRACKER-stat {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.TRACKER-stat:not(:last-child) { border-right: 1px solid rgba(255,255,255,0.05); }
.TRACKER-stat strong { font-size: 16px; font-weight: 800; }
.TRACKER-stat span { font-size: 11px; color: var(--text-secondary); }

.act-list { display: flex; flex-direction: column; gap: 8px; }
.act-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}
.act-rank-icon { width: 40px; height: 40px; object-fit: contain; flex: none; }
.act-rank-placeholder { width: 40px; height: 40px; flex: none; }
.act-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.act-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-sub { font-size: 11px; color: var(--text-secondary); }
.act-stats { display: flex; gap: 10px; font-size: 12px; font-weight: 700; flex: none; }
.act-wins { color: #4ade80; }
.act-losses { color: var(--accent-color); }
.act-wr { color: var(--text-secondary); }

.explore-list { display: flex; flex-direction: column; gap: 8px; }
.explore-item {
  width: 100%;
  background: var(--surface-color);
  border-radius: var(--radius-md);
  padding: 8px 16px 8px 8px;
  display: flex; align-items: center;
}
.explore-icon-wrap {
  width: 44px; height: 44px;
  background: var(--surface-light);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-right: 16px; color: #fff;
}
.explore-icon { width: 22px; height: 22px; }
.explore-text { flex: 1; text-align: left; font-size: 15px; font-weight: 600; }
.explore-arrow { color: var(--text-secondary); font-size: 20px; }

.TRACKER-footer {
  padding: 32px 24px 8px;
  display: flex; justify-content: center; gap: 16px;
}
.btn-ghost-sm { font-size: 14px; color: var(--text-secondary); font-weight: 600; }
.theme-btn-sm {
  width: 32px; height: 32px;
  background: var(--surface-color); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: var(--text-secondary);
}
.theme-btn-sm::before { content: '☾'; }
[data-theme='light'] .theme-btn-sm::before { content: '☀'; }


/* ----------------------------------------------------
   Shop Page
---------------------------------------------------- */
.app-topbar {
  display: flex; align-items: center; padding: 16px 24px;
  position: sticky; top: 0; z-index: 10;
  background: var(--bg-color);
}
.topbar-back {
  font-size: 18px; color: var(--text-primary);
  width: 32px; height: 32px; display: flex; align-items: center;
}
.topbar-title { flex: 1; text-align: center; font-size: 18px; font-weight: 700; margin-right: 32px; }

.wallet-bar { padding: 8px 24px 24px; }
.wallet-pill {
  background: var(--surface-color);
  border-radius: var(--radius-full);
  display: flex; justify-content: center; align-items: center;
  padding: 10px 16px;
}
.wallet-item { display: flex; align-items: center; font-size: 13px; font-weight: 700; }
.wallet-item:not(:last-child) {
  border-right: 1px solid rgba(255,255,255,0.05); padding-right: 12px;
}
.wallet-item:not(:first-child) { padding-left: 12px; }

.shop-carousel { margin: 0 24px 16px; position: relative; }
.shop-bundle-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.shop-bundle-track::-webkit-scrollbar { display: none; }
.shop-bundle-hero {
  flex: 0 0 calc(100% - 16px);
  scroll-snap-align: start;
  height: 200px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  background: var(--surface-light);
}
.shop-bundle-img { width: 100%; height: 100%; object-fit: cover; }
.shop-bundle-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%);
  padding: 20px; display: flex; flex-direction: column; justify-content: flex-end;
}
.shop-bundle-name { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.shop-bundle-meta { display: flex; gap: 8px; }
.shop-bundle-badge {
  background: rgba(255,255,255,0.15); backdrop-filter: blur(4px);
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700; display: flex; align-items: center; gap: 4px;
}
.shop-bundle-arrow {
  position: absolute; right: 20px; bottom: 20px;
  width: 28px; height: 28px; background: rgba(255,255,255,0.2); backdrop-filter: blur(4px);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

.shop-carousel-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 24px 24px;
}
.shop-dots { display: flex; gap: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--surface-lighter); }
.dot.active { background: var(--purple-color); }
.shop-viewall { font-size: 12px; font-weight: 600; color: var(--purple-color); cursor: pointer; }

.shop-section-head {
  padding: 0 24px 16px; display: flex; align-items: center; gap: 8px;
}
.shop-section-title { font-size: 16px; font-weight: 700; }
.shop-section-sep { color: rgba(255,255,255,0.2); }
.shop-section-countdown { font-size: 13px; font-weight: 600; color: var(--text-secondary); }

.shop-offers { padding: 0 24px 32px; display: flex; flex-direction: column; gap: 12px; }

/* Offer Card styling to exactly match the image */
.offer-card {
  width: 100%; height: 160px;
  background: var(--surface-color);
  /* hex pattern background */
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 12px 12px;
  border-radius: var(--radius-md);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.offer-card-img {
  width: 85%; height: 85%;
  object-fit: contain;
  transform: rotate(-15deg) scale(1.1); /* angled guns */
  transition: transform 0.3s ease;
}
.offer-card-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 16px;
  display: flex; justify-content: space-between; align-items: flex-end;
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
}
.offer-info { display: flex; align-items: center; gap: 8px; }
.offer-tier {
  width: 20px; height: 20px; border-radius: 4px;
  background: rgba(0,0,0,0.5); padding: 2px;
}
.offer-name { font-size: 14px; font-weight: 700; }
.offer-price-pill {
  background: rgba(255,255,255,0.1); backdrop-filter: blur(4px);
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 800; display: flex; align-items: center;
}

/* ----------------------------------------------------
   Bundle Page
---------------------------------------------------- */
.bundle-hero { height: 260px; position: relative; background: var(--surface-light); }
.bundle-hero-img { width: 100%; height: 100%; object-fit: cover; }
.shop-bundle-img[src=""], .bundle-hero-img[src=""] { display: none; }
.bundle-hero-title {
  position: absolute;
  top: 20px; left: 0; right: 0;
  text-align: center;
  font-size: 20px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.bundle-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 40%, transparent 60%, var(--bg-color) 100%);
}
.topbar-back--light {
  position: absolute; top: 16px; left: 24px; z-index: 10;
  color: #fff; background: rgba(0,0,0,0.4); border-radius: 50%; width: 40px; height: 40px; padding: 0; backdrop-filter: blur(4px);
}
.bundle-summary {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  padding: 24px; margin: -40px 24px 24px; position: relative; z-index: 2;
}
.bundle-summary-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.bundle-name { display: block; font-size: 20px; font-weight: 800; }
.bundle-sub { font-size: 12px; color: var(--text-secondary); }
.bundle-count-badge {
  background: var(--surface-light); padding: 4px 12px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700;
}
.bundle-summary-bottom { display: flex; justify-content: space-between; align-items: center; }
.bundle-price-wrap { display: flex; align-items: center; }
.bundle-total-price { font-size: 24px; font-weight: 800; }
.bundle-total-label {
  background: rgba(255,255,255,0.1); padding: 4px 12px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700; color: var(--text-secondary);
}

.bundle-items-head { padding: 0 24px 12px; font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.bundle-items { padding: 0 24px 32px; display: flex; flex-direction: column; gap: 12px; }

/* ----------------------------------------------------
   Bottom Navigation
---------------------------------------------------- */
.bottom-nav-wrap {
  position: fixed; bottom: 28px; left: 0; right: 0;
  display: flex; justify-content: center; z-index: 100;
}
.bottom-nav-pill {
  background: rgba(28, 28, 30, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  display: flex; padding: 4px 8px; gap: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.nav-tab {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: color 0.2s;
}
.nav-tab.active { color: #fff; }
.nav-label { display: none; }
.sb-user { display: none; }
.nav-icon-bg { 
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; transition: background 0.2s;
}
.nav-tab.active .nav-icon-bg {
  background: rgba(255,255,255,0.15);
}

/* ----------------------------------------------------
   Toast
---------------------------------------------------- */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translate(-50%, 20px);
  background: var(--surface-lighter); color: #fff;
  padding: 12px 24px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 600; opacity: 0; transition: 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error {
  background: var(--accent-color);
  color: #fff;
}

/* ----------------------------------------------------
   Desktop (≥900px)
---------------------------------------------------- */
@media (min-width: 900px) {
  body {
    padding-left: 232px;
  }

  body > div:not(.bottom-nav-wrap):not(.toast):not(.connect-wrap),
  body > main {
    max-width: 1080px;
  }

  #rso-connect { max-width: none; padding-left: 0; }

  /* Bottom nav → fixed left sidebar */
  .bottom-nav-wrap {
    bottom: 0; left: 0; top: 0; right: auto;
    width: 232px;
    justify-content: flex-start;
    align-items: stretch;
    padding: 32px 20px;
    background: rgba(10, 11, 15, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255,255,255,0.06);
  }
  .bottom-nav-pill {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    gap: 6px;
  }
  .nav-tab {
    width: 100%; height: 48px;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 12px;
    border-radius: 12px;
  }
  .nav-tab.active {
    color: #fff;
    background: rgba(255,255,255,0.08);
  }
  .nav-icon-bg { width: 36px; height: 36px; }
  .nav-tab.active .nav-icon-bg { background: transparent; }
  .nav-label { display: block; font-size: 14px; font-weight: 600; }

  /* Sidebar user card */
  .sb-user {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; margin-bottom: 24px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
  }
  .sb-avatar {
    width: 42px; height: 42px; flex: none;
    border-radius: 12px;
    background: var(--surface-light);
    background-size: cover; background-position: center;
    border: 1px solid rgba(255,255,255,0.1);
  }
  .sb-user-info { display: flex; flex-direction: column; min-width: 0; }
  .sb-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sb-tag { font-size: 12px; color: var(--text-secondary); }

  /* App pages: no bottom-nav clearance needed */
  .app-page { padding-bottom: 48px; }

  /* TRACKER: banner full width, ranks + explore side by side */
  .TRACKER-banner { height: 240px; padding: 32px 40px; }
  .TRACKER-avatar { width: 80px; height: 80px; border-radius: 24px; }
  .TRACKER-name { font-size: 26px; }
  #rso-TRACKER {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 32px;
  }
  .TRACKER-banner { grid-column: 1 / -1; }
  .TRACKER-footer { grid-column: 1 / -1; padding: 32px 40px; }
  .TRACKER-section { padding: 32px 40px 0; }
  .rank-section { grid-column: 1 / -1; }
  .stats-section { grid-column: 1 / -1; }
  .act-section { grid-column: 1 / 2; }
  .explore-section { grid-column: 2 / 3; }

  /* Shop */
  .app-topbar { padding: 20px 40px; }
  .wallet-bar { padding: 8px 40px 28px; }
  .wallet-pill { max-width: 480px; margin: 0 auto; }
  .shop-bundle-hero { margin: 0 40px 24px; height: 320px; }
  .shop-carousel-nav { padding: 0 40px 24px; }
  .shop-section-head { padding: 0 40px 16px; }
  .shop-offers {
    padding: 0 40px 40px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  /* Bundle */
  .bundle-hero { height: 380px; }
  .bundle-summary { margin: -48px 40px 32px; padding: 32px 40px; }
  .bundle-items-head { padding: 0 40px 16px; }
  .bundle-items {
    padding: 0 40px 48px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .toast { bottom: 32px; }
}
