:root {
  --ink: #171717;
  --paper: #fffdf7;
  --muted: #68635c;
  --line: #171717;
  --line-soft: #ddd8cf;
  --accent: #5b4bdb;
  --accent-soft: #eeeaff;
  --surface: #fff;
  --surface-2: #f3f1eb;
  --ok: #0b7a3e;
  --ok-soft: #dbf8e8;
  --warn: #9b5a00;
  --warn-soft: #fff0cb;
  --error: #b42318;
  --error-soft: #fee4e2;
  --code-bg: #171717;
  --code-ink: #f2efe6;
  --shadow: 5px 5px 0 var(--ink);
}

:root[data-theme="dark"] {
  --ink: #f2efe6;
  --paper: #161411;
  --muted: #a39d90;
  --line: #f2efe6;
  --line-soft: #47423a;
  --accent: #8b7cf7;
  --accent-soft: #2b2452;
  --surface: #211e1a;
  --surface-2: #2a2620;
  --ok: #7ee2a8;
  --ok-soft: #143726;
  --warn: #ffd27d;
  --warn-soft: #3d2c0e;
  --error: #ff9d94;
  --error-soft: #46160f;
  --code-bg: #0d0c0a;
  --code-ink: #f2efe6;
}

* {
  box-sizing: border-box;
}

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

main {
  width: min(1180px, calc(100% - 28px));
  margin: 32px auto 80px;
}

h1,
h2,
h3,
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

h2 {
  margin-top: 0;
  font-size: 1.15rem;
}

a {
  color: var(--accent);
}

.lede {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.05rem;
}

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.pill {
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 5px 10px;
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 750;
}

.pill[data-state="ok"] {
  background: var(--ok-soft);
}

.pill[data-state="warn"] {
  background: var(--warn-soft);
}

.pill[data-state="error"] {
  background: var(--error-soft);
}

.panel {
  margin: 18px 0;
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.wide {
  grid-column: 1 / -1;
}

label,
legend {
  font-weight: 800;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--surface);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
[role="tab"]:focus-visible {
  outline: 4px solid #b7afff;
  outline-offset: 2px;
}

.hint {
  color: var(--muted);
  font-size: 0.84rem;
}

.results-summary {
  margin: 0 0 18px;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  max-width: 62ch;
}

.loading-panel[aria-busy="true"] {
  border-color: var(--accent);
  background: var(--surface);
}

.loading-context {
  margin: 0 0 18px;
  color: var(--muted);
  max-width: 62ch;
}

.loading-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.loading-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.loading-step[data-state="active"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 3px 3px 0 var(--accent);
}

.loading-step[data-state="complete"] {
  border-color: var(--line);
  background: var(--ok-soft);
}

.loading-step-marker {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-radius: 0;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 900;
  background: var(--surface);
}

.loading-step[data-state="pending"] .loading-step-marker {
  color: var(--muted);
}

.loading-step[data-state="active"] .loading-step-marker {
  border-color: var(--accent);
  color: var(--accent);
  animation: loading-pulse 1.2s ease-in-out infinite;
}

.loading-step[data-state="complete"] .loading-step-marker {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
}

.loading-step-body {
  min-width: 0;
}

.loading-step-label {
  margin: 0;
  font-weight: 850;
  line-height: 1.35;
}

.loading-step-detail {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.loading-step[data-state="pending"] .loading-step-detail {
  display: none;
}

.loading-progress {
  margin: 18px 0 12px;
  height: 10px;
  border: 2px solid var(--line);
  border-radius: 0;
  overflow: hidden;
  background: var(--surface);
}

.loading-progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 420ms ease;
}

.loading-detail {
  margin: 0;
  min-height: 1.4em;
  color: var(--ink);
  font-weight: 650;
}

@keyframes loading-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgb(91 75 219 / 35%);
  }

  50% {
    transform: scale(1.04);
    box-shadow: 0 0 0 6px rgb(91 75 219 / 0%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-step[data-state="active"] .loading-step-marker {
    animation: none;
  }

  .loading-progress-bar {
    transition: none;
  }
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 8px 13px;
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font-weight: 850;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  color: #fff;
}

button.secondary {
  background: var(--surface);
}

.sample-select {
  min-height: 42px;
  max-width: 100%;
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 8px 13px;
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font-weight: 850;
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
}

.optional {
  color: var(--muted);
  font-weight: 600;
}

.template-fieldset {
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 16px;
  margin: 18px 0 0;
}

.template-table {
  margin: 12px 0;
  border: 2px solid var(--line);
  border-radius: 0;
  overflow: hidden;
  background: var(--surface);
}

.template-table-head,
.template-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.6fr) 42px;
  gap: 10px;
  align-items: center;
}

