@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─────────────────────────────────────────
   DESIGN TOKENS
───────────────────────────────────────── */
:root {
  --bg:          #070711;
  --bg-2:        #0e0e1a;
  --bg-3:        #14142a;
  --card:        rgba(255,255,255,0.04);
  --card-border: rgba(255,255,255,0.08);
  --card-hover:  rgba(255,255,255,0.07);

  --accent:      #6366f1;
  --accent-2:    #8b5cf6;
  --accent-glow: rgba(99,102,241,0.35);
  --success:     #10b981;
  --warning:     #f59e0b;
  --danger:      #ef4444;

  --text:        #e2e8f0;
  --text-2:      #94a3b8;
  --text-3:      #4a5568;

  --radius:      16px;
  --radius-sm:   10px;
  --radius-lg:   24px;

  --nav-h:       64px;
  --transition:  0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

/* ─────────────────────────────────────────
   APP LAYOUT
───────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Page container */
#page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 20px 16px 24px;
  scroll-behavior: smooth;
}

/* ─────────────────────────────────────────
   NAVIGATION BAR
───────────────────────────────────────── */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: var(--nav-h);
  background: rgba(14,14,26,0.95);
  border-top: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
  padding: 0 8px;
  flex-shrink: 0;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  position: relative;
  color: var(--text-3);
}

.nav-item:active { transform: scale(0.93); }

.nav-item svg { transition: var(--transition); }
.nav-item span {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: var(--transition);
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active svg path { stroke: var(--accent); }
.nav-item.active span { color: var(--accent); }

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 4px 4px;
}

/* ─────────────────────────────────────────
   PAGE HEADER
───────────────────────────────────────── */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.page-header p {
  font-size: 14px;
  color: var(--text-2);
  margin-top: 4px;
}

/* ─────────────────────────────────────────
   HOME SCREEN
───────────────────────────────────────── */
.home-hero {
  background: linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(139,92,246,0.1) 100%);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.home-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.home-hero .greeting {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.home-hero .user-name {
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, #e2e8f0, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.balance-card {
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.balance-card .label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}

.balance-card .amount {
  font-size: 20px;
  font-weight: 700;
  color: var(--success);
  letter-spacing: -0.02em;
}

/* Quick Actions Grid */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.quick-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-card:active {
  transform: scale(0.96);
  background: var(--card-hover);
}

.quick-card .qc-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.quick-card .qc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.quick-card .qc-sub {
  font-size: 11px;
  color: var(--text-2);
}

.qc-icon.blue  { background: rgba(99,102,241,0.15); }
.qc-icon.purple{ background: rgba(139,92,246,0.15); }
.qc-icon.green { background: rgba(16,185,129,0.15); }
.qc-icon.orange{ background: rgba(245,158,11,0.15); }

/* ─────────────────────────────────────────
   CARDS
───────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: var(--transition);
}

.card:active { background: var(--card-hover); }

.card-clickable { cursor: pointer; }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(99,102,241,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.card-info { flex: 1; }

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

.card-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.card-price.old {
  text-decoration: line-through;
  color: var(--text-3);
  font-size: 13px;
}

/* ─────────────────────────────────────────
   BUTTONS
───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  letter-spacing: 0.01em;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 24px var(--accent-glow);
}

.btn-primary:hover {
  box-shadow: 0 6px 32px rgba(99,102,241,0.5);
}

.btn-secondary {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
}

.btn-secondary:active { background: var(--card-hover); }

.btn-success {
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.3);
  color: var(--success);
}

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

.btn-sm {
  padding: 9px 14px;
  font-size: 13px;
  width: auto;
}

/* ─────────────────────────────────────────
   INPUTS
───────────────────────────────────────── */
.input-group {
  margin-bottom: 16px;
}

.input-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  display: block;
}

.input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  outline: none;
  transition: var(--transition);
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input::placeholder { color: var(--text-3); }

