:root {
  --bg: #0A0D14; /* Deep premium black/navy */
  --s1: #111620; /* Surface 1 */
  --s2: #1A2130; /* Surface 2 */
  --s3: #242D40; /* Surface 3 */
  --br: rgba(255, 255, 255, 0.06); /* Very subtle borders */
  --pr: #00E599; /* Fintech Emerald Green */
  --pr-dim: rgba(0, 229, 153, 0.15);
  --cy: #3B82F6; /* Trust Blue */
  --tx: #F8FAFC; /* Primary Text */
  --ts: #94A3B8; /* Secondary Text */
  --tm: #64748B; /* Muted Text */
  --danger: #EF4444; /* Red for errors/debits */
  --glass: rgba(10, 13, 20, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
}

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

html, body {
  width: 100%;
  background: var(--bg);
  color: var(--tx);
  font-family: 'Inter', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#app {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1;
  display: none;
  flex-direction: column;
  padding-bottom: 90px;
}

.page.active {
  display: flex;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.04); }
}

/* NAV - Clean, strict */
.nav {
  display: flex;
  background: rgba(10, 13, 20, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--br);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.ni {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 4px;
  gap: 6px;
  cursor: pointer;
  transition: 0.2s;
  color: var(--tm);
}

.ni i {
  width: 20px;
  height: 20px;
  transition: transform 0.2s, stroke 0.2s;
  stroke-width: 2.5px;
}

.ni-lb {
  font-size: 11px;
  font-weight: 600;
  transition: color 0.2s;
  letter-spacing: 0.2px;
}

.ni.active {
  color: var(--tx); /* Active state is crisp white */
}

.ni.active i {
  transform: translateY(-2px);
  stroke: var(--tx);
}

/* CARDS - Fintech style */
.card {
  background: var(--s1);
  border: 1px solid var(--br);
  border-radius: 16px; /* Straighter corners */
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.card+.card {
  margin-top: 12px;
}

.section {
  padding: 24px 20px 0;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ts);
  letter-spacing: 0.3px;
  margin-bottom: 16px;
}

/* BALANCE CARD - The Hero */
.bal-card {
  background: var(--s1);
  border: 1px solid var(--br);
  border-radius: 20px;
  padding: 32px 24px;
  margin: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.bal-label {
  font-size: 14px;
  color: var(--ts);
  font-weight: 500;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bal-amount {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -1.5px;
  color: var(--tx);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* BUTTONS */
.btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--tx);
  color: var(--bg);
}

.btn-primary:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.btn-secondary {
  background: var(--s2);
  color: var(--tx);
  border: 1px solid var(--br);
}

.btn-secondary:active {
  transform: scale(0.97);
  background: var(--s3);
}

.btn-accent {
  background: var(--pr);
  color: #000;
}

.btn-accent:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.btn:disabled {
  background: var(--s2) !important;
  color: var(--tm) !important;
  box-shadow: none !important;
  cursor: not-allowed;
  transform: none !important;
}

/* STATS ROW */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin: 0 20px 24px;
}

.stat-cell {
  background: var(--s1);
  border: 1px solid var(--br);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
}

.stat-val {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}

.stat-lbl {
  font-size: 12px;
  color: var(--ts);
  font-weight: 500;
}

/* FEED - Clean Player */
#page-feed {
  background: #000;
  position: relative;
  min-height: 100vh;
}

.feed-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 24px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 100%);
}

.feed-logo {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.feed-logo i {
  color: var(--tx);
  width: 20px;
  height: 20px;
  stroke-width: 2.5px;
}

.bal-chip {
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--pr);
  display: flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.feed-info {
  position: absolute;
  left: 20px;
  bottom: 120px;
  z-index: 10;
  max-width: 80%;
}

/* EARN POPUP */
.earn-pop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  background: rgba(10, 13, 20, 0.8);
  backdrop-filter: blur(8px);
}

.earn-pop.show {
  opacity: 1;
  pointer-events: all;
}

