:root {
  color-scheme: dark;
  --bg: #07090d;
  --bg-soft: #0c111a;
  --panel: #101722;
  --panel-strong: #151f2d;
  --line: rgba(255, 215, 0, 0.16);
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f6f1dd;
  --muted: #aeb6c5;
  --muted-strong: #d8dfeb;
  --gold: #ffd700;
  --gold-soft: #ffe066;
  --green: #78f2b8;
  --blue: #77b7ff;
  --red: #ff8b8b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 28% -12%, rgba(255, 215, 0, 0.16), transparent 30rem),
    linear-gradient(180deg, #09101a 0%, var(--bg) 36rem);
  color: var(--text);
}

a {
  color: inherit;
}

.noscript {
  max-width: 680px;
  margin: 6rem auto;
  padding: 2rem;
}

.site-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.25rem;
  border-right: 1px solid var(--line-soft);
  background: rgba(7, 9, 13, 0.78);
  backdrop-filter: blur(18px);
}

.brand,
.mobile-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.brand img,
.mobile-brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.22);
}

.side-nav {
  display: grid;
  gap: 0.25rem;
  margin-top: 2rem;
}

.nav-link {
  display: block;
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 650;
  text-decoration: none;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 215, 0, 0.11);
  color: var(--gold-soft);
}

.nav-link:hover {
  transform: translateX(2px);
}

.page-shell {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0.85rem 2rem;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(7, 9, 13, 0.76);
  backdrop-filter: blur(18px);
}

.mobile-brand {
  display: none;
}

.mobile-nav {
  display: none;
}

.topbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid rgba(255, 215, 0, 0.5);
  border-radius: var(--radius);
  padding: 0 1rem;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #151200;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(255, 215, 0, 0.18);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 900px);
  width: min(980px, calc(100% - 4rem));
  margin: 0 auto;
  padding: 3.5rem 0 5rem;
}

.article {
  min-width: 0;
}

.article-header {
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line-soft);
}

.hero-logo {
  width: min(210px, 62vw);
  height: auto;
  display: block;
  margin-bottom: 1.75rem;
  filter: drop-shadow(0 18px 40px rgba(255, 215, 0, 0.12));
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  color: var(--text);
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(2.25rem, 4vw, 4.8rem);
  line-height: 0.98;
}

.description {
  max-width: 680px;
  margin: 1rem 0 0;
  color: var(--muted-strong);
  font-size: 1.1rem;
  line-height: 1.7;
}

.doc-content {
  color: var(--muted-strong);
  font-size: 1rem;
  line-height: 1.75;
}

.doc-content h2 {
  margin: 2.7rem 0 0.9rem;
  font-size: 1.6rem;
  line-height: 1.2;
}

.doc-content h3 {
  margin: 2rem 0 0.75rem;
  font-size: 1.12rem;
  line-height: 1.3;
}

.doc-content p {
  margin: 1rem 0;
}

.doc-content ul,
.doc-content ol {
  padding-left: 1.25rem;
}

.doc-content li {
  margin: 0.35rem 0;
}

.doc-content strong {
  color: var(--text);
}

.doc-content code {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 0.12rem 0.35rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--gold-soft);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

.doc-content pre {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1rem;
  background: #090d13;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.doc-content pre code {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.table-frame {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  margin: 1.1rem 0 1.6rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
  vertical-align: top;
}

.doc-content table {
  display: inline-table;
  width: auto;
  max-width: none;
  margin: 0;
  border-spacing: 0;
  border-collapse: separate;
  background: transparent;
}

.doc-content thead {
  background: rgba(255, 215, 0, 0.09);
}

.doc-content th,
.doc-content td {
  min-width: 0;
  max-width: min(32rem, 70vw);
  padding: 0.78rem 0.9rem;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
}

.doc-content th {
  color: var(--text);
  font-size: 0.83rem;
  font-weight: 850;
}

.doc-content tr:last-child td {
  border-bottom: 0;
}

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

.doc-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.2rem 0.8rem;
  min-height: 116px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.018));
  color: var(--muted-strong);
  text-decoration: none;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.doc-card:hover {
  border-color: rgba(255, 215, 0, 0.38);
  background: rgba(255, 215, 0, 0.07);
  transform: translateY(-2px);
}

.doc-card strong {
  color: var(--text);
  font-size: 1rem;
}

.doc-card span:last-child {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.card-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 215, 0, 0.24);
  border-radius: 8px;
  background: rgba(255, 215, 0, 0.1);
  color: var(--gold-soft);
  font-size: 0.72rem;
  font-weight: 900;
}

.flow-diagram,
.fee-flow,
.chart-panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  margin: 1.25rem 0 1.6rem;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.018));
  box-shadow: var(--shadow);
}

.flow-diagram {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto
    minmax(0, 1fr) auto minmax(0, 1.3fr);
  align-items: center;
  gap: 0.7rem;
}

.protocol-flow {
  grid-template-columns:
    minmax(120px, 1fr) auto minmax(120px, 1fr) auto minmax(130px, 1fr) auto
    minmax(155px, 1fr) auto minmax(165px, 1fr) auto minmax(155px, 1fr) auto
    minmax(130px, 1fr) auto minmax(190px, 1.2fr);
  overflow-x: auto;
}

.flow-node,
.fee-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  border: 1px solid rgba(255, 215, 0, 0.18);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: rgba(255, 215, 0, 0.07);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 760;
  text-align: center;
}