/* ─────────────────────────────────────────
   BADGES & TAGS
───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-accent  { background: rgba(99,102,241,0.15); color: #a5b4fc; }
.badge-success { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,0.15);  color: var(--danger); }

/* ─────────────────────────────────────────
   DIVIDER
───────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--card-border);
  margin: 16px 0;
}

/* ─────────────────────────────────────────
   STATS ROW
───────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
}

/* ─────────────────────────────────────────
   MODAL
───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.modal-sheet {
  background: var(--bg-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-top: 1px solid var(--card-border);
  padding: 8px 20px 32px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.visible .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--card-border);
  border-radius: 2px;
  margin: 12px auto 20px;
}

.modal-title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.modal-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 20px;
}

/* ─────────────────────────────────────────
   INSTRUCTION READER
───────────────────────────────────────── */
.reader-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.reader-overlay.visible {
  transform: translateY(0);
}

.reader-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--card-border);
  background: var(--bg-2);
}

.reader-back {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.reader-title {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(16,185,129,0.15);
  color: var(--success);
  font-weight: 600;
  white-space: nowrap;
}

.reader-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  user-select: none;         /* нельзя выделить текст */
  -webkit-user-select: none;
}

.reader-content h1, .reader-content h2, .reader-content h3 {
  font-weight: 700;
  margin: 20px 0 10px;
  letter-spacing: -0.02em;
}

.reader-content h1 { font-size: 20px; }
.reader-content h2 { font-size: 17px; color: var(--accent); }
.reader-content h3 { font-size: 15px; }

.reader-content p { margin-bottom: 12px; }
.reader-content ul, .reader-content ol {
  padding-left: 20px;
  margin-bottom: 12px;
}
.reader-content li { margin-bottom: 6px; }

.reader-content code {
  background: var(--bg-3);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  color: #a5b4fc;
}

.reader-content pre {
  background: var(--bg-3);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
  margin: 12px 0;
}

.reader-watermark {
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  padding: 12px;
  border-top: 1px solid var(--card-border);
  user-select: none;
}

/* ─────────────────────────────────────────
   TOAST NOTIFICATIONS
───────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}

.toast {
  background: var(--bg-2);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toast-in 0.25s ease forwards;
}

.toast.removing { animation: toast-out 0.2s ease forwards; }

.toast-success { border-color: rgba(16,185,129,0.4); }
.toast-error   { border-color: rgba(239,68,68,0.4); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* ─────────────────────────────────────────
   LOADER / SKELETON
───────────────────────────────────────── */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 60px 20px;
  color: var(--text-2);
  font-size: 14px;
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--card-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, rgba(255,255,255,0.06) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ─────────────────────────────────────────
   SCREEN TRANSITIONS
───────────────────────────────────────── */
.screen { display: none; animation: fade-up 0.22s ease; }
.screen.active { display: block; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────
   PROFILE
───────────────────────────────────────── */
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 16px;
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.profile-name {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.profile-username {
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 24px;
}

/* Payment method cards */
.pay-methods {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pay-method {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--transition);
}

.pay-method:active { background: var(--card-hover); transform: scale(0.98); }
.pay-method-icon { font-size: 24px; }
.pay-method-info { flex: 1; }
.pay-method-name { font-size: 14px; font-weight: 600; }
.pay-method-sub  { font-size: 12px; color: var(--text-2); }

/* ─────────────────────────────────────────
   REFERRAL LINK
───────────────────────────────────────── */
.ref-link-box {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

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

/* ─────────────────────────────────────────
   FAQ
───────────────────────────────────────── */
.faq-item {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
}

.faq-question {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.faq-chevron {
  transition: transform 0.2s;
  flex-shrink: 0;
  color: var(--text-3);
}

.faq-item.open .faq-chevron { transform: rotate(180deg); }

.faq-answer {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s;
  padding: 0 16px;
}

.faq-item.open .faq-answer {
  max-height: 300px;
  padding: 0 16px 14px;
}

/* ─────────────────────────────────────────
   EMPTY STATE
───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-2);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 14px; }
.empty-state h3 { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state p  { font-size: 13px; line-height: 1.5; }

/* ─────────────────────────────────────────
   UTILITIES
───────────────────────────────────────── */
.mt-4  { margin-top: 4px;  }
.mt-8  { margin-top: 8px;  }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px;  }
.mb-8  { margin-bottom: 8px;  }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm  { font-size: 13px; }
.text-muted { color: var(--text-2); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
