/* ============================================================
   WORDMINT — Стили (Dark Theme)
   ============================================================ */

/* ── Переменные ── */
:root {
  --bg-primary:    #0e0e12;
  --bg-secondary:  #16161e;
  --bg-card:       #1c1c28;
  --bg-card-hover: #232333;

  --accent:        #7c6af5;
  --accent-dim:    #5a4fd4;
  --accent-glow:   rgba(124, 106, 245, 0.25);

  --gold:          #f4c542;
  --silver:        #a8b2c1;
  --bronze:        #cd7f45;
  --green:         #3ecf8e;
  --red:           #f45b5b;

  --text-primary:  #e8e8f0;
  --text-secondary:#8888aa;
  --text-muted:    #555570;

  --border:        rgba(255, 255, 255, 0.07);
  --border-accent: rgba(124, 106, 245, 0.35);

  --radius-sm:     8px;
  --radius-md:     14px;
  --radius-lg:     20px;
  --radius-xl:     28px;

  --shadow:        0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-accent: 0 0 24px rgba(124, 106, 245, 0.3);

  --transition:    0.2s ease;
  --font:          -apple-system, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
}

/* ── Сброс и базовые стили ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom, 24px);
}

/* ── Анимации ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.05); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 12px var(--accent-glow); }
  50%       { box-shadow: 0 0 28px var(--accent-glow), 0 0 48px rgba(124,106,245,0.15); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes countUp {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

/* ── Глобальные утилиты ── */
.fade-up  { animation: fadeUp 0.45s ease both; }
.slide-in { animation: slideIn 0.35s ease both; }

.hidden { display: none !important; }

/* ── Скелетон-загрузчик ── */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius-sm);
  color: transparent;
  pointer-events: none;
  user-select: none;
}

/* ── Шапка навигации ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(14, 14, 18, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.app-logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent) 0%, #a78cfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header-score {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
}
.header-score span { font-size: 18px; }

/* ── Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 100;
  background: rgba(22, 22, 30, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10px 8px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  transition: color var(--transition), transform var(--transition);
  cursor: pointer;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  -webkit-user-select: none;
  user-select: none;
}
.nav-item .icon { font-size: 22px; line-height: 1; }
.nav-item.active { color: var(--accent); }
.nav-item:active { transform: scale(0.92); }

/* ── Основной контент ── */
.page-content {
  padding: 20px 16px;
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  max-width: 480px;
  margin: 0 auto;
}

/* ── Карточки ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  transition: background var(--transition), border-color var(--transition);
}
.card:hover { background: var(--bg-card-hover); }
.card-accent {
  background: linear-gradient(135deg,
    rgba(124, 106, 245, 0.15) 0%, rgba(167, 140, 250, 0.08) 100%);
  border-color: var(--border-accent);
  animation: glow 3s ease-in-out infinite;
}

/* ── Hero-карточка профиля ── */
.hero-card {
  background: linear-gradient(145deg,
    rgba(124, 106, 245, 0.2) 0%,
    rgba(28, 28, 40, 1) 60%);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(124,106,245,0.25) 0%, transparent 70%);
  pointer-events: none;
}
.hero-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a78cfa);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin-bottom: 12px;
  box-shadow: 0 4px 20px rgba(124, 106, 245, 0.35);
}
.hero-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.hero-level {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.hero-score {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--gold) 0%, #f9e06e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: countUp 0.6s ease both;
}
.hero-score-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* ── Прогресс-бар ── */
.progress-wrapper { margin-top: 16px; }
.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a78cfa);
  border-radius: 99px;
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  min-width: 4px;
}
.progress-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 0;
  width: 10px; height: 100%;
  background: rgba(255,255,255,0.4);
  border-radius: 99px;
  filter: blur(4px);
}

/* ── Статс-сетка ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  text-align: center;
  transition: transform var(--transition), background var(--transition);
}
.stat-card:active { transform: scale(0.96); }
.stat-icon { font-size: 24px; margin-bottom: 6px; }
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Множитель-бейдж ── */
.multiplier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  background: linear-gradient(135deg, rgba(124,106,245,0.2), rgba(167,140,250,0.12));
  border: 1px solid var(--border-accent);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.multiplier-badge.active {
  animation: pulse 2s ease-in-out infinite;
  background: linear-gradient(135deg, rgba(124,106,245,0.3), rgba(167,140,250,0.18));
}

