/* =========================================================
   Дизайн-система: BNB Smart Chain кошелёк
   Палитра построена вокруг фирменного жёлтого BSC — это язык
   самой сети, а не декоративный акцент. Тёплый графит вместо
   чистого чёрного, мятный — для успеха/депозитов.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --ink: #0d1117;
  --surface: #141b25;
  --surface-2: #1b2432;
  --surface-3: #232f40;
  --border: #2a3646;

  --text: #e9eef4;
  --text-muted: #8b98a9;
  --text-faint: #5c6a7c;

  --accent: #f0b90b;
  --accent-ink: #17130a;
  --mint: #2dd4a7;
  --danger: #e5484d;
  --violet: #9b8cff;

  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 30px -16px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent; /* убирает синий прямоугольник при тапе на мобильных */
}

html, body {
  touch-action: manipulation; /* отключает зум двойным тапом, pinch-zoom не затрагивает */
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(60rem 30rem at 90% -10%, rgba(240, 185, 11, 0.08), transparent 60%),
    radial-gradient(50rem 30rem at -10% 110%, rgba(45, 212, 167, 0.06), transparent 60%);
  min-height: 100vh;
}

a { color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0; color: var(--text-muted); line-height: 1.55; }

.mono { font-family: var(--font-mono); }

button {
  font-family: var(--font-body);
  cursor: pointer;
}

input, select {
  font-family: var(--font-body);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* На обычный тап/клик мышью браузерный outline не нужен — оставляем его
   только для навигации с клавиатуры (:focus-visible выше) */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-danger {
  background: rgba(229, 72, 77, 0.15);
  color: #ff9498;
  border: 1px solid rgba(229, 72, 77, 0.35);
}

.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ---------- Карточки ---------- */

.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  margin-bottom: 16px;
}
.card-title svg { color: var(--accent); }

/* ---------- Форма ---------- */

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 16px; /* >=16px предотвращает авто-зум при фокусе на iOS/Android */
}
.field input::placeholder { color: var(--text-faint); }
.field input:focus, .field select:focus { border-color: var(--accent); }

.hint { font-size: 0.78rem; color: var(--text-faint); margin-top: 6px; }
.error-box {
  background: rgba(229, 72, 77, 0.12);
  border: 1px solid rgba(229, 72, 77, 0.3);
  color: #ff9498;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.86rem;
  margin-bottom: 16px;
  display: none;
}
.error-box.visible { display: block; }

.success-box {
  background: rgba(45, 212, 167, 0.12);
  border: 1px solid rgba(45, 212, 167, 0.3);
  color: var(--mint);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.86rem;
  margin-bottom: 16px;
  display: none;
}
.success-box.visible { display: block; }

/* ---------- Значки / статусы ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.74rem;
  font-weight: 600;
}
.badge-mint { background: rgba(45, 212, 167, 0.15); color: var(--mint); }
.badge-amber { background: rgba(240, 185, 11, 0.15); color: var(--accent); }
.badge-danger { background: rgba(229, 72, 77, 0.15); color: #ff9498; }
.badge-muted { background: var(--surface-3); color: var(--text-muted); }

.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(45, 212, 167, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(45, 212, 167, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(45, 212, 167, 0); }
  100% { box-shadow: 0 0 0 0 rgba(45, 212, 167, 0); }
}

/* ---------- Layout: страница авторизации ---------- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}

.auth-brand {
  position: relative;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.brand-mark { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.brand-mark svg { color: var(--accent); }

.brand-copy h1 { font-size: 2.6rem; line-height: 1.08; max-width: 12ch; }
.brand-copy p { margin-top: 16px; max-width: 40ch; font-size: 1.02rem; }

.node-graphic { position: absolute; inset: 0; opacity: 0.55; pointer-events: none; }

.brand-stats { display: flex; gap: 28px; }
.brand-stats .stat b { display: block; font-family: var(--font-display); font-size: 1.4rem; }
.brand-stats .stat span { font-size: 0.78rem; color: var(--text-muted); }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-box { width: 100%; max-width: 380px; }
.auth-tabs {
  display: flex;
  background: var(--surface-3);
  border-radius: 100px;
  padding: 4px;
  margin-bottom: 28px;
}
.auth-tabs button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 10px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.88rem;
}
.auth-tabs button.active { background: var(--accent); color: var(--accent-ink); }

.auth-form { display: none; }
.auth-form.active { display: block; }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}

/* ---------- Layout: личный кабинет ---------- */

.app-shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

.sidebar {
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
}
.sidebar .brand-mark { padding: 0 10px 20px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.92rem;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-3); color: var(--accent); }

.sidebar-footer { margin-top: auto; }

.main-area { padding: 28px 36px; max-width: 1180px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.balance-pill {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 8px 18px 8px 8px;
}
.balance-pill .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-family: var(--font-display);
}

.view { display: none; }
.view.active { display: block; }

.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto;
    flex-direction: row; justify-content: space-around; border-right: none;
    border-top: 1px solid var(--border); z-index: 20; padding: 8px;
  }
  .sidebar .brand-mark, .sidebar-footer { display: none; }
  .nav-item { flex-direction: column; gap: 4px; font-size: 0.68rem; padding: 8px; }
  .main-area { padding: 20px 16px 100px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.stat-card { text-align: left; }
.stat-card .label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.stat-card .value { font-family: var(--font-display); font-size: 1.7rem; }
.stat-card .value.mint { color: var(--mint); }
.stat-card .value.amber { color: var(--accent); }

.wallet-address-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  word-break: break-all;
}
.wallet-address-row button { margin-left: auto; flex-shrink: 0; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th { text-align: left; color: var(--text-muted); font-weight: 500; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.task-card, .draw-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.task-card .top-row, .draw-card .top-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-faint); }
.empty-state svg { margin-bottom: 12px; opacity: 0.6; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(6, 9, 13, 0.7);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-overlay.visible { display: flex; }
.modal-box { width: 100%; max-width: 420px; }

.toast-stack { position: fixed; top: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: 0.86rem;
  box-shadow: var(--shadow-card); min-width: 220px;
}
.toast.success { border-color: rgba(45, 212, 167, 0.4); }
.toast.error { border-color: rgba(229, 72, 77, 0.4); }

.copy-input-row { display: flex; gap: 8px; }
.copy-input-row input {
  flex: 1;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 16px; /* >=16px предотвращает авто-зум при фокусе на iOS/Android */
  font-family: var(--font-mono);
}

.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.section-heading h2 { font-size: 1.3rem; }

.tiers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.tier-tile {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.tier-tile.current {
  border-color: var(--accent);
  background: rgba(240, 185, 11, 0.1);
}
.tier-tile .tier-amount { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; }
.tier-tile .tier-count { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; }
.tier-tile .tier-count span { font-size: 0.7rem; color: var(--text-muted); font-family: var(--font-body); font-weight: 400; display: block; margin-top: 2px; }
.tier-tile .tier-badge { margin-top: 8px; }

.task-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 14px;
  background: var(--surface-3);
  position: relative;
}
.task-row .task-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.task-row .task-row-header span { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.task-row .remove-row-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  line-height: 0;
}
.task-row .remove-row-btn:hover { color: #ff9498; }
