/* ===========================================================
   WATCH OOZE — wargames / phosphor-CRT aesthetic
   single panel + flat table + corner brackets
   =========================================================== */

:root {
  --bg: #000000;
  --line: #0a2010;
  --line-strong: #154820;

  --fg: #b8e8c4;
  --fg-dim: #4a8a5a;
  --fg-mute: #2a4a32;

  --phos: #00ff41;
  --phos-soft: #00b830;
  --phos-glow: rgba(0, 255, 65, 0.55);
  --phos-glow-mid: rgba(0, 255, 65, 0.25);
  --phos-glow-soft: rgba(0, 255, 65, 0.08);

  --err: #ff4444;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: 'VT323', var(--mono);

  --maxw: 1320px;
  --panel-bg: rgba(0, 8, 4, 0.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

code { font-family: var(--mono); }

/* ----- world map background ----- */

.map-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.map-svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 130%;
  height: 130%;
  min-width: 1400px;
  /* Source SVG has black fills/strokes on transparent background.
     Recipe: invert (black -> white), then sepia + hue-rotate to tint
     toward phosphor green, saturate to crank vibrancy, brightness +
     drop-shadow for the CRT bloom.  */
  opacity: 0.42;
  filter:
    invert(1)
    sepia(1)
    saturate(600)
    hue-rotate(59deg)
    brightness(1.45)
    drop-shadow(0 0 8px rgb(15, 255, 2));
  animation: map-pulse 6s ease-in-out infinite;
}

@keyframes map-pulse {
  0%, 100% { opacity: 0.40; }
  50% { opacity: 0.50; }
}

.map-scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 48%,
    var(--phos-glow-soft) 50%,
    transparent 52%,
    transparent 100%
  );
  background-size: 100% 220px;
  animation: scan-sweep 9s linear infinite;
  mix-blend-mode: screen;
}

@keyframes scan-sweep {
  0% { background-position: 0 -100%; }
  100% { background-position: 0 100%; }
}

/* ----- scanlines / vignette / grain ----- */

.scanlines {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1000;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.16) 2px,
    rgba(0, 0, 0, 0.16) 3px
  );
}

.vignette {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 998;
  background: radial-gradient(
    ellipse at center,
    transparent 0%,
    transparent 50%,
    rgba(0, 0, 0, 0.55) 100%
  );
}

.grain {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 999;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.7'/></svg>");
  mix-blend-mode: overlay;
}

/* ----- topbar ----- */

.topbar {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
}

.logo {
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: 5px;
  color: var(--phos);
  text-decoration: none;
  text-shadow:
    0 0 4px var(--phos-glow),
    0 0 12px var(--phos-glow-mid),
    0 0 28px var(--phos-glow-soft);
  flex-shrink: 0;
}

.topbar nav { display: flex; gap: 22px; align-items: center; }

.topbar nav a {
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  font-weight: 500;
  transition: color 0.15s, text-shadow 0.15s;
}
.topbar nav a:hover {
  color: var(--phos);
  text-shadow: 0 0 6px var(--phos-glow-mid);
}
.topbar nav a.active {
  color: var(--phos);
  text-shadow: 0 0 6px var(--phos-glow), 0 0 16px var(--phos-glow-mid);
}

/* ----- main ----- */

main {
  position: relative;
  z-index: 2;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 28px 80px;
}

/* ----- status strip ----- */

.status-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--line-strong);
  border: 1px solid var(--line-strong);
  margin-bottom: 28px;
  overflow: hidden;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.6);
  animation: fade-up 0.6s ease both;
}
.strip-stat {
  background: rgba(0, 0, 0, 0.78);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.strip-label {
  color: var(--fg-mute);
  font-size: 9.5px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}
.strip-value {
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: 1.5px;
  color: var(--phos);
  text-shadow:
    0 0 3px var(--phos),
    0 0 8px var(--phos-glow),
    0 0 18px var(--phos-glow-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
}

/* ----- panel ----- */

.panel {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--line-strong);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(0, 0, 0, 0.7),
    inset 0 0 80px rgba(0, 0, 0, 0.4);
  animation: fade-up 0.6s 0.15s ease both;
}

/* corner brackets */
.panel-corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid var(--phos);
  box-shadow: 0 0 6px var(--phos-glow-mid);
}
.corner-tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.corner-tr { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.corner-bl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.corner-br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* panel header */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-strong);
  flex-wrap: wrap;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  font-weight: 700;
}

