:root {
  color-scheme: light;
  --paper: #f4f4f0;
  --ink: #101010;
  --muted: #5d5d58;
  --line: #b9b9ad;
  --soft: #ffffff;
  --green: #097b30;
  --blue: #2347d6;
  --red: #9b111e;
  --yellow: #fff3a8;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(16, 16, 16, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 16, 16, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 18px 18px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
}

a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

button,
input,
select {
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--soft);
  color: var(--ink);
  font: inherit;
}

button {
  min-height: 30px;
  padding: 5px 9px;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}

button:hover {
  background: var(--yellow);
}

button:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

input,
select {
  width: 100%;
  min-height: 32px;
  padding: 5px 7px;
}

.page-shell {
  width: min(1440px, calc(100% - 28px));
  margin: 14px auto 48px;
  border: 1px solid var(--ink);
  background: rgba(244, 244, 240, 0.92);
  box-shadow: 5px 5px 0 var(--ink);
}

.top-strip {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--ink);
  background: var(--soft);
  padding: 9px 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0;
}

.brand img {
  width: 26px;
  height: 26px;
  image-rendering: pixelated;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

nav a {
  color: var(--ink);
}

nav a[aria-current="page"] {
  background: var(--yellow);
  outline: 1px solid var(--ink);
  padding: 1px 4px;
  text-decoration: none;
}

main {
  padding: 14px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.kicker,
.panel-title,
.muted,
label,
th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.kicker {
  margin: 0 0 10px;
  color: var(--green);
  font-weight: 700;
}

h1 {
  max-width: 880px;
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(28px, 5vw, 64px);
  line-height: 0.95;
  letter-spacing: 0;
}

.copy {
  max-width: 720px;
  margin: 14px 0 0;
  font-size: 14px;
}

.terminal-art {
  margin: 0;
  min-height: 100%;
  overflow: auto;
  border: 1px solid var(--ink);
  background: #050505;
  color: #9cff9c;
  padding: 13px;
  white-space: pre-wrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--ink);
  border-right: 0;
  margin: 14px 0;
  background: var(--soft);
}

.stats div {
  min-width: 0;
  border-right: 1px solid var(--ink);
  padding: 10px;
}

.stats span {
  display: block;
  font-family: var(--sans);
  font-size: clamp(24px, 4vw, 42px);
  font-weight: 700;
  line-height: 1;
}

.stats label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.workbench {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.dashboard-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  gap: 14px;
  min-width: 0;
}

.filters,
.feed-panel,
.plain-panel,
.method > div {
  border: 1px solid var(--ink);
  background: var(--soft);
}

.dashboard-grid > *,
.workbench > *,
.directory-layout > *,
.pattern-layout > *,
.plain-panel {
  min-width: 0;
}

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) minmax(160px, 0.75fr) minmax(160px, 0.75fr) minmax(180px, 0.9fr);
  gap: 10px;
  align-items: end;
  padding: 12px;
}

.filters .panel-title,
.filters .quick-filters,
.filters .side-note {
  grid-column: 1 / -1;
}

.panel-title {
  color: var(--ink);
  font-weight: 700;
}

label {
  display: grid;
  gap: 4px;
  color: var(--muted);
}

.quick-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.side-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.feed-panel {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.strong-panel {
  box-shadow: 3px 3px 0 var(--ink);
}

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  border-bottom: 1px solid var(--ink);
  padding: 8px 10px;
}

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

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: var(--soft);
}

th,
td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 7px 8px;
  vertical-align: top;
}

th:last-child,
td:last-child {
  border-right: 0;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #e9e9df;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
}

td {
  min-width: 90px;
}

td.signal-title {
  min-width: 260px;
  max-width: 430px;
}

td.direction {
  min-width: 340px;
  max-width: 560px;
}

td.repo {
  white-space: nowrap;
}

tbody tr:hover {
  background: #fffbe0;
}

.tag {
  display: inline-block;
  border: 1px solid currentColor;
  padding: 1px 5px;
  color: var(--green);
  white-space: nowrap;
}

.tag.performance {
  color: var(--blue);
}

.tag.correctness {
  color: var(--red);
}

.tag.review,
.tag.maintenance,
.tag.maintainability {
  color: #6f3a00;
}

.source {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.feed-actions {
  display: flex;
  justify-content: center;
  padding: 12px;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr);
  gap: 14px;
  margin-top: 14px;
}

.subpage-hero {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.subpage-hero h1 {
  max-width: 940px;
}

.directory-layout,
.pattern-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.inline-query {
  display: grid;
  grid-template-columns: auto minmax(180px, 260px);
  align-items: center;
  gap: 8px;
}

.directory-table table {
  min-width: 760px;
}

.compact td,
.compact th {
  padding: 6px 8px;
}

.compact table {
  min-width: 620px;
}

.bar {
  display: inline-block;
  width: min(150px, 38vw);
  height: 9px;
  border: 1px solid var(--ink);
  background: #e6e6db;
  vertical-align: middle;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--green);
}

.bucket-list {
  display: grid;
}

.bucket-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
}

.bucket-row:last-child {
  border-bottom: 0;
}

.bucket-name {
  overflow-wrap: anywhere;
}

.bucket-count {
  display: inline-flex;
  justify-content: flex-end;
  min-width: 4ch;
}

.bucket-list.loud .bucket-row {
  min-height: 42px;
  padding: 9px 10px;
}

.spot-list {
  display: grid;
}

.spot-row {
  display: grid;
  grid-template-columns: 3ch minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 43px;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  color: var(--ink);
  text-decoration: none;
}

.spot-row:last-child {
  border-bottom: 0;
}

.spot-row:hover {
  background: var(--yellow);
}

.spot-rank {
  color: var(--muted);
}

.spot-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.spot-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spot-meta {
  color: var(--muted);
  white-space: nowrap;
}

.spot-bar {
  display: block;
  width: 100%;
  height: 7px;
  border: 1px solid var(--ink);
  background: #e6e6db;
}

.spot-bar span {
  display: block;
  height: 100%;
  background: var(--green);
}

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

.method > div {
  padding: 12px;
}

.method p {
  margin: 8px 0 0;
}

@media (max-width: 980px) {
  .intro,
  .dashboard-grid,
  .workbench,
  .lower-grid,
  .directory-layout,
  .pattern-layout,
  .method {
    grid-template-columns: 1fr;
  }

  .filters,
  .dashboard-side {
    position: static;
  }

  .dashboard-side,
  .filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: calc(100% - 16px);
    margin-top: 8px;
    box-shadow: 3px 3px 0 var(--ink);
  }

  .top-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  main {
    padding: 8px;
  }

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

  .quick-filters {
    grid-template-columns: 1fr;
  }

  .inline-query {
    grid-template-columns: 1fr;
    width: 100%;
  }

  td.signal-title,
  td.direction {
    min-width: 240px;
  }

  .table-wrap {
    border-top: 0;
  }
}
