:root {
  color-scheme: dark;
  --bg: #070911;
  --panel: rgba(17, 20, 34, .88);
  --panel-2: rgba(24, 29, 48, .72);
  --line: rgba(185, 200, 255, .13);
  --text: #f5f2e9;
  --muted: #a9b0c5;
  --gold: #f6cb69;
  --blue: #6da9ff;
  --a: #67edb7;
  --b: #70b7ff;
  --c: #d5a5ff;
  --d: #ff8c83;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 8%, rgba(48, 79, 152, .24), transparent 35rem),
    radial-gradient(circle at 88% 26%, rgba(113, 45, 135, .18), transparent 38rem),
    linear-gradient(#080a13, #05060b 65%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .23;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

a { color: #9bc5ff; }
button, input { font: inherit; }

.masthead {
  height: 64px;
  padding: 0 clamp(20px, 4vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 13, .76);
  backdrop-filter: blur(18px);
  position: relative;
  z-index: 2;
}

.brand { color: var(--text); text-decoration: none; letter-spacing: .16em; font-size: .77rem; font-weight: 800; }
.brand-mark { color: var(--gold); margin-right: 9px; }
.status { color: var(--muted); font: 650 .68rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .11em; }
.pulse { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 7px; background: var(--a); box-shadow: 0 0 12px var(--a); }

main { width: min(1540px, calc(100% - 32px)); margin: 0 auto; }
.intro { max-width: 1040px; padding: clamp(52px, 8vw, 108px) 0 32px; }
.eyebrow { color: var(--gold); font: 800 .7rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .18em; text-transform: uppercase; }
h1 { margin: 10px 0 18px; max-width: 880px; font-size: clamp(2.7rem, 7vw, 6.7rem); line-height: .91; letter-spacing: -.062em; }
.lede { max-width: 850px; color: #c0c7d8; font-size: clamp(1rem, 2vw, 1.28rem); line-height: 1.65; }

.mode-switch { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.mode, .secondary {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  padding: 11px 17px;
  cursor: pointer;
  transition: .2s ease;
}
.mode:hover, .secondary:hover { border-color: rgba(246,203,105,.5); color: var(--text); }
.mode.active { background: var(--gold); color: #171108; border-color: var(--gold); font-weight: 800; box-shadow: 0 10px 35px rgba(246,203,105,.16); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; margin: 18px 0; background: rgba(13,16,27,.76); }
.stats div { min-height: 88px; padding: 18px 22px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.stats div:last-child { border: 0; }
.stats strong { font: 760 clamp(1.45rem, 3vw, 2rem)/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.stats span { color: var(--muted); font-size: .78rem; margin-top: 8px; text-transform: uppercase; letter-spacing: .08em; }

.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 28px 80px rgba(0,0,0,.22); }
.workspace { display: grid; grid-template-columns: 230px minmax(420px, 1fr) 330px; gap: 14px; min-height: 650px; }
.controls, .detail { padding: 20px; }
.search-label, legend { color: #e7e8ef; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
#search { width: 100%; margin: 9px 0 22px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: #090c16; color: var(--text); }
#search:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(246,203,105,.1); }
fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend { margin-bottom: 11px; }
fieldset label { display: grid; grid-template-columns: 18px 25px 1fr; gap: 7px; align-items: center; margin: 10px 0; color: var(--muted); font-size: .82rem; cursor: pointer; }
fieldset input { accent-color: var(--gold); }
.grade { width: 21px; height: 21px; display: inline-grid; place-items: center; border: 1px solid currentColor; border-radius: 6px; font: 800 .68rem/1 ui-monospace, monospace; }
.grade-a { color: var(--a); } .grade-b { color: var(--b); } .grade-c { color: var(--c); } .grade-d { color: var(--d); }
.secondary { width: 100%; border-radius: 10px; }
.hint { color: #7f879d; font-size: .76rem; line-height: 1.55; }
.method-note { margin-top: 22px; padding: 14px; border: 1px solid rgba(246,203,105,.16); border-radius: 12px; background: rgba(246,203,105,.05); }
.method-note strong { color: var(--gold); font-size: .78rem; }
.method-note p { color: var(--muted); font-size: .73rem; line-height: 1.45; margin: 7px 0 0; }

.graph-shell { position: relative; min-width: 0; overflow: hidden; background: radial-gradient(circle at 50% 45%, rgba(35, 56, 111, .24), transparent 55%), #070a12; }
#graph { display: block; width: 100%; height: 100%; min-height: 650px; cursor: grab; }
#graph.dragging { cursor: grabbing; }
.canvas-key { position: absolute; left: 14px; bottom: 12px; display: flex; gap: 12px; color: #6f7890; font: .66rem/1 ui-monospace, monospace; pointer-events: none; }
#empty-state { position: absolute; inset: 0; place-items: center; color: var(--muted); }

.detail { overflow: auto; }
.detail h2 { margin: 8px 0 10px; font-size: 1.6rem; letter-spacing: -.03em; }
#detail-description { color: var(--muted); font-size: .88rem; line-height: 1.6; }
#detail-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0; }
.meta-chip { border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; color: #bfc5d7; font: .68rem/1 ui-monospace, monospace; }
.edge-card { padding: 14px 0; border-top: 1px solid var(--line); }
.edge-head { display: flex; gap: 9px; align-items: flex-start; }
.edge-head h3 { margin: 1px 0 0; font-size: .88rem; line-height: 1.35; }
.edge-card p { color: var(--muted); font-size: .77rem; line-height: 1.5; }
.edge-card ul { list-style: none; padding: 0; margin: 8px 0 0; }
.edge-card li { margin: 5px 0; }
.edge-card a { font-size: .72rem; text-decoration: none; }
.edge-card a:hover { text-decoration: underline; }

.coverage, .rights { margin-top: 16px; padding: clamp(24px, 4vw, 48px); }
.coverage { display: grid; grid-template-columns: minmax(240px, .75fr) 1.3fr; gap: 42px; }
.coverage h2, .rights h2 { margin: 7px 0 12px; font-size: clamp(1.7rem, 3vw, 2.8rem); letter-spacing: -.04em; }
.coverage-copy > p:last-child, .rights > p { color: var(--muted); line-height: 1.7; }
.coverage-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.coverage-item { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.coverage-item strong { display: block; font-size: .78rem; }
.coverage-item span { color: var(--muted); font-size: .7rem; }
.status-seeded { color: var(--a) !important; }
.status-minimal, .status-framework { color: var(--gold) !important; }
.status-rights-gated { color: var(--d) !important; }
.rights { display: grid; grid-template-columns: .6fr 1.4fr; gap: 42px; margin-bottom: 32px; }
footer { max-width: 1540px; margin: 0 auto; padding: 26px 16px 42px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: #737b90; font: .7rem/1 ui-monospace, monospace; }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 210px 1fr; }
  .detail { grid-column: 1 / -1; max-height: none; }
}

@media (max-width: 720px) {
  main { width: min(100% - 20px, 1540px); }
  .status { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div:nth-child(2) { border-right: 0; }
  .stats div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .workspace { display: flex; flex-direction: column; }
  .controls { order: 2; }
  .graph-shell { order: 1; height: 510px; }
  #graph { min-height: 510px; }
  .detail { order: 3; }
  .coverage, .rights { grid-template-columns: 1fr; gap: 16px; }
  .coverage-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; gap: 10px; }
}
