:root {
  --ink: #13231c;
  --muted: #617068;
  --paper: #ffffff;
  --surface: #ffffff;
  --line: #d8ddd7;
  --green: #174f3a;
  --green-2: #2a7658;
  --mint: #c9e5d6;
  --lime: #ddea88;
  --rust: #b95336;
  --shadow: 0 24px 70px rgba(20, 45, 34, 0.1);
  color-scheme: light;
}

* {
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
}

button, input { font: inherit; }

.site-header {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand strong, .brand small { display: block; }
.brand strong { font-family: Arial, Helvetica, sans-serif; font-size: 18px; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; letter-spacing: .04em; }

.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  border: 1px solid var(--green);
  border-radius: 50%;
}

.brand-mark i {
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid var(--green);
  border-radius: 50%;
  background: var(--paper);
}

.brand-mark i:nth-child(1) { left: 14px; top: 4px; }
.brand-mark i:nth-child(2) { right: 5px; top: 12px; }
.brand-mark i:nth-child(3) { right: 8px; bottom: 6px; }
.brand-mark i:nth-child(4) { left: 7px; bottom: 6px; }
.brand-mark i:nth-child(5) { left: 4px; top: 12px; }
.brand-mark i:nth-child(6) { left: 14px; top: 14px; background: var(--green); }

.index-pill {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.58);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dca42f;
  box-shadow: 0 0 0 4px rgba(220,164,47,.14);
  animation: pulse 1.8s ease-in-out infinite;
}

