:root{
  --brand-blue-top:#0d1433;
  --brand-blue-mid:#11254a;
  --brand-blue-bottom:#06162f;

  --header-blue-top:#0b102e;
  --header-blue-bottom:#071f3d;

  --gold:#ffc62a;
  --gold-soft:#ffd76a;

  --text-main:#f4f6fb;
  --text-muted:rgba(215,224,246,0.78);

  --tile-top:rgba(18,34,70,0.96);
  --tile-bottom:rgba(6,18,46,0.96);

  --tile-border:rgba(255,255,255,0.30);
  --highlight-top:rgba(255,255,255,0.06);
  --highlight-inner:rgba(255,255,255,0.04);

  --shadow-soft:0 4px 12px rgba(0,0,0,0.45);
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:
    radial-gradient(circle at 50% -10%, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 40%),
    linear-gradient(180deg,
      var(--brand-blue-top) 0%,
      var(--brand-blue-mid) 45%,
      var(--brand-blue-bottom) 100%
    );
  color:var(--text-main);
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

header{
  padding:16px 24px;
  border-bottom:1px solid rgba(255,255,255,0.10);
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:linear-gradient(
    180deg,
    rgba(11,16,46,0.82) 0%,
    rgba(7,23,61,0.70) 100%
  );
  position:sticky;
  top:0;
  z-index:10;
  flex-wrap:wrap;
  gap:15px;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){
  header,.card,.site-footer{
    backdrop-filter:blur(14px);
    -webkit-backdrop-filter:blur(14px);
  }
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  flex:1;
  min-width:340px;
}
.brand-link{
  display:flex;
  align-items:center;
  gap:12px;
  text-decoration:none;
  color:inherit;
}
.brand-logo{
  height:52px;
  width:auto;
}
.brand-text{
  display:flex;
  flex-direction:column;
}
header h1{
  margin:0;
  font-size:1.25rem;
  font-weight:600;
  letter-spacing:.10em;
  text-transform:uppercase;
  color:#ffffff;
}
header .subtitle{
  font-size:.80rem;
  color:var(--text-muted);
}

.header-actions{
  display:flex;
  align-items:center;
  gap:20px;
  margin-left:auto;
}

.nav-button{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 20px;
  border-radius:999px;
  font-size:.9rem;
  font-weight:600;
  border:none;
  text-decoration:none;
  cursor:pointer;
  background:radial-gradient(circle at 30% 30%, #ffe47e 0%, var(--gold) 40%, #ffb31a 100%);
  color:#111321;
  box-shadow:0 10px 18px rgba(0,0,0,0.42);
  transition:transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.nav-button i{ font-size:.95rem; }
.nav-button:hover{
  transform:translateY(-1px);
  filter:brightness(1.05);
  box-shadow:0 14px 24px rgba(0,0,0,0.55);
  color:#1a1d27;
  text-shadow:none;
}

#reload-indicator{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:4px;
  font-size:.75rem;
  color:var(--text-muted);
}
.reload-bar{
  width:180px;
  height:8px;
  background:rgba(0,0,0,0.60);
  border-radius:999px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,0.18);
}
.reload-bar-fill{
  height:100%;
  width:0%;
  background:linear-gradient(90deg,#ffe47e,var(--gold-soft),#ffb31a);
  transition:width .15s linear;
}
.online-counter{
  text-align:right;
  font-size:.8rem;
  color:var(--text-muted);
  margin-top:4px;
}

main{
  padding:16px;
  max-width:1400px;
  margin:0 auto;
  width:100%;
  flex:1;
}

.grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:16px;
  margin-bottom:16px;
}
.charts-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(320px,1fr));
  gap:16px;
  margin-bottom:16px;
}

.card{
  position:relative;
  background:linear-gradient(
    180deg,
    var(--tile-top) 0%,
    var(--tile-bottom) 100%
  );
  border-radius:18px;
  padding:16px 18px;
  border:1px solid var(--tile-border);
  box-shadow:var(--shadow-soft);
}

