:root {
  --bg: #07090f;
  --bg2: #0d1020;
  --bg3: #111827;
  --bg4: #0c1428;
  --gold: #c9a84c;
  --gold-dim: #8a6e2e;
  --gold-glow: rgba(201, 168, 76, 0.12);
  --text: #ddd9cc;
  --text-dim: #a39d8f;
  --text-muted: #666257;
  --border: rgba(201, 168, 76, 0.18);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --red: #cc6655;
  --teal: #2ab8a0;
  --blue: #3d8bcd;
  --green: #5aaa72;
  --purple: #8b6fba;
  --amber: #d4900a;
  --gray: #7c7a72;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Outfit", sans-serif;
  --mono: "JetBrains Mono", monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(61, 139, 205, 0.08), transparent 28%),
    radial-gradient(circle at top left, rgba(42, 184, 160, 0.06), transparent 24%),
    linear-gradient(180deg, #06080d 0%, #090d18 38%, #06080d 100%);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.75;
  overflow-x: hidden;
}

a {
  color: inherit;
}

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 56px;
  padding: 0 2.2rem;
  background: rgba(7, 9, 15, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

nav .logo {
  color: var(--gold);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.18rem;
  letter-spacing: 0.08em;
}

nav .links {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}

nav .links a {
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

nav .links a:hover,
nav .links a.active-link {
  color: var(--gold);
}

nav .right-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
}

nav .lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.16rem;
  padding: 0.15rem;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}

nav .lang-toggle a {
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
}

nav .lang-toggle a.active {
  color: var(--gold);
  background: rgba(201, 168, 76, 0.12);
}

nav .status-pill {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  text-transform: uppercase;
}

nav .menu-toggle {
  display: none;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

#hero {
  position: relative;
  padding: 7.6rem 2rem 3.2rem;
}

#hero::before {
  content: "";
  position: absolute;
  inset: 4.5rem 2rem 0;
  border: 1px solid rgba(201, 168, 76, 0.06);
  border-radius: 28px;
  pointer-events: none;
}

.hero-shell {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 2rem;
  align-items: start;
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.35rem;
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(3rem, 7vw, 5.1rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.hero-title em {
  color: var(--gold);
  font-style: italic;
}

.hero-subtitle {
  max-width: 42rem;
  margin-top: 1.25rem;
  color: var(--text-dim);
  font-size: 1.12rem;
}

.hero-lead {
  max-width: 43rem;
  margin-top: 1.6rem;
  color: var(--text);
  font-size: 1rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1.8rem;
}

.hero-actions a,
.hero-actions button,
.action-row button {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.72rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.69rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.hero-actions a.primary,
.hero-actions button.primary,
.action-row button.primary {
  color: var(--gold);
  border-color: rgba(201, 168, 76, 0.32);
  background: rgba(201, 168, 76, 0.08);
}

.hero-actions a:hover,
.hero-actions button:hover,
.action-row button:hover {
  border-color: rgba(201, 168, 76, 0.38);
  transform: translateY(-1px);
}

.hero-side {
  display: grid;
  gap: 1rem;
}

.hero-card {
  background: linear-gradient(180deg, rgba(13, 16, 32, 0.98), rgba(10, 13, 23, 0.98));
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 1.35rem;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.25);
}

.hero-card .kicker,
.panel-header,
.section-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.hero-card h3 {
  margin-top: 0.55rem;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
}

.hero-card p {
  margin-top: 0.7rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 0.9rem;
}

.hero-stat {
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.hero-stat .n {
  display: block;
  font-family: var(--serif);
  font-size: 2rem;
  color: var(--gold);
  line-height: 1;
}

.hero-stat .l {
  display: block;
  margin-top: 0.3rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

hr.div {
  border: 0;
  height: 1px;
  margin: 0 2rem;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.08) 10%, rgba(255, 255, 255, 0.08) 90%, transparent 100%);
}

.section {
  max-width: 1240px;
  margin: 0 auto;
  padding: 4.8rem 2rem;
}

.section-title {
  margin-top: 0.6rem;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.45rem);
  font-weight: 400;
  line-height: 1.02;
}

.section-title em {
  color: var(--gold);
  font-style: italic;
}

.section-intro {
  max-width: 52rem;
  margin-top: 1.2rem;
  color: var(--text-dim);
  font-size: 0.98rem;
}

.overview-grid,
.gates-grid,
.pivot-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.registry-layout,
.lab-layout {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 1rem;
  margin-top: 2rem;
}

.visual-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 1rem;
  margin-top: 1rem;
}

