:root {
  color-scheme: light;
  --bg: #f3f2ef; --paper: #fff; --ink: #252b30; --muted: #555f64;
  --navy: #142b45; --blue: #1f4e79; --blue-dark: #143c62; --blue-light: #eaf2fa;
  --line: #d9dcd8; --rule: #a8b0b2; --soft: #f5f5f2; --accent: #006e60; --error: #a83224;
  font: 15px/1.48 "Inter", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, select, input[type="checkbox"] { touch-action: manipulation; }
a { color: var(--blue); text-underline-offset: .18em; }
a:hover { color: var(--blue-dark); }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .52; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible,
textarea:focus-visible, select:focus-visible, iframe:focus-visible { outline: 3px solid #397cbe; outline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 3.1vw, 2.65rem); font-weight: 500; letter-spacing: -.022em; line-height: 1.14; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 1.05rem; }
.shell { width: min(1392px, calc(100% - 64px)); margin-inline: auto; }
.skip { position: absolute; z-index: 5; background: white; padding: 8px; top: -80px; }
.skip:focus { top: 5px; }
.header { background: var(--navy); color: white; border-bottom: 1px solid #254666; }
.topbar { min-height: 57px; display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.brand { display: inline-flex; gap: 0; align-items: center; color: white; text-decoration: none; white-space: nowrap; font-size: 1.2rem; letter-spacing: -.016em; font-weight: 650; }
.brand:hover { color: white; }
nav { display: flex; gap: 26px; align-self: stretch; }
nav a { display: grid; align-content: center; position: relative; color: #d4e3f1; font-size: .88rem; text-decoration: none; white-space: nowrap; }
nav a:hover, nav a[aria-current] { color: #fff; }
nav a[aria-current]::after { content: ""; left: 0; right: 0; bottom: 0; height: 2px; position: absolute; background: #cbd9e8; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 32px 0 23px; }
.page-heading h1 + p { margin-top: 10px; color: var(--muted); }
.eyebrow { margin-bottom: 9px; color: var(--blue); font-size: .71rem; font-weight: 650; letter-spacing: .075em; }
.panel { min-width: 0; background: var(--paper); border-block: 1px solid var(--line); border-block-start-color: var(--rule); }
.panel-head { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 11px 20px; min-height: 48px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 18px 20px; }
.workbench, .method-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 18px; }
.preview-panel { display: flex; flex-direction: column; }
.preview-drawing { min-height: 260px; flex: 1; display: grid; place-items: center; padding: 12px; color: var(--muted); background: var(--paper); }
.preview-drawing img { display: block; width: min(100%, 480px); margin-inline: auto; }
.preview-drawing .mini-structures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
.preview-drawing .mini-structures figure { display: grid; grid-template-rows: 1fr auto; place-items: center; min-width: 0; margin: 0; }
.preview-drawing figcaption { text-align: center; font-size: .82rem; }
.preview-panel > .panel-body { border-top: 1px solid var(--line); overflow-wrap: anywhere; }
#preview-meta { min-height: 43px; font-size: .83rem; }
label { display: block; font-weight: 620; margin-bottom: 5px; }
textarea, select { background: var(--paper); border: 1px solid var(--rule); border-radius: 2px; }
textarea { display: block; width: 100%; min-height: 66px; padding: 9px 11px; font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; font-size: .88rem; resize: vertical; }
textarea[readonly] { background: var(--soft); }
select { padding: 6px 8px; }
#second-structure { margin-top: 10px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.button, .primary, .quiet { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; font-size: .86rem; font-weight: 600; white-space: nowrap; }
.button, .primary { border-radius: 2px; min-height: 36px; padding: 7px 12px; }
.button { color: var(--ink); border: 1px solid var(--rule); background: var(--paper); }
.button:hover { background: var(--soft); }
.button:is([aria-pressed="true"],[aria-expanded="true"]) { border-color: var(--blue); color: var(--blue); }
.primary { min-height: 39px; border: 1px solid var(--navy); color: white; background: var(--navy); }
.primary:hover { background: var(--blue-dark); }
.quiet { border: 0; background: transparent; color: var(--blue); padding: 4px 0; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: .2em; }
.quiet:hover { text-decoration-color: currentColor; }
.file-button { position: relative; cursor: pointer; margin: 0; }
.file-button:focus-within { outline: 3px solid #397cbe; outline-offset: 3px; }
.file-button input { position: absolute; inset: 0; opacity: 0; color: transparent; cursor: pointer; width: 100%; }
.input-actions { margin-top: 9px; }
.run-row { margin-top: 14px; justify-content: space-between; }
fieldset { min-width: 0; border: 0; padding: 0; margin: 16px 0 0; }
legend { margin-bottom: 7px; font-size: .94rem; font-weight: 700; }
.model-options { display: flex; flex-wrap: wrap; gap: 5px 13px; }
.model-options label { white-space: nowrap; font-size: .8rem; font-weight: 500; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 5px; }
.check input { accent-color: var(--blue); margin: 0; }
body:has(#editor-dialog[open]) { overflow: hidden; }
#editor-dialog {
  position: fixed; inset: 0; margin: auto; max-width: none; max-height: none;
  width: min(1120px, calc(100% - 48px)); height: min(730px, calc(100dvh - 48px));
  padding: 0; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--rule); color: var(--ink); background: var(--paper);
}
#editor-dialog[open] { display: grid; grid-template-rows: auto minmax(276px, 1fr) auto; }
#editor-dialog::backdrop { background: rgb(20 31 40 / 52%); }
#editor-dialog.is-fullscreen { width: 100%; height: 100dvh; border: 0; }
.editor-dialog-head, .editor-dialog-footer { padding: 12px 18px; }
.editor-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.editor-dialog-footer { border-top: 1px solid var(--line); }
.editor-dialog-footer .button-row { justify-content: flex-end; }
#editor-error { margin: 0 0 10px; }
#editor-host { min-width: 0; min-height: 0; }
#editor { display: block; width: 100%; height: 100%; background: var(--paper); border: 0; }
@media (max-width: 600px) {
  #editor-dialog { width: 100%; height: 100dvh; border: 0; }
  #editor-expand { display: none; }
  .editor-dialog-head, .editor-dialog-footer { padding: 8px 12px; }
}
@media (max-width: 600px) and (max-height: 430px) {
  .editor-dialog-head, .editor-dialog-footer { padding-block: 5px; }
  #editor-dialog :is(.button, .primary) { min-height: 34px; padding-block: 5px; }
}
.message { margin-top: 13px; border-left: 2px solid var(--blue); padding: 9px 12px; background: var(--paper); color: var(--blue-dark); }
.error { border-color: #a83224; color: #902b20; }
.meta-badge { color: var(--muted); font: .84rem Consolas, monospace; }
.decision { color: var(--muted); font-size: .8rem; font-weight: 600; }
.decision.selected { color: #005f51; }
.decision.disagree + span { color: #902b20; }
.case-context { margin-top: 15px; padding: 14px 18px; border-left: 2px solid var(--blue); background: var(--paper); overflow-wrap: anywhere; }
.case-context p { margin-top: 4px; }
#results { margin-top: 22px; }
.result-grid { display: grid; gap: 15px; }
.result-grid.paired { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.result-card { overflow: hidden; }
.result-top { display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); }
.result-structure { padding: 12px; display: grid; place-items: center; min-width: 0; background: var(--paper); border-right: 1px solid var(--line); }
.result-structure img { width: min(100%, 370px); }
.result-structure p { color: var(--muted); font-size: .8rem; text-align: center; margin-bottom: 7px; }
.result-summary { padding: 17px 20px; min-width: 0; }
.score-line { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.big-score { font-size: clamp(1.75rem, 4vw, 2.6rem); line-height: 1; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.score-axis { margin: 20px 7px 8px; position: relative; height: 9px; background: #e8eae7; }
.score-axis .bar-fill { display: block; height: 100%; border-radius: inherit; background: #a2bfdc; }
.axis-threshold { position: absolute; top: -7px; height: 22px; border-left: 2px dashed #52677e; }
.axis-seed { position: absolute; height: 9px; width: 9px; border-radius: 50%; background: white; border: 2px solid #1f4e79; left: var(--x); top: var(--y); transform: translateX(-50%); }
.axis-mean { position: absolute; height: 6px; width: 6px; border-radius: 50%; background: #143c62; transform: translateX(-50%); top: 2px; }
.axis-ends, .seed-inline { display: flex; justify-content: space-between; gap: 5px; color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
.seed-inline { justify-content: start; flex-wrap: wrap; column-gap: 12px; margin-top: 9px; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; margin-top: 12px; gap: 7px; }
.status-grid > div { padding: 7px 9px 0 0; border-top: 1px solid var(--line); font-size: .79rem; }
.status-grid small { display: block; color: var(--muted); margin-bottom: 2px; }
.result-card details { border-top: 1px solid var(--line); }
summary { cursor: pointer; font-size: .94rem; font-weight: 660; padding: 12px 17px; color: var(--blue); }
summary:hover { background: var(--soft); }
.result-card details > div { padding: 0 17px 14px; }
.result-card .inner-details { margin-top: 9px; }
.inner-details summary { padding-inline: 0; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .84rem; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
thead { background: var(--soft); color: var(--muted); }
th { font-size: .77rem; font-weight: 680; }
tr:last-child td { border-bottom: 0; }
tr.primary-row { background: var(--soft); }
tr.primary-row td:first-child { color: var(--blue); font-weight: 650; }
.cell-smiles, .cell-id, .cell-error { display: block; width: max-content; max-width: min(260px, 70vw); }
.cell-smiles { font-family: Consolas, monospace; overflow: hidden; text-overflow: ellipsis; }
.cell-id, .cell-error { white-space: normal; overflow-wrap: anywhere; }
.streams { display: grid; gap: 8px; margin-bottom: 12px; }
.stream-line { display: grid; grid-template-columns: minmax(105px,1fr) repeat(2,minmax(0,1fr)); align-items: center; gap: 9px; font-size: .82rem; }
.stream-label strong { display: block; }
.stream-label span { font-size: .71rem; color: var(--muted); }
.mini-bar label { display: flex; justify-content: space-between; gap: 4px; margin: 0; font-size: .7rem; font-weight: 500; }
.mini-bar div { height: 4px; background: #e8eae7; margin-top: 4px; overflow: hidden; }
.mini-bar div span { display: block; height: 100%; background: var(--series, var(--blue)); }
.head-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px 13px; }
.head-grid .mini-bar { padding: 7px 0; border-top: 1px solid var(--line); }
.explain-views { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.explain-view { display: flex; flex-direction: column; min-width: 0; margin: 0; border-block: 1px solid var(--line); overflow: hidden; }
.explain-view figcaption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
.explain-view img { display: block; width: 100%; }
.viewer3d { flex: 1; min-height: 230px; position: relative; }
.version { padding: 8px 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
.results-toolbar { margin: 18px 0; }
.csv-editor { border: 1px solid var(--rule); }
.csv-editor.is-dragover { border-color: var(--blue); outline: 2px solid var(--blue); outline-offset: -2px; }
.csv-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 11px; border-bottom: 1px solid var(--line); }
.csv-toolbar .button-row { flex: none; }
#csv-selection { flex: 1 1 8rem; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#csv-text { border: 0; border-radius: 0; }
#csv-text:focus-visible { outline-offset: -3px; }
#csv-status, #csv-upload-error { margin-top: 6px; }
#batch-results .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-bottom: 9px; }
#batch-results .filters label { margin: 0; }
#batch-form > .primary { margin-top: 13px; }
progress { width: 100%; height: 12px; accent-color: var(--blue); }
.paper-layout { display: grid; grid-template-columns: minmax(180px, 245px) minmax(0, 1fr); gap: 18px; align-items: start; }
.paper-nav { display: grid; position: sticky; top: 15px; gap: 3px; padding: 9px 0; background: transparent; }
.paper-nav a { padding: 7px 9px; text-decoration: none; font-size: .84rem; }
.paper-nav a:hover, .paper-nav a:focus-visible { text-decoration: underline; }
.evidence { display: grid; gap: 15px; }
.evidence .panel { scroll-margin-top: 15px; }
.section-number { color: var(--blue); padding-right: 7px; font-size: .85rem; }
.figure { margin: 16px 0; padding-block: 10px 0; border-top: 1px solid var(--line); }
.figure img { display: block; width: 100%; max-height: 640px; object-fit: contain; }
.figure figcaption { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; color: var(--muted); font-size: .8rem; padding: 7px 5px 0; }
.evidence-table { margin-top: 13px; }
.evidence-table { border-top: 1px solid var(--line); }
.evidence-table summary { padding-inline: 0; }
.benchmark-filters { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: .85rem; margin: 10px 0; }
.benchmark-filters label { margin: 0; }
.example-list { margin-top: 16px; display: grid; }
.example-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; border-bottom: 1px solid var(--line); padding: 10px 0; }
.example-row .button { color: var(--blue); background: transparent; border: 0; min-height: 32px; padding: 4px 0; text-decoration: underline; }
.example-row p { color: var(--muted); font-size: .8rem; }
.prose p + p, .prose p + a { margin-top: 11px; }
.prose a { display: inline-block; }
.footer { margin-top: 36px; padding: 18px 0 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); font-size: .77rem; color: var(--muted); }
@media (width > 790px) {
  .result-grid.paired { row-gap: 0; }
  .result-grid.paired > .result-card { display: grid; grid-row: span 6; grid-template-rows: subgrid; grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1050px) {
  .result-grid.paired .result-top { grid-template-columns: 1fr; }
  .result-grid.paired .result-structure { border: 0; border-bottom: 1px solid var(--line); }
  .result-grid.paired .result-structure img { max-height: 190px; object-fit: contain; }
}
@media (max-width: 790px) {
  .shell { width: calc(100% - 32px); }
  .topbar { gap: 6px; min-height: initial; align-items: start; flex-direction: column; padding-top: 10px; }
  nav { max-width: 100%; gap: 17px; min-height: 40px; }
  nav a { font-size: .8rem; }
  .page-heading { margin: 26px 0 17px; align-items: start; flex-direction: column; gap: 12px; }
  .workbench, .method-layout, .paper-layout, .result-grid.paired { grid-template-columns: 1fr; }
  .paper-nav { position: static; grid-template-columns: 1fr 1fr; }
  .preview-drawing { min-height: 165px; }
  .preview-drawing img { max-height: 250px; object-fit: contain; }
}
@media (max-width: 460px) {
  .shell { width: calc(100% - 20px); }
  .panel-head, .panel-body, .result-summary { padding-inline: 12px; }
  .result-top, .explain-views { grid-template-columns: 1fr; }
  .result-structure { border: 0; border-bottom: 1px solid var(--line); }
  .result-structure img { max-height: 185px; object-fit: contain; }
  .stream-line { grid-template-columns: 90px 1fr 1fr; }
  nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  nav a { font-size: .74rem; line-height: 1.2; text-align: center; white-space: normal; padding-inline: 4px; }
  .result-card > details:first-of-type :is(th, td) { padding-inline: 6px; }
  .result-card > details:first-of-type td:first-child { white-space: normal; }
}

.manuscript-caption { padding: 0 10px 9px; color: var(--muted); }
