:root {
  /* Цвета */
  --bg: #0A0E27;
  --bg-grad: linear-gradient(180deg, #0F1729 0%, #0A0E27 50%, #050911 100%);
  --panel: #141B2D;
  --panel-light: #1A2235;
  --text: #F0F4FF;
  --text-dim: #8B95B0;
  --accent: #6366F1;
  --accent-glow: #818CF8;
  --accent-dark: #4F46E5;
  --accent-2: #F59E0B;
  --accent-2-glow: #FBBF24;
  --up: #10B981;
  --up-glow: #34D399;
  --down: #EF4444;
  --down-glow: #F87171;
  --border: #1E293B;
  --border-light: #334155;
  --chip: #1A2235;
  /* Радиусы */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  /* Тени */
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.28);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.35);
  --shadow-glow: 0 0 24px rgba(99,102,241,0.25);
  /* Сетка/отступы */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  /* Типографика */
  --font-xs: 11px;
  --font-sm: 12px;
  --font-base: 14px;
  --font-md: 15px;
  --font-lg: 16px;
  --font-xl: 18px;
  --font-2xl: 20px;
  --line-tight: 1.25;
  --line-base: 1.5;
  /* Скорости */
  --dur-fast: .15s;
  --dur: .28s;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  /* Кнопки */
  --btn-bg: linear-gradient(140deg,#1A2235,#141B2D 70%);
  --btn-bg-hover: linear-gradient(140deg,#222d42,#1a2235 70%);
  --btn-bg-active: linear-gradient(140deg,#101522,#0d111c 70%);
  --btn-accent: linear-gradient(135deg,#6366F1,#4F46E5);
  --btn-accent-hover: linear-gradient(135deg,#818CF8,#6366F1);
  --btn-outline-border: rgba(99,102,241,.35);
  --btn-text: #E5EBFF;
  --btn-text-dim: #B3BED4;
  /* Дополнительные нейтральные поверхности для getgems-like стиля */
  --surface-0: #121419;
  --surface-1: #181B22;
  --surface-2: #1F242C;
  --surface-border: #262C35;
  --surface-border-light: #313841;
  --surface-hover: #242A33;
  --surface-active: #101317;
}

html, body { height: 100%; }
body {
  margin: 0;
  font: var(--font-md)/var(--line-base) -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: env(safe-area-inset-bottom);
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body::before {
  content: 'BAZDEST';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  font-size: min(25vw, 150px);
  font-weight: 900;
  letter-spacing: 0.2em;
  color: rgba(99, 102, 241, 0.02);
  z-index: 0;
  pointer-events: none;
  user-select: none;
}
body::after {
  content: 'BAZDEST';
  position: fixed;
  bottom: 15%;
  right: 5%;
  transform: rotate(-45deg);
  font-size: min(15vw, 100px);
  font-weight: 900;
  letter-spacing: 0.2em;
  color: rgba(99, 102, 241, 0.015);
  z-index: 0;
  pointer-events: none;
  user-select: none;
}
@keyframes bgShift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-20px, 10px) scale(1.05); }
}
body::after {
  content:"";
  position: fixed; inset:0; pointer-events:none; z-index:0;
  background: 
    repeating-linear-gradient(0deg, rgba(99,102,241,0.03) 0px, transparent 1px, transparent 2px, rgba(99,102,241,0.03) 3px),
    repeating-linear-gradient(90deg, rgba(99,102,241,0.03) 0px, transparent 1px, transparent 2px, rgba(99,102,241,0.03) 3px);
  opacity: 0.5;
}

/* Страницы */
.page { display: none; }
.page.active { display: block; }
/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.app-header {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, rgba(20,27,45,0.95) 0%, rgba(10,14,39,0.98) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(99,102,241,0.2);
  box-shadow: 0 4px 24px rgba(0,0,0,0.2), 0 0 0 1px rgba(99,102,241,0.1) inset;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px 16px;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 24px;
  background: linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(79,70,229,0.1) 100%);
  border: 2px solid rgba(99,102,241,0.3);
  border-radius: 16px;
  box-shadow: 
    0 0 20px rgba(99,102,241,0.3),
    0 0 40px rgba(99,102,241,0.15),
    inset 0 0 20px rgba(99,102,241,0.1);
  transition: all 0.3s ease;
}

.logo-container:hover {
  border-color: rgba(99,102,241,0.5);
  box-shadow: 
    0 0 30px rgba(99,102,241,0.4),
    0 0 60px rgba(99,102,241,0.2),
    inset 0 0 30px rgba(99,102,241,0.15);
  transform: translateY(-2px);
}

.logo-container img {
  height: 60px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(99,102,241,0.5));
  transition: all 0.3s ease;
}

