:root {
  --bg: #070b14;
  --bg2: #0b1120;
  --panel: rgba(15, 22, 41, 0.82);
  --panel-solid: #0e1526;
  --border: rgba(120, 150, 220, 0.14);
  --border-strong: rgba(120, 150, 220, 0.28);
  --text: #e6ecff;
  --muted: #7d8bb3;
  --dim: #4a5678;
  --accent: #22d3ee;
  --accent2: #a78bfa;
  --green: #34d399;
  --btc: #f7931a;
  --eth: #627eea;
  --tron: #ff4757;
  --radius: 14px;
  --glow: 0 0 24px rgba(34, 211, 238, 0.18);
}

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

html { scrollbar-color: #26324f #0a0f1c; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1000px 600px at 75% -10%, rgba(34, 211, 238, 0.08), transparent 60%),
    radial-gradient(900px 600px at 10% 0%, rgba(167, 139, 250, 0.08), transparent 55%),
    linear-gradient(180deg, var(--bg2), var(--bg) 45%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 26px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(11, 17, 32, 0.9), rgba(11, 17, 32, 0.55));
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

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

.logo {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  color: var(--accent);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(167, 139, 250, 0.16));
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--glow);
}

.brand-text h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.25;
}

.brand-text h1 span {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  margin-left: 6px;
}

.brand-text p {
  font-size: 10px;
  letter-spacing: 2.2px;
  color: var(--dim);
  margin-top: 2px;
}

.topbar-right { display: flex; align-items: center; gap: 18px; }

.live-status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--green);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 6px 12px; border-radius: 999px;
}

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

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  55% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
}

.clock {
  font-family: "SF Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 15px; color: var(--accent);
  letter-spacing: 1px;
}

/* ---------- stats ---------- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 18px 26px 6px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute; inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  opacity: 0.7;
}

.stat-label {
  font-size: 12px; color: var(--muted);
  letter-spacing: 1px;
  white-space: nowrap;
}

.stat-value {
  font-family: "SF Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 22px; font-weight: 700;
  color: var(--text);
  text-shadow: 0 0 18px rgba(34, 211, 238, 0.25);
}

.stat-unit { font-size: 11px; color: var(--dim); }

/* ---------- filter bar ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 28px;
  padding: 14px 26px;
}

.filter-group { display: flex; align-items: center; gap: 10px; }

.filter-title { font-size: 12px; color: var(--muted); letter-spacing: 1px; white-space: nowrap; }

.segmented {
  display: inline-flex;
  background: rgba(15, 22, 41, 0.9);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  border: 0; background: transparent; cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.2s;
  font-family: inherit;
}

.seg-btn:hover { color: var(--text); background: rgba(120, 150, 220, 0.1); }

.seg-btn.active {
  color: #04101a;
  background: linear-gradient(135deg, var(--accent), #67e8f9);
  font-weight: 600;
}

.seg-btn.btc.active { background: var(--btc); color: #141003; }
.seg-btn.eth.active { background: var(--eth); color: #f4f7ff; }
.seg-btn.tron.active { background: var(--tron); color: #fff; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 200px; height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.6);
}

input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
}

.threshold-value {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px; color: var(--accent);
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.25);
  padding: 4px 10px; border-radius: 8px;
  white-space: nowrap;
}

/* ---------- dashboard ---------- */
.dashboard {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 16px;
  padding: 10px 26px 20px;
  min-height: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  font-size: 15px; font-weight: 600;
  letter-spacing: 0.5px;
}

.panel-head h2 small { font-size: 11px; color: var(--dim); font-weight: 400; margin-left: 8px; }

.legend { display: flex; gap: 14px; }

.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.btc { background: var(--btc); box-shadow: 0 0 8px var(--btc); }
.dot.eth { background: var(--eth); box-shadow: 0 0 8px var(--eth); }
.dot.tron { background: var(--tron); box-shadow: 0 0 8px var(--tron); }

/* map */
.map-wrap { position: relative; flex: 1; min-height: 420px; }

#mapCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.map-corner {
  position: absolute; right: 14px; bottom: 12px;
  font-size: 11px; color: var(--dim);
  background: rgba(7, 11, 20, 0.6);
  border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 8px;
}

/* feed */
.feed-panel { max-height: calc(100vh - 320px); }