.template-table-head {
  padding: 10px 12px;
  background: var(--surface-2);
  border-bottom: 2px solid var(--line);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.template-rows {
  display: grid;
}

.template-row {
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
}

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

.template-row-index {
  display: none;
}

.template-field {
  margin: 0;
}

.template-description input {
  min-width: 0;
}

.template-fieldset > .secondary {
  margin-top: 12px;
}

.icon-button {
  min-height: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
  align-self: center;
}

.icon-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: 3px 3px 0 var(--ink);
}

.results > section {
  border-top: 2px solid var(--line-soft);
  margin-top: 28px;
  padding-top: 22px;
}

.scaffold-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.result-card,
.scaffold-block {
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 14px;
  background: var(--surface);
}

.result-card h4 {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.result-card h4,
.scaffold-block h4 {
  margin: 0 0 8px;
}

.scaffold-block + .scaffold-block {
  margin-top: 14px;
}

.scaffold-block-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.jsonld-output {
  margin: 0;
  max-height: 420px;
}

.verify-links {
  margin-top: 24px;
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

button:hover:not(:disabled),
.file-button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding: 5px;
}

.feature {
  display: flex;
  gap: 8px;
  align-items: start;
  border: 1.5px solid var(--line);
  border-radius: 0;
  padding: 8px;
  font-weight: 650;
}

.feature input {
  width: auto;
  margin-top: 3px;
}

[hidden] {
  display: none !important;
}

pre {
  max-height: 640px;
  overflow: auto;
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 14px;
  background: var(--code-bg);
  color: var(--code-ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#diagram {
  min-height: 260px;
  overflow: auto;
  border: 2px dashed var(--line);
  border-radius: 0;
  padding: 12px;
}

#diagram svg {
  max-width: 100%;
  height: auto;
}

.privacy {
  display: inline-block;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-left: 10px solid var(--accent);
  background: var(--accent-soft);
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 700;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@media (max-width: 720px) {
  main {
    margin-top: 20px;
  }

  .grid,
  .template-table-head,
  .template-row {
    grid-template-columns: 1fr;
  }

  .template-table-head {
    display: none;
  }

  .template-row {
    gap: 8px;
    padding: 14px;
  }

  .template-row-index {
    display: block;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .template-field label.sr-only {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    margin-bottom: 4px;
    font-size: 0.82rem;
  }

  .field.wide {
    grid-column: auto;
  }

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

.prop-cites {
  margin: 8px 0 4px;
  line-height: 2;
}

.prop-cites-label {
  color: var(--muted);
  font-weight: 700;
  margin-right: 4px;
}

.prop-cite {
  display: inline-block;
  border: 1.5px solid var(--line);
  border-radius: 0;
  padding: 1px 7px;
  margin: 0 3px 3px 0;
  font-size: 0.85em;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
}

.prop-cite-required {
  border-color: var(--ink);
}

.prop-cite-missing {
  border-style: dashed;
  color: var(--muted);
}

.view-tabs {
  display: flex;
  gap: 10px;
  margin: 20px 0 4px;
}

.view-tab {
  flex: 1;
  background: var(--surface);
  font-weight: 850;
}

.view-tab[aria-selected="true"] {
  background: var(--accent);
  color: #fff;
  transform: translate(3px, 3px);
  box-shadow: none;
}

.view-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.form-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.form-topline .sample-select {
  max-width: 340px;
}

.results-headline {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border-bottom: 4px solid var(--accent);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.results-headline h2 {
  font-size: 2rem;
  margin: 0;
}

.graph-details,
.snippet-block {
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 10px 14px;
  margin: 12px 0;
  background: var(--surface);
}

.graph-details summary,
.snippet-block summary {
  cursor: pointer;
  font-weight: 850;
}

.snippet-block summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.snippet-block .snippet-body {
  margin-top: 10px;
}

.snippet-block .copy-scaffold {
  margin-bottom: 8px;
}

.graph-legend {
  padding-left: 20px;
}

.graph-legend li {
  margin: 6px 0;
}

.graph-ai-summary {
  border: 2px dashed var(--line);
  border-radius: 0;
  padding: 8px 12px;
  margin: 10px 0;
}

.graph-ai-summary h4 {
  margin: 0 0 6px;
}

.graph-ai-summary p {
  margin: 0;
}

.page-footer {
  margin: 28px 0 12px;
}

.footer-details {
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 10px 14px;
  margin: 10px 0;
  background: var(--surface);
}

.footer-details summary {
  cursor: pointer;
  font-weight: 850;
}

.footer-details p,
.footer-details li {
  color: var(--ink);
}

.footer-details ul {
  padding-left: 20px;
}

.footer-details li {
  margin: 8px 0;
}

.resources-details {
  border: 2px solid var(--line);
  border-left: 10px solid var(--accent);
  border-radius: 0;
  padding: 10px 14px;
  margin: 18px 0 12px;
  background: var(--surface);
}

.resources-details summary {
  cursor: pointer;
  font-weight: 850;
}

.resources-details .prop-cite {
  background: var(--accent-soft);
}

#diagram {
  background: #fffdf7;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.theme-toggle {
  min-height: 34px;
  min-width: 42px;
  padding: 4px 12px;
  font-size: 1.05rem;
  line-height: 1;
  box-shadow: 3px 3px 0 var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border: 2px solid var(--line);
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font-weight: 850;
  font-size: 0.85rem;
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.back-link:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}

.results h3,
#form-heading,
#loading-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.results h3::before,
#form-heading::before,
#loading-heading::before {
  content: "";
  width: 13px;
  height: 13px;
  flex: none;
  background: var(--accent);
  border: 2px solid var(--line);
}

summary {
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "+";
  display: inline-block;
  margin-right: 9px;
  font-weight: 900;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

details[open] > summary::before {
  content: "\2212";
}

.snippet-block summary .hint {
  font-weight: 600;
}

.export-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  margin: 12px 0 4px;
}

.export-option {
  display: flex;
  align-items: start;
  gap: 10px;
  border: 2px solid var(--line);
  padding: 10px 12px;
  background: var(--surface);
  font-weight: 750;
  cursor: pointer;
}

.export-option:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.export-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  flex: none;
}

.section-rail {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 34px;
  border-right: 4px solid var(--line);
  padding: 16px 14px 16px 0;
  z-index: 40;
}

.section-rail a {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 44px;
  height: 22px;
  position: relative;
}

.section-rail a::before {
  content: "";
  width: 24px;
  height: 7px;
  background: var(--line);
  transition:
    width 120ms ease,
    background 120ms ease;
}

.section-rail a:hover::before,
.section-rail a[data-active]::before {
  background: var(--accent);
  width: 40px;
}

.section-rail a::after {
  content: attr(data-label);
  position: absolute;
  right: calc(100% + 16px);
  top: 50%;
  transform: translateY(-50%);
  border: 2px solid var(--line);
  background: var(--surface);
  padding: 2px 9px;
  font-size: 0.72rem;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--ink);
  white-space: nowrap;
  transition:
    font-size 130ms ease,
    box-shadow 130ms ease,
    border-color 130ms ease;
}

.section-rail a:hover::after {
  font-size: 0.85rem;
  box-shadow: 3px 3px 0 var(--ink);
}

.section-rail a[data-active]::after {
  font-size: 0.95rem;
  border-color: var(--accent);
  box-shadow: 3px 3px 0 var(--accent);
  padding: 5px 12px;
}

#section-graph,
#section-rich,
#section-snippets,
#section-references,
#section-export,
#results-heading {
  scroll-margin-top: 24px;
}

