:root {
  --bg: #050812;
  --bg-soft: #0b1020;
  --bg-card: rgba(18, 26, 56, 0.95);
  --accent: #4ade80;
  --accent-soft: rgba(74, 222, 128, 0.12);
  --accent-strong: #22c55e;
  --danger: #f97373;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --border-soft: rgba(148, 163, 184, 0.35);
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.8);
  --radius-lg: 18px;
  --radius-md: 12px;
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Roboto", sans-serif;
  background: radial-gradient(circle at top, #111827 0, #020617 55%, #000 100%);
  color: var(--text-main);
}

#app {
  min-height: 100vh;
  padding: 12px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Верхняя панель */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #020617 0%, #020617 40%, #0f172a 100%);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.7);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand .logo {
  font-size: 22px;
}

.brand .title {
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--text-main);
}

.user-info {
  font-size: 12px;
  color: var(--text-muted);
}

/* Статистика */

.stats-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.stat-item {
  flex: 1 1 calc(50% - 6px);
  padding: 8px 10px;
  border-radius: 14px;
  background: linear-gradient(
    145deg,
    rgba(15, 23, 42, 0.9),
    rgba(15, 23, 42, 0.4)
  );
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.stat-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

/* Табы */

.tabs {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.tab-btn {
  flex: 1 1 calc(50% - 6px);
  min-width: 120px;
  padding: 7px 4px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.85);
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.12s ease-out,
    color 0.12s ease-out,
    border-color 0.12s ease-out,
    transform 0.08s ease-out;
}

.tab-btn.active {
  background: radial-gradient(circle at top, #22c55e 0, #16a34a 40%, #15803d 100%);
  color: #022c22;
  border-color: rgba(34, 197, 94, 0.9);
  transform: translateY(-1px);
  box-shadow: 0 12px 25px rgba(22, 163, 74, 0.5);
}

.tab-btn-main {
  font-size: 13px;
  font-weight: 800;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #022c22;
  border-color: rgba(34, 197, 94, 0.95);
  box-shadow: 0 12px 25px rgba(22, 163, 74, 0.6);
}

.tab-btn-main.active {
  transform: translateY(-1px);
}

/* Экраны */

.screens {
  flex: 1;
  margin-top: 8px;
}

.screen {
  display: none;
}

.screen-active {
  display: block;
}

/* Игровой экран */

.click-area {
  padding: 18px 14px 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #020617 0%, #020617 40%, #020617 100%);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.troll-button {
  width: 100%;
  padding: 26px 20px;
  border-radius: 999px;
  border: none;
  outline: none;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #022c22;
  background: radial-gradient(circle at 30% 0, #bbf7d0 0, #22c55e 25%, #16a34a 70%, #166534 100%);
  box-shadow:
    0 24px 46px rgba(22, 163, 74, 0.65),
    0 0 0 1px rgba(16, 185, 129, 0.7);
  position: relative;
  overflow: visible; /* чтобы +TP вылетали наружу */
  cursor: pointer;
  transition:
    transform 0.08s ease-out,
    box-shadow 0.08s ease-out,
    filter 0.08s ease-out;
  touch-action: manipulation;
}

.troll-button.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.5);
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.25);
}

/* мягкое "вдавливание" через класс pressed */
.troll-button.pressed {
  transform: translateY(2px) scale(0.97);
  box-shadow:
    0 14px 28px rgba(22, 163, 74, 0.5),
    0 0 0 1px rgba(16, 185, 129, 0.9);
  filter: brightness(0.96);
}

.troll-button.boost-active {
  box-shadow:
    0 28px 52px rgba(255, 221, 85, 0.4),
    0 0 0 1px rgba(255, 221, 85, 0.65);
  filter: brightness(1.04);
}

/* запасной вариант для :active, пусть тоже чуть играет */
.troll-button:active {
  transform: translateY(1px) scale(0.985);
}

.boost-button {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 221, 85, 0.7);
  background: linear-gradient(135deg, rgba(255, 221, 85, 0.12), rgba(15, 23, 42, 0.9));
  color: #ffdd55;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 14px 26px rgba(255, 221, 85, 0.25);
  cursor: pointer;
  transition:
    transform 0.08s ease-out,
    box-shadow 0.12s ease-out,
    filter 0.12s ease-out,
    opacity 0.12s ease-out;
}

.boost-button:active {
  transform: translateY(1px) scale(0.99);
  filter: brightness(0.96);
}

.boost-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: 0 6px 10px rgba(255, 221, 85, 0.12);
}

.boost-button.active {
  background: linear-gradient(135deg, rgba(255, 221, 85, 0.24), rgba(250, 204, 21, 0.1));
  box-shadow:
    0 0 0 1px rgba(255, 221, 85, 0.7),
    0 0 26px rgba(255, 221, 85, 0.5);
  animation: boost-glow 1.6s ease-in-out infinite;
  filter: brightness(1.05);
}