.logo-container:hover img {
  filter: drop-shadow(0 0 15px rgba(99,102,241,0.7));
  transform: scale(1.05);
}
.app-header h1 {
  margin: 0;
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #FFFFFF 0%, #818CF8 30%, #6366F1 60%, #4F46E5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(99,102,241,0.6)) drop-shadow(0 0 40px rgba(99,102,241,0.3));
  animation: titleGlow 3s ease-in-out infinite alternate;
  font-family: 'Arial Black', 'Impact', sans-serif;
  position: relative;
  display: inline-block;
}
.app-header h1::before {
  content: 'BAZDEST';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(99,102,241,0.2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: blur(8px);
  z-index: -1;
}
@keyframes titleGlow {
  0% { filter: drop-shadow(0 0 20px rgba(99,102,241,0.4)) drop-shadow(0 0 40px rgba(99,102,241,0.2)); }
  100% { filter: drop-shadow(0 0 30px rgba(99,102,241,0.8)) drop-shadow(0 0 60px rgba(99,102,241,0.4)); }
}
.section-title {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #FFFFFF 0%, #818CF8 30%, #6366F1 60%, #4F46E5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 15px rgba(99,102,241,0.5));
  font-family: 'Arial Black', 'Impact', sans-serif;
  margin: 0 0 20px 0;
  text-align: center;
  animation: sectionGlow 3s ease-in-out infinite alternate;
}
@keyframes sectionGlow {
  0% { filter: drop-shadow(0 0 15px rgba(99,102,241,0.4)); }
  100% { filter: drop-shadow(0 0 25px rgba(99,102,241,0.7)); }
}
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* User profile in header */
.user-profile {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px 6px 6px;
  background: var(--btn-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all var(--dur-fast) var(--ease);
}
.user-profile:hover {
  background: var(--btn-bg-hover);
  border-color: var(--border-light);
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.user-nickname {
  color: var(--btn-text);
  font-size: var(--font-sm);
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .user-profile { padding: 4px 10px 4px 4px; }
  .user-avatar { width: 28px; height: 28px; }
  .user-nickname { font-size: 11px; max-width: 80px; }
}

/* Profile page styles */
.profile-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-4);
  max-width: 600px;
  margin: 0 auto;
}
.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--btn-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.profile-avatar-wrapper {
  flex-shrink: 0;
}
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-light);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}
.profile-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.profile-name {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--btn-text);
  line-height: var(--line-tight);
}
.profile-username {
  font-size: var(--font-base);
  color: var(--btn-text-dim);
  font-weight: 500;
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}
.profile-stat {
  padding: var(--space-4);
  background: var(--btn-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--dur-fast) var(--ease);
}
.profile-stat:hover {
  background: var(--btn-bg-hover);
  border-color: var(--border-light);
  transform: translateY(-2px);
}
.profile-stat-label {
  font-size: var(--font-xs);
  color: var(--btn-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: var(--space-1);
}
.profile-stat-value {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--btn-text);
  word-break: break-all;
}
.profile-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.profile-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--btn-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--font-base);
  font-family: inherit;
  transition: all var(--dur-fast) var(--ease);
  box-shadow: var(--shadow-sm);
}
.profile-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}
.profile-input::placeholder {
  color: var(--btn-text-dim);
  opacity: 0.6;
}

@media (max-width: 600px) {
  .profile-avatar { width: 64px; height: 64px; }
  .profile-name { font-size: var(--font-lg); }
  .profile-username { font-size: var(--font-sm); }
  .profile-header { flex-direction: column; text-align: center; }
  .profile-stats { grid-template-columns: 1fr; }
  .profile-container { padding: var(--space-3); max-width: 100%; }
}