.visual-grid .panel.large-panel {
  min-height: 420px;
}

.visual-grid .panel {
  min-height: 310px;
}

.panel {
  background: linear-gradient(180deg, rgba(13, 16, 32, 0.98), rgba(9, 12, 22, 0.98));
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 1.25rem;
  min-width: 0;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--gold);
}

.panel-header .muted {
  color: var(--text-muted);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
}

.panel-copy {
  margin-top: 0.7rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.overview-card,
.gate-card,
.report-card,
.pivot-card {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.overview-card h3,
.gate-card h3,
.pivot-card h3 {
  font-family: var(--serif);
  font-size: 1.24rem;
  font-weight: 400;
}

.overview-card p,
.gate-card p,
.pivot-card p,
.report-body {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.meta-row,
.mini-stats,
.status-row,
.chip-row,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip,
.badge,
.metric-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.22rem 0.56rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chip {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-chip {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.badge.gray {
  color: var(--gray);
  background: rgba(124, 122, 114, 0.12);
  border: 1px solid rgba(124, 122, 114, 0.22);
}

.badge.blue {
  color: var(--blue);
  background: rgba(61, 139, 205, 0.12);
  border: 1px solid rgba(61, 139, 205, 0.22);
}

.badge.green {
  color: var(--green);
  background: rgba(90, 170, 114, 0.12);
  border: 1px solid rgba(90, 170, 114, 0.22);
}

.badge.amber {
  color: var(--amber);
  background: rgba(212, 144, 10, 0.12);
  border: 1px solid rgba(212, 144, 10, 0.22);
}

.badge.red {
  color: var(--red);
  background: rgba(204, 102, 85, 0.12);
  border: 1px solid rgba(204, 102, 85, 0.22);
}

.badge.purple {
  color: var(--purple);
  background: rgba(139, 111, 186, 0.12);
  border: 1px solid rgba(139, 111, 186, 0.22);
}

.badge.teal {
  color: var(--teal);
  background: rgba(42, 184, 160, 0.12);
  border: 1px solid rgba(42, 184, 160, 0.22);
}

.scoreboard-wrap,
.constraint-wrap,
.report-wrap {
  margin-top: 1rem;
  width: 100%;
  max-width: 100%;
}

.scoreboard-table {
  width: 100%;
  border-collapse: collapse;
}

.scoreboard-table th,
.scoreboard-table td {
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}

.scoreboard-table th {
  text-align: left;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.scoreboard-table td {
  color: var(--text-dim);
  font-size: 0.84rem;
}

.scoreboard-table td strong {
  display: block;
  color: var(--text);
  font-weight: 500;
}

.scoreboard-table td small {
  display: block;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.constraint-item,
.report-item,
.selection-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.constraint-item + .constraint-item,
.report-item + .report-item {
  margin-top: 0.7rem;
}

.bundle-metrics {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.bundle-metrics-title {
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bundle-metrics-copy {
  margin-top: 0.45rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.bundle-metrics-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.metric-chip--neutral {
  border-color: rgba(201, 168, 76, 0.22);
  background: rgba(201, 168, 76, 0.08);
}

.metric-chip--success {
  color: #d9f6ea;
  border-color: rgba(42, 184, 160, 0.35);
  background: rgba(42, 184, 160, 0.14);
}

.metric-chip--success strong {
  color: #7ee0c4;
}

.metric-chip--warning {
  color: #efe6c7;
  border-color: rgba(201, 168, 76, 0.36);
  background: rgba(201, 168, 76, 0.16);
}

.metric-chip--warning strong {
  color: #dcb964;
}

.metric-chip--danger {
  color: #f7dddd;
  border-color: rgba(212, 97, 104, 0.34);
  background: rgba(212, 97, 104, 0.15);
}

.metric-chip--danger strong {
  color: #ee8c92;
}

.constraint-item h4,
.report-item h4,
.selection-card h4 {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 400;
}

.constraint-item p,
.report-item p,
.selection-card p {
  margin-top: 0.45rem;
  color: var(--text-dim);
  font-size: 0.84rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  padding: 0.7rem 0.82rem;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font: inherit;
}

.field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 4px;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.82rem;
  min-height: 45px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.02);
}

.inline-check span {
  color: var(--text);
  font-size: 0.9rem;
}

.field small {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.compile-stack {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.compile-card {
  border-radius: 14px;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.compile-card.success {
  border-color: rgba(90, 170, 114, 0.22);
  background: rgba(90, 170, 114, 0.05);
}

.compile-card.fail {
  border-color: rgba(204, 102, 85, 0.24);
  background: rgba(204, 102, 85, 0.05);
}

.compile-card.warn {
  border-color: rgba(212, 144, 10, 0.24);
  background: rgba(212, 144, 10, 0.05);
}

.compile-card h4 {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 400;
}

.compile-card p,
.compile-card li {
  color: var(--text-dim);
  font-size: 0.84rem;
}

.compile-card ul {
  margin-top: 0.5rem;
  padding-left: 1.1rem;
}

.selection-grid {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
}

.metric-box {
  border-radius: 12px;
  padding: 0.8rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.metric-box .label {
  display: block;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.metric-box .value {
  display: block;
  margin-top: 0.35rem;
  color: var(--text);
  font-size: 1.25rem;
}

.metric-box .sub {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.chart-shell {
  margin-top: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
  overflow: hidden;
}

.chart-shell svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-caption {
  padding: 0.8rem 0.95rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  font-size: 0.82rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.7rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.gate-card {
  min-height: 100%;
}

.gate-card .decision-line {
  margin-top: 0.35rem;
  color: var(--text);
  font-size: 0.9rem;
}

.gate-card ul,
.pivot-card ul,
.report-card ul {
  padding-left: 1.1rem;
  margin-top: 0.6rem;
}

.gate-card li,
.pivot-card li,
.report-card li {
  color: var(--text-dim);
  font-size: 0.83rem;
  margin-top: 0.25rem;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.86rem;
}

footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2.8rem 2rem 3.2rem;
  text-align: center;
}

footer .foot-phi {
  display: block;
  margin-bottom: 0.8rem;
  font-family: var(--serif);
  font-size: 2.6rem;
  color: var(--gold);
  font-style: italic;
  opacity: 0.3;
}

footer p {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.8;
}

footer a {
  text-decoration: none;
  border-bottom: 1px dotted rgba(122, 118, 104, 0.42);
}

footer a:hover {
  color: var(--gold);
  border-bottom-color: rgba(201, 168, 76, 0.45);
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .hero-shell,
  .registry-layout,
  .lab-layout,
  .visual-grid,
  .overview-grid,
  .gates-grid,
  .pivot-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  nav {
    height: auto;
    min-height: 56px;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 0.7rem 1rem;
  }

  nav .menu-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  nav .links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.45rem 0 0.2rem;
  }

  nav.open .links {
    display: flex;
  }

  nav .right-tools {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }

  #hero {
    padding: 6.8rem 1.3rem 2.6rem;
  }

  #hero::before {
    inset: 4rem 1.3rem 0;
  }

  hr.div {
    margin: 0 1.3rem;
  }

  .section {
    padding: 4rem 1.3rem;
  }
}

@media (max-width: 640px) {
  .hero-stats,
  .metric-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 2.7rem;
  }

  .hero-subtitle,
  .hero-lead,
  .section-intro {
    font-size: 0.94rem;
  }

  .panel,
  .hero-card {
    padding: 1rem;
  }

  .scoreboard-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .scoreboard-table {
    min-width: 720px;
  }

  footer {
    padding-left: 1.2rem;
    padding-right: 1.2rem;
  }
}
