* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a14;
  --bg-secondary: #12121f;
  --bg-tertiary: #1a1a2e;
  --accent-cyan: #00d9ff;
  --accent-purple: #8b00ff;
  --accent-gold: #ffd700;
  --accent-orange: #ff6b35;
  --accent-green: #00ff88;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);
  --border: rgba(255, 255, 255, 0.1);
  --bg-card: rgba(18, 18, 31, 0.85);
  --glow-cyan: 0 0 20px rgba(0, 217, 255, 0.4);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-primary);
}

#cosmos-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 0%, transparent 40%, rgba(0,0,0,0.4) 100%),
    radial-gradient(ellipse at 15% 85%, rgba(139, 0, 255, 0.18) 0%, transparent 35%),
    radial-gradient(ellipse at 85% 15%, rgba(0, 217, 255, 0.15) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 70%, rgba(139, 0, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 25% 35%, rgba(0, 217, 255, 0.06) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 20%, rgba(255, 107, 53, 0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 40% 60%, rgba(139, 0, 255, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 60% 40%, rgba(0, 100, 150, 0.05) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(0, 255, 136, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(20, 20, 40, 1) 0%, var(--bg-primary) 70%),
    var(--bg-primary);
}

/* Wrapper isolates rotation from UI layer */
#graph-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

#graph-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background: transparent;
  transform-origin: center center;
  will-change: transform;
  pointer-events: auto;
}


#stats-overlay {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  gap: 20px;
  z-index: 500;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(18, 18, 31, 0.8);
  backdrop-filter: blur(10px);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.connection-status {
  flex-direction: row;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.disconnected {
  background: #ff4757;
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

#legend {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(18, 18, 31, 0.8);
  backdrop-filter: blur(10px);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  z-index: 500;
}

.legend-filters {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.legend-item.clickable {
  cursor: pointer;
  padding: 6px 8px;
  margin: -6px -8px;
  border-radius: 8px;
  transition: all 0.2s;
}

.legend-item.clickable:hover {
  background: rgba(255, 255, 255, 0.05);
}

.legend-item.clickable:not(.active) {
  opacity: 0.4;
}

.legend-item.clickable:not(.active) .legend-dot {
  filter: grayscale(1);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.validator { background: var(--accent-purple); box-shadow: 0 0 10px var(--accent-purple); }
.legend-dot.whale { background: var(--accent-gold); box-shadow: 0 0 10px var(--accent-gold); }
.legend-dot.normal { background: var(--accent-cyan); box-shadow: 0 0 10px var(--accent-cyan); }

.legend-gradient {
  margin-top: 8px;
  width: 280px;
}

.gradient-bar {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right,
    #40a0a8 0%,      /* <100 Dim Cyan */
    #00d9ff 10%,     /* 100+ Cyan */
    #6495ed 20%,     /* 1K+ Blue */
    #9370db 30%,     /* 5K+ Purple-Blue */
    #da70d6 40%,     /* 10K+ Magenta */
    #ff69b4 50%,     /* 25K+ Pink */
    #ff6347 60%,     /* 50K+ Red-Orange */
    #ff8c00 70%,     /* 100K+ Orange */
    #ffa500 80%,     /* 250K+ Orange-Gold */
    #ffd700 90%,     /* 500K+ Gold */
    #fff8dc 100%     /* 2M+ Brilliant Gold */
  );
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.gradient-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

#logo {
  position: fixed;
  top: 20px;
  right: 20px;
  font-size: 1.5rem;
  font-weight: 800;
  z-index: 500;
}

.logo-text { color: var(--text-primary); }

.logo-accent {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#tooltip {
  position: fixed;
  pointer-events: none;
  background: rgba(18, 18, 31, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-width: 200px;
  z-index: 200;
}

#tooltip.hidden { display: none; }

.tooltip-address {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  margin-bottom: 12px;
  word-break: break-all;
}

.tooltip-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.tooltip-stat { display: flex; flex-direction: column; }

.tooltip-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tooltip-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.tooltip-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

#modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

#modal-overlay.hidden { display: none; }

#modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

#modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}

#modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

#modal-content { padding: 24px; }

.modal-header { margin-bottom: 24px; }

.modal-address {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.9rem;
  color: var(--accent-cyan);
  word-break: break-all;
  margin-bottom: 8px;
}

.modal-address-actions {
  display: flex;
  gap: 8px;
}

.modal-btn {
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-btn:hover {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border-color: var(--accent-cyan);
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.modal-stat {
  text-align: center;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: 12px;
}

.modal-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.modal-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.modal-section { margin-bottom: 24px; }

.modal-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.modal-tx-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-tx {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: 8px;
}

.modal-tx-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-tx-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.modal-tx-address {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.modal-tx-amount { font-weight: 700; }
.modal-tx-amount.in { color: var(--accent-green); }
.modal-tx-amount.out { color: #ff6b6b; }

.activity-chart {
  height: 40px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 8px;
  background: var(--bg-tertiary);
  border-radius: 8px;
}

.activity-bar {
  flex: 1;
  background: var(--accent-cyan);
  border-radius: 2px;
  min-height: 2px;
  opacity: 0.7;
}

@media (max-width: 768px) {
  /* Reorganize header for mobile - stack vertically */
  #logo {
    top: 12px;
    right: 12px;
    font-size: 1.2rem;
  }

  #stats-overlay {
    top: auto;
    bottom: 100px;
    left: 10px;
    right: 70px; /* Leave space for watcher bell to not cover Live button */
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 6px;
  }

  .stat {
    padding: 6px 8px;
    flex: 1;
    min-width: 0;
  }
  .stat-value { font-size: 1rem; }
  .stat-label { font-size: 0.6rem; letter-spacing: 0.5px; }

  .connection-status {
    flex: 0 0 auto;
    padding: 6px 10px;
  }

  #legend {
    padding: 6px 8px;
    bottom: 8px;
    left: 8px;
    right: auto;
    max-width: calc(100vw - 80px);
  }

  .legend-filters {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 4px;
  }

  .legend-item {
    font-size: 0.6rem;
    gap: 5px;
  }

  .legend-item.clickable {
    padding: 4px 6px;
    margin: 0;
    min-height: 24px;
  }

  .legend-dot {
    width: 8px;
    height: 8px;
  }

  .legend-gradient {
    width: 100%;
    margin-top: 4px;
  }

  .gradient-bar {
    height: 8px;
  }

  .gradient-labels {
    margin-top: 3px;
    font-size: 0.55rem;
  }

  #modal {
    width: 95%;
    max-height: 90vh;
  }

  .modal-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Search */
#search-container {
  position: fixed;
  top: 20px;
  right: 180px;
  z-index: 550;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.search-toggle {
  width: 44px;
  height: 44px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  animation: search-pulse 3s ease-in-out infinite;
}

@keyframes search-pulse {
  0%, 100% {
    border-color: var(--border);
    box-shadow: 0 0 0 0 rgba(0, 217, 255, 0);
  }
  50% {
    border-color: rgba(0, 217, 255, 0.4);
    box-shadow: 0 0 8px 0 rgba(0, 217, 255, 0.2);
  }
}

.search-toggle:hover,
.search-toggle.active {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
  animation: none;
}

.search-box {
  position: absolute;
  top: 0;
  right: 54px;
  width: 320px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.search-box.hidden {
  display: none;
}

#search-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: 'SF Mono', Monaco, monospace;
  outline: none;
  transition: all 0.2s;
}

#search-input::placeholder {
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#search-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.search-hint {
  padding: 8px 12px;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
}

.search-results {
  max-height: 300px;
  overflow-y: auto;
  margin-top: 4px;
}

.search-results.hidden {
  display: none;
}

.search-result {
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.search-result:hover,
.search-result.active {
  background: var(--bg-tertiary);
  border-color: var(--border);
}

.search-result.active {
  border-color: var(--accent-cyan);
}

.search-result-address {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.8rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.search-result-address mark {
  background: rgba(0, 217, 255, 0.3);
  color: var(--accent-cyan);
  padding: 1px 2px;
  border-radius: 3px;
}

.search-result-meta {
  display: flex;
  gap: 12px;
  font-size: 0.7rem;
}

.search-result-balance {
  color: var(--accent-gold);
  font-weight: 600;
}

.search-result-txs {
  color: var(--text-muted);
}

.search-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Mobile adjustments for search */
@media (max-width: 768px) {
  #search-container {
    right: auto;
    left: 12px;
    top: 12px;
  }

  .search-toggle {
    width: 38px;
    height: 38px;
  }

  .search-box {
    width: calc(100vw - 32px);
    left: 0;
    right: auto;
    top: 48px;
  }
}

/* Watcher */
.watcher-bell {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 200;
}

.watcher-bell:hover {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}

.watcher-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  background: #ff4757;
  border-radius: 10px;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.watcher-badge.hidden {
  display: none;
}

.watcher-panel {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 360px;
  max-height: 500px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 250;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.watcher-panel.hidden {
  display: none;
}

.watcher-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.watcher-panel-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-primary);
}

.watcher-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}

.watcher-panel-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.watcher-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.watcher-section {
  text-align: center;
}

.watcher-section p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.watcher-btn {
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.watcher-btn.primary {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border-color: var(--accent-cyan);
}

.watcher-btn.primary:hover {
  background: #00b8d9;
  box-shadow: var(--glow-cyan);
}

.watcher-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.watcher-tab {
  flex: 1;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.watcher-tab:hover {
  background: var(--bg-primary);
}

.watcher-tab.active {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border-color: var(--accent-cyan);
}

.tab-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  background: #ff4757;
  border-radius: 9px;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.tab-badge.hidden {
  display: none;
}

.watcher-tab-content {
  min-height: 200px;
}

.watcher-tab-content.hidden {
  display: none;
}

.watched-wallets-list,
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.watched-wallet-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.watched-wallet-item:hover {
  border-color: var(--accent-cyan);
}

.wallet-info {
  cursor: pointer;
  flex: 1;
}

.wallet-address {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.8rem;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

.wallet-balance {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.remove-wallet-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.remove-wallet-btn:hover {
  background: rgba(255, 71, 87, 0.2);
  color: #ff4757;
}

.alert-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.alert-item:hover {
  border-color: var(--accent-cyan);
}

.alert-item.unseen {
  background: rgba(0, 217, 255, 0.1);
  border-color: rgba(0, 217, 255, 0.3);
}

.alert-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.alert-icon.incoming {
  background: rgba(0, 255, 136, 0.2);
  color: var(--accent-green);
}

.alert-icon.outgoing {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
}

.alert-content {
  flex: 1;
  min-width: 0;
}

.alert-title {
  font-size: 0.8rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.alert-amount {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-gold);
  margin-bottom: 2px;
}

.alert-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 40px 20px;
  line-height: 1.6;
}

/* Watch button in modal */
.watch-btn.watching {
  background: rgba(0, 255, 136, 0.2);
  color: var(--accent-green);
  border-color: var(--accent-green);
}

.watch-btn.watching:hover {
  background: rgba(0, 255, 136, 0.3);
}

/* Telegram section in modal */
.telegram-section {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.telegram-info p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.telegram-command {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.telegram-command code {
  flex: 1;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.75rem;
  color: var(--accent-cyan);
  word-break: break-all;
}

.copy-cmd-btn {
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.copy-cmd-btn:hover {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border-color: var(--accent-cyan);
}

.telegram-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #0088cc;
  border-radius: 8px;
  color: white;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.telegram-link:hover {
  background: #006699;
  box-shadow: 0 4px 12px rgba(0, 136, 204, 0.4);
}

/* Watcher notification toast */
.watcher-notification {
  position: fixed;
  bottom: 80px;
  right: 80px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-cyan);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), var(--glow-cyan);
  z-index: 300;
  cursor: pointer;
  animation: slide-in 0.3s ease-out;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.watcher-notification.fade-out {
  animation: fade-out 0.3s ease-out forwards;
}

@keyframes fade-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(50px);
  }
}

.notification-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
}

.notification-icon.incoming {
  background: rgba(0, 255, 136, 0.2);
  color: var(--accent-green);
}

.notification-icon.outgoing {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
}

.notification-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notification-title {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.notification-amount {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-gold);
}

/* Mobile adjustments for watcher */
@media (max-width: 768px) {
  .watcher-bell {
    bottom: 15px;
    right: 15px;
    width: 46px;
    height: 46px;
  }

  .watcher-panel {
    bottom: 70px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: 60vh;
  }

  .watcher-notification {
    right: 15px;
    left: 15px;
    bottom: 70px;
  }
}

/* Extra small screens - phones in portrait */
@media (max-width: 400px) {
  #stats-overlay {
    bottom: 95px;
    left: 8px;
    right: 60px;
    gap: 4px;
  }

  .stat {
    padding: 5px 6px;
  }

  .stat-value { font-size: 0.9rem; }
  .stat-label { font-size: 0.55rem; }

  .connection-status {
    padding: 5px 8px;
  }

  #legend {
    padding: 5px 6px;
    max-width: calc(100vw - 60px);
  }

  .legend-filters {
    gap: 2px;
  }

  .legend-item {
    font-size: 0.55rem;
    gap: 4px;
  }

  .legend-item.clickable {
    padding: 3px 5px;
    min-height: 20px;
  }

  .legend-dot {
    width: 6px;
    height: 6px;
  }

  .legend-gradient { width: 100%; margin-top: 3px; }
  .gradient-bar { height: 6px; }
  .gradient-labels { font-size: 0.5rem; }

  .watcher-bell {
    bottom: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
  }
}

/* Long-press toast notification */
.long-press-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 14px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 400;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.2s ease-out;
}

.long-press-toast.success {
  border-color: var(--accent-green);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 255, 136, 0.2);
}

.long-press-toast.info {
  border-color: var(--accent-cyan);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 217, 255, 0.2);
}

.long-press-toast.error {
  border-color: #ff4757;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 71, 87, 0.2);
}

.long-press-toast.fade-out {
  animation: toast-out 0.3s ease-out forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
}

/* Historical Playback */
.history-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.history-btn:hover {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}

.history-icon {
  font-size: 1rem;
}

/* Historical mode body filter */
body.historical-mode {
  --historical-filter: sepia(0.15) brightness(0.92);
}

body.historical-mode #cosmos-bg {
  filter: var(--historical-filter);
}

