/* tripwire scoreboard - Sentry-inspired, monochrome. Grayscale chrome;
   color only where it means something (status, difficulty). Sans-serif chrome,
   monospace for data (addresses, hashes, hex, bits, secrets). Dense. */
:root {
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  /* neutral grays */
  --bg: #131316;
  --bg2: #191a1e;
  --bg3: #232429;
  --line: #2c2d33;
  --line-soft: #232429;
  --fg: #d5d7dd;
  --fg-strong: #f1f2f4;
  --dim: #8a8d96;
  --faint: #61636b;
  --accent: #c7cad1;      /* interactive = light gray, not a hue */
  --accent-hi: #ffffff;
  --accent-weak: rgba(255, 255, 255, 0.055);

  /* meaningful color - used sparingly */
  --live: #56c06f;
  --swept: #e46a6a;
  --reclaimed: #cfa24a;
  --pending: #8a8d96;
  --cls-trivial: #8a8d96;
  --cls-low: #7f93a8;
  --cls-mid: #cfa24a;
  --cls-high: #db8a4a;
  --cls-extreme: #e46a6a;

  --maxw: 1180px;
  --gutter: max(20px, calc((100% - var(--maxw)) / 2));
  --radius: 7px;
  --shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f4f6;
    --bg2: #ffffff;
    --bg3: #eeeef1;
    --line: #e0e0e6;
    --line-soft: #ececef;
    --fg: #2c2d33;
    --fg-strong: #16171b;
    --dim: #6a6c75;
    --faint: #9a9ca4;
    --accent: #4b4d55;
    --accent-hi: #16171b;
    --accent-weak: rgba(0, 0, 0, 0.04);
    --live: #1a9f4a;
    --swept: #d5484d;
    --reclaimed: #a9780a;
    --pending: #6a6c75;
    --cls-trivial: #6a6c75;
    --cls-low: #5a7690;
    --cls-mid: #a9780a;
    --cls-high: #bf6b1e;
    --cls-extreme: #d5484d;
    --shadow: 0 1px 1px rgba(20, 20, 28, 0.05);
  }
}
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.45;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); text-decoration: underline; }

/* top bar: full-bleed sticky strip, contents centered with the page */
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px var(--gutter);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg2) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.logo {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 13px;
  color: var(--fg-strong);
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg3);
  text-decoration: none;
}
a.logo:hover { color: var(--fg-strong); text-decoration: none; border-color: var(--accent); }
.sub { color: var(--dim); font-size: 12px; }
nav { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: 12px; }
nav .dim { color: var(--faint); }

main { max-width: var(--maxw); margin: 0 auto; padding: 14px var(--gutter) 36px; }
main.login { max-width: none; padding: 14px; }
footer { margin-top: 16px; color: var(--faint); font-size: 11.5px; text-align: center; }

/* section headers */
h2 {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg-strong);
  letter-spacing: -0.01em;
  margin: 20px 0 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
h2::before {
  content: "";
  width: 2px; height: 13px;
  border-radius: 1px;
  background: var(--faint);
  transform: translateY(2px);
}
h2 .dim { color: var(--dim); font-size: 11.5px; font-weight: 400; letter-spacing: 0; }