.flow-arrow {
  position: relative;
  height: 2px;
  min-width: 24px;
  background: rgba(255, 215, 0, 0.55);
}

.flow-arrow::after {
  position: absolute;
  top: 50%;
  right: -2px;
  width: 8px;
  height: 8px;
  border-top: 2px solid rgba(255, 215, 0, 0.72);
  border-right: 2px solid rgba(255, 215, 0, 0.72);
  content: "";
  transform: translateY(-50%) rotate(45deg);
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding-left: 0 !important;
  list-style: none;
}

.pill-list li {
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 215, 0, 0.07);
  color: var(--text);
  font-size: 0.92rem;
}

.callout {
  border: 1px solid rgba(255, 215, 0, 0.24);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  margin: 1.4rem 0;
  padding: 1rem 1.1rem;
  background: rgba(255, 215, 0, 0.08);
}

.callout p {
  margin-bottom: 0;
}

.chart-heading {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.chart-heading span {
  color: var(--muted);
  font-size: 0.9rem;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(11, minmax(36px, 1fr));
  gap: 0.55rem;
  align-items: end;
  min-height: 280px;
  overflow-x: auto;
  padding: 1rem 0.25rem 0;
}

.bar-item {
  display: grid;
  grid-template-rows: 1fr auto auto;
  justify-items: center;
  height: 240px;
  min-width: 42px;
}

.bar-fill {
  align-self: end;
  width: 100%;
  height: var(--height);
  min-height: 4px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--gold-soft), var(--green));
  box-shadow: 0 8px 20px rgba(120, 242, 184, 0.16);
}

.bar-value {
  margin-top: 0.45rem;
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 800;
}

.bar-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.pie-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: center;
}

.pot-pie {
  width: min(240px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--panel) 0 40%, transparent 41%),
    conic-gradient(
      var(--gold) 0 90%,
      var(--green) 90% 95%,
      var(--blue) 95% 98%,
      var(--red) 98% 100%
    );
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 18px 45px rgba(0, 0, 0, 0.28);
}

.pie-legend {
  display: grid;
  gap: 0.65rem;
}

.pie-legend div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  background: rgba(255, 255, 255, 0.035);
}

.pie-legend strong {
  color: var(--text);
  font-size: 0.92rem;
}

.pie-legend em {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 800;
}

.legend-swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
}

.legend-swatch.winner {
  background: var(--gold);
}

.legend-swatch.collateral {
  background: var(--green);
}

.legend-swatch.leagues {
  background: var(--blue);
}

.legend-swatch.protocol {
  background: var(--red);
}

.line-chart {
  width: 100%;
  height: auto;
  min-height: 260px;
}

.axis,
.grid-line {
  fill: none;
  stroke-width: 1.5;
}

.axis {
  stroke: rgba(255, 255, 255, 0.26);
}

.grid-line {
  stroke: rgba(255, 255, 255, 0.08);
}

.winner-line,
.loser-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.winner-line {
  stroke: var(--gold);
}

.loser-line {
  stroke: var(--green);
}

.winner-dot {
  fill: var(--gold);
}

.loser-dot {
  fill: var(--green);
}

.chart-tick,
.chart-labels text,
.legend text {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.fee-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.8rem;
}

.fee-branches {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.fee-card.muted {
  background: rgba(120, 242, 184, 0.07);
  border-color: rgba(120, 242, 184, 0.18);
}

.split-bar {
  display: grid;
  grid-template-columns: 90fr 5fr 3fr 2fr;
  min-height: 64px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  margin: 1rem 0 1.5rem;
  background: var(--panel);
}

.split-bar span {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 0.55rem;
  color: #09101a;
  font-size: 0.74rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.split-bar em {
  font-style: normal;
}

.split-collateral em,
.split-leagues em,
.split-protocol em {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.split-winner {
  background: var(--gold);
}

.split-collateral {
  background: var(--green);
}

.split-leagues {
  background: var(--blue);
}

.split-protocol {
  background: var(--red);
}

@media (max-width: 1100px) {
  .site-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .mobile-brand {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .mobile-nav {
    display: flex;
    flex: 1 1 auto;
    gap: 0.3rem;
    overflow-x: auto;
    padding: 0.1rem;
  }

  .mobile-nav .nav-link {
    flex: 0 0 auto;
    padding: 0.5rem 0.65rem;
    white-space: nowrap;
  }

  .content-grid {
    grid-template-columns: minmax(0, 1fr);
    width: min(860px, calc(100% - 2rem));
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-wrap: wrap;
    gap: 0.7rem;
    padding: 0.8rem 1rem;
  }

  .mobile-nav {
    order: 3;
    flex-basis: 100%;
  }

  .content-grid {
    padding: 2rem 0 4rem;
  }

  h1 {
    font-size: 2.35rem;
  }

  .description {
    font-size: 1rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .flow-diagram,
  .fee-flow {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .flow-arrow {
    width: 2px;
    height: 26px;
    margin: 0 auto;
  }

  .flow-arrow::after {
    top: auto;
    right: 50%;
    bottom: -2px;
    transform: translateX(50%) rotate(135deg);
  }

  .split-bar {
    grid-template-columns: 1fr;
  }

  .pie-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .pie-legend {
    width: 100%;
  }
}