.earn-pop-box {
  background: var(--s1);
  border: 1px solid var(--br);
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.earn-pop.show .earn-pop-box {
  transform: scale(1);
}

.earn-pop-amt {
  font-size: 48px;
  font-weight: 700;
  color: var(--pr);
  letter-spacing: -1px;
  margin-bottom: 8px;
}

/* TXNS */
.txn-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--br);
}

.txn-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.txn-item:first-child {
  padding-top: 0;
}

.txn-ic {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.txn-ic i {
  width: 20px;
  height: 20px;
}

.txn-ic.earn {
  background: rgba(0, 229, 153, 0.1);
  color: var(--pr);
}

.txn-ic.withdraw {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.txn-info {
  flex: 1;
}

.txn-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--tx);
  margin-bottom: 4px;
}

.txn-date {
  font-size: 12px;
  color: var(--ts);
}

.txn-amt {
  font-size: 16px;
  font-weight: 600;
  color: var(--pr);
}

.txn-amt.neg {
  color: var(--tx);
}

/* WITHDRAW MODAL */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 20, 0.85);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-bg.show {
  opacity: 1;
  pointer-events: all;
}

.modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--br);
  border-radius: 24px 24px 0 0;
  padding: 24px;
  z-index: 151;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0, 0.67, 0);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-bg.show .modal {
  transform: none;
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--s3);
  border-radius: 2px;
  margin: 0 auto 24px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.method-btn {
  width: 100%;
  background: var(--s1);
  border: 1px solid var(--br);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  margin-bottom: 12px;
  transition: all 0.2s;
  font-family: inherit;
  color: var(--tx);
}

.method-btn:active {
  transform: scale(0.98);
  border-color: var(--ts);
  background: var(--s2);
}

.method-icon {
  width: 40px;
  height: 40px;
  background: var(--bg);
  border: 1px solid var(--br);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.method-icon i {
  width: 20px;
  height: 20px;
  stroke: var(--tx);
}

.method-info {
  text-align: left;
  flex: 1;
}

.method-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.method-fee {
  font-size: 12px;
  color: var(--ts);
}

/* REF */
.ref-link-box {
  background: var(--s1);
  border: 1px solid var(--br);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  cursor: pointer;
}

.ref-link-text {
  flex: 1;
  font-size: 14px;
  color: var(--ts);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-link-copy {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
}

/* TOAST */
.toast {
  position: fixed;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--tx);
  color: var(--bg);
  padding: 14px 20px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  transition: top 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.toast.show {
  top: 40px;
}

.toast i {
  width: 20px;
  height: 20px;
  stroke: var(--bg);
}

/* LIST ITEMS (Tasks, Profile) */
.list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--s1);
  border: 1px solid var(--br);
  border-radius: 14px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.2s;
}

.list-item:active {
  transform: scale(0.98);
}

.list-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--s2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.list-icon i {
  width: 20px;
  height: 20px;
  stroke: var(--tx);
}

.list-info {
  flex: 1;
}

.list-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--tx);
  margin-bottom: 4px;
}

.list-sub {
  font-size: 13px;
  color: var(--ts);
}

.list-right i {
  stroke: var(--ts);
  width: 20px;
  height: 20px;
}

/* AVATAR */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 20px;
  margin-top: 20px;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--s2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-tag {
  font-size: 13px;
  color: var(--ts);
}

.badge {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge.unver {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* PROGRESS BARS */
.progress-bg {
  height: 8px;
  background: var(--s2);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--tx);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* CIRCULAR PROGRESS (Video player) */
.circ-progress {
  position: absolute;
  right: 20px;
  bottom: 120px;
  width: 56px;
  height: 56px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.circ-svg {
  transform: rotate(-90deg);
  width: 56px;
  height: 56px;
}

.circ-bg {
  fill: none;
  stroke: rgba(255,255,255,0.2);
  stroke-width: 3;
}

.circ-fg {
  fill: none;
  stroke: var(--tx);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 157;
  stroke-dashoffset: 157;
  transition: stroke-dashoffset 0.1s linear;
}

.circ-text {
  position: absolute;
  font-size: 12px;
  font-weight: 700;
  color: var(--tx);
}
