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

:root {
  --bg:       #000000;
  --bg2:      #080808;
  --card:     #0A0A0A;
  --border:   #7B2FBE;
  --gold:     #E8A020;
  --gold2:    #C4841A;
  --purple:   #8B40C0;
  --purple2:  #6B2FA0;
  --green:    #39FF6E;
  --green2:   #28DD58;
  --teal:     #1AC8C8;
  --red:      #FF5C5C;
  --text:     #E8EDF5;
  --muted:    #5A7A9A;
  --radius:   14px;
  --radius-sm: 8px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { opacity: 0.85; }

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  height: 64px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  background: rgba(7,13,26,0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 100;
}

.header-inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
}

.logo-text { font-size: 17px; font-weight: 800; color: var(--gold); letter-spacing: -0.3px; }
.logo-sub  { font-size: 11px; color: var(--muted); display: none; }

@media (min-width: 480px) { .logo-sub { display: inline; } }

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-loading { background: rgba(90,122,154,0.2); color: var(--muted); }
.badge-online  { background: rgba(57,255,110,0.15); color: var(--green); }
.badge-offline { background: rgba(255,92,92,0.15);  color: var(--red); }

.btn-docs {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.btn-docs:hover { background: rgba(255,255,255,0.1); }

.btn-cta {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple), var(--purple2));
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(139,64,192,0.4);
}
.btn-cta:hover { opacity: 0.9; }

/* ── Main ──────────────────────────────────────────────────────────────────── */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Stats grid ──────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px)  { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: border-color 0.2s, transform 0.15s;
  cursor: default;
}
.stat-card:hover { border-color: #A855F7; transform: translateY(-1px); }
.stat-card.gold   { border-color: rgba(232,160,32,0.25); }
.stat-card.purple { border-color: rgba(139,64,192,0.25); }
.stat-card.green  { border-color: rgba(57,255,110,0.2); }

.stat-icon { font-size: 22px; flex-shrink: 0; line-height: 1; }
.stat-body { min-width: 0; }

.stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 768px) { .stat-value { font-size: 22px; } }

.stat-card.gold   .stat-value { color: var(--gold); }
.stat-card.purple .stat-value { color: #A855F7; }
.stat-card.green  .stat-value { color: var(--green); }

.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
  white-space: nowrap;
}

/* ── Bottom grid ──────────────────────────────────────────────────────────── */
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 900px) { .bottom-grid { grid-template-columns: 3fr 2fr; } }

/* ── Panels ──────────────────────────────────────────────────────────────── */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.updated-at { font-size: 11px; font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: 0; }

/* Chart */
.chart-wrap { padding: 1.25rem; height: 240px; }
@media (min-width: 768px) { .chart-wrap { height: 280px; } }

/* Trades */
.trades-list { max-height: 340px; overflow-y: auto; }
.trades-list::-webkit-scrollbar { width: 4px; }
.trades-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.trade-row {
  display: grid;
  grid-template-columns: 48px 1fr 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 13px;
  border-bottom: 1px solid rgba(26,45,69,0.6);
  transition: background 0.15s;
}
.trade-row:hover { background: rgba(255,255,255,0.02); }
.trade-row.placeholder { color: var(--muted); grid-template-columns: 1fr; }

/* Extended trade row — show wallet/time on wider screens */
.trade-row { grid-template-columns: 48px minmax(60px,1fr) 1fr; }
@media (min-width: 640px)  { .trade-row { grid-template-columns: 48px 80px 1fr 100px; } }
@media (min-width: 900px)  { .trade-row { grid-template-columns: 48px 80px 1fr 110px 65px; } }

.trade-wallet { display: none; }
.trade-time   { display: none; }
@media (min-width: 640px) { .trade-wallet { display: inline; } }
@media (min-width: 900px) { .trade-time   { display: inline; } }

.trade-type {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 5px;
  text-align: center;
  letter-spacing: 0.03em;
}
.trade-type.buy  { background: rgba(57,255,110,0.15); color: var(--green); }
.trade-type.sell { background: rgba(255,92,92,0.15);  color: var(--red); }
.trade-token   { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-amount  { color: var(--gold); font-weight: 600; }
.trade-wallet  { color: var(--muted); font-family: monospace; font-size: 11px; }
.trade-time    { color: var(--muted); font-size: 11px; text-align: right; }

/* ── System status ───────────────────────────────────────────────────────── */
.system-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
}
@media (min-width: 640px)  { .system-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .system-grid { grid-template-columns: repeat(6, 1fr); } }

.sys-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 1rem 1.25rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.sys-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; }
.sys-val   { font-size: 13px; font-weight: 700; color: var(--text); }
.sys-ok    { color: var(--green); }
.sys-err   { color: var(--red); }
.sys-gold  { color: var(--gold); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.footer-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 0.75rem;
}
.footer-logo img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  object-fit: cover;
}
.footer-logo span { font-weight: 700; color: var(--gold); font-size: 15px; }

.footer-project {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.footer-project a { color: var(--purple); }
.footer-project a:hover { color: #A855F7; }

.footer-links {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--gold); }
