:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: #201d39;
  background: #f6f6fb;
  --accent: #4e40c7;
  --muted: #65637d;
  --border: #e4e3ee;
  --viewer-background: #fbfaff;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.wrap { width: min(1120px, calc(100% - 72px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.topbar { background: #fff; border-bottom: 1px solid var(--border); }
.topbar-inner { min-height: 67px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; gap: 11px; align-items: center; color: #201d39; font-size: 17px; font-weight: 750; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 24px; font-weight: 400; line-height: 1; }
.viewer-link { color: var(--muted); font-size: 14px; text-decoration: none; }
.viewer-link:hover { color: var(--accent); text-decoration: underline; }

.intro { padding: 63px 0 33px; }
.intro h1 { margin: 0; font-size: clamp(32px, 4.3vw, 54px); font-weight: 800; line-height: 1.2; letter-spacing: -.045em; }
.intro h1 span { margin-inline-start: .2em; color: var(--accent); }
.intro p { margin: 16px 0 0; color: var(--muted); font-size: 16px; line-height: 1.75; }
.workspace { display: grid; grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr); align-items: start; gap: 22px; }
.panel { min-width: 0; padding: 27px; border: 1px solid var(--border); border-radius: 22px; background: #fff; box-shadow: 0 4px 14px #25204406; }
.panel h2 { margin: 0; font-size: 20px; line-height: 1.4; }

.query-box { margin-top: 17px; background: #f9f8fd; border: 1px solid #dedceb; border-radius: 13px; }
.query-box:focus-within { border-color: #8276e0; box-shadow: 0 0 0 3px #5143c516; }
.query-box textarea { display: block; width: 100%; min-height: 135px; padding: 14px 15px 3px; border: 0; border-radius: 13px; outline: none; background: transparent; color: inherit; line-height: 1.65; resize: vertical; }
.query-box textarea::placeholder { color: #75728a; }
.query-count { padding: 6px 13px 10px; color: var(--muted); text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.query-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; margin-top: 14px; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 11px; min-height: 45px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 700; }
.primary:hover { background: #3f32ae; }
.primary:disabled { cursor: wait; background: #6559bf; }
.search-icon { position: relative; display: inline-block; width: 13px; height: 13px; margin-right: 3px; border: 1.7px solid currentColor; border-radius: 50%; }
.search-icon::after { content: ""; position: absolute; left: 9px; top: 9px; width: 6px; height: 1.7px; background: currentColor; border-radius: 2px; transform: rotate(45deg); transform-origin: left center; }
.shortcut { color: var(--muted); font-size: 12px; white-space: nowrap; }
kbd { font: inherit; border: 1px solid var(--border); border-radius: 4px; padding: 1px 4px; }

.examples { margin-top: 23px; border-top: 1px solid var(--border); padding-top: 16px; }
.examples h3 { margin: 0 0 8px; color: var(--muted); font-size: 13px; font-weight: 650; }
.example { display: flex; align-items: center; width: 100%; min-height: 39px; padding: 5px 7px 5px 0; gap: 11px; border: 0; border-radius: 8px; background: transparent; color: inherit; font-size: 14px; text-align: left; }
.example:hover { color: var(--accent); background: #f7f6ff; }
.example-type { flex: none; border-radius: 5px; padding: 2px 7px; background: #efedfc; color: #5546b4; font-size: 12px; font-weight: 650; }

.results-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.result-count { color: var(--muted); font-size: 13px; }
.structure { position: relative; display: grid; place-items: center; min-width: 0; background-color: #f5f3fd; background-image: radial-gradient(#d7d1f1 1px, transparent 1px); background-size: 16px 16px; }
.structure img { display: block; max-width: 100%; width: auto; height: auto; }
.structure-note { padding: 12px; color: var(--muted); font-size: 13px; text-align: center; }
.source-link:hover { text-decoration: underline; }
.formula { color: #493da7; font: 650 14px/1.4 Inter, system-ui, sans-serif; letter-spacing: .025em; }

.molecule-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(244px, 32vw, 335px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--viewer-background);
}
.molecule-canvas { position: absolute; inset: 0; cursor: grab; }
.molecule-canvas:active { cursor: grabbing; }
.molecule-canvas:focus-visible { outline-offset: -3px; }
.molecule-canvas.is-previewing { pointer-events: none; }
.molecule-rings { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.molecule-ring-edge, .molecule-ring { fill: none; }
.molecule-ring-edge { stroke: #fff; stroke-width: 5px; }
.molecule-ring { stroke: #2563d9; stroke-width: 2.5px; }
.molecule-empty { max-width: 32ch; margin: 16px; color: var(--muted); font-size: 14px; line-height: 1.65; text-align: center; }
.molecule-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.molecule-source { margin: 0; color: var(--muted); font-size: 14px; }
.molecule-controls { display: grid; gap: 10px; margin-top: 10px; }
.molecule-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.molecule-control-label { color: var(--muted); font-size: 14px; font-weight: 650; }
.molecule-actions .molecule-control-label { margin-inline-end: 5px; }
.molecule-electrons { display: flex; width: fit-content; align-items: center; gap: 7px; color: #443969; font-size: 14px; font-weight: 650; cursor: pointer; }
.molecule-electrons input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.molecule-electron-note { margin: -5px 0 0; color: var(--muted); font-size: 13px; }
.molecule-actions button {
  min-height: 36px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font-size: 14px;
  font-weight: 650;
}
.molecule-actions button:hover { border-color: #aaa0eb; background: #f7f5ff; }
.molecule-actions button[aria-pressed="true"] { border-color: #c8bff0; background: #efedfc; }
.molecule-actions button[aria-label] { min-width: 36px; }
.molecule-actions button:disabled { cursor: default; opacity: .65; }
.molecule-live-speed { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 9px; }
.molecule-speed { flex-wrap: nowrap; gap: 8px; min-height: 36px; }
.molecule-speed input { flex: 1; min-width: 0; height: 30px; margin: 0; accent-color: var(--accent); }
.molecule-speed output { min-width: 4ch; color: var(--accent); font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; }
.molecule-animation { min-width: 0; margin: 2px 0 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.molecule-animation summary { cursor: pointer; }
.molecule-animation summary::marker { color: var(--accent); }
.molecule-animation-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; margin-top: 10px; }
.molecule-setting { display: grid; gap: 5px; min-width: 0; }
.molecule-setting input, .molecule-setting select { width: 100%; min-width: 0; min-height: 36px; padding: 4px 7px; border: 1px solid var(--border); border-radius: 8px; color: inherit; background: #fff; font: inherit; }
.molecule-preview-actions { margin-top: 10px; }
.molecule-animation-note { margin: 0; color: var(--muted); font-size: 13px; }
#feedback { min-height: 136px; }

.feedback { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 345px; padding: 24px; border: 1px dashed #ddd8ee; border-radius: 14px; background: #f9f8fd; text-align: center; }
.feedback h3 { margin: 13px 0 0; font-size: 17px; }
.feedback p { max-width: 42ch; margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.feedback-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--accent); background: #eeebfc; font-weight: 700; }
.feedback[data-state="loading"] .feedback-icon { border: 2px solid #d8d2f6; border-top-color: var(--accent); animation: spin .85s linear infinite; }
.feedback[data-state="error"] .feedback-icon::before { content: "!"; }
.feedback[data-state="empty"] .feedback-icon::before { content: "⌬"; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .feedback[data-state="loading"] .feedback-icon { animation: none; } }

.summary { margin: 0 0 14px; padding: 13px 14px; border-radius: 9px; background: #f3f0fd; color: #423873; font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.candidate-list { display: grid; gap: 12px; }
.candidate { position: relative; display: grid; grid-template-columns: 138px minmax(0, 1fr); gap: 14px; min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.candidate:hover, .candidate:focus-within { border-color: #aaa0eb; }
.candidate-link { color: inherit; text-decoration: none; }
.candidate-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.candidate-link:hover, .candidate-link:focus-visible { color: var(--accent); text-decoration: underline; }
.candidate-structure { align-self: start; min-height: 116px; overflow: hidden; border-radius: 8px; }
.candidate h3 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.candidate-details p { margin: 6px 0 0; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.candidate-details .candidate-english { margin-top: 1px; font-size: 12px; color: var(--muted); }
.candidate-details .candidate-caveat { color: var(--muted); font-size: 13px; }
.candidate-source { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 11px; margin-top: 10px; font-size: 12px; }
.source-link { position: relative; z-index: 1; text-decoration: none; }
.detail-hint { margin-left: auto; color: var(--accent); }
.unverified { color: #805418; }
.footer { padding: 22px 0 28px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.footer a { margin-inline-start: .75em; }

@media (max-width: 820px) {
  .wrap { width: min(100% - 36px, 630px); }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .intro { padding: 38px 0 23px; }
  .shortcut { display: none; }
}

@media (max-width: 440px) {
  .topbar-inner { min-height: 56px; }
  .viewer-link { font-size: 12px; }
  .panel { padding: 17px; border-radius: 17px; }
  .molecule-actions button, .molecule-setting input, .molecule-setting select, .molecule-speed input { min-height: 42px; }
  .candidate { grid-template-columns: minmax(0, 1fr); }
  .candidate-structure { min-height: 120px; }
  .candidate-structure img { max-width: 150px; }
}