body.historical-mode #graph-container {
  filter: var(--historical-filter);
}

/* Playback controls panel */
.playback-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 24px;
  z-index: 600;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  min-width: 400px;
  backdrop-filter: blur(20px);
}

.playback-controls.hidden {
  display: none;
}

.playback-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.historical-indicator {
  width: 10px;
  height: 10px;
  background: #ff9500;
  border-radius: 50%;
  animation: historical-pulse 2s ease-in-out infinite;
}

@keyframes historical-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px #ff9500; }
  50% { opacity: 0.6; box-shadow: 0 0 4px #ff9500; }
}

.mode-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #ff9500;
  font-weight: 600;
}

.playback-date {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 12px;
}

.playback-slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.slider-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 50px;
}

.slider-label.end {
  text-align: right;
}

.playback-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.playback-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent-cyan);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 217, 255, 0.5);
  transition: all 0.2s;
}

.playback-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 15px rgba(0, 217, 255, 0.7);
}

.playback-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--accent-cyan);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 10px rgba(0, 217, 255, 0.5);
}

.playback-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.playback-btn {
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.playback-btn:hover {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border-color: var(--accent-cyan);
}

.playback-btn.play-btn {
  padding: 10px 20px;
}

.playback-btn.play-btn.playing {
  background: #ff9500;
  color: var(--bg-primary);
  border-color: #ff9500;
}

.playback-btn.speed-btn {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.8rem;
  min-width: 50px;
}

.playback-btn.live-btn {
  background: var(--accent-green);
  color: var(--bg-primary);
  border-color: var(--accent-green);
  font-weight: 600;
}

.playback-btn.live-btn:hover {
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

/* Mobile adjustments for playback */
@media (max-width: 768px) {
  .history-btn {
    padding: 6px 10px;
    font-size: 0.7rem;
  }

  .history-icon {
    font-size: 0.9rem;
  }

  .playback-controls {
    left: 10px;
    right: 10px;
    transform: none;
    min-width: auto;
    padding: 12px 16px;
    bottom: 75px;
  }

  .playback-date {
    font-size: 0.95rem;
  }

  .playback-slider-container {
    margin-bottom: 12px;
  }

  .slider-label {
    display: none;
  }

  .playback-buttons {
    gap: 6px;
  }

  .playback-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
    min-width: 38px;
  }

  .playback-btn.play-btn {
    padding: 8px 16px;
  }

  .playback-btn.speed-btn {
    min-width: 42px;
    font-size: 0.7rem;
  }
}

@media (max-width: 400px) {
  .history-btn span:not(.history-icon) {
    display: none;
  }

  .history-btn {
    padding: 6px 8px;
  }

  .playback-controls {
    bottom: 65px;
    padding: 10px 12px;
  }

  .playback-header {
    margin-bottom: 6px;
  }

  .playback-date {
    font-size: 0.85rem;
    margin-bottom: 8px;
  }

  .playback-btn {
    padding: 6px 10px;
    min-width: 34px;
  }
}
