/* ── Reset & Root ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:       #040d1a;
  --surface:  #071629;
  --surface2: #0b2040;
  --border:   rgba(71,200,255,0.10);
  --accent:   #00c8ff;
  --accent2:  #7b61ff;
  --neon:     #00ffa3;
  --warning:  #ffb347;
  --danger:   #ff4d6d;
  --text:     #e0f0ff;
  --text2:    #6ea8c8;
  --text3:    #2e5a7a;
  --font:     'Inter', sans-serif;
  --mono:     'JetBrains Mono', 'Fira Code', monospace;
  --display:  'Space Grotesk', sans-serif;
  --radius:   14px;
}


html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: var(--font);
  background: linear-gradient(to bottom, #020c1e 0%, #0a1e46 18%, #143176 42%, #1e60a0 60%, #2a88c8 78%, #3ab0d8 100%) fixed;
  background-size: cover;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
* { max-width: 100%; }

/* ── Background ── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0,200,255,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(123,97,255,0.05) 0%, transparent 60%);
}

/* ── Nav ── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(4,13,26,0.92); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem; height: 58px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav-brand img { height: 28px; }
.nav-brand-text { font-family: var(--display); font-size: 1.1rem; font-weight: 700; color: var(--text); }
.nav-brand-text span { color: var(--accent); }
.nav-badge {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  background: rgba(0,200,255,0.1); color: var(--accent); border: 1px solid rgba(0,200,255,0.3);
  border-radius: 20px; padding: 2px 8px;
}
.nav-links { display: flex; gap: 0.25rem; align-items: center; }
.nav-links a {
  padding: 6px 14px; border-radius: 8px; font-size: 0.82rem; font-weight: 500;
  color: var(--text2); text-decoration: none; transition: all 0.2s; white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active { color: var(--accent); background: rgba(0,200,255,0.08); }
.nav-search {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 16px; color: var(--text); font-size: 0.82rem;
  outline: none; width: 220px; transition: border-color 0.2s; flex-shrink: 0;
}
.nav-search:focus { border-color: var(--accent); }

/* ── Hamburger ── */
.nav-hamburger {
  display: none; flex-direction: column; gap: 5px;
  background: transparent; border: none; cursor: pointer; padding: 6px; flex-shrink: 0;
}
.nav-hamburger span { display: block; width: 22px; height: 2px; background: var(--text2); border-radius: 2px; transition: all 0.3s; }

@media (max-width: 768px) {
  nav { padding: 0 1rem; position: relative; flex-wrap: wrap; height: auto; min-height: 54px; }
  .nav-search { display: none; }
  .nav-hamburger { display: flex; }
  .nav-links {
    display: none; flex-direction: column; align-items: flex-start; gap: 0;
    position: absolute; top: 54px; left: 0; right: 0; z-index: 200;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 0.5rem 0; box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 1.5rem; width: 100%; border-radius: 0; font-size: 0.9rem; }
}

/* ── Stats Hero ── */
.hero {
  padding: 2.5rem 2rem 1.5rem;
  max-width: 1400px; margin: 0 auto;
}
.hero-title {
  font-family: var(--display); font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--text3);
  margin-bottom: 1.25rem;
}
.stats-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px; background: var(--border); border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
}
.stat-cell {
  background: var(--surface); padding: 1.1rem 1.4rem;
  transition: background 0.2s;
}
.stat-cell:hover { background: var(--surface2); }
.stat-cell-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text3); margin-bottom: 0.35rem;
}
.stat-cell-value {
  font-family: var(--display); font-size: 1.35rem; font-weight: 700; color: var(--text);
}
.stat-cell-value.accent { color: var(--accent); }
.stat-cell-value.neon   { color: var(--neon); }
.stat-cell-sub { font-size: 0.72rem; color: var(--text3); margin-top: 0.2rem; }

/* ── Main layout ── */
.main { max-width: 1400px; margin: 0 auto; padding: 0 2rem 4rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ── Panel ── */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.panel-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-title {
  font-family: var(--display); font-size: 0.85rem; font-weight: 600;
  color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em;
}
.panel-action {
  font-size: 0.75rem; color: var(--accent); text-decoration: none;
  transition: opacity 0.2s;
}
.panel-action:hover { opacity: 0.7; }

/* ── Live dot ── */
.live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--neon); margin-right: 6px;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0,255,163,0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 5px rgba(0,255,163,0); }
}

