:root {
  --bg: #0b0f17;
  --bg-elev: #111826;
  --bg-card: #151f32;
  --bg-subtle: #1b273d;
  --border: rgba(148, 163, 184, 0.18);
  --border-strong: rgba(245, 158, 11, 0.42);
  --text: #f1f5f9;
  --text-soft: #cbd5e1;
  --muted: #94a3b8;
  --gold: #f59e0b;
  --gold-bright: #fbbf24;
  --cyan: #2dd4bf;
  --sky: #38bdf8;
  --emerald: #34d399;
  --coral: #fb7185;
  --violet: #a78bfa;
  --serif: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 14% -4%, rgba(245, 158, 11, 0.09), transparent 65%),
    radial-gradient(960px 480px at 88% 2%, rgba(45, 212, 191, 0.08), transparent 65%),
    var(--bg);
  color: var(--text);
}

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

a:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(11, 15, 23, 0.88);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.48rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: 0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-bright), var(--cyan));
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.65);
}

.nav-links {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text-soft);
  font-size: 0.78rem;
  padding: 0.24rem 0.54rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 0.16s ease;
}

.nav-links a:hover {
  color: var(--gold-bright);
  border-color: var(--border-strong);
  background: rgba(245, 158, 11, 0.08);
  text-decoration: none;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.2rem 1.4rem 4.5rem;
}

.hero {
  padding: 1.6rem 0 2.4rem;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.77rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--cyan);
  background: rgba(45, 212, 191, 0.09);
  border: 1px solid rgba(45, 212, 191, 0.26);
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  margin-bottom: 0.95rem;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 3.8vw, 3.25rem);
  line-height: 1.15;
  margin: 0 0 0.85rem;
  letter-spacing: -0.015em;
  color: #fffbeb;
}

.hero-sub {
  max-width: 920px;
  font-size: 1.08rem;
  color: var(--text-soft);
  margin: 0 0 1.65rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 0.9rem;
}

.stat-card {
  background: linear-gradient(180deg, rgba(22, 32, 50, 0.92), rgba(17, 24, 38, 0.96));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.05rem;
}

.stat-kicker {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-val {
  font-family: var(--serif);
  font-size: 1.24rem;
  font-weight: 700;
  color: var(--gold-bright);
  margin: 0.25rem 0 0.3rem;
}

.stat-desc {
  font-size: 0.83rem;
  color: var(--text-soft);
  line-height: 1.45;
}

.section {
  scroll-margin-top: 76px;
  padding: 2.6rem 0 2.3rem;
  border-bottom: 1px solid var(--border);
}

.section-header {
  margin-bottom: 1.5rem;
}

.section-num {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--gold-bright);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

h2 {
  font-family: var(--serif);
  font-size: clamp(1.55rem, 2.5vw, 2.15rem);
  margin: 0.3rem 0 0.6rem;
  color: #fef3c7;
  line-height: 1.24;
}

.section-lead {
  color: var(--text-soft);
  max-width: 960px;
  margin: 0;
  font-size: 0.98rem;
}

.conjecture-banner {
  background: rgba(245, 158, 11, 0.07);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-left: 4px solid var(--gold);
  border-radius: 10px;
  padding: 0.95rem 1.15rem;
  margin-bottom: 1.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}

.formula {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: #fef3c7;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.24rem 0.62rem;
  border-radius: 999px;
  white-space: nowrap;
}

.pill-emerald {
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.38);
}

.pill-coral {
  color: #fecdd3;
  background: rgba(244, 63, 94, 0.17);
  border: 1px solid rgba(251, 113, 133, 0.42);
}

.pill-cyan {
  color: #99f6e4;
  background: rgba(45, 212, 191, 0.14);
  border: 1px solid rgba(45, 212, 191, 0.36);
}

