:root {
  color-scheme: dark;
  --ink: #f4f7fb;
  --muted: #9aa6b8;
  --line: #29313d;
  --paper: #080a0d;
  --panel: #12161d;
  --panel-soft: #171d26;
  --panel-lift: #1d2530;
  --cyan: #2fc7d3;
  --green: #39d08f;
  --amber: #f4b64b;
  --coral: #ff7c66;
  --shadow: 0 18px 56px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.net-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100vw;
  height: 100vh;
  opacity: 0.15;
  pointer-events: none;
}

button,
select {
  font: inherit;
}

a {
  color: inherit;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 48px);
  border: 1px solid rgba(244, 247, 251, 0.1);
  border-bottom: 1px solid rgba(244, 247, 251, 0.1);
  border-radius: 0;
  background: rgba(8, 10, 13, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 0;
  box-shadow: none;
}

.brand span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.brand strong {
  font-size: 1rem;
}

.brand small,
.label,
.eyebrow {
  color: var(--muted);
  font-size: 0.76rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
  gap: 8px;
}

.nav a {
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.nav a:hover,
.nav a:focus-visible {
  background: var(--panel-lift);
  color: var(--ink);
}

main {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, 1440px);
  margin: 0 auto;
  gap: 28px;
  padding: 104px clamp(14px, 4vw, 48px) 96px;
}

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  justify-items: center;
  gap: 3px;
  min-height: 58px;
  padding: 10px 16px;
  border: 1px solid rgba(244, 247, 251, 0.1);
  border-radius: 0;
  background: rgba(8, 10, 13, 0.88);
  box-shadow: 0 -14px 42px rgba(0, 0, 0, 0.32);
  color: var(--muted);
  text-align: center;
  backdrop-filter: blur(18px);
}

.site-footer span {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
}

.site-footer .site-version {
  color: var(--ink);
  font-size: 0.82rem;
}