@keyframes boost-glow {
  0% {
    box-shadow:
      0 0 0 1px rgba(255, 221, 85, 0.6),
      0 0 18px rgba(255, 221, 85, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(255, 221, 85, 0.8),
      0 0 28px rgba(255, 221, 85, 0.55);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(255, 221, 85, 0.6),
      0 0 18px rgba(255, 221, 85, 0.35);
  }
}

.prestige-button {
  width: 100%;
  margin: 6px 0 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.7);
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.16), rgba(127, 29, 29, 0.32));
  color: #fecdd3;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 0.08s ease-out,
    filter 0.12s ease-out,
    box-shadow 0.12s ease-out;
}

.prestige-button:active {
  transform: translateY(1px) scale(0.99);
  filter: brightness(0.95);
}

.prestige-info {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.phrase {
  margin-top: 4px;
  font-size: 13px;
  text-align: center;
  color: var(--text-muted);
}

/* Вылетающее +TP */

.floating-tp {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, 0);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
  opacity: 0;
  pointer-events: none;
  animation: float-tp 0.6s ease-out forwards;
}

.floating-tp-crit {
  color: #ffdd55;
  text-shadow: 0 0 8px rgba(255, 221, 85, 0.8);
  font-weight: 700;
}

@keyframes float-tp {
  0% {
    transform: translate(-50%, 4px);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -26px);
    opacity: 0;
  }
}

/* Лог */

.log-section {
  margin-top: 10px;
  padding: 10px 10px 8px;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    145deg,
    rgba(15, 23, 42, 0.96),
    rgba(15, 23, 42, 0.75)
  );
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.log-section h2 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.log {
  max-height: 130px;
  overflow-y: auto;
  font-size: 11px;
  color: var(--text-muted);
  padding-right: 4px;
}

.log-entry {
  margin-bottom: 3px;
}

/* Общие карточные секции */

.tree-section,
.achievements-section,
.leaders-section,
.autoclickers-section,
.daily-section,
.friends-section,
.social-section {
  padding: 12px 10px 10px;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    145deg,
    rgba(15, 23, 42, 0.96),
    rgba(15, 23, 42, 0.75)
  );
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.tree-section h2,
.achievements-section h2,
.leaders-section h2,
.autoclickers-section h2,
.daily-section h2,
.friends-section h2,
.social-section h2 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}

/* Дерево прогресса */

.tree {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tier {
  position: relative;
  padding-left: 12px;
}

.tier::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(to bottom, #4ade80, transparent);
  opacity: 0.3;
}

.tier-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.tier-nodes {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.node-card {
  border-radius: var(--radius-md);
  padding: 8px 9px;
  background: radial-gradient(
    circle at top left,
    rgba(34, 197, 94, 0.1),
    rgba(15, 23, 42, 0.9)
  );
  border: 1px solid rgba(148, 163, 184, 0.5);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.node-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.node-name {
  font-size: 13px;
  font-weight: 600;
}

.node-status {
  font-size: 11px;
  color: var(--text-muted);
}

.node-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.node-unlocked {
  border-color: rgba(34, 197, 94, 0.9);
  background: linear-gradient(
    135deg,
    rgba(34, 197, 94, 0.18),
    rgba(15, 23, 42, 0.98)
  );
}

.node-available {
  border-color: rgba(52, 211, 153, 0.9);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.3);
}

.node-locked {
  opacity: 0.7;
  filter: grayscale(0.25);
}

.node-unlock-btn {
  margin-top: 4px;
  align-self: flex-start;
  padding: 5px 10px;
  border-radius: 999px;
  border: none;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(34, 197, 94, 0.12);
  color: var(--accent-strong);
  cursor: pointer;
  transition:
    background 0.08s ease-out,
    transform 0.08s ease-out;
}

.node-unlock-btn:active {
  transform: translateY(1px) scale(0.98);
  background: rgba(34, 197, 94, 0.22);
}

/* Ачивки */

.achievements {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.achievement-card {
  border-radius: var(--radius-md);
  padding: 8px 9px;
  background: radial-gradient(
    circle at top left,
    rgba(59, 130, 246, 0.12),
    rgba(15, 23, 42, 0.95)
  );
  border: 1px solid rgba(148, 163, 184, 0.5);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.achievement-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.achievement-name {
  font-size: 13px;
  font-weight: 600;
}

.achievement-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.achievement-badge.unlocked {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-strong);
  border: 1px solid rgba(34, 197, 94, 0.7);
}

.achievement-badge.locked {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.achievement-badge.referral {
  background: rgba(255, 221, 85, 0.14);
  color: #facc15;
  border-color: rgba(255, 221, 85, 0.7);
}

.achievement-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.achievement-progress-bar {
  margin-top: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(31, 41, 55, 1);
  overflow: hidden;
}

.achievement-progress-inner {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #4ade80);
}

/* Ежедневные задания */

.daily-quests {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.daily-quest-card {
  border-radius: var(--radius-md);
  padding: 10px 10px 8px;
  background: radial-gradient(
    circle at top left,
    rgba(255, 221, 85, 0.12),
    rgba(15, 23, 42, 0.95)
  );
  border: 1px solid rgba(255, 221, 85, 0.35);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.daily-quest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.daily-quest-name {
  font-size: 13px;
  font-weight: 700;
}

.daily-quest-status {
  font-size: 11px;
  color: #facc15;
  font-weight: 600;
}

.daily-quest-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.daily-quest-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(31, 41, 55, 0.9);
  overflow: hidden;
  border: 1px solid rgba(255, 221, 85, 0.2);
}

.daily-quest-progress-inner {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #facc15, #fbbf24);
}

.daily-claim-btn {
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: 12px;
  border: none;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 221, 85, 0.14);
  color: #facc15;
  cursor: pointer;
  transition:
    transform 0.08s ease-out,
    background 0.12s ease-out,
    filter 0.12s ease-out;
}

.daily-claim-btn:active {
  transform: translateY(1px) scale(0.99);
  filter: brightness(0.96);
}

.daily-quest-claimed {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 221, 85, 0.25);
  align-self: flex-start;
}

/* Друзья / Социалка */

.friends-info,
.referral-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--text-main);
}

.friends-count {
  font-weight: 700;
  font-size: 14px;
}

.friends-hint {
  color: var(--text-muted);
  font-size: 12px;
}

.referral-link-block {
  padding: 10px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 221, 85, 0.35);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.referral-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.referral-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.referral-link {
  flex: 1;
  font-family: "SF Pro Text", system-ui, sans-serif;
  font-size: 13px;
  word-break: break-all;
}

.copy-btn {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 221, 85, 0.6);
  background: rgba(255, 221, 85, 0.1);
  color: #facc15;
  font-weight: 700;
  cursor: pointer;
}

