:root {
  --bg: #09090b;
  --s1: #18181b;
  --s2: #27272a;
  --s3: #3f3f46;
  --br: rgba(255, 255, 255, 0.1);
  --pr: #fe2c55;
  --cy: #25f4ee;
  --tx: #f8fafc;
  --ts: #a1a1aa;
  --tm: #71717a;
  --gr: linear-gradient(135deg, #fe2c55, #ff4d6d);
  --glass: rgba(24, 24, 27, 0.7);
}

*, *::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;
  /* Allow native vertical scrolling for Telegram swipe-to-expand */
  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(10px); }
  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.08); }
}

/* NAV */
.nav {
  display: flex;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  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: 12px 4px;
  gap: 4px;
  cursor: pointer;
  transition: 0.2s;
  color: var(--tm);
}

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

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

.ni.active {
  color: var(--pr);
}

.ni.active i {
  transform: scale(1.15);
  stroke: var(--pr);
}

/* CARDS */
.card {
  background: var(--s1);
  border: 1px solid var(--br);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}

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

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

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ts);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
}

/* BALANCE CARD */
.bal-card {
  background: linear-gradient(135deg, #240b13, #15060b);
  border: 1px solid rgba(254, 44, 85, 0.3);
  border-radius: 24px;
  padding: 32px 24px;
  position: relative;
  overflow: hidden;
  margin: 20px;
  box-shadow: 0 12px 32px rgba(254, 44, 85, 0.15);
}

.bal-card::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(254, 44, 85, 0.25), transparent 70%);
  pointer-events: none;
}