@media (max-width: 1339px) {
  .section-rail {
    display: none;
  }
}

.tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.label-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.tip {
  min-height: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 2px solid var(--line);
  background: var(--surface);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--muted);
  cursor: help;
  position: relative;
  flex: none;
}

.tip:hover,
.tip:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  transform: none;
  box-shadow: 2px 2px 0 var(--accent);
}

[data-tip] {
  position: relative;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: max-content;
  max-width: min(300px, 68vw);
  border: 2px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(3px);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 8px 11px;
  font-size: 0.8rem;
  font-weight: 650;
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  text-align: left;
  white-space: normal;
  line-height: 1.45;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 130ms ease;
  z-index: 60;
}

[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.usage-pill {
  background: var(--accent-soft);
  border-color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  cursor: help;
}

.graph-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.graph-controls .secondary {
  min-height: 34px;
  padding: 4px 12px;
}

#diagram svg {
  display: block;
  width: 100%;
  height: 540px;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

#diagram {
  user-select: none;
  -webkit-user-select: none;
}

#diagram svg:active {
  cursor: grabbing;
}

.g-node {
  cursor: grab;
}

.g-node-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 700;
  fill: #171717;
  pointer-events: none;
  paint-order: stroke;
  stroke: #fffdf7;
  stroke-width: 3px;
}

