:root { --bg:#0b0d12; --fg:#e7ecf3; --muted:#99a3b3; --card:#151924; --accent:#66d9ef; --ok:#3ecf8e; --warn:#f39c12; }

/* Container для ограничения максимальной ширины и центрирования */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Responsive padding для мобильных устройств */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }
}

*{box-sizing:border-box}
body{margin:0;font:14px/1.5 system-ui,Segoe UI,Roboto; background:var(--bg); color:var(--fg)}
header{padding:16px 0;border-bottom:1px solid #1f2430;background:var(--card);text-align:center}
h1{margin:0 0 8px 0;font-size:20px;text-align:center}
.controls{display:flex;gap:10px;align-items:center;flex-wrap:wrap;justify-content:center}
.badge{display:inline-block;padding:2px 8px;border-radius:999px;font-size:12px;border:1px solid #2b3346;color:var(--muted)}
.meta{margin-top:8px;color:var(--muted);text-align:center}

main{padding:16px 0}

/* Контейнер для таблицы с горизонтальной прокруткой на мобильных */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding: 0 16px;
}

table{width:100%;border-collapse:separate;border-spacing:0 8px}
thead th{font-weight:600;text-align:left;color:var(--muted);padding:6px 10px}
tbody tr{background:var(--card)}
tbody td{padding:10px}
tbody tr:hover{outline:1px solid #263049}
.addr{display:flex;align-items:center;gap:6px;word-break:break-all}
.addr span{font-family:'Courier New',monospace;font-size:13px;color:var(--fg)}
.addr a{font-family:'Courier New',monospace;font-size:13px;color:var(--fg);text-decoration:none;transition:color 0.2s ease}
.addr .address-text{cursor:pointer;transition:color 0.2s ease}
.addr .address-text:hover{color:var(--accent)}
.addr a:hover{color:var(--accent);text-decoration:underline}
.addr .copy{background:#1a1f2e;border:1px solid #3a4152;border-radius:6px;padding:4px 6px;cursor:pointer;color:#cfe9ff;transition:all 0.2s ease}
.addr .copy:hover{background:#2a3142;border-color:#4a5162;transform:scale(1.05)}

/* Адаптивные стили для мобильных устройств */
@media (max-width: 768px) {
  .addr {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .addr span {
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
  }
  
  .addr .copy {
    align-self: flex-end;
    font-size: 10px;
    padding: 3px 5px;
  }
  
  /* Показываем полный адрес при наведении на мобильных */
  .addr span:hover {
    color: var(--accent);
  }
}

@media (max-width: 480px) {
  .addr span {
    font-size: 11px;
  }
  
  .addr .copy {
    font-size: 9px;
    padding: 2px 4px;
  }
}

/* Адаптивные стили для таблицы на мобильных */
@media (max-width: 768px) {
  .table-wrapper {
    margin: 0 -12px;
    padding: 0 12px;
  }
  
  table {
    min-width: 600px; /* Минимальная ширина для читаемости */
    font-size: 12px;
  }
  
  thead th {
    padding: 8px 6px;
    font-size: 11px;
    white-space: nowrap;
  }
  
  tbody td {
    padding: 8px 6px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .table-wrapper {
    margin: 0 -8px;
    padding: 0 8px;
  }
  
  table {
    min-width: 500px;
    font-size: 11px;
  }
  
  thead th {
    padding: 6px 4px;
    font-size: 10px;
  }
  
  tbody td {
    padding: 6px 4px;
    font-size: 11px;
  }
}
.num{text-align:right;font-variant-numeric:tabular-nums}
.muted{color:var(--muted);text-align:center}
.error{color:#ff8a80;text-align:center}

/* USD badge styling */
.usd-badge {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
  font-weight: normal;
}
.pager{display:flex;gap:10px;align-items:center;justify-content:center;margin-top:12px}
footer{padding:16px 0;color:var(--muted);border-top:1px solid #1f2430}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(200px,1fr));
  gap: 16px;
  padding: 16px 0;
}
.stat-card {
  background: var(--card);
  padding: 16px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-title { color: var(--accent); font-size:14px; }
.stat-value { font-size: 20px; font-weight: 600; }
.stat-label { color: var(--muted); font-size: 12px; }
.bar {
  width: 100%; height: 6px; background:#0f1320; border-radius:4px; overflow:hidden;
}
.bar div {
  height:100%; background:var(--accent); width:0%;
  transition:width .5s ease;
}
/* Topbar */
.topbar{
  position: sticky; top:0; z-index: 50;
  background:rgba(12,14,20,.9); backdrop-filter: blur(6px);
  border-bottom:1px solid #1f2430;
}
.topbar .container{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 0;
}
.topbar-left{display:flex; gap:14px; align-items:center; flex-wrap:wrap}
.brand{font-weight:700; color:var(--fg); text-decoration:none; margin-right:6px}
.navlink{color:#a9b4c7; text-decoration:none; padding:6px 10px; border-radius:8px}
.navlink:hover{background:#151924; color:var(--fg)}
.navlink.active{background:#151924; color:#cfe9ff}
.topbar-right{display:flex; align-items:center; gap:10px}
.price-badge{background:#0f1320; border:1px solid #2b3346; border-radius:999px; padding:6px 10px; font-weight:600}



/* Distribution Table Styles */
.distribution-section {
  margin: 24px 0;
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #1f2430;
}

/* Top Addresses Section Styles */
.top-addresses-section {
  margin: 24px 0;
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #1f2430;
}

.top-addresses-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.top-addresses-section .section-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--fg);
}

.top-addresses-section .controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.top-addresses-section .controls label {
  color: var(--muted);
  font-size: 14px;
}

.top-addresses-section .controls select,
.top-addresses-section .controls button {
  background: #0f1320;
  color: var(--fg);
  border: 1px solid #242b3a;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

.top-addresses-section .controls button {
  cursor: pointer;
  transition: all 0.2s ease;
}

.top-addresses-section .controls button:hover {
  background: #1a1f2e;
  border-color: #3a4152;
}

/* Sortable table headers */
.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color 0.2s ease;
}

.sortable:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.sort-icon {
  font-size: 12px;
  margin-left: 4px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.sortable.sort-asc .sort-icon {
  opacity: 1;
  color: var(--accent);
}

.sortable.sort-desc .sort-icon {
  opacity: 1;
  color: var(--accent);
}

.sortable.sort-asc .sort-icon::after {
  content: " ↑";
}

.sortable.sort-desc .sort-icon::after {
  content: " ↓";
}

/* Balance change colors */
.positive {
  color: #10b981;
}

.negative {
  color: #ef4444;
}

/* Dash styling for no change */
.no-change {
  color: var(--muted);
}

/* Balance change background styling */
.balance-change-cell {
  position: relative;
}

.balance-change-cell .change-value {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 500;
  min-width: 80px;
  text-align: center;
}

.balance-change-cell.positive .change-value {
  background-color: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.balance-change-cell.negative .change-value {
  background-color: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.balance-change-cell.no-change .change-value {
  background-color: rgba(156, 163, 175, 0.1);
  border: 1px solid rgba(156, 163, 175, 0.2);
  color: var(--muted);
}

/* USD badge styling for balance change column */
.balance-change-cell .usd-badge {
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.8;
}

/* Distribution table delta backgrounds */
.distribution-table .delta-cell {
  position: relative;
}

.distribution-table .delta-cell .delta-value {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 500;
  min-width: 50px;
  text-align: center;
}

.distribution-table .delta-cell.delta-positive .delta-value {
  background-color: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.distribution-table .delta-cell.delta-negative .delta-value {
  background-color: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.distribution-table .delta-cell.delta-neutral .delta-value {
  background-color: rgba(156, 163, 175, 0.1);
  border: 1px solid rgba(156, 163, 175, 0.2);
  color: var(--muted);
}

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

.section-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--fg);
}

.last-updated {
  color: var(--muted);
  font-size: 12px;
}

.toggle-container {
  display: flex;
  align-items: center;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
}

.toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.distribution-table-container {
  overflow-x: auto;
}

.distribution-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.distribution-table th {
  background: #0f1320;
  color: var(--muted);
  font-weight: 600;
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid #1f2430;
  white-space: nowrap;
}

.distribution-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #1f2430;
  vertical-align: middle;
}

.distribution-table tbody tr:hover {
  background: rgba(102, 217, 239, 0.05);
}

.category-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.category-emoji {
  font-size: 16px;
}

.category-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-name {
  color: var(--fg);
  font-weight: 600;
}

.category-range {
  color: var(--muted);
  font-size: 11px;
}

.balance-range {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.count-cell {
  font-weight: 600;
  color: var(--fg);
  text-align: center;
}

.delta-cell {
  text-align: center;
  font-weight: 500;
  font-size: 12px;
}

.delta-positive {
  color: #3ecf8e;
}

.delta-negative {
  color: #ff8a80;
}

.delta-neutral {
  color: var(--muted);
}

.total-balance-cell {
  text-align: right;
  font-weight: 500;
}

.balance-amount {
  color: var(--fg);
  font-weight: 600;
}

.balance-usd {
  color: var(--muted);
  font-size: 11px;
  display: block;
  margin-top: 2px;
}

.percentage-cell {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .distribution-table th,
  .distribution-table td {
    padding: 8px 6px;
    font-size: 12px;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  .distribution-section {
    padding: 16px;
  }
  
  .distribution-table-container {
    font-size: 11px;
  }
}

/* Tags styling */
.tag {
  display:inline-block; padding:3px 8px; border-radius:999px;
  font-size:12px; background:#0f1320; border:1px solid #2b3346; color:#cfe9ff;
  white-space:nowrap;
}
.usd-badge {
  display:inline-block; margin-left:8px; padding:2px 6px; border-radius:6px;
  font-size:12px; color:var(--muted); background:#0f1320; border:1px solid #2b3346;
}

/* ===== Support Us Button ===== */
.support-btn {
  background: linear-gradient(135deg, #ff6b9d, #c44569);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: 16px;
  box-shadow: 0 2px 8px rgba(255, 107, 157, 0.3);
}

.support-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 107, 157, 0.4);
}

.support-btn:active {
  transform: translateY(0);
}

/* ===== Modal Styles ===== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--fg);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--border);
  color: var(--fg);
}

.modal-body {
  padding: 24px;
}

/* QR Code Section */
.qr-section {
  text-align: center;
  margin-bottom: 24px;
}

.qr-code {
  display: inline-block;
  padding: 16px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.qr-code img {
  display: block;
  border-radius: 8px;
}

/* Wallet Address Section */
.wallet-section {
  margin-bottom: 24px;
}

.wallet-address {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  word-break: break-all;
}

.wallet-address span {
  color: var(--fg);
  flex: 1;
}

.copy-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copy-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.copy-btn:active {
  transform: scale(0.95);
}

.copy-btn svg {
  width: 16px;
  height: 16px;
}

/* Description Section */
.description-section {
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 20px;
}

.description-section h4 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
}

.description-section p {
  margin: 0 0 16px 0;
  line-height: 1.6;
  color: var(--fg);
  font-size: 14px;
}

.description-section p:last-child {
  margin-bottom: 0;
}

.highlight {
  color: var(--accent);
  font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 20px;
  }
  
  .modal-header {
    padding: 20px 20px 16px;
  }
  
  .modal-body {
    padding: 20px;
  }
  
  .wallet-address {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .copy-btn {
    align-self: center;
  }
}