.index-pill.ready .status-dot { background: #3a9a6e; box-shadow: 0 0 0 4px rgba(58,154,110,.14); animation: none; }
.index-pill.error .status-dot { background: var(--rust); box-shadow: 0 0 0 4px rgba(185,83,54,.14); animation: none; }

@keyframes pulse { 50% { opacity: .45; } }

.hero {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 78px 0 84px;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--green-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

h1, h2 { font-family: Arial, Helvetica, sans-serif; font-weight: 500; }

h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(40px, 5vw, 58px);
  line-height: 1;
  letter-spacing: -.035em;
}

h1 em, h2 em { color: var(--green-2); font-weight: 400; }

.hero-copy {
  max-width: 680px;
  margin: 34px 0 30px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.search-panel {
  padding: 18px;
  border: 1px solid rgba(23,79,58,.22);
  border-radius: 18px;
  background: rgba(255,254,249,.92);
  box-shadow: var(--shadow);
}

.search-mode-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #edf0eb;
}

.search-mode-tabs button {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.search-mode-tabs button[aria-selected="true"] {
  color: white;
  background: var(--green);
  box-shadow: 0 5px 14px rgba(23,79,58,.18);
}

.search-mode-panel { margin-top: 16px; }
.search-mode-panel[hidden] { display: none; }

.search-mode-panel > label,
.draw-toolbar label {
  display: block;
  margin: 0 0 9px 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.search-row { display: flex; gap: 10px; }

.search-row input {
  min-width: 0;
  flex: 1;
  padding: 18px 19px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: #fbfaf5;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}

.search-row input:focus { border-color: var(--green-2); box-shadow: 0 0 0 4px rgba(42,118,88,.1); }

.draw-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 9px;
}

.draw-toolbar label { margin-left: 3px; }
.draw-toolbar span { color: var(--muted); font-size: 11px; }

.molecule-editor {
  width: 100%;
  min-height: 422px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
}

.draw-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
  margin-top: 10px;
}

.recognized-smiles {
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfaf5;
}

.recognized-smiles span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.recognized-smiles code {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.4;
}

.recognized-smiles code.empty { color: var(--muted); }
.draw-controls .primary-search-button { min-height: 56px; }

.primary-search-button, .dialog-action {
  position: relative;
  border: 0;
  border-radius: 11px;
  background: var(--green);
  color: white;
  padding: 0 25px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .2s, background .2s;
}

.primary-search-button:hover:not(:disabled), .dialog-action:hover { transform: translateY(-1px); background: #0f3f2d; }
.primary-search-button:disabled { opacity: .48; cursor: wait; }
.primary-search-button.loading .button-label { opacity: 0; }

.button-spinner {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 19px;
  height: 19px;
  margin: -10px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.loading .button-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.search-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 10px 3px 0; }
.search-meta p { margin: 0; color: var(--muted); font-size: 11px; }
.search-meta details { color: var(--muted); font-size: 11px; }
.search-meta summary { cursor: pointer; text-align: right; }
.limit-fields { display: flex; flex-wrap: nowrap; justify-content: flex-end; gap: 9px; padding-top: 8px; }
.limit-fields label { display: grid; gap: 4px; }
.limit-fields input, .limit-fields select { width: 108px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); }
.limit-fields select { width: 166px; }

.examples { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 12px; }
.example-chip { max-width: 330px; border: 1px solid var(--line); border-radius: 999px; background: transparent; padding: 6px 10px; color: var(--muted); font-size: 10px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.example-chip:hover { color: var(--green); border-color: var(--green); }

.hero-stats {
  margin-top: 42px;
  padding-top: 25px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.hero-stats div { display: flex; align-items: baseline; gap: 8px; }
.hero-stats strong { font-family: Arial, Helvetica, sans-serif; font-size: 27px; font-weight: 500; }
.hero-stats span { color: var(--muted); font-size: 12px; }

.results-shell {
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto 80px;
  padding: 42px 0;
  background: #ffffff;
}

.results-heading { width: min(1180px, calc(100% - 32px)); margin: 0 auto 22px; display: flex; justify-content: space-between; gap: 24px; align-items: end; }
.results-heading h2 { margin: 0; font-size: clamp(29px, 3.5vw, 42px); line-height: 1.05; letter-spacing: -.025em; }
.query-summary { max-width: 440px; text-align: right; color: var(--muted); font-size: 12px; line-height: 1.6; }
.query-summary code { display: block; color: var(--ink); overflow-wrap: anywhere; }

.results-note { width: min(1180px, calc(100% - 32px)); margin: 0 auto 14px; padding: 11px 13px; border-radius: 8px; background: rgba(201,229,214,.44); color: var(--green); font-size: 12px; }
.results-note span { margin-right: 7px; }
.results-actions { width: min(1180px, calc(100% - 32px)); margin: 0 auto 9px; text-align: right; }
.results-actions[hidden] { display: none; }
.results-actions button { padding: 9px 14px; border: 1px solid var(--green); border-radius: 8px; background: #ffffff; color: var(--green); font-size: 11px; font-weight: 750; cursor: pointer; }
.results-actions button:hover, .results-actions button:focus-visible { background: var(--green); color: #ffffff; }

.fuzzy-comparison {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 18px;
  padding: 22px;
  border: 1px solid rgba(23,79,58,.22);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 12px 36px rgba(20,45,34,.06);
}

.fuzzy-comparison[hidden] { display: none; }
.fuzzy-comparison > header { margin-bottom: 18px; }
.fuzzy-comparison > header h3 { margin: 0 0 5px; font-family: Arial, Helvetica, sans-serif; font-size: 22px; font-weight: 500; }
.fuzzy-comparison > header p { margin: 0; color: var(--muted); font-size: 10px; }
.fuzzy-auto-layout { display: grid; grid-template-columns: minmax(0, 1fr) 130px minmax(0, 1fr); gap: 18px; align-items: center; }
.fuzzy-selection-layout { display: grid; grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); gap: 20px; align-items: start; }

.match-molecule-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.match-molecule-card > .structure-display { width: 100%; height: 220px; }
.match-card-label { margin: 0; color: var(--green-2); font-size: 9px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.match-smiles-row { margin-top: 10px; }
.match-smiles-row span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.match-smiles-row code { display: block; overflow-wrap: anywhere; font-size: 10px; line-height: 1.45; }
.candidate-card-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 8px; }
.similarity-badge { padding: 4px 8px; border-radius: 999px; background: var(--mint); color: var(--green); font-size: 11px; }
.candidate-meta { margin: 8px 0 0; color: var(--muted); font-size: 9px; }
.candidate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; max-height: 820px; overflow: auto; padding-right: 4px; }
.candidate-card.selectable { width: 100%; user-select: text; }
.candidate-action { display: block; width: 100%; margin-top: 11px; padding: 9px 11px; border: 0; border-radius: 8px; background: var(--green); color: white; font-size: 10px; font-weight: 800; cursor: pointer; transition: background .18s, transform .18s; }
.candidate-action:hover { background: #0f3f2d; transform: translateY(-1px); }
.candidate-action:focus-visible { outline: 3px solid rgba(42,118,88,.2); outline-offset: 2px; }
.similarity-connector { text-align: center; color: var(--muted); }
.similarity-connector span { display: block; font-size: 8px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.similarity-connector strong { display: block; margin-top: 5px; color: var(--green); font-family: Arial, Helvetica, sans-serif; font-size: 23px; font-weight: 500; }
.similarity-connector i { display: block; margin-top: 3px; color: var(--green-2); font-size: 28px; font-style: normal; }

.path-card {
  margin: 14px 0 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 10px 35px rgba(20,45,34,.06);
}

.path-card-header { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 17px 22px; border-bottom: 1px solid var(--line); background: #ffffff; }
.rank { display: flex; gap: 12px; align-items: center; }
.rank-badge { min-width: 43px; height: 43px; padding: 0 8px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: white; font-family: Arial, Helvetica, sans-serif; font-size: 17px; }
.rank h3 { margin: 0 0 3px; font-family: Arial, Helvetica, sans-serif; font-weight: 500; font-size: 19px; }
.rank p { margin: 0; color: var(--muted); font-size: 11px; }
.metrics { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px 22px; }
.metric { text-align: right; }
.metric strong { display: block; font-family: Arial, Helvetica, sans-serif; font-size: 18px; font-weight: 500; }
.metric span { color: var(--muted); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }

.equivalent-paths { border-top: 1px solid var(--line); background: #ffffff; }
.equivalent-paths > summary { padding: 15px 22px; color: var(--green); font-size: 12px; font-weight: 800; cursor: pointer; user-select: none; }
.equivalent-paths > summary:hover { background: rgba(201,229,214,.32); }
.equivalent-paths > p { margin: 0; padding: 0 22px 14px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.equivalent-path-list { padding: 0 16px 4px; }
.equivalent-path-card { margin: 0 0 16px; box-shadow: none; background: #ffffff; }
.equivalent-path-card .rank-badge { min-width: 50px; border-radius: 999px; font-size: 14px; }

.path-scroll { overflow-x: auto; padding: 26px 24px 30px; scrollbar-color: var(--green-2) #edf0eb; background: #ffffff; }
.path-flow { min-width: max-content; display: flex; align-items: flex-start; background: #ffffff; }

.molecule-node { width: 228px; flex: 0 0 228px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #ffffff; }
.molecule-image { height: 188px; display: grid; place-items: center; border-radius: 8px; background: white; overflow: hidden; }
.molecule-image img { width: 100%; height: 100%; object-fit: contain; }
.node-data { margin-top: 11px; display: grid; gap: 8px; }
.node-row { min-width: 0; }
.node-row span { display: block; margin-bottom: 2px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.node-row code, .node-row strong { display: block; color: var(--ink); font-size: 11px; font-weight: 600; }
.node-row code { line-height: 1.35; overflow-wrap: anywhere; }
.node-id { display: inline-flex !important; width: auto; padding: 3px 7px; border-radius: 999px; background: var(--mint); color: var(--green) !important; }

.reaction-edge { position: relative; width: 214px; flex: 0 0 214px; height: 300px; }
.arrow-line { position: absolute; left: 20px; right: 20px; top: 146px; height: 1px; background: var(--green-2); }
.arrow-line::after { content: ""; position: absolute; right: -1px; top: -4px; width: 8px; height: 8px; border-top: 1px solid var(--green-2); border-right: 1px solid var(--green-2); transform: rotate(45deg); }
.edge-top, .edge-bottom { position: absolute; left: 8px; right: 8px; text-align: center; }
.edge-top { bottom: 164px; }
.edge-bottom { top: 160px; }
.edge-top strong { display: block; font-size: 10px; line-height: 1.35; overflow-wrap: anywhere; }
.edge-top span { display: block; margin-top: 4px; color: var(--rust); font-family: Arial, Helvetica, sans-serif; font-size: 14px; }
.edge-bottom strong { display: inline-block; padding: 4px 8px; border-radius: 999px; background: #edf0eb; color: var(--green); font-size: 10px; }

.reaction-type-label {
  position: relative;
  z-index: 4;
  cursor: help;
  outline: none;
}

.reaction-type-label::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  width: max-content;
  max-width: min(280px, 70vw);
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--ink);
  color: white;
  box-shadow: 0 10px 28px rgba(13,29,23,.2);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 4px);
  transition: opacity .16s, transform .16s, visibility .16s;
  pointer-events: none;
}

.reaction-type-label::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  border: 5px solid transparent;
  border-top-color: var(--ink);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%);
  transition: opacity .16s, visibility .16s;
}

.reaction-type-label:hover::after,
.reaction-type-label:focus-visible::after,
.reaction-type-label:hover::before,
.reaction-type-label:focus-visible::before {
  opacity: 1;
  visibility: visible;
}

.reaction-type-label:hover::after,
.reaction-type-label:focus-visible::after {
  transform: translate(-50%, 0);
}

.reaction-type-label:focus-visible {
  box-shadow: 0 0 0 3px rgba(42,118,88,.18);
}
.edge-bottom span { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.unknown-energy { color: var(--rust) !important; }

.empty-state { padding: 42px; text-align: center; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.empty-state h3 { margin: 0 0 8px; font-family: Arial, Helvetica, sans-serif; font-size: 24px; font-weight: 500; }
.empty-state p { margin: 0; color: var(--muted); }

.method { width: min(1180px, calc(100% - 48px)); margin: 0 auto 100px; padding-top: 70px; border-top: 1px solid var(--line); display: grid; grid-template-columns: .85fr 1.15fr; gap: 80px; }
.method h2 { margin: 0; font-size: clamp(29px, 3.5vw, 42px); line-height: 1.04; letter-spacing: -.025em; }
.method ol { list-style: none; margin: 0; padding: 0; }
.method li { padding: 20px 0; display: grid; grid-template-columns: 54px 1fr; border-top: 1px solid var(--line); }
.method li:last-child { border-bottom: 1px solid var(--line); }
.method li > span { color: var(--green-2); font-family: Arial, Helvetica, sans-serif; }
.method li p { margin: 0; color: var(--muted); line-height: 1.55; }
.method li strong { display: block; margin-bottom: 4px; color: var(--ink); }

footer { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); display: flex; justify-content: space-between; font-size: 11px; }

.error-dialog { width: min(480px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 18px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 90px rgba(8,30,21,.28); }
.error-dialog::backdrop { background: rgba(13,29,23,.55); backdrop-filter: blur(4px); }
.error-dialog form { position: relative; padding: 38px; }
.dialog-close { position: absolute; right: 17px; top: 13px; border: 0; background: none; color: var(--muted); font-size: 25px; cursor: pointer; }
.dialog-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 22px; border-radius: 50%; background: #f3d8cf; color: var(--rust); font-family: Arial, Helvetica, sans-serif; font-size: 22px; }
.error-dialog h2 { margin: 0 0 14px; font-size: 26px; }
.error-dialog #errorMessage { margin: 0 0 26px; color: var(--muted); line-height: 1.55; }
.error-dialog .error-help { margin: -14px 0 26px; padding: 10px 12px; border-radius: 8px; background: #f4efe3; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.dialog-action, .dialog-fuzzy-action { min-height: 44px; padding: 10px 17px; }
.dialog-fuzzy-action { border: 0; border-radius: 11px; background: var(--green); color: white; font-weight: 750; cursor: pointer; }
.dialog-action { border: 1px solid var(--line); background: transparent; color: var(--ink); }
.dialog-action:hover { background: #edf0eb; color: var(--ink); transform: none; }
.dialog-fuzzy-action:hover { background: #0f3f2d; }

.pdf-export-dialog { width: min(520px, calc(100% - 28px)); border: 0; border-radius: 16px; padding: 0; color: var(--ink); background: #ffffff; box-shadow: 0 30px 90px rgba(8,30,21,.28); }
.pdf-export-dialog::backdrop { background: rgba(13,29,23,.55); }
.pdf-export-dialog form { position: relative; padding: 30px; }
.pdf-export-dialog h2 { margin: 0 0 18px; font-size: 22px; }
.pdf-count-label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; }
.pdf-count-label input { width: 130px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; }
.pdf-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 14px; margin: 18px 0 12px; padding: 15px; border: 1px solid var(--line); border-radius: 9px; }
.pdf-fields legend { padding: 0 5px; font-size: 12px; font-weight: 700; }
.pdf-fields label { font-size: 11px; }
.pdf-export-dialog #pdfExportStatus { min-height: 17px; color: var(--muted); font-size: 11px; }
.validation-warning-panel { margin-top: 13px; padding: 13px 15px; border-left: 4px solid var(--rust); border-radius: 8px; background: #f8eee9; color: var(--ink); }
.validation-warning-panel strong { display: block; font-size: 11px; }
.validation-warning-panel ul { margin: 7px 0; padding-left: 18px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.validation-warning-panel p { margin: 0; color: var(--rust); font-size: 11px; font-weight: 750; line-height: 1.45; }

.structure-image-button {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  place-items: stretch;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: zoom-in;
}

.structure-display { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; }
.structure-display > .structure-image-button { min-height: 0; }
.structure-image-controls { display: flex; align-items: center; justify-content: flex-end; gap: 7px; min-height: 29px; }
.structure-pubchem-link { display: inline-flex; align-items: center; padding: 5px 8px; border: 1px solid rgba(23,79,58,.18); border-radius: 999px; color: var(--green); background: white; font-size: 9px; font-weight: 800; text-decoration: none; }
.structure-pubchem-link:hover, .structure-pubchem-link:focus-visible { color: #ffffff; background: var(--green); }

.structure-image-button img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  background: #ffffff;
}

.structure-image-button:focus-visible {
  outline: 3px solid rgba(42,118,88,.28);
  outline-offset: 3px;
}

.structure-3d-hint {
  position: static;
  justify-self: end;
  margin: 0;
  padding: 5px 8px;
  border: 1px solid rgba(23,79,58,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
}

.structure-3d-dialog {
  width: min(820px, calc(100% - 30px));
  max-height: calc(100vh - 30px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(8,30,21,.3);
}

.structure-3d-dialog::backdrop {
  background: rgba(13,29,23,.58);
  backdrop-filter: blur(4px);
}

.structure-3d-shell {
  display: grid;
  max-height: calc(100vh - 30px);
  overflow: auto;
  background: #ffffff;
}

.structure-3d-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.structure-3d-header .eyebrow { margin-bottom: 6px; }
.structure-3d-header h2 { margin: 0; font-size: 24px; line-height: 1.15; }
.structure-3d-context { margin: 5px 0 0; color: var(--muted); font-size: 11px; }

.structure-3d-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #ffffff;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.structure-3d-close:hover,
.structure-3d-close:focus-visible {
  border-color: var(--green-2);
  color: var(--green);
  outline: none;
}

.structure-3d-stage {
  position: relative;
  min-height: 390px;
  height: min(54vh, 520px);
  overflow: hidden;
  background: #ffffff;
  touch-action: none;
}

#structure3dCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #ffffff;
  cursor: grab;
}

#structure3dCanvas.dragging { cursor: grabbing; }

.structure-3d-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 11px;
  padding: 30px;
  background: rgba(255,255,255,.94);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.structure-3d-status[hidden] { display: none; }

.structure-3d-status.error {
  color: var(--rust);
}

.structure-3d-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(42,118,88,.18);
  border-top-color: var(--green-2);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.structure-3d-status.error .structure-3d-spinner { display: none; }

.structure-3d-meta {
  padding: 14px 24px 12px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.structure-3d-meta > span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.structure-3d-meta code {
  display: block;
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.45;
}

.structure-3d-meta p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.structure-3d-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.structure-3d-controls > span { color: var(--muted); font-size: 10px; }
.structure-3d-controls > div { display: flex; flex-wrap: wrap; gap: 7px; }

.structure-3d-controls button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.structure-3d-controls button:hover,
.structure-3d-controls button:focus-visible {
  border-color: var(--green-2);
  color: var(--green);
  outline: none;
}

.structure-3d-controls .structure-3d-done {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.structure-3d-disclaimer {
  margin: 0;
  padding: 0 24px 18px;
  background: #ffffff;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .site-header, .hero, .method, footer { width: min(100% - 28px, 1180px); }
  .site-header { align-items: flex-start; }
  .brand small { display: none; }
  .index-pill { max-width: 155px; }
  h1 { font-size: clamp(36px, 10vw, 48px); }
  .hero { padding: 48px 0 64px; }
  .search-row { flex-direction: column; }
  .primary-search-button { min-height: 52px; }
  .search-mode-tabs { display: flex; width: 100%; }
  .search-mode-tabs button { flex: 1; }
  .draw-toolbar { align-items: flex-start; flex-direction: column; }
  .draw-controls { grid-template-columns: 1fr; }
  .molecule-editor { min-height: 382px; }
  .search-meta { flex-direction: column; }
  .search-meta summary { text-align: left; }
  .limit-fields { justify-content: flex-start; flex-wrap: wrap; }
  .limit-fields select { width: 166px; }
  .pdf-fields { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: 1fr 1fr; gap: 18px; }
  .results-heading { display: block; }
  .query-summary { margin-top: 16px; text-align: left; }
  .fuzzy-auto-layout, .fuzzy-selection-layout { grid-template-columns: 1fr; }
  .similarity-connector i { transform: rotate(90deg); }
  .candidate-grid { grid-template-columns: 1fr; max-height: none; }
  .path-card-header { align-items: flex-start; flex-direction: column; }
  .metrics { width: 100%; justify-content: space-between; }
  .metric { text-align: left; }
  .method { grid-template-columns: 1fr; gap: 42px; }
  footer { display: grid; gap: 7px; }
  .structure-3d-stage { min-height: 310px; height: 48vh; }
  .structure-3d-header { padding: 18px 17px 12px; }
  .structure-3d-meta { padding: 12px 17px 10px; }
  .structure-3d-controls { align-items: flex-start; flex-direction: column; padding: 10px 17px; }
  .structure-3d-controls > div { width: 100%; }
  .structure-3d-controls button { flex: 1; }
  .structure-3d-disclaimer { padding: 0 17px 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

