:root {
  color-scheme: dark;
  --bg: #0d151a;
  --panel: #14232c;
  --text: #edf3f4;
  --muted: #a9bdc7;
  --teal: #69e3cc;
  --line: #2e424d;
  font-family: "Inter", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; }
h1, p { margin: 0; }
.shell { width: min(1232px, calc(100% - 100px)); margin-inline: auto; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 3; inset: 10px auto auto 10px; padding: 12px; background: var(--teal); color: var(--bg); }

.site-header { border-bottom: 1px solid #24333a; }
.header-inner { min-height: 66px; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 690; letter-spacing: -.65px; white-space: nowrap; }
.brand-mate { color: var(--teal); }
.research-note { color: var(--muted); font-size: 13px; font-weight: 550; text-align: right; }

.home { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.15fr); gap: clamp(25px, 5vw, 78px); align-items: center; padding-block: clamp(48px, 7.5vw, 115px); }
.hero-copy h1 { font-size: clamp(44px, 6vw, 89px); font-weight: 630; letter-spacing: -.08em; line-height: 1.01; }
.hero-copy h1 em { font-style: normal; color: var(--teal); }
.hero-copy p { color: var(--muted); font-size: clamp(16px, 1.48vw, 19px); line-height: 1.6; max-width: 370px; margin-top: 23px; }