/* stat tiles */
.statgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}
.statgrid .cell {
  padding: 9px 11px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.statgrid .k {
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
  font-weight: 600;
}
.statgrid .v {
  font-family: var(--sans);
  font-weight: 650;
  font-size: 20px;
  line-height: 1.1;
  color: var(--fg-strong);
  letter-spacing: -0.02em;
}
.up { color: var(--live); font-weight: 700; }

/* tables */
.tablewrap {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg2);
}
table { border-collapse: collapse; white-space: nowrap; width: 100%; }
th, td {
  text-align: left;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
th {
  font-family: var(--sans);
  color: var(--dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  background: color-mix(in srgb, var(--bg2) 60%, var(--bg));
  position: sticky; top: 0;
}
td {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--fg);
}
tbody tr:last-child td { border-bottom: 0; }
tbody.wgroup { border-bottom: 1px solid var(--line); }
tbody.wgroup:last-child { border-bottom: 0; }
tbody tr:hover td { background: var(--accent-weak); }
tbody.wgroup tr.detailrow td { border-bottom: 0; padding-top: 0; background: transparent; }
tr.detailrow > td { padding-right: 12px; }
tr.detailrow:hover td { background: transparent; }
.r { text-align: right; font-variant-numeric: tabular-nums; }
.wrap { white-space: normal; word-break: break-all; }
td.addr { color: var(--dim); }
.dim { color: var(--dim); }
.tfoot { color: var(--faint); font-size: 11px; padding: 7px 2px 0; }
.copy { cursor: pointer; border-bottom: 1px dotted var(--faint); }
.copy:hover { color: var(--accent-hi); border-bottom-color: var(--accent); }

/* status badges - filled, color IS the signal here */
.st {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  padding: 1px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  white-space: nowrap;
  color: var(--pending);
  background: color-mix(in srgb, var(--pending) 16%, transparent);
  border-color: color-mix(in srgb, var(--pending) 38%, transparent);
}
.st-live { color: var(--live); background: color-mix(in srgb, var(--live) 18%, transparent); border-color: color-mix(in srgb, var(--live) 52%, transparent); }
.st-swept { color: var(--swept); background: color-mix(in srgb, var(--swept) 18%, transparent); border-color: color-mix(in srgb, var(--swept) 52%, transparent); }
.st-reclaimed { color: var(--reclaimed); background: color-mix(in srgb, var(--reclaimed) 18%, transparent); border-color: color-mix(in srgb, var(--reclaimed) 52%, transparent); }
.st-pending, .st-funding, .st-draft, .st-closed { color: var(--pending); background: color-mix(in srgb, var(--pending) 15%, transparent); border-color: color-mix(in srgb, var(--pending) 35%, transparent); }
.st-race {
  color: var(--swept);
  border-color: var(--swept);
  animation: raceblink 1s steps(2, start) infinite;
}
@keyframes raceblink { to { opacity: 0.25; } }
tr.st-swept > td, tr.st-race > td { background: color-mix(in srgb, var(--swept) 5%, transparent); }
tr.st-live > td { background: color-mix(in srgb, var(--live) 4%, transparent); }

/* difficulty chips - the ramp encodes the experiment variable */
.chip {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
}
/* instant, styled tooltip for difficulty pills (native title is delayed) */
.tip {
  position: fixed;
  z-index: 100;
  max-width: 320px;
  background: var(--bg3);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.cls-trivial  { color: var(--cls-trivial); border-color: color-mix(in srgb, var(--cls-trivial) 40%, transparent); }
.cls-low      { color: var(--cls-low);     border-color: color-mix(in srgb, var(--cls-low) 40%, transparent); }
.cls-mid      { color: var(--cls-mid);     border-color: color-mix(in srgb, var(--cls-mid) 45%, transparent); }
.cls-high     { color: var(--cls-high);    border-color: color-mix(in srgb, var(--cls-high) 45%, transparent); }
.cls-extreme  { color: var(--cls-extreme); border-color: color-mix(in srgb, var(--cls-extreme) 50%, transparent); }

.prov { color: var(--reclaimed); cursor: help; font-family: var(--mono); }

/* detail / secrets panel */
details summary {
  cursor: pointer;
  color: var(--dim);
  font-family: var(--sans);
  font-size: 11.5px;
  padding: 6px 2px;
  list-style: none;
}
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "\25B8  "; color: var(--faint); }
details[open] summary::before { content: "\25BE  "; }
details summary:hover { color: var(--accent-hi); }
details[open] summary { margin-bottom: 8px; }
.panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  white-space: normal;
  margin-bottom: 8px;
}
.pgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2px 24px;
  margin-bottom: 8px;
}
.panel h3 {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dim);
  margin: 12px 0 4px;
}
.panel h3:first-child { margin-top: 0; }
.panel dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; }
.panel dt { color: var(--dim); font-family: var(--sans); font-size: 11.5px; }
.panel dd { margin: 0; font-family: var(--mono); font-size: 11.5px; color: var(--fg); }
.panel dd.r { text-align: right; }
.sec { color: var(--faint); letter-spacing: 1px; font-family: var(--mono); }
.sec.on { color: var(--fg-strong); letter-spacing: 0; }