.g-edge-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 9px;
  fill: #68635c;
  opacity: 0.85;
  pointer-events: none;
  transition: opacity 100ms ease;
  paint-order: stroke;
  stroke: #fffdf7;
  stroke-width: 3px;
}

.g-edge:hover .g-edge-label {
  opacity: 1;
  fill: #5b4bdb;
  font-size: 10.5px;
}

.g-edge:hover line {
  opacity: 1 !important;
  stroke: #5b4bdb;
}

.g-edge line {
  cursor: pointer;
}

.graph-key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
}

.key-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.key-swatch {
  width: 13px;
  height: 13px;
  border: 2px solid #171717;
  flex: none;
}

.key-line {
  width: 22px;
  height: 0;
  border-top: 2px solid #171717;
  opacity: 0.6;
  flex: none;
}

.key-line-subject {
  border-top: 3px solid var(--accent);
  opacity: 1;
}

#diagram {
  position: relative;
}

.key-swatch-pinned {
  background: #fff;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px #fff, inset 4px -4px 0 2px var(--accent);
}

.node-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 50;
  width: 290px;
  max-height: 230px;
  overflow-y: auto;
  border: 2px solid #171717;
  background: rgba(255, 253, 247, 0.94);
  backdrop-filter: blur(3px);
  box-shadow: 4px 4px 0 #171717;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.74rem;
  color: #171717;
}

.node-panel-title {
  margin: 0 0 2px;
  font-weight: 850;
  color: #5b4bdb;
}

.node-panel-sub {
  margin: 0 0 8px;
  color: #68635c;
  font-weight: 650;
}

.node-panel-row {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 8px;
  padding: 3px 0;
  border-top: 1px solid #ddd8cf;
}