.pill-gold {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.two-col {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 980px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
}

.panel h3 {
  font-family: var(--serif);
  font-size: 1.18rem;
  margin: 0 0 0.65rem;
  color: #f8fafc;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
  align-items: center;
}

button, select, input[type="text"], input[type="number"] {
  font-family: var(--sans);
  font-size: 0.83rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.42rem 0.74rem;
  cursor: pointer;
  transition: all 0.14s ease;
}

button:hover, select:hover {
  border-color: rgba(251, 191, 36, 0.55);
  background: var(--bg-subtle);
}

button.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--gold-bright);
  color: #fef3c7;
  font-weight: 600;
}

.copy-btn {
  font-family: var(--mono);
  font-size: 0.74rem;
  padding: 0.2rem 0.52rem;
  border-radius: 6px;
}

.svg-stage {
  width: 100%;
  background: radial-gradient(circle at 50% 45%, #152036, #0d1320);
  border: 1px solid var(--border);
  border-radius: 11px;
  display: block;
}

.canvas-stage {
  width: 100%;
  height: 440px;
  background: radial-gradient(circle at 50% 42%, #162238, #0b101b);
  border: 1px solid var(--border);
  border-radius: 11px;
  display: block;
  cursor: grab;
}

.canvas-stage:active {
  cursor: grabbing;
}

.scatter-stage {
  width: 100%;
  height: 390px;
  background: #0d1422;
  border: 1px solid var(--border);
  border-radius: 11px;
  display: block;
  cursor: crosshair;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 0.65rem;
  font-size: 0.79rem;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
}

.swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.inspector-bar {
  margin-top: 0.75rem;
  padding: 0.6rem 0.82rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.79rem;
  color: var(--text-soft);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0.6rem;
  margin: 0.8rem 0;
}

.metric-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.58rem 0.72rem;
}

.metric-box .k {
  font-family: var(--mono);
  font-size: 0.71rem;
  color: var(--muted);
}

.metric-box .v {
  font-family: var(--mono);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 0.15rem;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 0.7rem;
  margin: 0.9rem 0;
}

.score-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.72rem 0.85rem;
}

.score-card.violated {
  border-color: rgba(251, 113, 133, 0.55);
  background: rgba(244, 63, 94, 0.09);
}

.score-card.tight {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(16, 185, 129, 0.08);
}

.proof-card {
  background: linear-gradient(180deg, #131c2e, #0f1625);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem 1.35rem;
}

.proof-card h3 {
  font-family: var(--serif);
  color: #fde68a;
  margin-top: 0;
  margin-bottom: 0.65rem;
  font-size: 1.18rem;
}

.proof-card p, .proof-card li {
  font-size: 0.91rem;
  color: var(--text-soft);
}

.proof-card ul, .proof-card ol {
  padding-left: 1.25rem;
  margin: 0.55rem 0;
}

.proof-card li {
  margin-bottom: 0.48rem;
}

.math-block {
  font-family: var(--mono);
  font-size: 0.88rem;
  background: rgba(11, 15, 23, 0.72);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.68rem 0.9rem;
  margin: 0.65rem 0;
  color: #fef3c7;
  overflow-x: auto;
}

.g6-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: #0c121e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--cyan);
  overflow-x: auto;
  margin-top: 0.55rem;
}

.table-wrap {
  max-height: 330px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 0.75rem;
}

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

th, td {
  padding: 0.46rem 0.65rem;
  text-align: right;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  font-family: var(--mono);
}

th:first-child, td:first-child {
  text-align: left;
}

thead th {
  position: sticky;
  top: 0;
  background: #162135;
  color: var(--gold-bright);
  font-weight: 600;
  z-index: 2;
}

tr.highlight-row {
  background: rgba(245, 158, 11, 0.11);
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.82rem;
  color: var(--text-soft);
  margin: 0.55rem 0;
  flex-wrap: wrap;
}

input[type="range"] {
  accent-color: var(--gold);
  width: 165px;
}

.footer {
  padding-top: 2rem;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