/* callouts */
.msg, .note, .alert {
  border-radius: var(--radius);
  padding: 8px 11px;
  margin-bottom: 10px;
  font-size: 12px;
}
.msg { background: var(--bg2); border: 1px solid var(--line); }
.msg.err { border-color: color-mix(in srgb, var(--swept) 50%, transparent); color: var(--swept); }
.alert {
  background: var(--bg2);
  border: 1px solid color-mix(in srgb, var(--swept) 45%, transparent);
  color: var(--swept);
}
.note {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-left: 2px solid var(--faint);
  color: var(--dim);
  max-width: 680px;
}
.note code, .msg code { font-family: var(--mono); color: var(--fg-strong); }
/* intro / explainer box */
.intro {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-left: 2px solid var(--faint);
  border-radius: var(--radius);
  padding: 13px 15px;
  margin-bottom: 14px;
}
.intro p { margin: 0; }
.intro p + p { margin-top: 7px; }
.intro-lead { font-size: 13px; line-height: 1.5; color: var(--dim); }
.intro-lead b { color: var(--fg-strong); font-weight: 600; }

/* difficulty-band legend (aligned columns) */
.legend {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: 12px;
}
.legend-head { color: var(--fg-strong); font-weight: 600; margin-bottom: 8px; }
.legend-head .dim { font-weight: 400; font-size: 11px; }
.legend-row {
  display: grid;
  grid-template-columns: 76px 84px 1fr;
  align-items: center;
  gap: 12px;
  padding: 3px 0;
}
.legend-row .chip { justify-self: start; }
.legend-bits { color: var(--dim); font-family: var(--mono); font-size: 11.5px; }
.legend-ex { color: var(--fg); }
@media (max-width: 560px) {
  .legend-row { grid-template-columns: 72px 1fr; }
  .legend-row .legend-ex { grid-column: 2; }
}

/* buttons */
button {
  background: var(--bg3);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
button:hover { border-color: var(--accent); color: var(--accent-hi); background: var(--accent-weak); }
button.danger:hover { border-color: var(--swept); color: var(--swept); background: color-mix(in srgb, var(--swept) 10%, transparent); }
.panel > button { margin-top: 2px; }
form.inline { display: inline; }

/* login */
main.login { display: flex; justify-content: center; align-items: center; min-height: 70vh; }
.loginbox {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--bg2); border: 1px solid var(--line);
  padding: 22px 26px; border-radius: 10px; min-width: 300px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  align-items: stretch;
}
.loginbox .logo { align-self: center; margin-bottom: 2px; }
.loginbox input {
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: 7px;
  font-family: var(--sans); font-size: 12.5px; padding: 8px 10px;
}
.loginbox input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.loginbox button { padding: 8px 10px; font-size: 12.5px; }

/* methodology / long-form doc page: readable prose, not dashboard-dense */
.doc p { max-width: 780px; margin: 8px 0; line-height: 1.6; font-size: 13px; color: var(--fg); }
.doc b { color: var(--fg-strong); }
.doc code { font-family: var(--mono); font-size: 12px; color: var(--fg-strong); }
.doc-list { max-width: 780px; margin: 6px 0; padding-left: 18px; }
.doc-list li { margin: 5px 0; line-height: 1.55; font-size: 13px; }
.doc .tablewrap { max-width: 820px; }
.doc table td { font-family: var(--sans); font-size: 12px; white-space: normal; }
.doc footer { text-align: left; margin-top: 22px; }

/* links inside prose boxes read as links (global links only underline on hover) */
.intro a, .note a { text-decoration: underline; text-underline-offset: 2px; }
.alert a { color: var(--swept); text-decoration: underline; text-underline-offset: 2px; }
.alert-cc { max-width: 820px; }