.node-panel-key {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.node-panel-value {
  color: #443f38;
  overflow-wrap: anywhere;
}

.ledger-details {
  margin: 4px 0 14px;
}

.ledger-wrap {
  max-height: 320px;
  overflow-y: auto;
  border: 2px solid var(--line);
  margin-top: 4px;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
}

.ledger-table th {
  text-align: left;
  background: var(--surface-2);
  border-bottom: 2px solid var(--line);
  padding: 7px 12px;
  position: sticky;
  top: 0;
}

.ledger-table th:last-child,
.ledger-table td:last-child {
  text-align: right;
  width: 90px;
}

.ledger-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-weight: 700;
}

.ledger-table tr:last-child td {
  border-bottom: 0;
}

.graph-buttons {
  display: inline-flex;
  gap: 8px;
}

#graph-stage:fullscreen {
  background: var(--paper);
  padding: 20px;
  overflow: auto;
}

#graph-stage:fullscreen #diagram svg {
  height: calc(100vh - 150px);
}

.node-panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.node-panel-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.node-panel-pin,
.node-panel-close {
  min-height: 0;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 850;
  border: 2px solid #5b4bdb;
  color: #5b4bdb;
  background: #fff;
  box-shadow: 2px 2px 0 #171717;
  cursor: pointer;
  flex: none;
}

.node-panel-close {
  border-color: #171717;
  color: #171717;
}

/* Selection focus: clicking a node dims everything not connected to it. */
.g-node.is-dim,
.g-edge.is-dim {
  opacity: 0.18;
  transition: opacity 120ms ease;
}

.g-node.is-selected rect {
  stroke: #5b4bdb;
  stroke-width: 3.5px;
}

/* Edge labels only appear where they can be read: on the page-subject edges
   and on edges touching the selected node. */
.g-edge .g-edge-label {
  opacity: 0;
}

.g-edge.is-subject .g-edge-label,
.g-edge.is-active .g-edge-label {
  opacity: 1;
}

.opportunity-summary {
  margin: 0 0 12px;
  font-weight: 800;
  font-size: 0.9rem;
}

.result-card[data-state="ready"] {
  border-left: 8px solid var(--ok);
}

.result-card[data-state="tokens"] {
  border-left: 8px solid var(--accent);
}

.result-card[data-state="blocked"] {
  border-left: 8px solid var(--line-soft);
}

.result-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.state-badge {
  flex: none;
  border: 2px solid var(--line);
  padding: 1px 8px;
  font-size: 0.7rem;
  font-weight: 850;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
}

.state-badge[data-state="ready"] {
  background: var(--ok-soft);
}

.state-badge[data-state="tokens"] {
  background: var(--accent-soft);
}

.state-badge[data-state="blocked"] {
  background: var(--surface-2);
  color: var(--muted);
}

.opportunity-benefit {
  margin: 6px 0 2px;
  color: var(--muted);
  font-style: italic;
  font-size: 0.86rem;
}

.opportunity-line {
  margin: 6px 0;
  font-size: 0.9rem;
}

.result-card-links {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}

.snippet-jump {
  min-height: 0;
  padding: 2px 9px;
  font-size: 0.76rem;
  font-weight: 850;
  box-shadow: 2px 2px 0 var(--ink);
}

.card-docs {
  margin: 8px 0 2px;
}

.card-docs summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 850;
  color: var(--ink);
}

.card-docs .prop-cites-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.card-docs .prop-cite {
  cursor: default;
  text-decoration: none;
}

.card-docs .prop-cites {
  margin-top: 6px;
}

.node-panel-sub-gap {
  margin-top: 10px;
}

.export-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.export-option input {
  margin-top: 3px;
}

.snippet-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.snippet-toolbar .secondary {
  min-height: 32px;
  padding: 3px 11px;
  font-size: 0.82rem;
}

.json-validity {
  border: 2px solid var(--line);
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 850;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.token-count {
  border: 2px solid var(--line);
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 850;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--warn-soft);
}

.token-count[data-state="done"] {
  background: var(--ok-soft);
}