.wallet-bar { display: inline-flex; align-items: center; gap: 8px; background: #1a1630; border: 1px solid var(--border); border-radius: 999px; padding: 4px 6px; }
.wallet-bar .balance { display: inline-flex; align-items: center; gap: 6px; background: #241d43; border: 1px solid #352d63; border-radius: 999px; padding: 6px 10px; color: #d5ceff; font-weight: 600; }
.wallet-bar .ton-logo { filter: brightness(1.15); }
.btn-mini { width: 28px; height: 28px; border-radius: 999px; border: 1px solid #352d63; background: #2a2352; color: #e9e6ff; font-weight: 700; cursor: pointer; transition: background .18s ease, transform .12s ease; }
.btn-mini:hover { background:#342c63; }
.btn-mini:active { transform: translateY(1px); }
.avatar { width: 28px; height: 28px; border-radius: 999px; background: linear-gradient(135deg,#2a2352,#1a1630); border: 1px solid #352d63; }
.btn-connect { background: linear-gradient(135deg,#7C5CFF,#A78BFA); color: #100a1c; border: none; padding: 8px 14px; border-radius: 999px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 4px 18px -4px rgba(124,92,255,.55); }
.btn-connect:hover { filter: brightness(1.05); }

.container {
  max-width: 900px;
  margin: 12px auto 16px auto;
  padding: 0 12px 10px 12px;
}

.card {
  background: linear-gradient(145deg, rgba(20,27,45,0.8) 0%, rgba(15,23,41,0.9) 100%);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 
    0 20px 60px rgba(0,0,0,0.3),
    0 0 0 1px rgba(99,102,241,0.1) inset,
    0 0 40px rgba(99,102,241,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: cardIn 500ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 24px 70px rgba(0,0,0,0.4),
    0 0 0 1px rgba(99,102,241,0.2) inset,
    0 0 60px rgba(99,102,241,0.1);
  border-color: rgba(99,102,241,0.3);
}
.card::before {
  content: "";
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at 30% 20%, rgba(99,102,241,0.15), transparent 70%);
  opacity: 0.6;
  z-index: 0;
}
.card > * { position: relative; z-index: 1; }
.card h2 { 
  margin: 0 0 16px; 
  background: linear-gradient(135deg, #E0E7FF, #C7D2FE);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-size: 18px; 
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* Alerts */
.alert-list { 
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 24px;
  width: 100%;
}
.alert-item { 
  background: linear-gradient(145deg, rgba(20,27,45,0.7) 0%, rgba(15,23,41,0.8) 100%);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2), 0 0 0 1px rgba(99,102,241,0.1) inset;
  position: relative;
  overflow: hidden;
  min-height: 120px;
}
.alert-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 30%, rgba(99,102,241,0.1), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}
.alert-item:hover::before { opacity: 1; }
.alert-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(99,102,241,0.25), 0 0 0 1px rgba(99,102,241,0.3) inset;
  border-color: rgba(99,102,241,0.4);
}
.alert-item .tag { 
  background: linear-gradient(135deg, #6366F1, #4F46E5);
  padding: 6px 12px; 
  border-radius: 999px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.alert-item button.toggle-btn { 
  background: linear-gradient(135deg, rgba(34,197,94,0.2), rgba(22,163,74,0.3));
  border: 1px solid rgba(34,197,94,0.4);
  color: #22C55E;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.alert-item button.toggle-btn:hover { 
  background: linear-gradient(135deg, rgba(34,197,94,0.3), rgba(22,163,74,0.4));
  transform: scale(1.05);
  box-shadow: 0 2px 12px rgba(34,197,94,0.3);
}
.alert-item button.toggle-btn.paused {
  background: linear-gradient(135deg, rgba(156,163,175,0.2), rgba(107,114,128,0.3));
  border: 1px solid rgba(156,163,175,0.4);
  color: #9CA3AF;
}
.alert-item button.toggle-btn.paused:hover {
  background: linear-gradient(135deg, rgba(156,163,175,0.3), rgba(107,114,128,0.4));
  box-shadow: 0 2px 12px rgba(156,163,175,0.3);
}
.alert-item button.delete-btn { 
  background: linear-gradient(135deg, rgba(239,68,68,0.2), rgba(220,38,38,0.3));
  border: 1px solid rgba(239,68,68,0.4);
  color: var(--down-glow);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}
.alert-item button.delete-btn:hover { 
  background: linear-gradient(135deg, rgba(239,68,68,0.3), rgba(220,38,38,0.4));
  transform: scale(1.05);
  box-shadow: 0 2px 12px rgba(239,68,68,0.3);
}
.alert-item .icon-svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.alert-item button svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}
.alert-events { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.alert-ev { 
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(79,70,229,0.2));
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius-md);
  padding: 12px 14px 12px 18px;
  font-size: 13px;
  line-height: 1.5;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  animation: fadeIn 0.4s ease both;
}
.alert-ev::before { 
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(135deg, #6366F1, #4F46E5);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  box-shadow: 0 0 10px rgba(99,102,241,0.5);
}
.toolbar select, .toolbar button.btn-secondary { height:40px; }
.bottom-nav a[data-tab="alerts"]::after { content:""; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.fade-in { animation: fadeIn .28s ease-out both; }

@keyframes glowPulse {
  0% { box-shadow: 0 0 0 rgba(10,139,255,0.0), 0 0 0 rgba(46,208,120,0.0); }
  50% { box-shadow: 0 0 24px rgba(10,139,255,0.12), 0 0 18px rgba(46,208,120,0.10); }
  100% { box-shadow: 0 0 0 rgba(10,139,255,0.0), 0 0 0 rgba(46,208,120,0.0); }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.35); border-color: #2f2f2f; }

.skeleton {
  background: linear-gradient(90deg, #191919 25%, #232323 37%, #191919 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.skeleton.round { border-radius: 999px; }
.skeleton.block { border-radius: 10px; height: 14px; }
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { color: var(--text); font-weight: 600; font-size: 18px; }

.statbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.pill {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-radius: 24px; font-weight: 600; font-size: 14px;
  background: linear-gradient(135deg, rgba(20,27,45,0.8), rgba(15,23,41,0.9));
  border: 1px solid rgba(99,102,241,0.25);
  color: var(--text);
  position: relative; overflow: hidden; isolation: isolate;
  backdrop-filter: blur(10px) saturate(150%);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.05) inset;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.pill::after { 
  content:""; 
  position:absolute; 
  inset:0; 
  background:radial-gradient(circle at 20% 30%, rgba(99,102,241,0.15), transparent 70%); 
  opacity:0.6; 
  pointer-events:none; 
}
.pill:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 30px var(--dynamic-color, rgba(99,102,241,0.2)); 
  border-color: var(--dynamic-color, rgba(99,102,241,0.4));
}
.pill:active { transform: translateY(0) scale(0.98); }
.pill.positive { 
  background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(5,150,105,0.18));
  border-color: var(--dynamic-color, rgba(16,185,129,0.4));
  box-shadow: 0 4px 16px var(--dynamic-color, rgba(16,185,129,0.25)), 0 0 20px var(--dynamic-color, rgba(16,185,129,0.15)) inset;
}
.pill.negative { 
  background: linear-gradient(135deg, rgba(239,68,68,0.12), rgba(220,38,38,0.18));
  border-color: var(--dynamic-color, rgba(239,68,68,0.4));
  box-shadow: 0 4px 16px var(--dynamic-color, rgba(239,68,68,0.25)), 0 0 20px var(--dynamic-color, rgba(239,68,68,0.15)) inset;
}

/* Stats card enhancements */
#stats.card { padding-top:20px; }
#stats.card h2 { font-size:15px; letter-spacing:.5px; text-transform:uppercase; opacity:.9; margin-bottom:14px; }
.statbar + .heatmap { margin-top:4px; }

/* Treemap container */
#treemapContainer {
  position: relative;
  border: 1px solid rgba(99,102,241,0.2);
  box-shadow: 
    0 8px 32px rgba(0,0,0,0.3),
    0 0 0 1px rgba(99,102,241,0.1) inset;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#treemapContainer:hover {
  box-shadow: 
    0 12px 48px rgba(0,0,0,0.4),
    0 0 0 1px rgba(99,102,241,0.2) inset;
  border-color: rgba(99,102,241,0.3);
}

@media (max-width: 900px) {
  #treemapContainer {
    height: clamp(400px, 60vh, 700px) !important;
  }
}

@media (max-width: 600px) {
  #treemapContainer {
    height: clamp(350px, 55vh, 600px) !important;
    margin-top: 12px !important;
  }
}

/* Heatmap tiles glassy look */
.heatmap { display:grid; grid-template-columns: repeat(auto-fill,minmax(120px,1fr)); gap:10px; }
.heat-cell { 
  position:relative; 
  background: linear-gradient(145deg, rgba(20,27,45,0.7), rgba(15,23,41,0.8));
  border: 1px solid rgba(99,102,241,0.2);
  padding: 14px 10px 10px; 
  border-radius: 18px; 
  overflow:hidden; 
  min-height: 100px; 
  display:flex; 
  flex-direction:column; 
  gap: 8px; 
  animation: fadeIn .6s ease both;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.heat-cell::before { 
  content:""; 
  position:absolute; 
  inset:0; 
  background: radial-gradient(circle at 70% 20%, var(--dynamic-color, rgba(99,102,241,0.2)), transparent 70%); 
  opacity: 0.4; 
  mix-blend-mode: screen; 
  pointer-events:none; 
}
.heat-cell.pos { 
  background: linear-gradient(145deg, rgba(16,185,129,0.08), rgba(5,150,105,0.12));
}
.heat-cell.neg { 
  background: linear-gradient(145deg, rgba(239,68,68,0.08), rgba(220,38,38,0.12));
}
.heat-cell:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 12px 32px var(--dynamic-color, rgba(99,102,241,0.3));
  border-color: var(--dynamic-color, rgba(99,102,241,0.4));
}
.heat-cell .name { font-size:13px; font-weight: 700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color: var(--text); }
.heat-cell .cap { font-size:12px; color: var(--text-dim); margin-top: auto; }
.heat-cell .icon { width: 48px; height: 48px; border-radius: 12px; background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(79,70,229,0.4)); display:flex; align-items:center; justify-content:center; box-shadow: 0 4px 12px rgba(99,102,241,0.3); overflow:hidden; margin: 0 auto; }
.heat-cell .icon img { width:100%; height:100%; object-fit:cover; border-radius:inherit; }

@keyframes fadeIn { from { opacity:0; transform: translateY(6px) scale(.97); } to { opacity:1; transform: translateY(0) scale(1); } }

.chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; width: 100%; }
.chip { 
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(79,70,229,0.15));
  color: var(--text); 
  padding: 7px 14px; 
  border-radius: 999px; 
  border: 1px solid rgba(99,102,241,0.25); 
  cursor: pointer; 
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  white-space: nowrap;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip svg {
  flex-shrink: 0;
  transition: transform 0.3s;
}
.chip:hover svg {
  transform: scale(1.15) rotate(5deg);
}
.chip:hover { 
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(79,70,229,0.25));
  border-color: rgba(99,102,241,0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.chip:active { transform: translateY(0); }
.chip.active { 
  background: linear-gradient(135deg, #6366F1, #4F46E5);
  border-color: rgba(99,102,241,0.6); 
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(99,102,241,0.4), 0 0 0 1px rgba(255,255,255,0.2) inset;
}

.gifts-list { list-style: none; margin: 0; padding: 0; }
.gifts-list li { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
  padding: 14px; 
  border-bottom: 1px solid rgba(99,102,241,0.1);
  transition: all 0.2s;
  border-radius: var(--radius-sm);
}
.gifts-list li:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(79,70,229,0.1));
  border-bottom-color: rgba(99,102,241,0.2);
}
.gifts-list li:last-child { border-bottom: none; }
.gift-emoji { 
  width: 48px; 
  height: 48px; 
  border-radius: 12px; 
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(99,102,241,0.2);
}
.gift-title { font-weight: 600; color: var(--text); }
.gift-title a { 
  color: var(--accent-glow); 
  text-decoration: none;
  transition: color 0.2s;
}
.gift-title a:hover { 
  color: var(--accent);
  text-decoration: underline; 
}
.gift-time { color: var(--text-dim); font-size: 13px; margin-left: auto; }

@keyframes giftPop {
  0% { transform: scale(.95); opacity: .0; }
  60% { transform: scale(1.02); opacity: 1; }
  100% { transform: scale(1); }
}
.gifts-list li { animation: giftPop 300ms cubic-bezier(.2,.75,.25,1) both; }

.btn,
.btn-primary,
.list-item .more,
.nav-btn,
.chip,
.pill {
  font-family: inherit;
  font-weight: 600;
  letter-spacing: .2px;
  -webkit-user-select: none; user-select: none;
}
.btn-primary,
.list-item .more {
  background: var(--surface-1);
  color: var(--btn-text);
  border: 1px solid var(--surface-border);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: clamp(13px, 3.4vw, var(--font-md));
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.btn-primary:hover,
.list-item .more:hover { background: var(--surface-hover); border-color: var(--surface-border-light); }
.btn-primary:active,
.list-item .more:active { background: var(--surface-active); transform: translateY(1px); }
.btn-primary:disabled { opacity:.4; pointer-events:none; }
/* Акцентная версия */
.btn-primary.accent { background: var(--btn-accent); border-color: var(--btn-outline-border); box-shadow: 0 4px 16px rgba(99,102,241,.35); }
.btn-primary.accent:hover { background: var(--btn-accent-hover); }
.btn-primary.accent:active { background: var(--btn-accent); transform: translateY(1px); }

/* Утончённая вторичная */
.btn-secondary { background: var(--surface-0); color: var(--btn-text-dim); border:1px solid var(--surface-border); padding:10px 16px; border-radius: var(--radius-md); font-size: clamp(12px,3.2vw,var(--font-base)); box-shadow: 0 2px 4px rgba(0,0,0,.35); transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
.btn-secondary:hover { background: var(--surface-hover); color: var(--btn-text); border-color: var(--surface-border-light); }
.btn-secondary:active { background: var(--surface-active); }

/* Приведение nav-btn к общим токенам */
.nav-btn { background: var(--surface-0); color: var(--btn-text-dim); border:1px solid var(--surface-border); font-size: clamp(10px,2.6vw,11px); box-shadow: none; }
.nav-btn.active { background: var(--surface-1); color: var(--btn-text); border-color: var(--surface-border-light); box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.nav-btn:hover { background: var(--surface-hover); color: var(--btn-text); }

/* Чипы и pill без резких белых бликов */
.chip { background: var(--surface-0); border-color: var(--surface-border); color: var(--btn-text-dim); box-shadow:none; }
.chip.active { background: var(--surface-1); color: var(--btn-text); border-color: var(--surface-border-light); }
.chip:hover { background: var(--surface-hover); color: var(--btn-text); }
.pill { background: var(--surface-0); border-color: var(--surface-border); color: var(--btn-text-dim); box-shadow:none; }
.pill.positive { background: var(--surface-1); color: var(--up-glow); border-color: rgba(16,185,129,.35); }
.pill.negative { background: var(--surface-1); color: var(--down-glow); border-color: rgba(239,68,68,.35); }
.pill:hover { background: var(--surface-hover); color: var(--btn-text); }

/* Нейтрализация старого стиля для .list-item .more */
.list-item .more { font-weight:600; font-size: clamp(12px,3.2vw,var(--font-base)); padding:10px 16px; border-radius: var(--radius-sm); }

/* Иконки-кнопки (плюс, сортировка и т.п.) */
.btn-icon { width:34px; height:34px; display:inline-flex; align-items:center; justify-content:center; border-radius: 10px; background: var(--surface-0); border:1px solid var(--surface-border); color: var(--btn-text-dim); cursor:pointer; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
.btn-icon:hover { background: var(--surface-hover); color: var(--btn-text); border-color: var(--surface-border-light); }
.btn-icon:active { background: var(--surface-active); }
.hint { color: var(--text-dim); font-size: 13px; margin-top: 8px; opacity: 0.8; }

/* Market */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; width: 100%; }
.toolbar > * { height: 42px; display: inline-flex; align-items: center; }
.toolbar input { box-sizing: border-box; }
.toolbar select { 
  background: linear-gradient(135deg, rgba(20,27,45,0.8), rgba(15,23,41,0.9));
  color: var(--text); 
  border: 1px solid rgba(99,102,241,0.25); 
  border-radius: var(--radius-sm); 
  padding: 10px 14px; 
  outline: none; 
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.toolbar select:focus { 
  border-color: var(--accent); 
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2), 0 2px 8px rgba(0,0,0,0.2);
}
.toolbar select:hover {
  border-color: rgba(99,102,241,0.4);
}
#mkSearch { 
  background: linear-gradient(135deg, rgba(20,27,45,0.8), rgba(15,23,41,0.9));
  color: var(--text); 
  border: 1px solid rgba(99,102,241,0.25); 
  border-radius: var(--radius-sm); 
  padding: 12px 16px; 
  outline: none; 
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
  min-height: 44px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
#mkSearch::placeholder { color: var(--text-dim); opacity: 0.6; }
#mkSearch:focus { 
  border-color: var(--accent); 
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2), 0 2px 8px rgba(0,0,0,0.2);
}
#mkSearch:hover { border-color: rgba(99,102,241,0.4); }

.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 16px; width: 100%; }
.list[aria-busy="true"] { position: relative; }
.list[aria-busy="true"]::after {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius-md);
  background: linear-gradient(90deg,
    rgba(99,102,241,0.08) 0%,
    rgba(129,140,248,0.12) 50%,
    rgba(99,102,241,0.08) 100%);
  background-size: 200% 100%; animation: shimmer 2s ease-in-out infinite;
  pointer-events: none;
}
.list-item {
  background: linear-gradient(145deg, rgba(20,27,45,0.7) 0%, rgba(15,23,41,0.8) 100%);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2), 0 0 0 1px rgba(99,102,241,0.1) inset;
  position: relative;
  overflow: hidden;
  min-height: 142px;
}
.list-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 30%, rgba(99,102,241,0.1), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}
.list-item:hover::before { opacity: 1; }
.list-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(99,102,241,0.25), 0 0 0 1px rgba(99,102,241,0.3) inset;
  border-color: rgba(99,102,241,0.4);
}
.list-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.list-item-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}
.list-item .ico {
  flex-shrink: 0;
}
.list-item .name {
  flex: 1;
  font-weight: 600;
  font-size: var(--font-md);
  line-height: var(--line-tight);
  color: var(--text);
}
.list-item .price {
  font-size: var(--font-base);
  color: var(--text-dim);
  font-weight: 500;
  white-space: nowrap;
}
.list-item .chg {
  flex-shrink: 0;
}
.list-item .more { 
  width: 100%;
  margin-top: 8px; 
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(79,70,229,0.2));
  color: #E0E7FF; 
  border: 1px solid rgba(99,102,241,0.3); 
  padding: 10px 14px; 
  border-radius: var(--radius-sm); 
  cursor: pointer; 
  text-align: center;
  font-weight: 600;
  transition: all 0.2s;
}
.list-item .more:hover { 
  background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(79,70,229,0.3));
  transform: scale(1.02);
}

