:root {
  --bg: #08050a;
  --surface: rgba(18, 12, 24, 0.65);
  --surface-hover: rgba(24, 18, 32, 0.8);
  --text: #fffbf5;
  --text-secondary: #9a8b7a;
  --grid: rgba(255, 251, 245, 0.06);
  --accent: #ff7b00;
  --accent-dim: rgba(255, 123, 0, 0.12);
  --accent-glow: rgba(255, 123, 0, 0.25);
  --radius: 10px;
}

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

html, body {
  height: 100%;
}

body {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 0.875rem;
  overflow-x: hidden;
}

/* WebGL canvas behind everything */
#gl {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Header ─────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2.5rem;
  background: rgba(8, 5, 10, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--grid);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.crown {
  font-size: 1.5rem;
  color: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.brand h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.version {
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 0.95rem;
}

.header-note {
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Notice ─────────────────────────────────────── */
.site-notice {
  position: relative;
  z-index: 10;
  max-width: none;
  margin: 0 auto;
  padding: 0.6rem 2.5rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-align: center;
  white-space: nowrap;
}

/* ── Layout ─────────────────────────────────────── */
.container {
  position: relative;
  z-index: 10;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* ── Hero ───────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 2.5rem;
  align-items: center;
}

.hero-text h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  color: var(--text);
}

.hero-text p {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.75;
}

.hero-viz {
  width: 100%;
  aspect-ratio: 21 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--grid);
}

.hero-viz canvas {
  width: 100%;
  height: 100%;
  display: block;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 251, 245, 0.1);
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* ── Basescan Card ──────────────────────────────── */
.basescan-card {
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.basescan-card h3 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.basescan-card .hint {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.65;
  margin-bottom: 0.75rem;
}

.basescan-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.basescan-card li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.5;
}

.basescan-card li::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  transform: translateY(-2px);
}

.basescan-card a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.basescan-card a:hover {
  text-decoration: underline;
}

.basescan-card code {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  font-size: 0.78rem;
}

/* ── King Card ──────────────────────────────────── */
.king-card {
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.king-card h3 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.king-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.king-empty {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.king-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.king-address {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
}

.king-meta {
  margin-left: auto;
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ── History Table ──────────────────────────────── */
.history-section h3,
.rules-section h3 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

thead {
  border-bottom: 1px solid var(--grid);
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

td {
  padding: 0.65rem 1rem;
  color: var(--text);
  border-bottom: 1px solid var(--grid);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: var(--surface-hover);
}

.empty-row td {
  color: var(--text-secondary);
  text-align: center;
  padding: 2rem;
}

.current-king-row {
  background: var(--accent-dim);
}

.current-king-row td {
  border-bottom-color: var(--accent-glow);
}

.king-dot {
  color: var(--accent);
  margin-right: 0.4rem;
}

/* ── Rules ──────────────────────────────────────── */
.rules-section {
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.rules-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.rules-section li {
  position: relative;
  padding-left: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.65;
}

.rules-section li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.rules-section strong {
  color: var(--text);
  font-weight: 600;
}

/* ── Footer ─────────────────────────────────────── */
.site-footer {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.7rem;
  border-top: 1px solid var(--grid);
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-viz {
    aspect-ratio: 16 / 9;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .site-header {
    padding: 1rem 1.25rem;
  }

  .container {
    padding: 1.5rem 1.25rem 3rem;
    gap: 1.75rem;
  }

  .hero-text h2 {
    font-size: 1.25rem;
  }
}

@media (max-width: 520px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-value {
    font-size: 1rem;
  }
}