.card::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:18px;
  pointer-events:none;
  background:linear-gradient(
    180deg,
    var(--highlight-top) 0%,
    rgba(255,255,255,0) 40%
  );
}
.card::after{
  content:"";
  position:absolute;
  inset:1px;
  border-radius:17px;
  pointer-events:none;
  border:1px solid var(--highlight-inner);
}

.card h2{
  margin:0 0 8px 0;
  font-size:.95rem;
  letter-spacing:.12em;
  color:var(--gold-soft);
}

.kpi-row{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:baseline;
}
.kpi-col{ flex:1; }

.kpi-label-title{
  font-size:.75rem;
  text-transform:uppercase;
  letter-spacing:.09em;
  color:var(--text-muted);
  margin-bottom:2px;
}
.kpi-value{
  color:var(--gold);
  font-size:1.5rem;
  font-weight:600;
  text-shadow:0 0 8px rgba(0,0,0,0.4);
  white-space:nowrap;
}
.kpi-subvalue{
  font-size:.9rem;
  color:var(--text-muted);
}
.kpi-text{
  font-size:.8rem;
  color:var(--text-muted);
  overflow-wrap:anywhere;
  word-break:normal;
}
.muted{
  color:var(--text-muted);
  font-size:.8rem;
}

.chart-container{
  position:relative;
  height:260px;
}
.chart-container canvas{ filter:none; }

#map{
  width:100%;
  height:380px;
  border-radius:14px;
  border:1px solid var(--tile-border);
  background:transparent;
}
.leaflet-container{ background:transparent !important; }

.legend-card{ margin-top:18px !important; }

a{
  color:var(--gold-soft);
  text-decoration:none;
}

#latest-block-height a,
#mempool-tx a{
  color:var(--gold);
  text-decoration:underline;
  text-underline-offset:2px;
  text-decoration-thickness:1px;
}
#latest-block-height a:hover,
#mempool-tx a:hover{
  text-decoration-thickness:2px;
}

.logo-halo{
  animation:haloPulse 2s ease-in-out infinite;
  border-radius:999px;
}
@keyframes haloPulse{
  0%{filter:drop-shadow(0 0 4px var(--gold));}
  50%{filter:drop-shadow(0 0 18px rgba(255,198,42,0.7));}
  100%{filter:drop-shadow(0 0 4px var(--gold));}
}

.site-footer{
  background:linear-gradient(
    180deg,
    rgba(4,8,20,0.98) 0%,
    rgba(3,6,14,0.98) 100%
  );
  border-top:1px solid rgba(255,255,255,0.14);
  padding:22px 24px 18px;
  margin-top:40px;
}
.footer-content{
  max-width:1400px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:12px;
}
.footer-powered{
  font-size:.85rem;
  color:var(--text-muted);
}

@supports selector(::-webkit-scrollbar){
  ::-webkit-scrollbar{ width:8px; height:8px; }
  ::-webkit-scrollbar-track{ background:transparent; }
  ::-webkit-scrollbar-thumb{
    background:rgba(255,255,255,0.40);
    border-radius:999px;
    border:2px solid #050814;
  }
  ::-webkit-scrollbar-thumb:hover{ background:rgba(255,255,255,0.60); }
}

*{
  scrollbar-width:thin;
  scrollbar-color: rgba(255,255,255,0.40) transparent;
}

@media (max-width:768px){
  .brand{ min-width:0; }
  .brand-logo{ height:38px; }
  header h1{ white-space:normal; }
  header .subtitle{ white-space:normal; }
}
@media (max-width:700px){
  header{
    flex-direction:column;
    align-items:stretch;
  }
  .header-actions{
    justify-content:space-between;
    width:100%;
  }
}

#latest-block-meta{ margin-top:8px; }
#latest-block-height{ display:inline-block; margin-bottom:3px; }

#map:focus{ outline:none; }
#map:focus-visible{ outline:none; }