/* Market layout */
.market-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; width: 100%; }
.market-main { min-width: 0; }
.market-side { min-width: 0; }
.side-card { 
  background: linear-gradient(145deg, rgba(20,27,45,0.7), rgba(15,23,41,0.8));
  border: 1px solid rgba(99,102,241,0.2); 
  border-radius: var(--radius-lg); 
  padding: 20px; 
  color: var(--text);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 0 1px rgba(99,102,241,0.1) inset;
  position: sticky;
  top: 80px;
}
.side-header { 
  background: linear-gradient(135deg, #E0E7FF, #C7D2FE);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 700; 
  font-size: 16px;
  margin-bottom: 16px; 
  letter-spacing: -0.3px;
}
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.kpi { 
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(79,70,229,0.15));
  border: 1px solid rgba(99,102,241,0.2); 
  border-radius: var(--radius-md); 
  padding: 16px 12px; 
  text-align: center;
  transition: all 0.2s;
}
.kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(99,102,241,0.2);
}
.kpi-val { 
  font-size: 26px; 
  font-weight: 800; 
  color: var(--text); 
  margin-bottom: 6px;
  line-height: 1;
}
.kpi-label { 
  color: var(--text-dim); 
  font-size: 11px; 
  text-transform: uppercase; 
  letter-spacing: 0.5px;
  font-weight: 600;
}
.sparkline { 
  margin-top: 16px; 
  height: 90px; 
  background: linear-gradient(135deg, rgba(99,102,241,0.05), rgba(79,70,229,0.1));
  border: 1px solid rgba(99,102,241,0.15); 
  border-radius: var(--radius-md); 
  overflow: hidden;
  padding: 10px;
}
.sparkline svg path { fill: none; stroke: url(#gradPurple); stroke-width: 2.5; }

@media (max-width: 900px) {
  .market-grid { grid-template-columns: 1fr; }
}

/* Purple accent gradient for sparkline */
.sparkline svg defs linearGradient stop:first-child { stop-color: #A78BFA; }
.sparkline svg defs linearGradient stop:last-child { stop-color: #7C5CFF; }
.list-item:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(10,139,255,0.12); border-color: #27313a; }
.list-item .ico { font-size: 18px; }
.list-item .ico img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.list-item .name { font-weight: 600; }
.list-item .price { margin-left: auto; font-variant-numeric: tabular-nums; }
.list-item .chg { font-weight: 600; }
.pct-badge {
  display: inline-block; min-width: 56px; text-align: center; padding: 6px 12px;
  border-radius: 999px; font-weight: 700; font-size: 13px;
  background: linear-gradient(135deg, rgba(16,185,129,0.2), rgba(5,150,105,0.3));
  border: 1px solid rgba(16,185,129,0.4);
  box-shadow: 0 2px 8px rgba(16,185,129,0.3), 0 0 0 1px rgba(16,185,129,0.2) inset;
  color: var(--up-glow);
  transition: all 0.2s;
}
.pct-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(16,185,129,0.4);
}
.chg.neg .pct-badge { 
  color: var(--down-glow); 
  background: linear-gradient(135deg, rgba(239,68,68,0.2), rgba(220,38,38,0.3));
  border-color: rgba(239,68,68,0.4);
  box-shadow: 0 2px 8px rgba(239,68,68,0.3), 0 0 0 1px rgba(239,68,68,0.2) inset;
}
.chg.pos { color: var(--up-glow); }
.chg.neg { color: var(--down-glow); }

@media (max-width: 600px) {
  .list-item { grid-template-columns: auto 1fr auto; }
}

.heatmap { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.heatmap[aria-busy="true"] { position: relative; }
.heatmap[aria-busy="true"]::after { display: none; }
.heat-cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 10px 8px; font-size: 13px; line-height: 1.15; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s;
  border: 1px solid var(--border);
  background: linear-gradient(120deg, rgba(10,139,255,0.08) 0%, rgba(16,18,22,0.96) 100%);
  box-shadow: 0 2px 12px rgba(10,139,255,0.08);
}
.heat-cell.pos { background: linear-gradient(120deg, rgba(46,208,120,0.15) 0%, rgba(16,18,22,0.96) 100%); }
.heat-cell.neg { background: linear-gradient(120deg, rgba(255,100,100,0.14) 0%, rgba(16,18,22,0.96) 100%); }
.heat-cell:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 32px rgba(10,139,255,0.14);
  background: linear-gradient(120deg, rgba(10,139,255,0.16) 0%, rgba(16,18,22,1) 100%);
}
.heat-cell .cap { position: absolute; bottom: 6px; left: 6px; right: 6px; font-variant-numeric: tabular-nums; }
.heat-cell .name { font-weight: 700; }
.heat-cell .icon { display: flex; align-items: center; justify-content: center; margin-bottom: 6px; width: auto; height: auto; }
.heat-cell .icon img {
  width: 56px; height: 56px; border-radius: 14px;
  object-fit: cover; box-shadow: 0 4px 16px rgba(10,139,255,0.18);
  background: linear-gradient(135deg, #00D28C 0%, #008CFF 100%);
  border: 2px solid #0A8BFF22;
}
/* Skeleton helpers for inline blocks */
.skeleton.round { border-radius: 999px; background: linear-gradient(90deg, #2a2550 25%, #3a3268 40%, #2a2550 65%); background-size: 260% 100%; animation: shimmer 1.15s ease-in-out infinite; opacity:.85; }
.skeleton.block { border-radius: 6px; height: 12px; background: linear-gradient(90deg, #2a2550 25%, #3a3268 40%, #2a2550 65%); background-size: 260% 100%; animation: shimmer 1.15s ease-in-out infinite; opacity:.85; }

/* Более мягкий стиль карточек-скелетонов */
.list-item.loading { position: relative; overflow: hidden; }
.list-item.loading::after {
  content:""; position:absolute; inset:0; border-radius:inherit; background: radial-gradient(circle at 25% 20%, rgba(124,92,255,0.18), transparent 60%);
  opacity:.35; pointer-events:none; mix-blend-mode:screen;
}
.list-item.loading:hover { transform:none; box-shadow: 0 2px 12px rgba(124,92,255,0.12); }

/* Убираем «широкие тёмные полосы» у скелетонов */
.list-item.loading {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 4px 2px !important;
  gap: 14px;
}
.list-item.loading .ico { opacity:.9; }
.list-item.loading .skeleton.block,
.list-item.loading .skeleton.round { filter: brightness(1.15); }
.list[aria-busy="true"] { gap: 4px; }


@media (prefers-reduced-motion: reduce) {
  .skeleton.round, .skeleton.block { animation: none !important; }
  .list[aria-busy="true"]::after { animation: none !important; }
}

/* Смещение контента вниз внутри этих карточек */
#market {
  display: grid;
  grid-template-rows: auto auto 1fr;
  align-content: end;
  min-height: 360px;
}
#stats {
  display: grid;
  grid-template-rows: auto auto 1fr;
  align-content: end;
  min-height: 360px;
}

/* Элементы из сниппета, безопасно добавлены */
.chips { display: flex; gap: 12px; margin: 16px 0; }
.chip { background: #1a1630; color: #bdb6f5; padding: 8px 16px; border-radius: 22px; border: 1px solid #2a2550; line-height:1; }
.chip.active { border-color: var(--accent); color: #e9e6ff; box-shadow: 0 0 0 2px rgba(124,92,255,.30); }
.meta { color: var(--text-dim); }
.name { font-weight: 600; }

/* Большой icon-блок внутри карточек, не трогаем heatmap */
.card .icon { width: 72px; height: 72px; border-radius: 20px; background: linear-gradient(135deg,#00D28C,#008CFF); }

/* Mobile tweaks */
@media (max-width: 600px) {
  .app-header { padding: calc(10px + env(safe-area-inset-top)) 12px 10px 12px; }
  .app-header h1 { font-size: 17px; }
  .wallet-bar { display: none; }
  .container { padding: 0 12px 10px 12px; }
  .card { padding: var(--space-4) var(--space-3); gap: var(--space-3); border-radius: 18px; }
  .card h2 { font-size: 16px; margin-bottom: 12px; }
  .toolbar { gap: 8px; margin-bottom: 12px; }
  .toolbar > * { height: 42px; }
  #mkSearch { font-size: 14px; padding: 10px 14px; }
  .chips { gap: 8px; flex-wrap: wrap; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { padding: 8px 14px; font-size: 13px; white-space: nowrap; }
  .list { grid-template-columns: 1fr; gap: var(--space-3); }
  .list-item { padding: var(--space-3) var(--space-3) var(--space-2); gap: var(--space-2); border-radius: 14px; min-height: 132px; }
  .list-item .name { font-size: 14px; }
  .list-item .ico img { width: 38px; height: 38px; }
  .pct-badge { min-width: 50px; font-size: 12px; padding: 5px 10px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .heatmap { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .heat-cell { padding: 12px 8px; font-size: 12px; border-radius: 14px; min-height: 90px; }
  .heat-cell .icon { width: 42px; height: 42px; }
  .heat-cell .icon img { width: 42px; height: 42px; border-radius: 10px; }
  .market-grid { grid-template-columns: 1fr; }
  .side-card { position: static; }
  .statbar { gap: 8px; }
  .pill { padding: 8px 12px; font-size: 13px; }
  .gift-emoji { width: 44px; height: 44px; }
  .gifts-list li { padding: 12px; }
}

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(env(safe-area-inset-bottom) + 10px);
  background: linear-gradient(180deg, rgba(10,14,39,0.95), rgba(5,7,20,0.98));
  border-top: 1px solid rgba(99,102,241,0.2);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.3), 0 0 0 1px rgba(99,102,241,0.1) inset;
  z-index: 100;
}
.nav-btn {
  flex: 1;
  display: inline-flex; 
  flex-direction: column;
  align-items: center; 
  justify-content: center;
  padding: 10px 6px; 
  border-radius: var(--radius-md); 
  text-decoration: none; 
  color: var(--text-dim);
  background: rgba(99,102,241,0.05);
  border: 1px solid rgba(99,102,241,0.15); 
  font-size: 11px; 
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  gap: 4px;
}
.nav-btn svg {
  transition: transform 0.3s;
}
.nav-btn:hover svg {
  transform: translateY(-2px);
}
.nav-btn.active svg {
  filter: drop-shadow(0 2px 4px rgba(255,255,255,0.3));
}
.nav-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.nav-btn:hover::before { opacity: 1; }
.nav-btn:active { transform: scale(0.95); }
.nav-btn.active { 
  background: linear-gradient(135deg, #6366F1, #4F46E5);
  border-color: rgba(99,102,241,0.5); 
  color: #FFFFFF; 
  box-shadow: 0 4px 16px rgba(99,102,241,0.4), 0 0 0 1px rgba(255,255,255,0.1) inset;
}

@media (max-width: 600px) {
  .nav-btn { font-size: 10px; padding: 8px 4px; }
}

/* Prevent overlap */
.container { padding-bottom: 100px; }

/* ================= Mobile polish overrides (non-breaking) ================= */
@media (max-width: 600px) {
  body { font-size: var(--font-base); }
  .toolbar { display:flex; flex-wrap:wrap; }
  .toolbar select, .toolbar button, #mkSearch { flex:1 1 calc(50% - 8px); min-width:140px; }
  #mkSearch { flex:1 1 100%; }
  .nav-btn { font-size: 10px; letter-spacing: .3px; }
  .nav-btn.active { box-shadow: 0 3px 12px rgba(99,102,241,.35); }
  .bottom-nav { gap: var(--space-2); padding: 8px 10px calc(env(safe-area-inset-bottom) + 8px); }
  .app-header { backdrop-filter: blur(18px) saturate(160%); }
  .pct-badge { padding: 4px 10px; }
  .list-item .more { font-size: var(--font-sm); padding: 8px 12px; }
  .kpi { padding: 14px 10px; }
  .kpi-val { font-size: 22px; }
  .heat-cell { box-shadow: 0 3px 12px rgba(0,0,0,.25); }
}

/* High-density mode (future hook) */
@media (max-width: 430px) {
  .list-item { min-height: 124px; }
  .heat-cell .icon img { width: 36px; height: 36px; }
  .chip { padding: 7px 12px; }
}

/* Focus accessibility */
:where(button, a, input, select).focus-visible,
:where(button, a, input, select):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Тонкие скроллбары */
* { scrollbar-width: thin; scrollbar-color: rgba(99,102,241,0.4) rgba(99,102,241,0.1); }
*::-webkit-scrollbar { height: 10px; width: 10px; }
*::-webkit-scrollbar-track { background: rgba(99,102,241,0.05); border-radius: 10px; }
*::-webkit-scrollbar-thumb { 
  background: linear-gradient(135deg, rgba(99,102,241,0.5), rgba(79,70,229,0.6));
  border-radius: 10px;
  transition: background 0.2s;
}
*::-webkit-scrollbar-thumb:hover { background: linear-gradient(135deg, rgba(99,102,241,0.7), rgba(79,70,229,0.8)); }

/* Raffle Cards */
/* ========== Raffles Section ========== */
#rafflesList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 24px;
  margin-bottom: 16px;
  width: 100%;
}

.raffle-card {
  background: linear-gradient(145deg, rgba(20,27,45,0.7) 0%, rgba(15,23,41,0.8) 100%);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2), 0 0 0 1px rgba(99,102,241,0.1) inset;
  position: relative;
  overflow: hidden;
  min-height: 160px;
}

.raffle-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 30%, rgba(99,102,241,0.1), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}

.raffle-card:hover::before {
  opacity: 1;
}

.raffle-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(99,102,241,0.25), 0 0 0 1px rgba(99,102,241,0.3) inset;
  border-color: rgba(99,102,241,0.4);
}

.raffle-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.raffle-icon {
  font-size: 32px;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(99,102,241,0.4));
}

.raffle-title {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 var(--space-1) 0;
  line-height: var(--line-tight);
}

.raffle-prize {
  font-size: var(--font-sm);
  color: var(--up-glow);
  font-weight: 600;
  margin: 0;
}

.raffle-description {
  font-size: var(--font-sm);
  color: var(--text-dim);
  line-height: var(--line-base);
  margin: 0;
}

.raffle-stats {
  display: flex;
  gap: var(--space-4);
  margin-top: auto;
  font-size: var(--font-sm);
  color: var(--text-dim);
}

.raffle-stat {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.raffle-stat svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
  flex-shrink: 0;
}

.raffle-timer {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.raffle-timer svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.raffle-join-btn {
  width: 100%;
  padding: 12px var(--space-4);
  background: var(--btn-accent);
  color: var(--btn-text);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--font-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
  margin-top: var(--space-2);
}

.raffle-join-btn:hover:not(:disabled) {
  background: var(--btn-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

.raffle-join-btn:active:not(:disabled) {
  transform: translateY(0);
}

.raffle-join-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--panel);
  color: var(--text-dim);
  box-shadow: none;
}

.raffle-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-7) var(--space-5);
  color: var(--text-dim);
  font-size: var(--font-base);
}

@media (max-width: 768px) {
  #rafflesList {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}