.bal-label {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bal-label i {
  width: 16px;
  height: 16px;
  stroke: var(--pr);
}

.bal-amount {
  font-size: 52px;
  font-weight: 900;
  letter-spacing: -2px;
  background: linear-gradient(135deg, #ffffff, #f1f5f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.bal-sub {
  font-size: 14px;
  color: var(--ts);
  margin-top: 8px;
}

.bal-sub span {
  color: var(--pr);
  font-weight: 700;
}

/* BUTTONS */
.btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn i {
  width: 20px;
  height: 20px;
}

.btn-primary {
  background: var(--gr);
  color: #fff;
  box-shadow: 0 8px 24px rgba(254, 44, 85, 0.4);
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 4px 12px rgba(254, 44, 85, 0.3);
}

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

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

.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 20px;
}

.stat-cell {
  background: var(--s1);
  border: 1px solid var(--br);
  border-radius: 18px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.stat-icon {
  width: 20px;
  height: 20px;
  stroke: var(--ts);
  margin-bottom: 2px;
}

.stat-val {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

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

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

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

.feed-logo {
  font-size: 22px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feed-logo i {
  color: var(--pr);
  fill: var(--pr);
  width: 24px;
  height: 24px;
}

.bal-chip {
  background: rgba(254, 44, 85, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(254, 44, 85, 0.4);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bal-chip i {
  width: 14px;
  height: 14px;
  stroke: var(--pr);
}

.video-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 28px;
  padding: 80px 24px 120px;
  position: relative;
  background: radial-gradient(circle at center, #1a0b12, #000);
}

.ring-wrap {
  position: relative;
  width: 180px;
  height: 180px;
}

.ring {
  width: 180px;
  height: 180px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 6;
}

.ring-fg {
  fill: none;
  stroke: var(--pr);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 452;
  stroke-dashoffset: 452;
  transition: stroke-dashoffset 1s linear;
  filter: drop-shadow(0 0 12px var(--pr));
}

.ring-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ring-icon {
  width: 42px;
  height: 42px;
  stroke: #fff;
  filter: drop-shadow(0 0 16px rgba(254, 44, 85, 0.8));
}

.ring-time {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.earn-title {
  font-size: 26px;
  font-weight: 900;
  text-align: center;
  letter-spacing: -0.5px;
}

.earn-title span {
  color: var(--pr);
}

.earn-sub {
  font-size: 15px;
  color: var(--ts);
  text-align: center;
}

.feed-btn-wrap {
  position: absolute;
  bottom: 100px;
  left: 20px;
  right: 20px;
}

.side-acts {
  position: absolute;
  right: 16px;
  bottom: 180px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-items: center;
}

.sa {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.sa-ic {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.sa-ic i {
  width: 22px;
  height: 22px;
  stroke: #fff;
}

.sa-ic.heart i { fill: #fff; }

.sa-lb {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
}

/* 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(0,0,0,0.6);
  backdrop-filter: blur(8px);
}

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

.earn-pop-box {
  background: var(--s1);
  border: 1px solid rgba(254, 44, 85, 0.4);
  border-radius: 32px;
  padding: 40px 50px;
  text-align: center;
  transform: scale(0.8);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 20px 40px rgba(254, 44, 85, 0.2);
}

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

.earn-pop-amt {
  font-size: 64px;
  font-weight: 900;
  color: var(--pr);
  line-height: 1;
  margin-bottom: 12px;
}

.earn-pop-lbl {
  font-size: 16px;
  color: var(--tx);
  font-weight: 500;
}

/* 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: 48px;
  height: 48px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.txn-ic.earn {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}

.txn-ic.gift {
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
}

.txn-ic.ref {
  background: rgba(37, 244, 238, 0.15);
  color: var(--cy);
}

.txn-ic.withdraw {
  background: rgba(254, 44, 85, 0.15);
  color: var(--pr);
}

.txn-info {
  flex: 1;
}

.txn-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

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

.txn-amt {
  font-size: 16px;
  font-weight: 800;
  color: #2ecc71;
}

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

/* WITHDRAW MODAL */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  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(--s1);
  border-top: 1px solid var(--br);
  border-radius: 32px 32px 0 0;
  padding: 32px 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: 48px;
  height: 5px;
  background: var(--s3);
  border-radius: 3px;
  margin: 0 auto 24px;
}

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

.modal-sub {
  font-size: 15px;
  color: var(--ts);
  margin-bottom: 28px;
  text-align: center;
}

.modal-sub strong {
  color: var(--tx);
}

.method-btn {
  width: 100%;
  background: var(--s2);
  border: 1px solid var(--br);
  border-radius: 18px;
  padding: 18px;
  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.97);
  border-color: var(--pr);
  background: rgba(254, 44, 85, 0.05);
}

.method-icon {
  width: 48px;
  height: 48px;
  background: var(--s1);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.method-btn:nth-child(4) .method-icon i { stroke: #2ecc71; } /* card */
.method-btn:nth-child(5) .method-icon i { stroke: #f59e0b; } /* ymoney */
.method-btn:nth-child(6) .method-icon i { stroke: #3b82f6; } /* phone */
.method-btn:nth-child(7) .method-icon i { stroke: #25f4ee; } /* crypto */

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

.method-name {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 4px;
}

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

/* REF */
.ref-hero {
  margin: 20px;
  background: linear-gradient(135deg, #091a18, #05100f);
  border: 1px solid rgba(37, 244, 238, 0.2);
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(37, 244, 238, 0.1);
}

.ref-hero-ic {
  width: 64px;
  height: 64px;
  background: rgba(37, 244, 238, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.ref-hero-ic i {
  width: 32px;
  height: 32px;
  stroke: var(--cy);
}

.ref-hero-title {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 10px;
}

.ref-hero-sub {
  font-size: 15px;
  color: var(--ts);
  line-height: 1.5;
}

.ref-link-box {
  background: var(--s2);
  border: 1px solid var(--br);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.ref-link-box:active {
  border-color: var(--pr);
}

.ref-link-box i {
  width: 20px;
  height: 20px;
  stroke: var(--ts);
}

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

.ref-link-copy {
  font-size: 14px;
  font-weight: 800;
  color: var(--cy);
  flex-shrink: 0;
}

/* PROFILE */
.profile-hero {
  margin: 20px;
  background: var(--s1);
  border: 1px solid var(--br);
  border-radius: 28px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}

.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--gr);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(254, 44, 85, 0.4);
  color: #fff;
}

.profile-name {
  font-size: 24px;
  font-weight: 900;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
}

.badge i {
  width: 14px;
  height: 14px;
}

.badge.unver {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ts);
}

.badge.ver {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}

.gift-card {
  background: linear-gradient(135deg, #1f1a09, #120e03);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 24px;
  padding: 24px;
  margin: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 8px 24px rgba(255, 215, 0, 0.1);
}

.gift-card:active {
  transform: scale(0.97);
}

.gift-left {
  flex: 1;
}

.gift-title {
  font-size: 18px;
  font-weight: 900;
  color: #ffd700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gift-title i {
  width: 18px;
  height: 18px;
}

.gift-sub {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}

.gift-ic {
  width: 56px;
  height: 56px;
  background: rgba(255, 215, 0, 0.15);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gift-ic i {
  width: 28px;
  height: 28px;
  stroke: #ffd700;
}

.vip-card {
  background: linear-gradient(135deg, #1a0010, #0a0018);
  border: 1px solid rgba(254, 44, 85, 0.3);
  box-shadow: 0 8px 24px rgba(254, 44, 85, 0.15);
}

.vip-icon {
  width: 48px;
  height: 48px;
  background: rgba(254, 44, 85, 0.15);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vip-icon i {
  width: 24px;
  height: 24px;
  stroke: var(--pr);
}

/* TOAST */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: rgba(39, 39, 42, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--br);
  border-radius: 100px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 700;
  z-index: 300;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  box-shadow: 0 12px 24px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast i {
  width: 18px;
  height: 18px;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}