.snippet-block summary .token-count {
  margin-left: auto;
  flex: none;
}

.snippet-block[open] summary .token-count {
  display: none;
}

.jsonld-output .token-mark {
  background: #3a2b0d;
  color: #ffd27d;
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 700;
}

.token-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.token-progress .hint {
  margin: 0;
}

.token-total-pill {
  border: 2px solid var(--line);
  padding: 3px 12px;
  font-size: 0.85rem;
  font-weight: 850;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--warn-soft);
  box-shadow: 3px 3px 0 var(--ink);
}

.token-total-pill[data-state="done"] {
  background: var(--ok-soft);
}

.json-validity[data-valid="true"] {
  background: var(--ok-soft);
}

.json-validity[data-valid="false"] {
  background: var(--error-soft);
}

.jsonld-output[contenteditable] {
  caret-color: #8b7cf7;
  cursor: text;
}

.jsonld-output[contenteditable]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.section-details > summary {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.section-details > summary h3 {
  margin: 0;
}

.section-details[open] > summary {
  margin-bottom: 12px;
}

/* --- Online store details --- */
.commerce-fieldset {
  border: 2px solid var(--ink, #171717);
  padding: 14px 16px 16px;
  margin: 18px 0 0;
}

.commerce-fieldset legend {
  font-weight: 850;
  padding: 0 6px;
}

.commerce-toggle,
.commerce-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  cursor: pointer;
  margin: 6px 0;
}

/* The global input rule stretches inputs to full width; checkboxes must not
   stretch or they drift far from their label text. */
.commerce-toggle input[type="checkbox"],
.commerce-check input[type="checkbox"] {
  width: auto;
  margin: 0;
  flex: none;
}

.commerce-toggle {
  justify-content: center;
}

.commerce-check {
  grid-column: 1 / -1;
  font-weight: 650;
}

#commerce-fields {
  margin-top: 12px;
}

#commerce-fields .hint.wide {
  grid-column: 1 / -1;
}

/* --- Merchant Center readiness --- */
.merchant-card {
  border: 2px solid var(--ink, #171717);
  padding: 12px 14px;
  margin: 0 0 12px;
  background: var(--panel, transparent);
}

.merchant-card h4 {
  margin: 0 0 4px;
}

.merchant-check {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 4px 0;
  border-top: 1px solid var(--line, #ddd8cf);
  font-size: 0.85rem;
}

.merchant-attr {
  font-weight: 800;
}

.merchant-check[data-state="present"] .merchant-state {
  color: #1d7a3d;
  font-weight: 750;
}

.merchant-check[data-state="stubbed"] .merchant-state {
  color: #8a6d00;
  font-weight: 750;
}

.merchant-check[data-state="missing"] .merchant-state {
  color: #b3261e;
  font-weight: 750;
}

/* --- Retired features (tombstones) --- */
.tombstone-icon svg {
  vertical-align: -2px;
  margin-right: 6px;
}

.retired-feature {
  display: grid;
  grid-template-columns: auto auto auto 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 6px 0;
  border-top: 1px solid var(--line, #ddd8cf);
  font-size: 0.85rem;
}

.retired-feature svg {
  align-self: center;
  opacity: 0.75;
}

.retired-name {
  font-weight: 800;
}

.retired-date {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--muted, #68635c);
}

.retired-note {
  color: var(--muted, #68635c);
}

/* --- Collapsible hero description --- */
.lede-details {
  max-width: 760px;
  margin: 8px 0;
}

.lede-details summary {
  cursor: pointer;
  font-weight: 750;
  color: var(--muted);
}

.lede-details .lede {
  margin: 8px 0 0;
}

/* --- Snippet entity pills --- */
.snippet-contains {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
}

.entity-pill {
  border: 2px solid var(--line);
  background: var(--accent-soft);
  padding: 1px 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 750;
  box-shadow: 2px 2px 0 var(--ink);
}