.referral-stats {
  font-weight: 700;
  font-size: 13px;
}

.referral-hint {
  color: var(--text-muted);
  font-size: 12px;
}

.referral-list {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.referral-row-item {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 221, 85, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.referral-name {
  font-weight: 700;
  font-size: 13px;
}

.referral-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.referral-empty {
  font-size: 12px;
  color: var(--text-muted);
}

/* Магазин автокликеров */

.autoclickers {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.autoclicker-card {
  border-radius: var(--radius-md);
  padding: 8px 10px;
  background: radial-gradient(
    circle at top left,
    rgba(56, 189, 248, 0.12),
    rgba(15, 23, 42, 0.95)
  );
  border: 1px solid rgba(148, 163, 184, 0.6);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.autoclicker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.autoclicker-name {
  font-size: 13px;
  font-weight: 600;
}

.autoclicker-count {
  font-size: 11px;
  color: var(--accent);
}

.autoclicker-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.autoclicker-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.autoclicker-price {
  font-weight: 600;
  color: var(--accent);
}

.autoclicker-income {
  font-size: 11px;
}

.autoclicker-buy-btn {
  margin-top: 6px;
  align-self: stretch;
  padding: 6px 10px;
  border-radius: 999px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(34, 197, 94, 0.12);
  color: var(--accent-strong);
  cursor: pointer;
  transition:
    background 0.08s ease-out,
    transform 0.08s ease-out,
    opacity 0.08s ease-out;
}

.autoclicker-buy-btn:active {
  transform: translateY(1px) scale(0.98);
  background: rgba(34, 197, 94, 0.22);
}

.autoclicker-buy-btn.disabled {
  opacity: 0.5;
  cursor: default;
}

/* Лидерборд */

.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 50vh;
  overflow-y: auto;
}

.leader-row {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.leader-rank {
  width: 32px;
  font-size: 13px;
  font-weight: 700;
}

.leader-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.leader-name {
  font-size: 13px;
}

.leader-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.leader-tp {
  min-width: 70px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.leader-row.me {
  border-color: rgba(34, 197, 94, 0.9);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.4);
}

.leader-rank.medal-1 {
  color: #facc15;
}

.leader-rank.medal-2 {
  color: #e5e7eb;
}

.leader-rank.medal-3 {
  color: #f97316;
}

/* Адаптив */

@media (min-width: 600px) {
  #app {
    max-width: 480px;
    margin: 0 auto;
  }
}

/* Баннер канала */

.promo-section {
  margin-top: 10px;
}

.promo-banner {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(96, 165, 250, 0.7);
  background: radial-gradient(circle at top left, #1d4ed8, #0f172a);
  box-shadow:
    0 18px 32px rgba(15, 23, 42, 0.7),
    0 0 0 1px rgba(56, 189, 248, 0.4);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  outline: none;
  border-width: 1px;
  color: #e5f2ff;
  text-align: left;
}

.promo-banner:active {
  transform: translateY(1px) scale(0.99);
  box-shadow:
    0 10px 18px rgba(15, 23, 42, 0.7),
    0 0 0 1px rgba(56, 189, 248, 0.6);
}

.promo-icon {
  font-size: 22px;
}

.promo-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.promo-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.promo-subtitle {
  font-size: 11px;
  color: rgba(226, 232, 240, 0.8);
}

.promo-cta {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(191, 219, 254, 0.8);
}