.feed-count {
  font-size: 12px; color: var(--muted);
  font-family: "SF Mono", Consolas, monospace;
}

.tx-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: #26324f transparent;
}

.tx-list::-webkit-scrollbar { width: 6px; }
.tx-list::-webkit-scrollbar-thumb { background: #26324f; border-radius: 4px; }

.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  animation: slideIn 0.35s ease both;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

.tx-item:hover { background: rgba(34, 211, 238, 0.06); border-color: var(--border-strong); }

.tx-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  flex-shrink: 0;
}

.tx-icon.btc { background: rgba(247, 147, 26, 0.14); color: var(--btc); border: 1px solid rgba(247, 147, 26, 0.35); }
.tx-icon.eth { background: rgba(98, 126, 234, 0.14); color: var(--eth); border: 1px solid rgba(98, 126, 234, 0.35); }
.tx-icon.tron { background: rgba(255, 71, 87, 0.14); color: var(--tron); border: 1px solid rgba(255, 71, 87, 0.35); }

.tx-body { flex: 1; min-width: 0; }

.tx-addrs {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px; color: var(--text);
  display: flex; align-items: center; gap: 6px;
  overflow: hidden; white-space: nowrap;
}

.tx-addrs .arrow { color: var(--dim); flex-shrink: 0; }

.tx-meta { display: flex; align-items: center; gap: 10px; margin-top: 5px; font-size: 11px; color: var(--dim); }

.chain-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 6px;
  letter-spacing: 0.5px;
}

.chain-badge.btc { background: rgba(247, 147, 26, 0.16); color: var(--btc); }
.chain-badge.eth { background: rgba(98, 126, 234, 0.16); color: var(--eth); }
.chain-badge.tron { background: rgba(255, 71, 87, 0.16); color: var(--tron); }

.tx-right { text-align: right; flex-shrink: 0; }

.tx-amount {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 14.5px; font-weight: 700;
}

.tx-amount em { font-style: normal; font-size: 10px; font-weight: 600; color: var(--muted); margin-left: 2px; }

.tx-usd { font-size: 11px; color: var(--muted); margin-top: 3px; font-family: "SF Mono", Consolas, monospace; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 7, 14, 0.72);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-backdrop.hidden { display: none; }

.modal {
  width: min(520px, 100%);
  background: linear-gradient(180deg, #101a30, #0b1120);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(34, 211, 238, 0.12);
  padding: 24px;
  position: relative;
  animation: modalIn 0.28s ease both;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: rgba(120, 150, 220, 0.1);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px; height: 32px; border-radius: 10px;
  font-size: 18px; line-height: 1; cursor: pointer;
  transition: all 0.2s;
}

.modal-close:hover { color: #fff; background: rgba(255, 71, 87, 0.25); border-color: var(--tron); }

.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

.modal-head h3 { font-size: 17px; }

.modal-status {
  margin-left: auto; margin-right: 40px;
  font-size: 11px; color: var(--green);
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 3px 9px; border-radius: 999px;
}

.modal-amount {
  display: flex; align-items: baseline; gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(34, 211, 238, 0.06);
  border: 1px solid rgba(34, 211, 238, 0.2);
  margin-bottom: 18px;
}

.ma-big { font-family: "SF Mono", Consolas, monospace; font-size: 26px; font-weight: 700; }
.ma-usd { font-size: 13px; color: var(--muted); font-family: "SF Mono", Consolas, monospace; }

.modal-grid {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px 14px;
  font-size: 13px;
}

.modal-grid dt { color: var(--dim); }

.modal-grid dd {
  font-family: "SF Mono", Consolas, monospace;
  word-break: break-all;
  color: var(--text);
  line-height: 1.5;
}

.modal-note { margin-top: 18px; font-size: 11px; color: var(--dim); }

/* ---------- footer ---------- */
.footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  padding: 12px 26px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--dim);
}

.footer-note { color: var(--dim); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .dashboard { grid-template-columns: 1fr; }
  .feed-panel { max-height: 460px; }
  .map-wrap { min-height: 360px; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; padding: 12px 16px; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .stats-bar, .filter-bar, .dashboard { padding-left: 14px; padding-right: 14px; }
  .stats-bar { grid-template-columns: 1fr 1fr; }
  input[type="range"] { width: 130px; }
  .brand-text h1 { font-size: 16px; }
  .modal { padding: 18px; }
}
