:root {
  color-scheme: dark;
  --bg: #06100d;
  --ink: #f2f4ec;
  --muted: #aab2a6;
  --line: rgba(238, 244, 226, 0.16);
  --panel: rgba(11, 21, 18, 0.78);
  --panel-strong: rgba(17, 31, 27, 0.94);
  --green: #9de7c7;
  --gold: #ffc86b;
  --coral: #f07f67;
  --blue: #7fb0ff;
  --shadow: rgba(0, 0, 0, 0.32);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(140deg, rgba(157, 231, 199, 0.08), transparent 34%),
    linear-gradient(230deg, rgba(240, 127, 103, 0.08), transparent 36%),
    var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.radar-shell {
  min-height: 100vh;
  overflow-x: clip;
}

.radar-topbar[data-site-header] {
  background: rgba(6, 16, 13, 0.88);
  border-color: var(--line);
}

.radar-topbar[data-site-header] .site-topbar__nav {
  display: grid !important;
  width: min(860px, 100%);
  flex: 1 1 auto;
  justify-items: end;
  gap: 8px;
  overflow: visible;
}

.radar-topbar .site-secondary-links[data-frontier-section-nav] {
  display: flex !important;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.radar-topbar [data-frontier-section-nav]::-webkit-scrollbar {
  display: none;
}

.radar-topbar .site-secondary-links[data-frontier-section-nav] a {
  min-height: 44px !important;
  border-color: var(--line) !important;
  padding: 5px 9px !important;
  color: var(--ink) !important;
  background: rgba(255, 255, 255, 0.06) !important;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.radar-stage {
  min-height: min(760px, calc(100vh - 76px));
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(360px, 1.22fr);
  gap: clamp(1.2rem, 4vw, 4rem);
  align-items: stretch;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) 0 1.6rem;
}

.radar-stage__copy {
  align-self: center;
  display: grid;
  gap: 1.2rem;
  max-width: 560px;
}

.radar-stage h1 {
  margin: 0;
  max-width: 11ch;
  font-size: clamp(3.1rem, 9vw, 6.7rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.radar-stage p {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: clamp(1.02rem, 2vw, 1.22rem);
  line-height: 1.62;
}

.radar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0.78rem 1rem;
  font-weight: 800;
  text-decoration: none;
}

.button-primary {
  background: var(--ink);
  color: #07100d;
}

.button-secondary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.radar-visual {
  position: relative;
  min-height: clamp(360px, 66vh, 660px);
  border-left: 1px solid var(--line);
  isolation: isolate;
}

.radar-visual canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
}

.radar-visual__hud {
  position: absolute;
  right: clamp(0.8rem, 3vw, 1.4rem);
  bottom: clamp(0.8rem, 3vw, 1.4rem);
  display: grid;
  gap: 0.2rem;
  max-width: min(360px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.74rem 0.85rem;
  background: rgba(4, 10, 8, 0.72);
  box-shadow: 0 18px 60px var(--shadow);
}

.radar-visual__hud span {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.radar-visual__hud strong {
  overflow-wrap: anywhere;
  font-size: 0.86rem;
}

.radar-metrics,
.source-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  border: 1px solid var(--line);
  background: var(--line);
}

.radar-metrics article,
.source-strip article {
  min-height: 150px;
  padding: clamp(1rem, 3vw, 1.4rem);
  background: rgba(8, 18, 15, 0.88);
}

.radar-metrics span,
.source-strip span,
.absorption-grid span,
.adjacent-panel span,
.packet-panel__heading label,
.rail-heading span,
.query-field span,
.detail-heading span,
.detail-metrics span {
  display: block;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.radar-metrics strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--gold);
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1;
}

.radar-metrics p,
.source-strip p {
  margin: 0.8rem 0 0;
  color: var(--muted);
  line-height: 1.52;
}

.radar-workbench {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 1.4rem);
  width: min(1180px, calc(100% - 32px));
  margin: clamp(1rem, 3vw, 1.4rem) auto;
}

.radar-rail,
.repo-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 80px var(--shadow);
}

.radar-rail {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 1rem;
}

.rail-heading strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.35rem;
  line-height: 1.12;
}

.filter-wrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.46rem;
  margin: 1rem 0;
}