.leaderboard-shell {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.page-title {
  max-width: 980px;
}

.eyebrow {
  margin: 0 0 8px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

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

h1 {
  max-width: 920px;
  margin-bottom: 10px;
  font-size: clamp(2.1rem, 6vw, 5.2rem);
  line-height: 0.98;
  white-space: nowrap;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
}

.lede {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.status-strip {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.status-strip div {
  display: grid;
  min-width: 0;
  min-height: 82px;
  gap: 6px;
  padding: 16px;
  background: linear-gradient(180deg, var(--panel-lift), var(--panel));
}

.status-strip strong {
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

strong {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.toolbar {
  display: grid;
  min-width: 0;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 22, 29, 0.94);
}

.tabs,
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  min-width: 0;
  gap: 8px;
}

.tab,
.command,
.link-button,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
}

.tab,
.command,
.link-button {
  cursor: pointer;
  padding: 0 14px;
}

.tab.active,
.command {
  border-color: transparent;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  color: #061012;
  font-weight: 800;
}

.filters label {
  display: grid;
  min-width: min(100%, 180px);
  gap: 5px;
  color: var(--muted);
  font-size: 0.8rem;
}

.filters label:first-child {
  min-width: min(100%, 260px);
}

select {
  width: 100%;
  min-width: 0;
  padding: 0 12px;
}

input[type="search"] {
  width: 100%;
  min-height: 40px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
}

input[type="search"]::placeholder {
  color: var(--muted);
}

.scoreboard {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--panel-lift);
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr:focus-visible {
  background: rgba(47, 199, 211, 0.08);
  outline: none;
}

td span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.rank {
  width: 58px;
  color: var(--muted);
  font-weight: 800;
}

.score {
  display: inline-grid;
  min-width: 64px;
  min-height: 34px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
}

.excellent {
  background: var(--green);
}

.strong {
  background: var(--cyan);
}

.mixed {
  background: var(--amber);
}

.weak {
  background: var(--coral);
}

meter {
  width: min(88px, 100%);
  height: 10px;
}

.failure {
  display: inline-block;
  padding: 6px 8px;
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.failure.clear {
  background: rgba(57, 208, 143, 0.14);
  color: var(--green);
}

.failure.warn {
  background: rgba(244, 182, 75, 0.14);
  color: var(--amber);
}

.analysis-band {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 18px;
}

.matrix-panel,
.compare-panel,
.chart-panel,
.evidence-band,
.submit-band {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 22, 29, 0.94);
}

.heatmap {
  display: grid;
  max-width: 100%;
  gap: 8px;
  overflow-x: auto;
}

.heatmap-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) repeat(3, minmax(72px, 0.5fr));
  min-width: 0;
  gap: 8px;
  align-items: center;
}

.heatmap-row span {
  display: grid;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  border-radius: 8px;
  padding: 0 12px;
  background: var(--panel-lift);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.heatmap-header span {
  min-height: 32px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.heat-cell {
  color: #fff;
  background: #24303d !important;
}

.heat-0 { background: #24303d !important; }
.heat-1 { background: #223944 !important; }
.heat-2 { background: #20424b !important; }
.heat-3 { background: #1e4b52 !important; }
.heat-4 { background: #1c5559 !important; }
.heat-5 { background: #1a5e60 !important; }
.heat-6 { background: #186768 !important; }
.heat-7 { background: #16706f !important; }
.heat-8 { background: #147976 !important; }
.heat-9 { background: #12837d !important; }
.heat-10 { background: #108c84 !important; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-grid div {
  min-width: 0;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.detail-grid strong {
  display: block;
  max-width: 100%;
}

.detail-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.selected-chart {
  min-height: 220px;
  display: grid;
  align-items: center;
}

.selected-chart svg {
  width: 100%;
  height: auto;
  min-height: 190px;
}

.empty-chart {
  color: var(--muted);
}

.evidence-band,
.submit-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.55fr);
  gap: 18px;
  align-items: center;
}

.doc-shell {
  min-width: 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 22, 29, 0.94);
  box-shadow: var(--shadow);
}

.doc-shell.compact {
  padding: 22px 28px;
}

.process-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.process-grid article {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.process-grid span,
.doc-list li::marker {
  color: var(--green);
}

.process-grid span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.process-grid h2 {
  font-size: 1.15rem;
}

.process-grid p,
.doc-list {
  color: var(--muted);
  line-height: 1.5;
}

.process-grid a {
  overflow-wrap: anywhere;
}

.doc-list {
  margin: 12px 0 0;
  padding-left: 22px;
}

.evidence-list {
  display: grid;
  gap: 10px;
}

.evidence-list a,
pre {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow-wrap: anywhere;
}

pre {
  overflow-x: auto;
  margin: 0;
}

code {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

@media (max-width: 980px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .nav {
    justify-content: start;
  }

  .analysis-band,
  .chart-panel,
  .evidence-band,
  .submit-band,
  .process-grid {
    grid-template-columns: 1fr;
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    font-size: clamp(2.1rem, 8vw, 4rem);
  }
}

@media (max-width: 760px) {
  main {
    gap: 18px;
    padding: 154px 12px 112px;
  }

  .topbar {
    top: 0;
    left: 0;
    right: 0;
    padding: 12px;
  }

  .site-footer {
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 62px;
    padding: 10px 12px;
  }

  .brand small {
    display: none;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .nav a,
  .tab,
  .command {
    display: grid;
    min-height: 40px;
    place-items: center;
    padding: 0 8px;
    text-align: center;
    white-space: normal;
  }

  .page-title,
  .toolbar,
  .matrix-panel,
  .compare-panel,
  .chart-panel,
  .evidence-band,
  .submit-band,
  .doc-shell {
    padding: 14px;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .tabs,
  .filters {
    display: grid;
    grid-template-columns: 1fr;
  }

  .filters label,
  .filters .command {
    width: 100%;
  }

  .scoreboard {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  table {
    border-collapse: separate;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tbody tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  td {
    display: grid;
    grid-template-columns: minmax(96px, 0.38fr) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  .rank {
    width: auto;
  }

  .link-button {
    width: 100%;
  }

  .heatmap-row {
    grid-template-columns: minmax(96px, 1fr) repeat(3, minmax(58px, 0.7fr));
    gap: 6px;
  }

  .heatmap-row span {
    min-height: 36px;
    padding: 0 8px;
    font-size: 0.84rem;
  }

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

  h1 {
    font-size: 2.15rem;
    line-height: 1.04;
  }
}

@media (max-width: 430px) {
  main {
    padding-top: 184px;
    padding-bottom: 128px;
  }

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

  td {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  td::before {
    margin-bottom: 2px;
  }
}