/* ── Block table ── */
.block-table { width: 100%; }
.block-row {
  display: grid; grid-template-columns: 80px 2fr 1fr 80px 100px;
  align-items: center; padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(71,200,255,0.05);
  transition: background 0.15s; cursor: pointer; text-decoration: none;
  color: inherit;
}
.block-row:last-child { border-bottom: none; }
.block-row:hover { background: rgba(0,200,255,0.04); }
.block-row.new-block { animation: blockIn 0.6s ease-out; }
@keyframes blockIn {
  from { background: rgba(0,255,163,0.08); }
  to   { background: transparent; }
}
.block-height {
  font-family: var(--display); font-weight: 700; font-size: 0.95rem; color: var(--accent);
}
.block-hash {
  font-family: var(--mono); font-size: 0.72rem; color: var(--text2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.block-miner {
  font-family: var(--mono); font-size: 0.68rem; color: var(--text3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.block-time { font-size: 0.75rem; color: var(--text3); text-align: right; }
.block-txs {
  font-size: 0.78rem; color: var(--text2); text-align: center;
}
.tx-badge {
  display: inline-block; background: rgba(123,97,255,0.15); color: var(--accent2);
  border: 1px solid rgba(123,97,255,0.3); border-radius: 12px;
  padding: 2px 8px; font-size: 0.68rem; font-weight: 600;
}

/* Table headers */
.block-row-head {
  display: grid; grid-template-columns: 80px 2fr 1fr 80px 100px;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text3); font-weight: 600;
}

/* ── Chart ── */
.chart-wrap { padding: 1.25rem; overflow: hidden; }
canvas { width: 100% !important; max-width: 100%; }

/* ── Countdown arc pulse (overdue/pending state) ── */
.arc-pulse {
  animation: arcPulse 1.8s ease-in-out infinite;
  transform-origin: 60px 60px;
}
@keyframes arcPulse {
  0%, 100% { opacity: 1; filter: drop-shadow(0 0 4px #ffb347); }
  50%       { opacity: 0.5; filter: drop-shadow(0 0 12px #ffb347); }
}

/* ── Countdown spinner ── */
.countdown-calculating {
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  padding: 2rem 1rem;
}
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(0,200,255,0.15);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.calculating-text { font-size: 0.72rem; color: var(--text3); letter-spacing: 0.06em; text-transform: uppercase; }

/* ── Miner leaderboard ── */
.miner-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem 1.25rem; border-bottom: 1px solid rgba(71,200,255,0.05);
}
.miner-row:last-child { border-bottom: none; }
.miner-rank {
  font-family: var(--display); font-weight: 700; font-size: 1rem; color: var(--text3);
  width: 24px; flex-shrink: 0; text-align: center;
}
.miner-rank.gold   { color: #ffd700; }
.miner-rank.silver { color: #c0c0c0; }
.miner-rank.bronze { color: #cd7f32; }
.miner-addr {
  font-family: var(--mono); font-size: 0.72rem; color: var(--text2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.miner-bar-wrap { width: 80px; background: rgba(255,255,255,0.05); border-radius: 4px; height: 6px; flex-shrink: 0; }
.miner-bar { height: 6px; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.miner-count { font-size: 0.78rem; font-weight: 600; color: var(--text); flex-shrink: 0; width: 50px; text-align: right; }

/* ── Block detail ── */
.detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem; padding: 1.25rem;
}
.detail-field { }
.detail-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text3); margin-bottom: 0.3rem; }
.detail-value { font-family: var(--mono); font-size: 0.82rem; color: var(--text); word-break: break-all; }
.detail-value.accent { color: var(--accent); }
.detail-value.neon   { color: var(--neon); }
.detail-value.large  { font-family: var(--display); font-size: 1.5rem; font-weight: 700; }

/* Announcement / tx row */
.ann-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.65rem 1.25rem; border-bottom: 1px solid rgba(71,200,255,0.05);
  font-family: var(--mono); font-size: 0.72rem;
}
.ann-row:last-child { border-bottom: none; }
.ann-idx { color: var(--text3); width: 28px; flex-shrink: 0; }
.ann-hash { color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ann-type { flex-shrink: 0; }
.badge {
  display: inline-block; border-radius: 12px; padding: 2px 10px;
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
}
.badge-coinbase { background: rgba(0,255,163,0.1); color: var(--neon); border: 1px solid rgba(0,255,163,0.3); }
.badge-tx       { background: rgba(123,97,255,0.1); color: var(--accent2); border: 1px solid rgba(123,97,255,0.3); }

/* ── Privacy section ── */
.privacy-banner {
  margin: 1.5rem 0;
  background: transparent;
  border: none;
  padding: 1.5rem;
  display: flex; align-items: flex-start; gap: 1.25rem;
  text-align: center; justify-content: center;
}
.privacy-icon { display: none; }
.privacy-title { font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: #fff; margin-bottom: 0.6rem; }
.privacy-text { font-size: 0.9rem; color: #000; line-height: 1.7; }
.privacy-text a { color: #fff !important; }

/* ── Pagination ── */
.pagination { display: flex; gap: 0.5rem; justify-content: center; padding: 1.5rem; }
.page-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text2);
  border-radius: 8px; padding: 6px 14px; font-size: 0.8rem; cursor: pointer; transition: all 0.2s;
}
.page-btn:hover, .page-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(0,200,255,0.08); }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Loading skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Countdown ring ── */
.countdown-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; gap: 0.5rem; }
.countdown-ring { position: relative; width: 120px; height: 120px; }
.countdown-ring svg { transform: rotate(-90deg); }
.countdown-ring circle { transition: stroke-dashoffset 1s linear; }
.countdown-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.countdown-label { font-size: 0.72rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border); padding: 2rem;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  max-width: 1400px; margin: 0 auto; font-size: 0.78rem; color: var(--text3);
}
footer a { color: var(--text3); text-decoration: none; }
footer a:hover { color: var(--accent); }
.footer-logos { display: flex; align-items: center; gap: 1rem; }
.footer-logos img { opacity: 0.5; }
.footer-logos img:hover { opacity: 0.8; }

/* ── Utility ── */
.mt1 { margin-top: 1rem; }
.mt2 { margin-top: 1.5rem; }
.section-spacer { height: 1.5rem; }
.text-mono { font-family: var(--mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag {
  display: inline-block; background: rgba(0,200,255,0.08); color: var(--accent);
  border: 1px solid rgba(0,200,255,0.2); border-radius: 20px;
  padding: 2px 10px; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em;
}

@media (max-width: 640px) {
  .hero { padding: 1.5rem 1rem 1rem; }
  .main { padding: 0 1rem 3rem; }
  nav { padding: 0 1rem; }
  .block-row, .block-row-head { grid-template-columns: 70px 1fr 70px; }
  .block-row > *:nth-child(3), .block-row-head > *:nth-child(3) { display: none; }
  .block-row > *:nth-child(4), .block-row-head > *:nth-child(4) { display: none; }
}

/* ══════════════════════════════════════════
   COLOUR OVERRIDES — dark mode only
   (Light mode vars already handle their own)
   ══════════════════════════════════════════ */

/* ── Stat strip ──
   First cell (Block Height) = white bg, dark text
   All other cells            = cyan bg, dark text  */
.stat-cell {
  background: #00a8d8;
}
.stat-cell:first-child {
  background: #ffffff;
}
.stat-cell-label {
  color: rgba(0, 20, 60, 0.65);
}
.stat-cell-value {
  color: #0b1e46;
}
.stat-cell-value.accent { color: #0b1e46; }
.stat-cell-value.neon   { color: #0b5c3a; }
.stat-cell-sub { color: rgba(0,20,60,0.55); }

/* ── All panels = navy blue ── */
.panel {
  background: #143176;
  border-color: rgba(0,168,216,0.2);
}
.panel-header {
  border-bottom-color: rgba(255,255,255,0.1);
}
.panel-title { color: #fff; }
.panel-action { color: #00a8d8; }

/* ── Block table (Latest Blocks) ── */
.block-row {
  border-bottom-color: rgba(255,255,255,0.07);
  color: #fff;
}
.block-row:hover { background: rgba(0,168,216,0.1); }
.block-height { color: #00a8d8; }
.block-hash   { color: rgba(255,255,255,0.85); }
.block-miner  { color: rgba(255,255,255,0.75); }
.block-time   { color: rgba(255,255,255,0.7); }
.block-txs    { color: rgba(255,255,255,0.85); }
.block-row-head {
  color: rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.15);
  border-bottom-color: rgba(255,255,255,0.1);
}

/* Age pill = cyan bg, white text */
.tx-badge {
  background: #00a8d8;
  color: #fff;
  border-color: #00a8d8;
}

/* ── Miner leaderboard ── */
.miner-rank  { color: rgba(255,255,255,0.5); }
.miner-rank.gold   { color: #ffd700; }
.miner-rank.silver { color: #c0c0c0; }
.miner-rank.bronze { color: #cd7f32; }
.miner-addr  { color: rgba(255,255,255,0.8); }
.miner-count { color: #fff; }
.miner-bar-wrap { background: rgba(255,255,255,0.1); }
.miner-row { border-bottom-color: rgba(255,255,255,0.07); }

/* ── Countdown / Next Block ── */
.countdown-num   { color: #00a8d8; }
.countdown-label { color: rgba(255,255,255,0.6); }


/* ── Chart grid lines & labels — keep readable ── */
.chart-wrap { background: transparent; }

/* ── Miners page: percentage sub-text ── */
.miner-row small { color: rgba(255,255,255,0.5) !important; }
.miner-count small { color: rgba(255,255,255,0.5) !important; }

/* ── Leaderboard rank numbers make cyan ── */
.miner-rank { color: #00a8d8 !important; font-weight: 700; }
.miner-rank.gold   { color: #ffd700 !important; }
.miner-rank.silver { color: #c0c0c0 !important; }
.miner-rank.bronze { color: #cd7f32 !important; }

/* ── Pagination on blocks page ── */
.page-btn {
  background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.15); color: rgba(255,255,255,0.75);
}
.page-btn:hover,
.page-btn.active { background: #00a8d8; border-color: #00a8d8; color: #fff; }

/* ── Footer on explorer pages ── */
footer { border-top-color: rgba(255,255,255,0.1); color: rgba(255,255,255,0.45); }
footer a { color: rgba(255,255,255,0.45); }
footer a:hover { color: #fff; }

/* ── NPT Price: navy blue (not green) ── */
.stat-cell-value.neon { color: #0b1e46 !important; }

/* ── Miner bar gradient: cyan → dark navy ── */
.miner-bar {
  background: linear-gradient(90deg, #00a8d8, #0b1e46) !important;
}

/* ── Nav links: WHITE on all explorer pages ── */
/* moved to dark-mode scope below */
.nav-links a:hover, .nav-links a.active { color: #00a8d8 !important; background: rgba(0,168,216,0.1) !important; }
.nav-badge { background: rgba(0,168,216,0.15); color: #00a8d8; border-color: rgba(0,168,216,0.35); }
/* moved to dark-mode scope below */


/* ── Block time bar chart hover: cyan bg, black text ── */
.chartjs-tooltip {
  background: #00a8d8 !important;
  color: #000 !important;
}

/* ── Rank #1 in top miners: cyan ── */
.miner-rank:first-child,
.miner-rank.gold { color: #00a8d8 !important; }


/* ── CORRECTED: Nav white text — DARK MODE ONLY ── */
.nav-links a { color: #fff !important; }
.nav-links a:hover,
.nav-links a.active { color: #00a8d8 !important; background: rgba(0,168,216,0.1) !important; }
.nav-brand-text { color: #fff !important; }

/* ── Light mode nav: RESTORE navy blue text ── */

/* ── MOBILE: prevent Latest Blocks & Top Miners overflow ── */
@media (max-width: 640px) {
  /* Clip panel contents */
  .panel { overflow: hidden; max-width: 100%; }

  /* Block row: show only height + truncated hash + age */
  .block-row {
    grid-template-columns: 60px 1fr 52px;
    gap: 0.4rem;
    padding: 0.65rem 0.75rem;
  }
  .block-row-head {
    grid-template-columns: 60px 1fr 52px;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
  }
  .block-hash { font-size: 0.65rem; }

  /* Miner rows: constrain to panel width */
  .miner-row {
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    overflow: hidden;
  }
  .miner-addr { font-size: 0.65rem; min-width: 0; }
  .miner-bar-wrap { width: 50px; flex-shrink: 0; }
  .miner-count { width: auto; font-size: 0.75rem; }

  /* Prevent any child from blowing out the container */
  .block-row > *, .miner-row > * { min-width: 0; }
}