.tools-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
a.tool-card { text-decoration: none; }
.tool-card { position: relative; display: grid; align-content: start; gap: 8px; width: 100%; min-height: 152px; padding: 17px 35px 17px 17px; text-align: left; color: var(--text); border: 1px solid var(--line); border-radius: 11px; background: var(--panel); transition: background .18s, border-color .18s; }
.tool-card:hover { background: #19303a; border-color: #4a8c8b; }
.tool-name { font-size: 20px; line-height: 1.18; font-weight: 650; letter-spacing: -.035em; }
.tool-description { color: var(--muted); font-size: 13px; line-height: 1.46; }
.tool-admin { display: inline-flex; align-items: center; gap: 6px; justify-self: start; margin-top: 3px; padding: 3px 9px; border: 1px solid #6b5420; border-radius: 999px; background: #2a2213; color: #f3cf86; font-size: 12px; font-weight: 600; line-height: 1.3; }
.tool-admin svg { width: 12px; height: 12px; flex: none; }
.tool-arrow { position: absolute; right: 14px; top: 13px; color: #a1c0ca; font-size: 17px; }
.tool-card:hover .tool-arrow { color: var(--teal); }
.tool-icon { position: relative; display: block; width: 34px; height: 34px; margin-bottom: 3px; border-radius: 7px; color: var(--teal); background: #1b3d40; }
.tool-icon::before, .tool-icon::after { content: ""; position: absolute; }
.icon-angle::before { width: 18px; height: 1.5px; left: 8px; top: 22px; background: currentColor; }
.icon-angle::after { width: 18px; height: 1.5px; left: 8px; top: 22px; background: currentColor; transform: rotate(-33deg); transform-origin: 0 50%; }
.icon-ruler::before { inset: 12px 7px; border: 1.5px solid currentColor; border-radius: 2px; transform: rotate(-40deg); }
.icon-ruler::after { width: 1px; height: 4px; left: 13px; top: 17px; background: currentColor; box-shadow: 4px 0 currentColor, 8px 0 currentColor; transform: rotate(-40deg); transform-origin: left top; }
.icon-spine::before { inset: 8px 13px auto; height: 4px; border-radius: 2px; background: currentColor; box-shadow: -2px 6px currentColor, 0 12px currentColor; transform: rotate(-12deg); }
.icon-liver::before { inset: 11px 6px 11px 7px; border: 1.5px solid currentColor; border-radius: 60% 40% 45% 55% / 55% 45% 55% 45%; transform: rotate(-10deg); }
.icon-liver::after { width: 1.5px; height: 9px; left: 20px; top: 12px; background: currentColor; transform: rotate(16deg); }
.icon-prostate::before { inset: 9px 8px 9px; border: 1.5px solid currentColor; border-radius: 48% 48% 50% 50% / 38% 38% 62% 62%; }
.icon-prostate::after { width: 1.5px; height: 20px; left: 16px; top: 7px; background: currentColor; border-radius: 1px; transform: rotate(-8deg); }
.icon-report::before { inset: 8px 10px; border: 1.5px solid currentColor; border-radius: 2px; }
.icon-report::after { inset: 13px 14px auto; height: 1px; background: currentColor; box-shadow: 0 4px currentColor; }

.workbench { padding-block: 28px 50px; }
body.wide main.shell { width: min(1520px, calc(100% - 64px)); }
.workbench .tool-card { z-index: 1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 0; padding: 13px 16px; border-color: #41626b; transform-origin: top left; }
.workbench .tool-icon { margin: 0; }
.workbench .tool-description, .workbench .tool-admin { display: none; }
.workbench .tool-arrow { position: static; font-size: 13px; color: var(--teal); font-weight: 600; white-space: nowrap; }
.workbench-content { padding: 20px 0 0; }
.panel > .sub, .panel .intro .sub { color: var(--muted); line-height: 1.55; margin-bottom: 14px; }
.panel .drop { display: grid; justify-items: center; align-content: center; min-height: 230px; background: #111c23; border: 1px dashed #53727d; }
.panel .drop.over { background: #173b39; border-color: var(--teal); }
.pick, .reference-pick { background: var(--teal); color: #0e2726; font-weight: 700; }
.pick:hover:not(:disabled), .reference-pick:hover { background: #a0f5e4; }
.pick:disabled { color: #c7d7de; }
.hint, .ver { color: var(--muted); }
.status:not(.err, .ok, .warnbox), .toolbar, .report, .layers, .sp-fig, .sp-opts { background: #14212a; }
.seg button.active { background: #28625d; color: #fff; }
.viewer, .toolbar, .rtext { border-color: var(--line); }
#boot { margin: 0 0 12px; }

.reference { margin-bottom: 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: #111c23; }
.reference-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.reference-controls small { color: var(--muted); }
.reference-pick { position: relative; display: inline-flex; padding: 8px 11px; border-radius: 7px; font-size: 13px; cursor: pointer; }
.reference-pick input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.reference-pick:focus-within { outline: 2px solid var(--teal); outline-offset: 3px; }
.reference-error:not(:empty) { margin-top: 8px; color: #f9b9ae; font-size: 13px; }
.reference img { display: block; width: auto; max-width: 100%; max-height: 55vh; margin: 12px auto 0; object-fit: contain; }


@media (max-width: 970px) {
  .shell { width: calc(100% - 64px); }
  .home { gap: 26px; }
}

@media (max-width: 760px) {
  .shell, body.wide main.shell { width: calc(100% - 40px); }
  .home { grid-template-columns: minmax(0, 1fr); padding-block: 40px; gap: 28px; }
  .hero-copy h1 { font-size: clamp(44px, 9vw, 66px); }
  .hero-copy p { margin-top: 16px; }
  .tool-card { min-height: 140px; }
}

@media (max-width: 430px) {
  .shell, body.wide main.shell { width: calc(100% - 32px); }
  .header-inner { min-height: 58px; }
  .brand { font-size: 18px; gap: 7px; }
  .research-note { font-size: 12px; }
  .tools-grid { gap: 9px; }
  .tool-card { padding: 12px; }
  .tool-arrow { top: 9px; right: 10px; }
  .tool-name { font-size: 17px; }
  .tool-description { font-size: 12px; }
  .tool-admin { font-size: 11px; padding: 2px 7px; }
  .workbench { padding-top: 18px; }
  .workbench .tool-card { padding: 10px; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .tool-card { transition: none; }
  .progress-fill { animation: none; }
}

.site-footer { padding-block: 20px 30px; border-top: 1px solid #24333a; }
.site-footer p { color: #7f939d; font-size: 12.5px; line-height: 1.5; max-width: 760px; }
body.wide .site-footer { width: min(1520px, calc(100% - 64px)); }
@media (max-width: 760px) { body.wide .site-footer { width: calc(100% - 40px); } }
@media (max-width: 430px) { body.wide .site-footer { width: calc(100% - 32px); } }