/* ── Таблица лидеров ── */
.leaderboard-list { display: flex; flex-direction: column; gap: 6px; }
.leader-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: background var(--transition), transform var(--transition);
  animation: slideIn 0.3s ease both;
}
.leader-item:active { transform: scale(0.98); }
.leader-item.rank-1 { border-color: rgba(244, 197, 66, 0.3); background: rgba(244,197,66,0.05); }
.leader-item.rank-2 { border-color: rgba(168, 178, 193, 0.3); }
.leader-item.rank-3 { border-color: rgba(205, 127, 69, 0.3); }
.leader-item.is-me  { border-color: var(--border-accent); background: rgba(124,106,245,0.08); }

.leader-rank {
  width: 32px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.rank-1 .leader-rank { color: var(--gold); }
.rank-2 .leader-rank { color: var(--silver); }
.rank-3 .leader-rank { color: var(--bronze); }

.leader-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-dim), #6c5ce7);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.leader-info { flex: 1; min-width: 0; }
.leader-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.leader-level { font-size: 11px; color: var(--text-muted); }
.leader-score {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
  text-align: right;
}

/* ── Переключатель режима лидерборда ── */
.tab-switcher {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 16px;
}
.tab-btn {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: calc(var(--radius-md) - 4px);
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}
.tab-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px rgba(124, 106, 245, 0.4);
}

/* ── Задания ── */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  animation: slideIn 0.3s ease both;
}
.task-item.completed {
  opacity: 0.55;
  border-color: rgba(62, 207, 142, 0.2);
}
.task-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(124, 106, 245, 0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.task-item.completed .task-icon {
  background: rgba(62, 207, 142, 0.12);
}
.task-info { flex: 1; min-width: 0; }
.task-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.task-desc { font-size: 12px; color: var(--text-muted); }
.task-reward {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}
.task-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(62, 207, 142, 0.15);
  display: flex; align-items: center; justify-content: center;
  color: var(--green);
  font-size: 14px;
  flex-shrink: 0;
}

/* ── P2P Перевод ── */
.transfer-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  margin-bottom: 16px;
}
.transfer-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}
.transfer-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.input-group { margin-bottom: 14px; }
.input-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.input-field {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}
.input-field::placeholder { color: var(--text-muted); }
.input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-field.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(244, 91, 91, 0.2);
}

.balance-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.balance-hint span { color: var(--gold); font-weight: 600; }

/* ── Кнопки ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  outline: none;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #a78cfa);
  color: #fff;
  box-shadow: 0 4px 16px rgba(124, 106, 245, 0.35);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(124, 106, 245, 0.5);
}

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

.btn-danger {
  background: rgba(244, 91, 91, 0.12);
  border: 1px solid rgba(244, 91, 91, 0.25);
  color: var(--red);
}
.btn-sm {
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
}

/* ── Toast-уведомления ── */
.toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  pointer-events: auto;
  animation: fadeUp 0.3s ease both;
  box-shadow: var(--shadow);
}
.toast.success { background: rgba(62, 207, 142, 0.9); color: #0e3d2a; }
.toast.error   { background: rgba(244, 91, 91, 0.9);  color: #3d0e0e; }
.toast.info    { background: rgba(124, 106, 245, 0.9); color: #fff; }

/* ── Спиннер ── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

/* ── Секция с заголовком ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.section-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(124, 106, 245, 0.15);
  color: var(--accent);
  font-weight: 600;
}

/* ── Реферальная карточка ── */
.ref-link-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 12px;
}
.ref-link-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-btn {
  padding: 7px 14px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  flex-shrink: 0;
}
.copy-btn:active { transform: scale(0.95); }

/* ── Пустое состояние ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; line-height: 1.6; }

/* ── История транзакций ── */
.tx-list { display: flex; flex-direction: column; gap: 6px; }
.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.tx-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.tx-icon.out { background: rgba(244, 91, 91, 0.12); }
.tx-icon.in  { background: rgba(62, 207, 142, 0.12); }
.tx-icon.bonus { background: rgba(124, 106, 245, 0.12); }
.tx-info { flex: 1; min-width: 0; }
.tx-desc {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-date { font-size: 11px; color: var(--text-muted); }
.tx-amount {
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.tx-amount.out { color: var(--red); }
.tx-amount.in  { color: var(--green); }

/* ── Уровни в профиле ── */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 99px;
  background: rgba(124, 106, 245, 0.12);
  border: 1px solid var(--border-accent);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

/* ── Адаптивность ── */
@media (max-width: 360px) {
  .stats-grid { grid-template-columns: 1fr; }
  .hero-score { font-size: 28px; }
}

/* ── Tap highlight ── */
a, button { -webkit-tap-highlight-color: transparent; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