.radar-filter,
.repo-row,
.packet-panel button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.radar-filter {
  min-height: 44px;
  border-radius: 8px;
  padding: 0.42rem;
  font-size: 0.84rem;
  font-weight: 800;
}

.radar-filter[aria-pressed="true"],
.repo-row[aria-pressed="true"] {
  border-color: rgba(157, 231, 199, 0.8);
  background: rgba(157, 231, 199, 0.12);
}

.query-field {
  display: grid;
  gap: 0.45rem;
}

.query-field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.8rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.repo-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

.repo-row {
  width: 100%;
  border-radius: 8px;
  padding: 0.8rem;
  text-align: left;
}

.repo-row__heading,
.repo-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.repo-row__heading strong {
  overflow-wrap: anywhere;
}

.repo-row__heading span,
.repo-row__meta span {
  color: var(--muted);
  font-size: 0.8rem;
}

.repo-row__meta {
  margin-top: 0.5rem;
}

.repo-detail {
  padding: clamp(1rem, 3vw, 1.5rem);
}

.detail-heading {
  display: grid;
  gap: 0.5rem;
}

.detail-heading h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.detail-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.detail-heading a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  width: fit-content;
  margin-top: 0.2rem;
  color: var(--gold);
  font-weight: 800;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 1.2rem 0;
  border: 1px solid var(--line);
  background: var(--line);
}

.detail-metrics article {
  min-width: 0;
  padding: 0.86rem;
  background: rgba(255, 255, 255, 0.045);
}

.detail-metrics strong {
  display: block;
  margin-top: 0.32rem;
  overflow-wrap: anywhere;
  color: var(--gold);
  font-size: clamp(1.05rem, 3vw, 1.5rem);
}

.absorption-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.absorption-grid article {
  min-height: 168px;
  padding: clamp(0.92rem, 2vw, 1.15rem);
  background: var(--panel-strong);
}

.absorption-grid p {
  margin: 0.8rem 0 0;
  color: #dde5d9;
  line-height: 1.56;
}

.packet-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.36fr) minmax(0, 0.64fr);
  gap: 1rem;
  margin-top: 1rem;
}

.adjacent-panel,
.packet-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  padding: 1rem;
}

.adjacent-panel ul {
  display: grid;
  gap: 0.55rem;
  margin: 0.8rem 0 0;
  padding-left: 1.1rem;
  color: #dde5d9;
}

.packet-panel__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}

.packet-panel button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0.4rem 0.72rem;
  font-weight: 800;
}

.packet-panel textarea {
  display: block;
  width: 100%;
  min-height: 260px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
  color: #eef4e2;
  background: #040807;
  line-height: 1.48;
}

.source-strip {
  margin-bottom: clamp(2rem, 6vw, 4rem);
}

.source-strip strong {
  display: block;
  margin-top: 0.35rem;
  color: var(--ink);
  font-size: 1.1rem;
}

@media (max-width: 920px) {
  .radar-stage,
  .radar-workbench {
    grid-template-columns: 1fr;
  }

  .radar-stage {
    min-height: auto;
  }

  .radar-visual {
    min-height: 360px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .radar-rail {
    position: static;
    max-height: none;
  }

  .radar-metrics,
  .source-strip,
  .packet-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .radar-stage {
    width: min(100% - 20px, 1180px);
    padding-top: 2rem;
  }

  .radar-stage h1 {
    font-size: clamp(2.7rem, 16vw, 4.2rem);
  }

  .radar-actions,
  .packet-panel__heading {
    align-items: stretch;
    flex-direction: column;
  }

  .button,
  .packet-panel button {
    width: 100%;
  }

  .radar-metrics,
  .radar-workbench,
  .source-strip {
    width: min(100% - 20px, 1180px);
  }

  .detail-metrics,
  .absorption-grid,
  .filter-wrap {
    grid-template-columns: 1fr;
  }

  .radar-topbar[data-site-header] .site-topbar__nav {
    width: auto;
    justify-items: end;
  }

  .radar-topbar[data-site-header] .site-primary-links {
    flex-wrap: wrap !important;
    justify-content: flex-end;
    overflow: visible;
  }

  .radar-topbar .site-secondary-links[data-frontier-section-nav] {
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
