:root {
  --ink: #122230;
  --ink-soft: #526170;
  --navy: #122d42;
  --navy-deep: #0b1c2a;
  --paper: #fffdf8;
  --canvas: #edf1f2;
  --line: #d9dfdf;
  --gold: #c89d22;
  --gold-soft: #f6e9b8;
  --green: #17724c;
  --green-soft: #dff3e9;
  --amber: #a45f08;
  --amber-soft: #fff0d5;
  --red: #a43d3d;
  --red-soft: #fbe3e3;
  --blue-soft: #e8f0f5;
  --shadow: 0 18px 45px rgba(15, 35, 48, 0.09);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -10%, rgba(200, 157, 34, 0.17), transparent 30rem),
    linear-gradient(180deg, #f5f7f6 0%, var(--canvas) 100%);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
}

.page-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 16px auto 32px;
}

.site-header {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 10px 30px rgba(16, 37, 51, 0.08);
  backdrop-filter: blur(18px);
}

.wordmark {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.wordmark-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  color: white;
  background: linear-gradient(135deg, var(--navy), #24546f);
  font-family: Georgia, serif;
  font-size: 1.45rem;
}

.wordmark strong,
.wordmark small {
  display: block;
}

.wordmark strong {
  letter-spacing: -0.02em;
}

.wordmark small {
  color: var(--ink-soft);
  font-size: 0.72rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

nav {
  display: flex;
  gap: 6px;
}

nav a {
  padding: 8px 11px;
  border-radius: 9px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 650;
  text-decoration: none;
}

nav a:hover {
  color: var(--navy);
  background: var(--blue-soft);
}

.section-frame {
  overflow: hidden;
  border: 1px solid rgba(26, 55, 70, 0.08);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  padding: clamp(30px, 4vw, 48px);
  color: white;
  background:
    linear-gradient(115deg, rgba(12, 29, 43, 0.98), rgba(23, 63, 86, 0.94)),
    repeating-linear-gradient(90deg, transparent 0 58px, rgba(255, 255, 255, 0.04) 58px 59px);
}

.hero-question {
  position: relative;
  z-index: 1;
  max-width: 1050px;
}

.section-kicker,
.micro-label {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h2,
h3,
p {
  margin-top: 0;
}

.hero-question blockquote {
  max-width: 980px;
  margin: 12px 0 24px;
  color: rgba(255, 255, 255, 0.96);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 2.7vw, 2.35rem);
  line-height: 1.3;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.075);
  font-size: 0.78rem;
  font-weight: 700;
}

.section-block {
  margin-top: 18px;
  padding: clamp(28px, 4vw, 54px);
}

.section-heading {
  display: flex;
  gap: 30px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 30px;
}

.section-heading h2 {
  max-width: 780px;
  margin: 8px 0 0;
  font-family: Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.section-heading > p {
  max-width: 390px;
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.topology-chain {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px minmax(0, 1fr) 100px minmax(180px, 0.55fr);
  gap: 14px;
  align-items: stretch;
}

.topology-node,
.topology-result,
.bridge-node {
  min-height: 178px;
  border-radius: var(--radius-md);
}

.topology-node {
  padding: 22px;
  border: 1px solid var(--line);
  background: #fafaf6;
}

.topology-node .node-number {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--navy);
  font-size: 0.78rem;
  font-weight: 800;
}

.topology-node h3 {
  margin: 14px 0 8px;
  font-size: 1.02rem;
}

.topology-node p {
  margin-bottom: 12px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.node-result {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--navy);
  font-weight: 800;
}

.node-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.node-meta span {
  padding: 3px 7px;
  border-radius: 6px;
  color: var(--ink-soft);
  background: var(--blue-soft);
  font-size: 0.69rem;
  font-weight: 700;
}

.bridge-node {
  display: grid;
  place-items: center;
  padding: 14px;
  text-align: center;
  color: #765600;
  border: 1px dashed #d8ae38;
  background: var(--gold-soft);
}

.bridge-node strong,
.bridge-node small {
  display: block;
}

.bridge-node strong {
  font-family: Georgia, serif;
  font-size: 1.15rem;
}

.bridge-node small {
  margin-top: 5px;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topology-result {
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  color: white;
  background: linear-gradient(145deg, var(--green), #0e5036);
}

.topology-result span,
.topology-result strong {
  display: block;
}

.topology-result span {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topology-result strong {
  margin-top: 8px;
  font-family: Georgia, serif;
  font-size: 2.5rem;
}

.chain-arrow {
  display: grid;
  place-items: center;
  color: #8d9aa2;
  font-size: 1.5rem;
}

.counterfactual-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.counterfactual-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.counterfactual-card strong,
.counterfactual-card span {
  display: block;
}

.counterfactual-card strong {
  font-size: 0.82rem;
}

.counterfactual-card span {
  margin-top: 5px;
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 750;
}

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

.evidence-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: white;
}

.evidence-card-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.evidence-card-header h3 {
  margin: 2px 0 0;
  font-size: 1.08rem;
}

.evidence-card-header p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.source-tag {
  align-self: flex-start;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--navy);
  background: var(--blue-soft);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.page-stage,
.crop-stage {
  position: relative;
  overflow: hidden;
  background: #e5e7e6;
}

.page-stage {
  max-width: 520px;
  margin: 22px auto;
  border: 1px solid #cbd1d0;
  box-shadow: 0 14px 30px rgba(22, 42, 54, 0.12);
}

.page-stage img,
.crop-stage img {
  display: block;
  width: 100%;
  height: auto;
}

.evidence-highlight {
  position: absolute;
  border: 3px solid #e04f39;
  border-radius: 5px;
  background: rgba(255, 225, 54, 0.19);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.86),
    0 4px 16px rgba(146, 42, 24, 0.27);
  pointer-events: none;
}

.evidence-highlight span {
  position: absolute;
  top: -25px;
  left: -3px;
  padding: 3px 7px;
  border-radius: 5px 5px 0 0;
  color: white;
  background: #e04f39;
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.crop-panel {
  padding: 18px 20px 20px;
  border-top: 1px solid var(--line);
  background: #fafaf6;
}

.crop-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.crop-panel-header span {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.image-link {
  border: 0;
  padding: 0;
  color: var(--navy);
  background: transparent;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.crop-stage {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.crop-stage .evidence-highlight span {
  display: none;
}

.evidence-explanation {
  margin: 13px 0 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.evidence-explanation strong {
  color: var(--ink);
}

.system-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.system-set-note {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: -8px 0 18px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink-soft);
  background: #f7f8f5;
  font-size: 0.78rem;
  font-weight: 700;
}

.system-set-note strong {
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: 1.12rem;
}

.outcome-card {
  padding: 18px;
  border: 1px solid;
  border-radius: 14px;
}

.outcome-card.complete {
  border-color: #9fceb7;
  background: var(--green-soft);
}

.outcome-card.partial {
  border-color: #e1bc79;
  background: var(--amber-soft);
}

.outcome-card.failed {
  border-color: #e4adad;
  background: var(--red-soft);
}

.outcome-card.neutral {
  border-color: #bfcdd6;
  background: var(--blue-soft);
}

.outcome-card .system-role {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.outcome-card h3 {
  margin: 7px 0 12px;
  font-size: 1.1rem;
}

.outcome-answer {
  min-height: 46px;
  font-family: Georgia, serif;
  font-size: 1.03rem;
}

.outcome-score {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding-top: 12px;
  border-top: 1px solid rgba(25, 45, 56, 0.14);
}

.outcome-score span {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 750;
}

.outcome-score strong {
  font-family: Georgia, serif;
  font-size: 1.65rem;
}

.system-records {
  display: grid;
  gap: 14px;
}

.system-record {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.system-record > summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 17px 20px;
  cursor: pointer;
  list-style: none;
}

.system-record > summary::-webkit-details-marker {
  display: none;
}

.system-record > summary::after {
  content: "+";
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--navy);
  font-size: 1.1rem;
}

.system-record[open] > summary::after {
  content: "−";
}

.system-record-title strong,
.system-record-title span {
  display: block;
}

.system-record-title span {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.record-content {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.record-panel {
  min-width: 0;
  padding: 18px;
  background: #fafaf8;
}

.record-panel h4 {
  margin: 0 0 10px;
  font-size: 0.75rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.context-preview-list {
  display: grid;
  gap: 10px;
  margin-bottom: 15px;
}

.context-preview-heading,
.hop-match-panel > h5 {
  margin: 0 0 9px;
  color: var(--ink-soft);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hop-match-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 17px;
}

.hop-match-card {
  padding: 13px 14px;
  border: 1px solid rgba(202, 151, 25, 0.42);
  border-radius: 11px;
  background: #fffaf0;
}

.hop-match-card header {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
}

.hop-match-card > strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
}

.hop-match-card > p {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 0.77rem;
  line-height: 1.55;
}

.hop-match-card > small {
  display: block;
  color: var(--ink-soft);
  font-size: 0.69rem;
  line-height: 1.45;
}

.context-preview-card {
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid #d8e1df;
  border-radius: 11px;
  background: white;
}

.context-preview-card header {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.context-rank {
  padding: 3px 7px;
  border-radius: 999px;
  color: white;
  background: var(--navy);
}

.context-preview-card > strong {
  display: block;
  overflow: hidden;
  margin-bottom: 5px;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-preview-card > p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.context-audit-panel > .full-context-note,
.context-preview-empty {
  max-width: 52rem;
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.55;
}

.raw-context-details {
  overflow: hidden;
  border: 1px solid #d8e1df;
  border-radius: 11px;
  background: white;
}

.raw-context-details > summary {
  padding: 13px 15px;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
}

.raw-context-details[open] > summary {
  border-bottom: 1px solid #d8e1df;
  background: #f3f7f6;
}

.raw-context-details > pre {
  max-height: 30rem;
  border: 0;
  border-radius: 0;
}

.visual-context-panel {
  grid-column: 1 / -1;
  background: #f3f7f6;
}

.context-gallery-note {
  margin: -2px 0 14px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.5;
}

.context-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.context-image-card {
  overflow: hidden;
  margin: 0;
  border: 1px solid #d8e1df;
  border-radius: 12px;
  background: white;
}

.context-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #e9efee;
  cursor: zoom-in;
}

.context-image-button img {
  display: block;
  width: 100%;
  aspect-ratio: 0.773;
  object-fit: contain;
}

.context-image-card figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  align-items: baseline;
  padding: 10px 12px 12px;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.context-image-card figcaption strong {
  color: var(--ink);
}

pre {
  overflow: auto;
  max-height: 34rem;
  margin: 0;
  padding: 14px;
  border: 1px solid #dfe4e3;
  border-radius: 10px;
  color: #21323e;
  background: white;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.73rem;
  line-height: 1.48;
  white-space: pre-wrap;
  word-break: break-word;
}

.judge-pending {
  padding: 26px;
  border: 1px dashed #d2a54b;
  border-radius: 14px;
  background: #fff8e8;
}

.judge-pending strong {
  display: block;
  margin-bottom: 6px;
  color: #7c4c0c;
  font-size: 1.05rem;
}

.judge-pending p {
  margin: 0;
  color: #785b31;
}

.judge-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 0.84rem;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--ink-soft);
  background: #f5f7f6;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.decision {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 800;
}

.decision-cell {
  display: grid;
  min-width: 150px;
  gap: 6px;
}

.decision-reason {
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.4;
}

.decision.covered {
  color: var(--green);
}

.decision.not-covered {
  color: var(--red);
}

.raw-decision {
  max-width: 360px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 10px 0;
  color: #667680;
  font-size: 0.75rem;
}

.image-dialog {
  width: min(1180px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  padding: 18px;
  border: 0;
  border-radius: 18px;
  background: white;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.34);
}

.image-dialog::backdrop {
  background: rgba(6, 18, 27, 0.74);
  backdrop-filter: blur(5px);
}

.image-dialog img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 130px);
  margin: auto;
}

.image-dialog p {
  margin: 10px 44px 0 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: white;
  background: var(--navy);
  font-size: 1.2rem;
  cursor: pointer;
}

@media (max-width: 980px) {
  nav {
    display: none;
  }

  .record-content {
    grid-template-columns: 1fr;
  }

  .topology-chain {
    grid-template-columns: 1fr;
  }

  .chain-arrow {
    min-height: 35px;
    transform: rotate(90deg);
  }

  .counterfactual-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 16px, 1440px);
    margin-top: 8px;
  }

  .site-header {
    position: static;
  }

  .hero {
    padding: 32px 22px;
  }

  .section-block {
    padding: 26px 18px;
  }

  .section-heading {
    display: block;
  }

  .section-heading > p {
    margin-top: 12px;
  }

  .evidence-grid,
  .system-overview,
  .counterfactual-grid {
    grid-template-columns: 1fr;
  }

  .system-set-note {
    display: grid;
  }

  footer {
    display: block;
  }

  footer span {
    display: block;
    margin-bottom: 5px;
  }
}

@media print {
  body {
    background: white;
  }

  .page-shell {
    width: 100%;
    margin: 0;
  }

  .site-header,
  .image-link,
  .dialog-close {
    display: none !important;
  }

  .section-frame {
    break-inside: avoid;
    box-shadow: none;
  }

  .system-record {
    break-inside: avoid;
  }

  .record-content {
    display: grid !important;
  }

  pre {
    max-height: none;
  }
}