/* sync light */
.sync-light {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--phos);
  box-shadow:
    0 0 4px var(--phos),
    0 0 12px var(--phos-glow),
    0 0 24px var(--phos-glow-mid);
  animation: sync-pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
.sync-light.err {
  background: var(--err);
  box-shadow: 0 0 6px var(--err), 0 0 16px rgba(255, 68, 68, 0.5);
  animation: sync-pulse 1.4s ease-in-out infinite;
}
@keyframes sync-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.7); }
}

.sync-label {
  color: var(--phos);
  text-shadow: 0 0 6px var(--phos-glow);
  font-weight: 700;
}
.sync-label.err {
  color: var(--err);
  text-shadow: 0 0 6px rgba(255, 68, 68, 0.5);
}

.panel-divider {
  color: var(--phos-soft);
  font-weight: 400;
  opacity: 0.6;
}

.panel-name {
  color: var(--fg);
}

.panel-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--fg-dim);
  font-weight: 500;
}
.panel-meta .dim { color: var(--fg-mute); margin-right: 4px; }
.panel-meta .meta-sep { color: var(--fg-mute); opacity: 0.5; }

/* table */
.panel-table-wrap {
  overflow-x: auto;
}

.panel-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12.5px;
  min-width: 920px;
}

.panel-table thead th {
  text-align: left;
  padding: 12px 14px;
  font-size: 9.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--fg-mute);
  border-bottom: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}
.panel-table thead th.col-stake,
.panel-table thead th.col-subsidy,
.panel-table thead th.col-votes,
.panel-table thead th.col-uptime,
.panel-table thead th.col-epoch,
.panel-table thead th.col-nonce {
  text-align: right;
}

.panel-table tbody td {
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
.panel-table tbody tr:last-child td {
  border-bottom: none;
}

.panel-table tbody tr.row-other td {
  color: var(--fg-dim);
}
.panel-table tbody tr.row-other:hover td {
  color: var(--fg);
  background: rgba(0, 255, 65, 0.025);
}

.panel-table tbody tr.row-ours td {
  color: var(--phos);
  background: rgba(0, 255, 65, 0.045);
  text-shadow: 0 0 4px var(--phos-glow-mid);
  position: relative;
}
.panel-table tbody tr.row-ours td:first-child {
  box-shadow: inset 3px 0 0 var(--phos);
}

.cell-validator { display: flex; align-items: center; gap: 10px; }
.cell-pubkey {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
}
.row-ours .cell-pubkey {
  font-weight: 700;
}
.tag {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  color: var(--fg-mute);
  font-weight: 700;
  flex-shrink: 0;
}
.tag.tag-ours {
  border-color: var(--phos);
  color: var(--phos);
  background: rgba(0, 255, 65, 0.1);
  text-shadow: 0 0 4px var(--phos-glow);
  box-shadow: 0 0 10px var(--phos-glow-soft);
}

.col-uptime, .col-stake, .col-votes, .col-subsidy, .col-epoch, .col-nonce {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cell-num {
  font-family: var(--mono);
  font-weight: 500;
}
.row-ours .cell-num {
  font-weight: 700;
}
.cell-num-strong {
  color: var(--phos);
  text-shadow: 0 0 4px var(--phos-glow-mid);
}

.cell-sub {
  font-size: 9.5px;
  color: var(--fg-mute);
  letter-spacing: 0.6px;
  margin-top: 2px;
  text-transform: uppercase;
  font-weight: 500;
}

.empty-row td {
  padding: 28px 14px;
  text-align: center;
  color: var(--fg-mute);
  letter-spacing: 2px;
}

/* ----- footer ----- */

.page-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 24px 28px 56px;
  color: var(--fg-mute);
  font-size: 10.5px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}
.page-footer .sep { margin: 0 10px; opacity: 0.5; }
.page-footer a { color: var(--fg-dim); text-decoration: none; }
.page-footer a:hover { color: var(--phos); text-shadow: 0 0 4px var(--phos-glow-mid); }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 720px) {
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .topbar nav { gap: 14px; flex-wrap: wrap; width: 100%; justify-content: flex-start; }
  .topbar nav a { font-size: 10px; letter-spacing: 1.2px; }
  main { padding: 24px 16px 60px; }
  .panel-head { padding: 12px 14px; }
  .strip-value { font-size: 24px; }
}

@media (max-width: 560px) {
  .panel-meta { font-size: 9.5px; }
  .strip-stat { padding: 12px 14px; }
}