:root {
  color-scheme: light;
  --ink: #172522;
  --ink-soft: #3d4d49;
  --muted: #5f6f6a;
  --muted-2: #7c8985;
  --line: #dfe5df;
  --line-strong: #cfd8d1;
  --paper: #f2f3ed;
  --panel: #ffffff;
  --canvas: #fafbf7;
  --teal: #087d70;
  --teal-deep: #05655b;
  --teal-soft: #dff2ed;
  --mint: #a9d9cd;
  --coral: #df6b52;
  --coral-soft: #fae7e1;
  --amber: #d49b2d;
  --amber-soft: #f7edcf;
  --blue: #2d6fa3;
  --shadow: 0 18px 50px rgba(24, 48, 41, 0.08);
  --shadow-soft: 0 8px 24px rgba(24, 48, 41, 0.07);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

button,
textarea,
select,
input {
  font: inherit;
}

button,
select,
input[type="range"] {
  cursor: pointer;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
select:focus-visible,
input:focus-visible,
canvas:focus-visible {
  outline: 3px solid rgba(8, 125, 112, 0.2);
  outline-offset: 2px;
}

svg {
  display: block;
}

.app-shell {
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr);
  width: 100%;
  height: 100%;
}

.topbar {
  z-index: 20;
  display: grid;
  grid-template-columns: 270px minmax(420px, 1fr) max-content;
  align-items: center;
  min-height: 72px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 7px 15px rgba(23, 37, 34, 0.18);
}

.brand-mark svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.brand strong {
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.3px;
}

.brand small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.16em;
}

.view-tabs {
  display: flex;
  justify-self: center;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f6f7f3;
}

.view-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 650;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.view-tab svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view-tab.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 3px 12px rgba(25, 49, 43, 0.08);
}

.top-actions {
  display: flex;
  justify-self: end;
  align-items: center;
  gap: 9px;
}

.icon-button,
.export-button,
.tool-button,
.text-icon-button,
.play-button,
.reset-button {
  border: 0;
  background: transparent;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.export-button {
  display: flex;
  align-items: center;
  height: 41px;
  gap: 8px;
  padding: 0 15px;
  border-radius: 11px;
  color: #fff;
  background: var(--teal);
  box-shadow: 0 7px 17px rgba(8, 125, 112, 0.2);
  font-size: 13px;
  font-weight: 700;
  transition: transform 150ms ease, background 150ms ease;
}

.export-button:hover {
  background: var(--teal-deep);
  transform: translateY(-1px);
}

.export-button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.export-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace-layout {
  display: grid;
  grid-template-columns: 270px minmax(680px, 1fr) 236px;
  min-height: 0;
}

.left-panel,
.right-panel,
.main-content {
  min-height: 0;
  overflow: auto;
}

.left-panel,
.right-panel {
  background: rgba(255, 255, 255, 0.88);
}

.left-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.right-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
}

.panel-section {
  padding: 21px 19px;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.text-icon-button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  color: var(--muted);
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.text-icon-button:hover {
  background: var(--paper);
}

.text-icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reaction-card-list {
  display: grid;
  max-height: min(34vh, 280px);
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 3px;
  scrollbar-color: #c4d2cc transparent;
  scrollbar-width: thin;
}

.reaction-library.is-collapsed .reaction-card-list {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.reaction-library.is-collapsed .reaction-card:not(.active) {
  display: none;
}

.reaction-library.is-collapsed .text-icon-button svg {
  transform: rotate(0deg);
}

.reaction-library:not(.is-collapsed) .text-icon-button svg {
  transform: rotate(180deg);
}

.reaction-card {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: start;
  width: 100%;
  gap: 8px;
  padding: 13px 12px;
  border: 1px solid transparent;
  border-radius: 13px;
  text-align: left;
  background: transparent;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.reaction-card + .reaction-card {
  margin-top: 6px;
}

.reaction-card:hover {
  background: #f7f8f4;
  transform: translateX(2px);
}

.reaction-card.active {
  border-color: #bcded6;
  background: var(--teal-soft);
}

.reaction-index {
  color: var(--muted-2);
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
}

.reaction-card.active .reaction-index {
  color: var(--teal);
}

.reaction-card-content {
  min-width: 0;
}

.reaction-card-content strong,
.reaction-card-content small {
  display: block;
}

.reaction-card-content strong {
  overflow: hidden;
  font-size: 13px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reaction-card-content small {
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reaction-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 9px;
}

.reaction-tags i {
  padding: 3px 6px;
  border: 1px solid rgba(8, 125, 112, 0.14);
  border-radius: 5px;
  color: var(--teal-deep);
  background: rgba(255, 255, 255, 0.55);
  font-size: 9px;
  font-style: normal;
  font-weight: 650;
}

.format-badge {
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--teal-deep);
  background: var(--teal-soft);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.ai-dialogue {
  display: flex;
  flex: 1;
  min-height: 350px;
  flex-direction: column;
  background:
    radial-gradient(circle at 100% 0, rgba(8, 125, 112, 0.08), transparent 36%),
    rgba(255, 255, 255, 0.64);
}

.ai-dialogue-heading {
  gap: 8px;
}

.ai-heading-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.clear-chat-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  appearance: none;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.7);
  line-height: 0;
  vertical-align: middle;
  transition: color 150ms ease, background 150ms ease;
}

.clear-chat-button:hover {
  color: var(--coral);
  background: var(--coral-soft);
}

.clear-chat-button svg {
  display: block;
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  margin: 0;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid #d9ded9;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: none;
}

.ai-status-badge i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a7b0ac;
}

.ai-status-badge.is-connected {
  border-color: #badbd3;
  color: var(--teal-deep);
  background: var(--teal-soft);
}

.ai-status-badge.is-connected i {
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 125, 112, 0.1);
}

.assistant-context {
  display: flex;
  align-items: center;
  min-height: 29px;
  gap: 6px;
  margin: -3px 0 11px;
  padding: 0 9px;
  overflow: hidden;
  border: 1px solid rgba(8, 125, 112, 0.13);
  border-radius: 8px;
  color: var(--teal-deep);
  background: rgba(223, 242, 237, 0.55);
  font-size: 9px;
}

.assistant-context svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assistant-context span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-messages {
  display: flex;
  min-height: 158px;
  max-height: min(34vh, 300px);
  flex: 1;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 2px 3px 13px;
  scrollbar-width: thin;
  scrollbar-color: #ced8d2 transparent;
}

.assistant-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.assistant-message.is-user {
  justify-content: flex-end;
}

.assistant-message > div {
  max-width: calc(100% - 34px);
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 4px 12px 12px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 5px 16px rgba(38, 56, 51, 0.035);
}

.assistant-message.is-user > div {
  border-color: #b8ddd4;
  border-radius: 12px 4px 12px 12px;
  color: var(--teal-deep);
  background: var(--teal-soft);
}

.assistant-message.is-error > div {
  border-color: #ebc3b8;
  color: #9f4936;
  background: #fff7f4;
}

.assistant-message.is-wrong-answer > div,
.assistant-message.is-wrong-answer strong {
  color: #c43f32;
}

.assistant-message strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 10px;
}

.assistant-message p,
.assistant-copy {
  margin: 0;
  font-size: 10px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.assistant-copy p + p,
.assistant-copy ul + p,
.assistant-copy ol + p {
  margin-top: 6px;
}

.assistant-copy ul,
.assistant-copy ol {
  margin: 4px 0 0;
  padding-left: 17px;
}

.assistant-copy li + li {
  margin-top: 3px;
}

.assistant-copy strong {
  display: inline;
  margin: 0;
  color: inherit;
  font-size: inherit;
}

.assistant-copy code {
  padding: 1px 4px;
  border-radius: 4px;
  color: var(--teal-deep);
  background: rgba(8, 125, 112, 0.08);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.94em;
}

.assistant-markdown-heading {
  color: var(--ink);
  font-weight: 750;
}

.assistant-avatar {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  place-items: center;
  border-radius: 8px;
  color: var(--teal-deep);
  background: var(--teal-soft);
}

.assistant-avatar svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.assistant-message.is-pending .assistant-copy::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 4px;
  margin-left: 5px;
  border-radius: 4px;
  background: linear-gradient(90deg, #a9b5b0 20%, transparent 20% 40%, #a9b5b0 40% 60%, transparent 60% 80%, #a9b5b0 80%);
  animation: assistant-pulse 900ms ease-in-out infinite;
}

@keyframes assistant-pulse {
  50% { opacity: 0.35; }
}

.assistant-suggestions {
  display: flex;
  gap: 6px;
  margin: 0 0 12px;
  overflow-x: auto;
  padding: 1px 1px 4px;
  scrollbar-width: none;
}

.assistant-suggestions::-webkit-scrollbar {
  display: none;
}

.assistant-suggestions button {
  min-height: 27px;
  flex: 0 0 auto;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.86);
  font-size: 8px;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.assistant-suggestions button:hover {
  border-color: #b8d9d2;
  color: var(--teal-deep);
  background: var(--teal-soft);
}

.assistant-suggestions button:disabled {
  cursor: wait;
  opacity: 0.48;
}

.assistant-composer {
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.assistant-composer > label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
}

.assistant-input-wrap {
  position: relative;
}

.assistant-input-wrap textarea {
  display: block;
  width: 100%;
  min-height: 88px;
  resize: vertical;
  padding: 11px 42px 11px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(251, 252, 249, 0.96);
  font: inherit;
  font-size: 11px;
  line-height: 1.55;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.assistant-input-wrap textarea::placeholder {
  color: #9aa5a1;
}

.assistant-input-wrap textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 125, 112, 0.09);
  outline: 0;
}

.assistant-input-wrap button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--ink);
  transition: background 150ms ease, transform 150ms ease;
}

.assistant-input-wrap button:hover {
  background: var(--teal-deep);
  transform: translateY(-1px);
}

.assistant-input-wrap button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.assistant-input-wrap button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assistant-composer-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted-2);
  font-size: 8px;
}

.assistant-composer-meta kbd {
  font: inherit;
}

.smiles-field {
  position: relative;
  display: block;
}

.smiles-field textarea {
  display: block;
  width: 100%;
  min-height: 68px;
  resize: vertical;
  padding: 11px 34px 11px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  background: #fbfcf9;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.55;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.smiles-field textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 125, 112, 0.09);
  outline: 0;
}

.smiles-field.invalid textarea {
  border-color: var(--coral);
}

.smiles-field button {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: var(--muted-2);
  background: transparent;
}

.smiles-field button:hover {
  color: var(--ink);
  background: var(--paper);
}

.smiles-field button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.field-status {
  display: flex;
  align-items: center;
  min-height: 29px;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.status-dot,
.offline-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 125, 112, 0.1);
}

.field-status.error {
  color: var(--coral);
}

.field-status.error .status-dot {
  background: var(--coral);
  box-shadow: 0 0 0 3px rgba(223, 107, 82, 0.12);
}

.preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-list button {
  height: 27px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink-soft);
  background: #fff;
  font-size: 10px;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.preset-list button:hover {
  border-color: #b8d9d2;
  color: var(--teal-deep);
  background: var(--teal-soft);
}

.molecule-preview-wrap {
  position: relative;
  height: 128px;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background-color: var(--canvas);
  background-image: radial-gradient(circle, #d9dfd9 0.8px, transparent 0.8px);
  background-size: 13px 13px;
}

#moleculePreview,
#reactionCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.preview-caption {
  position: absolute;
  right: 7px;
  bottom: 7px;
  max-width: calc(100% - 14px);
  overflow: hidden;
  padding: 4px 7px;
  border: 1px solid rgba(207, 216, 209, 0.7);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.87);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(5px);
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 39px;
  gap: 7px;
  margin-top: 10px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--ink);
  font-size: 12px;
  font-weight: 700;
  transition: background 150ms ease, transform 150ms ease;
}

.primary-button:hover {
  background: var(--teal-deep);
  transform: translateY(-1px);
}

.primary-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 15px 20px;
  color: var(--muted-2);
  font-size: 9px;
}

.offline-dot {
  width: 5px;
  height: 5px;
  box-shadow: none;
}

.main-content {
  padding: 23px clamp(14px, 1.55vw, 24px) 28px;
  background:
    radial-gradient(circle at 86% 8%, rgba(190, 220, 210, 0.22), transparent 24%),
    var(--paper);
}

.content-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 15px;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.content-header h1 {
  margin: 0;
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  font-size: clamp(25px, 2.2vw, 33px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.content-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.header-badges {
  display: flex;
  flex: none;
  gap: 8px;
  padding-bottom: 2px;
}

.header-badges > span {
  display: flex;
  align-items: center;
  height: 29px;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
  font-size: 9px;
  font-weight: 650;
}

.bond-swatch {
  display: inline-block;
  width: 15px;
  height: 0;
  border-top: 2px solid;
}

.bond-swatch.broken {
  border-color: var(--coral);
  border-top-style: dashed;
}

.bond-swatch.forming {
  border-color: var(--teal);
}

.stage-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  gap: 12px;
  padding: 7px 13px 7px 17px;
  border-bottom: 1px solid var(--line);
}

.stage-status {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.stage-status-copy {
  display: block;
  min-width: 0;
  flex: 1;
}

#stageStatusText {
  display: block;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#stageStatusText[hidden] {
  display: none;
}


@keyframes breathe {
  50% {
    box-shadow: 0 0 0 6px rgba(8, 125, 112, 0.04);
  }
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 13px;
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.toggle-control em {
  font-style: normal;
}

.toggle-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-control > span {
  position: relative;
  width: 26px;
  height: 15px;
  border-radius: 99px;
  background: #cdd5d0;
  transition: background 150ms ease;
}

.toggle-control > span::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: transform 150ms ease;
  content: "";
}

.toggle-control input:checked + span {
  background: var(--teal);
}

.toggle-control input:checked + span::after {
  transform: translateX(11px);
}

.toggle-control:has(input:focus-visible) > span {
  outline: 3px solid rgba(8, 125, 112, 0.22);
  outline-offset: 2px;
}

.tool-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.tool-button:hover {
  color: var(--teal);
  background: var(--teal-soft);
}

.tool-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.inspector-toggle {
  display: none;
}

.canvas-wrap {
  position: relative;
  height: clamp(360px, 52vh, 520px);
  min-height: 350px;
  overflow: hidden;
  background-color: var(--canvas);
  background-image:
    linear-gradient(rgba(24, 56, 47, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 56, 47, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
}

.canvas-wrap::before,
.canvas-wrap::after {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
  content: "";
}

.canvas-wrap::before {
  top: -100px;
  left: -80px;
  width: 270px;
  height: 270px;
  background: radial-gradient(circle, rgba(169, 217, 205, 0.17), transparent 68%);
}

.canvas-wrap::after {
  right: -95px;
  bottom: -100px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(247, 237, 207, 0.28), transparent 68%);
}

#reactionCanvas {
  position: relative;
  z-index: 1;
  cursor: grab;
}

#reactionCanvas.dragging {
  cursor: grabbing;
}

.canvas-fullscreen-button {
  position: absolute;
  z-index: 7;
  top: 14px;
  right: 14px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(207, 216, 209, 0.95);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 7px 20px rgba(23, 37, 34, 0.1);
  backdrop-filter: blur(9px);
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.canvas-fullscreen-button[hidden] {
  display: none;
}

.canvas-fullscreen-button:hover {
  color: var(--teal);
  background: var(--teal-soft);
  transform: translateY(-1px);
}

.canvas-fullscreen-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.canvas-fullscreen-button .fullscreen-exit-icon {
  display: none;
}

.canvas-fullscreen-button.is-active .fullscreen-enter-icon {
  display: none;
}

.canvas-fullscreen-button.is-active .fullscreen-exit-icon {
  display: block;
}

.stage-card:fullscreen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--panel);
}

.stage-card:fullscreen .canvas-wrap {
  width: 100%;
  height: auto;
  min-height: 0;
  background-color: var(--canvas);
}

.stage-card:fullscreen .editor-tools-top {
  right: 78px;
}

.stage-card:fullscreen .workspace-controls {
  display: flex;
  min-height: 72px;
  padding-right: 20px;
  padding-left: 20px;
}

.stage-card:fullscreen .reaction-capture-flow {
  flex-wrap: wrap;
}

/* 浏览器全屏时避免默认黑色背景从边缘露出。 */
.stage-card:fullscreen::backdrop {
  background: var(--panel);
}

/*
 * 编辑器工具分为两个明确区域：
 * 1. 上方仅保留原子、化学键和常见有机结构等“结构骨架”工具；
 * 2. 右侧放置选择、断键、擦除、撤销、缩放和画布管理工具。
 * 外层只负责统一显隐，不拦截画布指针事件。
 */
.editor-tools {
  position: absolute;
  z-index: 6;
  inset: 0;
  pointer-events: none;
}

.editor-tools-top,
.editor-tools-side {
  position: absolute;
  display: flex;
  align-items: center;
  border: 1px solid rgba(207, 216, 209, 0.92);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 25px rgba(23, 37, 34, 0.1);
  backdrop-filter: blur(9px);
  pointer-events: auto;
}

.editor-tools-top {
  top: 12px;
  right: 66px;
  left: 12px;
  min-width: 0;
  gap: 5px;
  padding: 5px 7px;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(8, 125, 112, 0.28) transparent;
}

.editor-tools-top::-webkit-scrollbar {
  height: 4px;
}

.editor-tools-top::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(8, 125, 112, 0.24);
}

.editor-tools-side {
  top: 62px;
  right: 12px;
  bottom: 12px;
  width: 46px;
  min-height: 0;
  flex-direction: column;
  gap: 1px;
  padding: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 12px;
  scrollbar-width: none;
}

.editor-tools-side::-webkit-scrollbar {
  display: none;
}

.editor-tool-group {
  display: flex;
  min-width: 0;
  flex: none;
  align-items: center;
  gap: 3px;
}

.editor-tools-top > i {
  width: 1px;
  height: 25px;
  flex: none;
  margin: 0 1px;
  background: var(--line);
}

.editor-tools-side > i {
  width: 24px;
  height: 1px;
  flex: none;
  margin: 0;
  background: var(--line);
}

.editor-tool {
  display: grid;
  min-width: 36px;
  height: 40px;
  padding: 3px 5px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 8px;
  line-height: 1;
  flex: none;
}

.editor-tools-side .editor-tool {
  width: 34px;
  min-width: 34px;
  height: 29px;
  padding: 2px;
}

.editor-tools-side .editor-tool span {
  display: none;
}

.editor-tools-side .editor-tool svg {
  width: 15px;
  height: 15px;
}

.editor-tool svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.editor-tool span {
  display: block;
  margin-top: 2px;
}

.editor-tool strong {
  display: block;
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  font-size: 17px;
  line-height: 15px;
}

.editor-tool:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.editor-tool:hover,
.editor-tool.active {
  color: var(--teal-deep);
  background: var(--teal-soft);
}

.zoom-tool:not(:disabled):active {
  transform: scale(0.94);
}

.zoom-tool:disabled {
  opacity: 0.25;
}

.break-bond-tool:hover,
.break-bond-tool.active,
.erase-tool:hover,
.erase-tool.active {
  color: #b84a33;
  background: var(--coral-soft);
}

.clear-workspace-tool:hover:not(:disabled) {
  color: #b84a33;
  background: var(--coral-soft);
}

.atom-tools,
.atom-structure-group {
  display: flex;
  flex: none;
  align-items: center;
}

.atom-tool {
  width: 38px;
  height: 31px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--atom-color, var(--ink-soft));
  background: #fff;
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  font-size: 13px;
  font-weight: 750;
}

.quick-atom-tool[data-element="H"] { --atom-color: #78847f; }
.quick-atom-tool[data-element="C"] { --atom-color: #263633; }
.quick-atom-tool[data-element="N"] { --atom-color: #2d6fa3; }
.quick-atom-tool[data-element="F"],
.quick-atom-tool[data-element="Cl"] { --atom-color: #31806b; }
.quick-atom-tool[data-element="Br"] { --atom-color: #8e553f; }

.atom-tool:hover,
.atom-tool.active {
  border-color: var(--teal);
  color: #fff;
  background: var(--ink);
  box-shadow: 0 3px 10px rgba(23, 37, 34, 0.14);
}

.current-atom-tool {
  flex: none;
}

.element-picker-trigger {
  display: inline-flex;
  width: 112px;
  height: 31px;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  background: #fff;
  font-size: 10px;
  font-weight: 700;
}

.element-picker-trigger:hover,
.element-picker-trigger.active {
  border-color: #acd4ca;
  color: var(--teal-deep);
  background: var(--teal-soft);
}

.element-picker-number {
  color: var(--muted-2);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.element-picker-dot {
  color: var(--line-strong);
}

.element-picker-trigger strong {
  min-width: 20px;
  color: inherit;
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  font-size: 13px;
  text-align: center;
}

.element-picker-trigger svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 150ms ease;
}

.element-picker-trigger.active svg {
  transform: rotate(180deg);
}

.periodic-table-popover {
  position: absolute;
  z-index: 12;
  top: 59px;
  bottom: 12px;
  left: 74px;
  display: flex;
  width: min(748px, calc(100% - 98px));
  min-height: 0;
  max-height: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(190, 207, 199, 0.98);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 20px 55px rgba(23, 37, 34, 0.2);
  backdrop-filter: blur(14px);
}

.periodic-table-popover[hidden] {
  display: none;
}

.periodic-table-header,
.periodic-table-footer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.periodic-table-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.periodic-table-header strong,
.periodic-table-header small {
  display: block;
}

.periodic-table-header strong {
  color: var(--ink);
  font-size: 14px;
}

.periodic-table-header small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.periodic-table-close {
  display: grid;
  width: 30px;
  height: 30px;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.periodic-table-close:hover {
  color: var(--coral);
  background: var(--coral-soft);
}

.periodic-table-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.periodic-table-scroll {
  min-height: 0;
  flex: 1 1 auto;
  max-height: none;
  overflow-x: auto;
  overflow-y: scroll;
  overscroll-behavior: contain;
  padding: 12px;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #aebfb8 #f3f6f3;
}

.periodic-table-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.periodic-table-scroll::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #f3f6f3;
}

.periodic-table-scroll::-webkit-scrollbar-thumb {
  border: 2px solid #f3f6f3;
  border-radius: 999px;
  background: #aebfb8;
}

.periodic-table-scroll::-webkit-scrollbar-thumb:hover {
  background: #8fa49b;
}

.periodic-table-grid {
  display: grid;
  min-width: 690px;
  grid-template-columns: repeat(18, minmax(32px, 1fr));
  grid-template-rows: repeat(9, 38px);
  gap: 3px;
}

.periodic-element {
  position: relative;
  display: grid;
  min-width: 0;
  padding: 3px 2px 2px;
  place-content: center;
  border: 1px solid #dce4df;
  border-radius: 7px;
  color: var(--ink-soft);
  background: #f7f9f6;
  line-height: 1;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.periodic-element small {
  position: absolute;
  top: 3px;
  left: 4px;
  color: rgba(61, 77, 73, 0.65);
  font-size: 7px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.periodic-element strong {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 800;
}

.periodic-element:hover {
  z-index: 2;
  border-color: var(--teal);
  box-shadow: 0 5px 14px rgba(23, 37, 34, 0.14);
  transform: translateY(-2px) scale(1.04);
}

.periodic-element.selected {
  z-index: 1;
  border-color: var(--teal-deep);
  color: #fff;
  background: var(--teal);
  box-shadow: 0 0 0 2px rgba(8, 125, 112, 0.18);
}

.periodic-element.selected small {
  color: rgba(255, 255, 255, 0.75);
}

.periodic-element[data-category="nonmetal"] { background: #edf6f1; }
.periodic-element[data-category="noble"] { background: #eeeaf8; }
.periodic-element[data-category="halogen"] { background: #e8f4f1; }
.periodic-element[data-category="metalloid"] { background: #f7f0d8; }
.periodic-element[data-category="alkali"] { background: #fae9e4; }
.periodic-element[data-category="alkaline"] { background: #f7eed8; }
.periodic-element[data-category="postTransition"] { background: #edf0ed; }
.periodic-element[data-category="lanthanide"] { background: #f6e9f1; }
.periodic-element[data-category="actinide"] { background: #f4e7e2; }
.periodic-element[data-category="transition"] { background: #eaf1f6; }
.periodic-element.selected { background: var(--teal); }

.periodic-series-label {
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--muted);
  background: #f4f6f3;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.periodic-table-footer {
  min-height: 40px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #fafbf8;
  font-size: 10px;
}

.periodic-table-footer strong {
  color: var(--teal-deep);
  font-size: 11px;
}

.periodic-table-tip {
  color: var(--muted-2);
}

.template-tool {
  min-width: 48px;
}

.template-tool svg {
  overflow: visible;
}

.template-select {
  width: 78px;
  height: 31px;
  flex: none;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  background: #fff;
  font-size: 9px;
  font-weight: 700;
  outline: 0;
}

.template-select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 125, 112, 0.1);
}

.history-tool {
  min-width: 30px;
  width: 30px;
  padding: 3px;
}

.editor-tools-top .history-tool span,
.charge-tool span {
  display: none;
}

.charge-tool {
  min-width: 31px;
  width: 31px;
  padding: 3px;
}

.interaction-toggle {
  padding: 5px 8px;
  border: 1px solid rgba(8, 125, 112, 0.16);
  border-radius: 9px;
  color: var(--teal-deep);
  background: rgba(223, 242, 237, 0.5);
}

.bond-challenge {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  max-width: min(760px, 68vw);
  gap: 10px;
  margin-top: 1px;
  pointer-events: none;
}

.bond-challenge-copy {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 7px;
}

.bond-challenge-copy strong,
.bond-challenge-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bond-challenge-copy strong {
  flex: 0 1 auto;
  color: var(--ink);
  font-size: 11px;
  line-height: 16px;
}

.bond-challenge-copy small {
  flex: 1 1 auto;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 15px;
}

.bond-challenge-copy small::before {
  margin-right: 7px;
  color: var(--line-strong);
  content: "·";
}

.bond-challenge-progress {
  display: inline-grid;
  min-width: 43px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  color: var(--teal-deep);
  background: var(--teal-soft);
  font-size: 10px;
  font-weight: 850;
}

#reactionCanvas.challenge-active {
  cursor: crosshair;
}

.canvas-tip {
  position: absolute;
  z-index: 3;
  right: 13px;
  bottom: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid rgba(207, 216, 209, 0.72);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
  font-size: 9px;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.canvas-tip svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.export-overlay {
  position: absolute;
  z-index: 5;
  top: 13px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid rgba(23, 37, 34, 0.12);
  border-radius: 9px;
  color: #fff;
  background: rgba(23, 37, 34, 0.88);
  box-shadow: var(--shadow-soft);
  font-size: 10px;
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

.recording-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff795f;
  box-shadow: 0 0 0 4px rgba(255, 121, 95, 0.13);
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  50% { opacity: 0.38; }
}

.reaction-controls,
.workspace-controls {
  display: flex;
  align-items: center;
  min-height: 66px;
  gap: 12px;
  padding: 0 15px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.play-button {
  display: grid;
  flex: none;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 5px 14px rgba(23, 37, 34, 0.18);
}

.play-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.play-button .pause-icon,
.play-button.playing .play-icon {
  display: none;
}

.play-button.playing .pause-icon {
  display: block;
}

.scrubber-area {
  position: relative;
  flex: 1;
  min-width: 160px;
  padding: 17px 0 20px;
}

#progressScrubber {
  display: block;
  width: 100%;
  height: 3px;
  margin: 0;
  appearance: none;
  border-radius: 99px;
  background: linear-gradient(to right, var(--teal) 0%, var(--teal) var(--progress, 0%), #dfe5df var(--progress, 0%), #dfe5df 100%);
}

#progressScrubber::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  appearance: none;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 1px 5px rgba(18, 55, 47, 0.35);
}

#progressScrubber::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 1px 5px rgba(18, 55, 47, 0.35);
}

.step-markers {
  position: absolute;
  right: 0;
  bottom: 4px;
  left: 0;
  height: 12px;
  color: var(--muted-2);
  font-size: 8px;
  pointer-events: none;
}

.step-markers span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}

.step-markers span.is-first {
  transform: none;
}

.step-markers span.is-last {
  transform: translateX(-100%);
}

.step-markers span.active {
  color: var(--teal);
  font-weight: 800;
}

#speedSelect {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  background: #fff;
  font-size: 10px;
  font-weight: 700;
  outline: 0;
}

.reset-button {
  display: flex;
  align-items: center;
  height: 32px;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.reset-button:hover {
  color: var(--ink);
  background: var(--paper);
}

.reset-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace-controls {
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.workspace-controls > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.reaction-condition-field {
  display: grid;
  width: min(310px, 34%);
  min-width: 220px;
  gap: 5px;
  flex: 0 1 310px;
}

.reaction-condition-field > span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.reaction-condition-field input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  background: #fbfcf9;
  font-size: 9px;
  outline: 0;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.reaction-condition-field input:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.reaction-condition-field input:focus {
  border-color: #9ecfc4;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(8, 125, 112, 0.1);
}

.reaction-condition-field input::placeholder {
  color: #9aa6a2;
}

.workspace-controls .reaction-capture-flow {
  flex-wrap: wrap;
  gap: 7px;
}

.reaction-capture-flow > svg {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: var(--muted-2);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.capture-button {
  display: flex;
  align-items: center;
  height: 42px;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  text-align: left;
  background: #fff;
}

.capture-button:hover:not(:disabled) {
  border-color: #a9d4ca;
  background: var(--teal-soft);
}

.capture-button.recorded {
  border-color: #a9d4ca;
  color: var(--teal-deep);
  background: var(--teal-soft);
}

.capture-button b {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--ink);
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  font-size: 9px;
}

.capture-button.recorded b {
  background: var(--teal);
}

.capture-button.prediction.revision-ready:not(.predicting) {
  border-color: #dfc77f;
  color: #76530c;
  background: #fff8df;
  box-shadow: 0 0 0 3px rgba(212, 155, 45, 0.08);
}

.capture-button.prediction.revision-ready:not(.predicting) b {
  background: var(--amber);
}

.capture-button.prediction.revision-ready:not(.predicting) small {
  color: #8a681a;
}

.capture-button.prediction.predicting {
  border-color: #e7aa9d;
  color: #a74432;
  background: var(--coral-soft);
  box-shadow: 0 0 0 3px rgba(223, 107, 82, 0.08);
}

.capture-button.prediction.predicting b {
  background: var(--coral);
}

.capture-button.prediction.predicting small {
  color: #b65a45;
}

.capture-button span,
.capture-button small {
  display: block;
}

.capture-button span {
  font-size: 9px;
  font-weight: 750;
  line-height: 1.15;
}

.capture-button small {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 500;
}

.capture-button.preview {
  margin-left: 2px;
  color: #fff;
  background: var(--ink);
}

.capture-button.preview:hover:not(:disabled) {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal-deep);
}

.capture-button.preview .mini-play {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: currentColor;
  stroke-linejoin: round;
}

.capture-button.preview small {
  color: rgba(255, 255, 255, 0.62);
}

.capture-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.workspace-hint {
  color: var(--muted);
  font-size: 9px;
}

.workspace-hint > span {
  width: 3px;
  height: 3px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--line-strong);
}

kbd {
  padding: 2px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--ink-soft);
  background: #f8f9f6;
  font-family: inherit;
  font-size: 8px;
}


.step-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 13px;
}

.step-chip {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 57px;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  text-align: left;
  background: rgba(255, 255, 255, 0.62);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.step-chip:hover {
  border-color: #bdd8d1;
  transform: translateY(-1px);
}

.step-chip.active {
  border-color: #a9d4ca;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.step-chip.active::after {
  position: absolute;
  right: 8px;
  bottom: 0;
  left: 8px;
  height: 2px;
  border-radius: 99px 99px 0 0;
  background: var(--teal);
  content: "";
}

.step-number {
  display: grid;
  flex: none;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted-2);
  background: #fff;
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  font-size: 9px;
  font-weight: 700;
}

.step-chip.active .step-number {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal);
}

.step-chip > span:last-child {
  min-width: 0;
}

.step-chip strong,
.step-chip small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-chip strong {
  font-size: 10px;
}

.step-chip small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
}

.inspector-top {
  padding: 22px 16px 19px;
  border-bottom: 1px solid var(--line);
}

.inspector-kicker {
  color: var(--teal);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.step-icon {
  display: grid;
  width: 46px;
  height: 46px;
  margin: 14px 0 13px;
  place-items: center;
  border-radius: 15px;
  color: var(--teal);
  background: var(--teal-soft);
}

.step-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.inspector-top h2 {
  margin: 0;
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.inspector-top p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.inspector-section {
  padding: 16px 14px;
  border-bottom: 1px solid var(--line);
}

.bond-list {
  display: grid;
  gap: 8px;
}

.bond-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 42px;
  gap: 7px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbf8;
}

.bond-symbol {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
}

.bond-item.break .bond-symbol {
  color: var(--coral);
  background: var(--coral-soft);
}

.bond-item.form .bond-symbol {
  color: var(--teal);
  background: var(--teal-soft);
}

.bond-item.observe .bond-symbol {
  color: var(--blue);
  background: #e4eef6;
}

.bond-copy strong,
.bond-copy small {
  display: block;
}

.bond-copy strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.bond-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.bond-state {
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--muted);
  background: var(--paper);
  font-size: 8px;
  font-weight: 700;
}

.bond-item.break .bond-state {
  color: #ad4630;
  background: var(--coral-soft);
}

.bond-item.form .bond-state {
  color: var(--teal-deep);
  background: var(--teal-soft);
}

.note-card {
  display: grid;
  grid-template-columns: 17px 1fr;
  gap: 8px;
  padding: 11px;
  border: 1px solid #eadfbf;
  border-radius: 11px;
  color: #765f30;
  background: #fbf6e7;
}

.note-card svg {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.note-card p {
  margin: 0;
  font-size: 9px;
  line-height: 1.65;
}

.summary-section {
  display: grid;
  gap: 11px;
}

.summary-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  font-size: 9px;
}

.summary-row span {
  flex: none;
  color: var(--muted);
}

.summary-row strong {
  text-align: right;
  font-size: 9px;
  line-height: 1.45;
}

.inspector-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  margin-top: auto;
  padding: 0 19px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.inspector-footer button {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  background: #fff;
}

.inspector-footer button:disabled {
  cursor: default;
  opacity: 0.35;
}

.inspector-footer button:hover:not(:disabled) {
  color: var(--teal);
  background: var(--teal-soft);
}

.inspector-footer button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#stepCounter {
  color: var(--muted);
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
}


.molecule-3d-dialog {
  width: min(1040px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  padding: 26px;
  overflow: auto;
  border: 0;
  border-radius: 22px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 28px 90px rgba(14, 32, 27, 0.25);
}

.molecule-3d-dialog::backdrop {
  background: rgba(14, 27, 24, 0.58);
  backdrop-filter: blur(5px);
}

.molecule-3d-heading {
  display: flex;
  align-items: center;
  gap: 15px;
  padding-right: 44px;
}

.molecule-3d-heading .dialog-mark {
  flex: none;
}

.molecule-3d-heading p {
  margin: 0 0 3px;
  color: var(--teal-deep);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.molecule-3d-heading h2 {
  margin: 0;
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  font-size: 24px;
  font-weight: 600;
}

.molecule-3d-heading small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.molecule-3d-mark svg {
  width: 32px;
  height: 32px;
  fill: rgba(8, 125, 112, 0.1);
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.molecule-3d-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin: 18px 0 12px;
}

.molecule-3d-actions button,
.molecule-3d-panel-heading button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  background: var(--paper);
  font-size: 11px;
  font-weight: 600;
}

.molecule-3d-actions button:hover,
.molecule-3d-panel-heading button:hover {
  color: var(--teal-deep);
  border-color: rgba(8, 125, 112, 0.34);
  background: var(--teal-soft);
}

.molecule-3d-actions button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.molecule-3d-auto-rotate {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.molecule-3d-auto-rotate input {
  accent-color: var(--teal);
}

.molecule-3d-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.molecule-3d-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.molecule-3d-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.molecule-3d-panel-heading span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.molecule-3d-panel-heading h3 {
  margin: 0;
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  font-size: 16px;
  font-weight: 600;
}

.molecule-3d-canvas-wrap {
  position: relative;
  height: 350px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(8, 125, 112, 0.06), transparent 46%),
    linear-gradient(180deg, #fbfdfc, #f3f7f5);
}

.molecule-3d-canvas-wrap::after {
  content: "拖动旋转 · 滚轮缩放";
  position: absolute;
  right: 10px;
  bottom: 9px;
  padding: 4px 7px;
  border-radius: 7px;
  color: rgba(46, 64, 59, 0.66);
  background: rgba(255, 255, 255, 0.78);
  font-size: 9px;
  pointer-events: none;
}

.molecule-3d-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.molecule-3d-canvas-wrap canvas:active {
  cursor: grabbing;
}

.molecule-3d-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 32px;
  color: var(--muted);
  background: rgba(247, 250, 248, 0.88);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
  pointer-events: none;
}

.molecule-3d-empty[hidden] {
  display: none;
}

.molecule-3d-meta {
  min-height: 56px;
  margin: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.molecule-3d-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 13px;
  margin-top: 13px;
  padding: 11px 13px;
  border-radius: 12px;
  color: var(--muted);
  background: var(--paper);
  font-size: 10px;
}

.molecule-3d-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.molecule-3d-legend small {
  flex: 1 1 320px;
  line-height: 1.6;
}

.atom-color {
  width: 11px;
  height: 11px;
  border: 1px solid rgba(23, 37, 34, 0.18);
  border-radius: 50%;
  box-shadow: inset 2px 2px 3px rgba(255, 255, 255, 0.65);
}

.atom-color-c { background: #44514d; }
.atom-color-h { background: #f5f7f6; }
.atom-color-o { background: #df5a47; }
.atom-color-n { background: #397daf; }
.atom-color-halogen { background: #3e8d75; }

.molecule-3d-tool:not(:disabled) {
  color: var(--teal-deep);
}

@media (max-width: 760px) {
  .molecule-3d-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
    padding: 18px 12px;
    border-radius: 16px;
  }

  .molecule-3d-heading {
    align-items: flex-start;
    padding-right: 36px;
  }

  .molecule-3d-heading .dialog-mark {
    width: 42px;
    height: 42px;
  }

  .molecule-3d-heading h2 {
    font-size: 20px;
  }

  .molecule-3d-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .molecule-3d-grid {
    grid-template-columns: 1fr;
  }

  .molecule-3d-canvas-wrap {
    height: 300px;
  }
}

.help-dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 31px;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 28px 90px rgba(14, 32, 27, 0.25);
}

.help-dialog::backdrop {
  background: rgba(14, 27, 24, 0.52);
  backdrop-filter: blur(5px);
}

.dialog-close {
  position: absolute;
  top: 15px;
  right: 15px;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: var(--paper);
}

.dialog-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.dialog-mark {
  display: grid;
  width: 51px;
  height: 51px;
  place-items: center;
  border-radius: 15px;
  color: var(--teal);
  background: var(--teal-soft);
}

.dialog-mark svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linejoin: round;
}

.help-dialog h2 {
  margin: 20px 0 10px;
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  font-size: 25px;
  font-weight: 600;
}

.help-dialog > p,
.help-dialog li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.help-dialog ol {
  margin: 17px 0;
  padding-left: 20px;
}

.help-dialog li + li {
  margin-top: 6px;
}

.help-dialog li strong {
  color: var(--ink-soft);
}

.help-dialog .dialog-footnote {
  padding: 10px 12px;
  border-left: 3px solid var(--amber);
  color: #705b2d;
  background: #fbf6e7;
  font-size: 10px;
}

.help-dialog .primary-button {
  margin-top: 19px;
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: 24px;
  left: 50%;
  max-width: min(440px, calc(100vw - 32px));
  padding: 10px 15px;
  border-radius: 10px;
  color: #fff;
  background: rgba(23, 37, 34, 0.94);
  box-shadow: 0 12px 35px rgba(15, 35, 29, 0.22);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Readability pass: keep the dense scientific layout, but avoid micro-type. */
.brand small { font-size: 11px; }
.view-tab,
.export-button { font-size: 14px; }
.section-heading { font-size: 12px; }
.reaction-card-content strong { font-size: 14px; }
.reaction-card-content small { font-size: 11px; }
.reaction-tags i,
.format-badge { font-size: 10px; }
.smiles-field textarea { font-size: 13px; }
.field-status,
.preset-list button { font-size: 11px; }
.preview-caption,
.sidebar-footer { font-size: 10.5px; }
.primary-button { font-size: 13px; }
.eyebrow { font-size: 11px; }
.content-header p { font-size: 13px; }
.header-badges > span,
.stage-status,
.toggle-control,
.canvas-tip { font-size: 10.5px; }
.editor-tool { font-size: 9px; }
.element-picker-trigger { font-size: 10px; }
.step-chip strong { font-size: 12px; }
.step-chip small { font-size: 10px; }
.inspector-kicker { font-size: 10px; }
.inspector-top p { font-size: 12.5px; }
.bond-copy strong { font-size: 11.5px; }
.bond-copy small,
.bond-state { font-size: 9.5px; }
.note-card p,
.summary-row,
.summary-row strong { font-size: 11px; }
#stepCounter { font-size: 11px; }
.capture-button span { font-size: 10px; }
.capture-button small { font-size: 8.5px; }
.workspace-hint { font-size: 10px; }
.reset-button,
#speedSelect { font-size: 11px; }
.toast { font-size: 12px; }

[hidden] {
  display: none !important;
}

/* 画布优先布局：桌面端收窄信息栏，把主要空间留给分子编辑画布。 */
@media (min-width: 1241px) {
  .right-panel {
    scrollbar-gutter: stable;
  }

  .right-panel .section-heading {
    margin-bottom: 10px;
    font-size: 10px;
    letter-spacing: 0.09em;
  }

  .right-panel .bond-copy {
    min-width: 0;
  }

  .right-panel .bond-copy strong,
  .right-panel .bond-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .right-panel .note-card {
    padding: 10px 9px;
  }

  .right-panel .summary-section {
    gap: 9px;
  }

  .right-panel .inspector-footer {
    min-height: 52px;
    padding: 0 14px;
  }

  .stage-card {
    border-radius: 18px;
    box-shadow: 0 20px 54px rgba(24, 48, 41, 0.09);
  }
}

@media (max-width: 1240px) {
  .topbar {
    grid-template-columns: 255px 1fr 255px;
  }

  .workspace-layout {
    grid-template-columns: 260px minmax(560px, 1fr);
  }

  .right-panel {
    position: fixed;
    z-index: 35;
    top: 72px;
    right: 0;
    bottom: 0;
    display: flex;
    width: min(286px, calc(100vw - 34px));
    overflow-y: auto;
    border-left: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: -18px 0 48px rgba(23, 37, 34, 0.16);
    transform: translateX(calc(100% + 22px));
    transition: transform 180ms ease;
  }

  .right-panel.open {
    transform: translateX(0);
  }

  .inspector-toggle {
    display: grid;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100%;
  }

  .topbar {
    position: sticky;
    top: 0;
    grid-template-columns: 1fr auto;
  }

  .view-tabs {
    position: fixed;
    z-index: 30;
    right: 16px;
    bottom: 16px;
    left: 16px;
    justify-content: center;
    box-shadow: 0 12px 34px rgba(23, 37, 34, 0.2);
  }

  .view-tab {
    flex: 1;
    justify-content: center;
  }

  .top-actions .icon-button {
    display: grid;
  }

  .workspace-layout {
    display: flex;
    flex-direction: column;
  }

  .left-panel,
  .main-content {
    overflow: visible;
  }

  .left-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .left-panel .panel-section {
    border-right: 1px solid var(--line);
  }

  .sidebar-footer {
    display: none;
  }

  .canvas-wrap {
    height: 420px;
  }

  .right-panel {
    top: 72px;
  }
}

@media (max-width: 820px) {
  .periodic-table-popover {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-height: none;
  }

  .periodic-table-scroll {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 64px;
    padding: 0 13px;
  }

  .right-panel {
    top: 64px;
  }

  .brand small,
  .export-button span {
    display: none;
  }

  .export-button {
    width: 41px;
    padding: 0;
    justify-content: center;
  }

  .left-panel {
    display: block;
  }

  .main-content {
    padding: 22px 12px 90px;
  }

  .content-header {
    display: block;
  }

  .content-header h1 {
    font-size: 25px;
  }

  .header-badges {
    margin-top: 14px;
  }

  .canvas-wrap {
    height: 360px;
    min-height: 300px;
  }

  .toolbar-controls .toggle-control {
    display: none;
  }

  .editor-tools-top {
    right: 62px;
    left: 8px;
    padding-right: 5px;
    padding-left: 5px;
  }

  .editor-tools-side {
    right: 8px;
    bottom: 8px;
  }

  .step-strip {
    grid-template-columns: 1fr 1fr;
  }

  .reaction-controls {
    flex-wrap: wrap;
    padding: 11px;
  }

  .scrubber-area {
    min-width: calc(100% - 54px);
  }

  #speedSelect,
  .reset-button {
    margin-left: auto;
  }

  .workspace-controls {
    align-items: stretch;
    flex-direction: column;
    padding: 10px;
  }

  .reaction-condition-field {
    width: 100%;
    min-width: 0;
    flex-basis: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


@media (max-width: 720px) {
  .interaction-toggle {
    padding: 4px 6px;
  }

  .interaction-toggle {
    font-size: 0;
  }

  .interaction-toggle::after {
    content: "互动";
    font-size: 9px;
  }

  .stage-toolbar {
    align-items: flex-start;
  }

  .bond-challenge {
    max-width: none;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
  }

  .bond-challenge-copy {
    display: block;
  }

  .bond-challenge-copy strong,
  .bond-challenge-copy small {
    display: block;
    font-size: 10px;
    white-space: normal;
  }

  .bond-challenge-copy small::before {
    display: none;
  }
}


/* 学习统计：自动存储后的查看入口 */
.learning-stats-button {
  position: relative;
  display: flex;
  min-width: 52px;
  height: 36px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
  font-weight: 700;
  transition: color 150ms ease, background 150ms ease;
}

.learning-stats-button:hover,
.learning-stats-button.active {
  color: var(--teal-deep);
  background: var(--teal-soft);
}

.learning-stats-button > svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}


.learning-stats-panel {
  position: absolute;
  z-index: 12;
  top: 62px;
  right: 12px;
  display: flex;
  width: min(620px, calc(100% - 24px));
  height: min(680px, calc(100vh - 112px));
  max-height: calc(100vh - 112px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(196, 210, 202, 0.95);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 65px rgba(23, 37, 34, 0.2);
  backdrop-filter: blur(18px);
}

.learning-stats-panel[hidden] { display: none; }

.learning-stats-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 17px 13px;
  border-bottom: 1px solid var(--line);
}

.learning-stats-header strong,
.learning-stats-header small { display: block; }
.learning-stats-header strong { color: var(--ink); font-size: 15px; }
.learning-stats-header small { margin-top: 4px; color: var(--muted); font-size: 9px; }

.learning-stats-close {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}
.learning-stats-close:hover { color: var(--coral); background: var(--coral-soft); }
.learning-stats-close svg,
.learning-stats-export svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.learning-stats-scroll {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #9fb2aa transparent;
}

.learning-stats-scroll:focus-visible {
  outline: 3px solid rgba(8, 125, 112, 0.16);
  outline-offset: -3px;
}

.learning-stats-scroll::-webkit-scrollbar {
  width: 10px;
}

.learning-stats-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.learning-stats-scroll::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #9fb2aa;
  background-clip: padding-box;
}

.learning-stats-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.learning-overview-card {
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(8, 125, 112, 0.12);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(223, 242, 237, 0.7), rgba(255, 255, 255, 0.96));
}
.learning-overview-card small,
.learning-overview-card strong { display: block; }
.learning-overview-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.learning-overview-card strong {
  margin-top: 6px;
  overflow: hidden;
  color: var(--teal-deep);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.learning-stats-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 17px 2px 8px;
}
.learning-stats-section-heading strong { color: var(--ink-soft); font-size: 11px; }
.learning-stats-section-heading small { color: var(--muted-2); font-size: 8px; }
.learning-stats-reaction-list,
.learning-stats-recent-list { display: grid; gap: 8px; }

.learning-reaction-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}
.learning-reaction-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.learning-reaction-title strong,
.learning-reaction-title small { display: block; }
.learning-reaction-title strong { color: var(--ink); font-size: 11px; line-height: 1.45; }
.learning-reaction-title small { margin-top: 3px; color: var(--muted-2); font-size: 8px; }
.learning-reaction-title > span {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--teal-deep);
  background: var(--teal-soft);
  font-size: 8px;
  font-weight: 750;
}

.learning-reaction-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-top: 10px;
}
.learning-reaction-metrics > div {
  min-width: 0;
  padding: 8px;
  border-radius: 8px;
  background: #f6f8f5;
}
.learning-reaction-metrics small,
.learning-reaction-metrics strong { display: block; }
.learning-reaction-metrics small { color: var(--muted); font-size: 7px; }
.learning-reaction-metrics strong {
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.learning-accuracy-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.learning-accuracy-row > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 5px;
  padding: 7px 8px;
  border: 1px solid rgba(8, 125, 112, 0.12);
  border-radius: 8px;
  color: var(--teal-deep);
  background: rgba(223, 242, 237, 0.45);
}
.learning-accuracy-row small {
  overflow: hidden;
  color: var(--muted);
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.learning-accuracy-row strong { font-size: 9px; }

.learning-stats-empty {
  display: grid;
  min-height: 180px;
  padding: 24px;
  place-items: center;
  align-content: center;
  color: var(--muted);
  text-align: center;
}
.learning-stats-empty svg {
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
  fill: none;
  stroke: #94aaa2;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.learning-stats-empty strong,
.learning-stats-empty span { display: block; }
.learning-stats-empty strong { color: var(--ink-soft); font-size: 11px; }
.learning-stats-empty span { max-width: 280px; margin-top: 6px; font-size: 8px; line-height: 1.6; }

.learning-recent-item {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.learning-recent-item > i { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); }
.learning-recent-item.is-correct > i { background: var(--teal); }
.learning-recent-item strong,
.learning-recent-item small { display: block; }
.learning-recent-item strong {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.learning-recent-item div small { margin-top: 4px; color: var(--muted); font-size: 7px; }
.learning-recent-item > span { color: var(--coral); font-size: 8px; font-weight: 800; text-align: right; }
.learning-recent-item.is-correct > span { color: var(--teal); }
.learning-recent-item > span small { margin-top: 4px; color: var(--muted-2); font-size: 6.5px; font-weight: 500; }
.learning-recent-empty {
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 8px;
}

.learning-stats-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  background: #fafbf8;
}
.learning-stats-clear,
.learning-stats-export {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 9px;
  font-weight: 700;
}
.learning-stats-clear {
  border: 1px solid rgba(223, 107, 82, 0.22);
  color: #ad4d38;
  background: var(--coral-soft);
}
.learning-stats-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  color: #fff;
  background: var(--teal);
}
.learning-stats-clear:hover { background: #f8dcd4; }
.learning-stats-export:hover { background: var(--teal-deep); }

@media (max-width: 720px) {
  .learning-stats-button { min-width: 36px; padding: 0 7px; }
  .learning-stats-button > span { display: none; }
  .learning-stats-panel { top: 62px; right: 8px; width: calc(100% - 16px); }
  .learning-stats-overview,
  .learning-reaction-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .learning-accuracy-row { grid-template-columns: 1fr; }
  .learning-recent-item { grid-template-columns: 7px minmax(0, 1fr); }
  .learning-recent-item > span { grid-column: 2; text-align: left; }
}

/* 隐藏化学问答模块中的连接状态、上下文提示和底部运行状态 */
#aiConnectionBadge,
.assistant-context,
.sidebar-footer {
  display: none !important;
}

/* 已保存画布：购物车式画布库 */
.canvas-library-tool {
  position: relative;
}

.canvas-library-tool:hover,
.canvas-library-tool.active {
  color: var(--teal-deep);
  background: var(--teal-soft);
}

.canvas-library-count {
  position: absolute;
  top: 1px;
  right: 1px;
  display: grid;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: var(--coral);
  font-size: 7px;
  font-weight: 800;
  line-height: 1;
}

.canvas-library-panel {
  position: absolute;
  z-index: 8;
  top: 67px;
  right: 12px;
  width: min(390px, calc(100% - 24px));
  max-height: min(590px, calc(100% - 88px));
  overflow: hidden;
  border: 1px solid rgba(196, 210, 202, 0.95);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 20px 55px rgba(23, 37, 34, 0.18);
  backdrop-filter: blur(16px);
}

.canvas-library-panel[hidden] {
  display: none;
}

.canvas-library-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.canvas-library-header strong,
.canvas-library-header small {
  display: block;
}

.canvas-library-header strong {
  color: var(--ink);
  font-size: 14px;
}

.canvas-library-header small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.canvas-library-close {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.canvas-library-close:hover {
  color: var(--coral);
  background: var(--coral-soft);
}

.canvas-library-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.canvas-library-save-new {
  display: flex;
  align-items: center;
  width: calc(100% - 24px);
  min-height: 58px;
  gap: 11px;
  margin: 12px;
  padding: 9px 12px;
  border: 1px solid rgba(8, 125, 112, 0.22);
  border-radius: 12px;
  color: var(--teal-deep);
  text-align: left;
  background: var(--teal-soft);
  transition: transform 150ms ease, background 150ms ease, opacity 150ms ease;
}

.canvas-library-save-new:hover:not(:disabled) {
  background: #d3eee7;
  transform: translateY(-1px);
}

.canvas-library-save-new:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.canvas-library-save-new > svg {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  padding: 5px;
  border-radius: 8px;
  color: #fff;
  background: var(--teal);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.canvas-library-save-new strong,
.canvas-library-save-new small {
  display: block;
}

.canvas-library-save-new strong {
  font-size: 11px;
}

.canvas-library-save-new small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
}

.canvas-library-empty {
  display: grid;
  min-height: 190px;
  padding: 24px;
  place-items: center;
  align-content: center;
  color: var(--muted);
  text-align: center;
}

.canvas-library-empty[hidden] {
  display: none;
}

.canvas-library-empty svg {
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  fill: none;
  stroke: #9eb2aa;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.canvas-library-empty strong {
  color: var(--ink-soft);
  font-size: 11px;
}

.canvas-library-empty span {
  max-width: 230px;
  margin-top: 6px;
  font-size: 9px;
  line-height: 1.6;
}

.canvas-library-list {
  display: grid;
  max-height: 390px;
  gap: 8px;
  overflow-y: auto;
  padding: 0 12px 12px;
  scrollbar-width: thin;
  scrollbar-color: #c9d7d1 transparent;
}

.canvas-library-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.canvas-library-card:hover {
  border-color: #bdd8d1;
  box-shadow: 0 5px 16px rgba(23, 37, 34, 0.06);
}

.canvas-library-card.is-active {
  border-color: #8bc9bb;
  background: rgba(223, 242, 237, 0.42);
}

.canvas-library-card-icon {
  display: grid;
  width: 54px;
  height: 48px;
  padding: 5px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #d9e4df;
  border-radius: 9px;
  color: var(--teal-deep);
  background:
    linear-gradient(rgba(8, 125, 112, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 125, 112, 0.04) 1px, transparent 1px),
    #fafbf7;
  background-size: 10px 10px;
  font-size: 9px;
  font-weight: 800;
  text-align: center;
  text-overflow: ellipsis;
}

.canvas-library-card-body {
  min-width: 0;
}

.canvas-library-name {
  display: block;
  width: 100%;
  height: 25px;
  padding: 0 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  font-size: 10px;
  font-weight: 750;
  outline: 0;
}

.canvas-library-name:hover,
.canvas-library-name:focus {
  border-color: var(--line-strong);
  background: #fff;
}

.canvas-library-name:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 125, 112, 0.08);
}

.canvas-library-card-body small {
  display: block;
  margin: 3px 5px 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-library-card-actions {
  display: grid;
  gap: 5px;
}

.canvas-library-card-actions button {
  min-width: 47px;
  height: 25px;
  padding: 0 8px;
  border: 1px solid #bfded7;
  border-radius: 7px;
  color: var(--teal-deep);
  background: var(--teal-soft);
  font-size: 8px;
  font-weight: 750;
}

.canvas-library-card-actions button:hover {
  border-color: var(--teal);
}

.canvas-library-card-actions button.danger {
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.canvas-library-card-actions button.danger:hover {
  color: #b84a33;
  background: var(--coral-soft);
}

@media (max-width: 760px) {
  .canvas-library-panel {
    top: 64px;
    right: 8px;
    width: calc(100% - 16px);
  }

  .canvas-library-card {
    grid-template-columns: 46px minmax(0, 1fr) auto;
  }

  .canvas-library-card-icon {
    width: 46px;
  }
}

/* 学习统计滚动修复（固定在视口内，避免被反应画布容器裁切） */
.learning-stats-panel {
  position: fixed;
  z-index: 1000;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(800px, calc(100vw - 32px));
  height: auto;
  max-height: none;
  overflow: hidden;
}

.learning-stats-scroll {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.learning-stats-header,
.learning-stats-footer {
  flex: 0 0 auto;
}

.learning-stats-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.learning-stats-header .learning-stats-clear {
  display: inline-flex;
  min-height: 29px;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid rgba(223, 107, 82, 0.22);
  border-radius: 8px;
  color: #ad4d38;
  background: rgba(250, 231, 225, 0.72);
  font-size: 9px;
  font-weight: 700;
}

.learning-stats-header .learning-stats-clear:hover {
  background: #f8dcd4;
}

.learning-stats-header .learning-stats-clear svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.learning-stats-footer {
  justify-content: space-between;
}

.learning-stats-footer > span {
  color: var(--muted-2);
  font-size: 8px;
}

@media (max-width: 720px) {
  .learning-stats-panel {
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    width: calc(100vw - 16px);
  }

  .learning-stats-header .learning-stats-clear span {
    display: none;
  }

  .learning-stats-header .learning-stats-clear {
    width: 29px;
    padding: 0;
    justify-content: center;
  }

  .learning-stats-footer > span {
    display: none;
  }

  .learning-stats-footer {
    justify-content: flex-end;
  }
}


/* 稳定化化学问答：区分本地分析、已配置与在线复核状态。 */
.ai-status-badge.is-configured {
  border-color: #ead7a8;
  color: #8a6519;
  background: #fff8e7;
}

.ai-status-badge.is-configured i {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(212, 155, 45, 0.1);
}

.assistant-message.is-fallback > div {
  border-color: #ead7a8;
  background: #fffdf7;
}

.assistant-message.is-fallback strong {
  color: #7f621f;
}


/* ===== 学生信息与服务器同步 ===== */
.admin-link {
  text-decoration: none;
}

.student-profile-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 24px 80px rgba(23, 37, 34, 0.22);
}

.student-profile-dialog::backdrop {
  background: rgba(18, 31, 28, 0.48);
  backdrop-filter: blur(3px);
}

.student-profile-form {
  display: grid;
  gap: 15px;
  padding: 24px;
}

.student-profile-form h2,
.student-profile-form p {
  margin: 0;
}

.student-profile-form h2 {
  font-size: 20px;
}

.student-profile-form p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.student-profile-form label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.student-profile-form input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}

.student-profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 4px;
}

.student-profile-actions button {
  min-width: 92px;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
}

.student-profile-actions .profile-cancel {
  color: var(--ink-soft);
  background: var(--paper);
}

.student-profile-actions .profile-save {
  color: #fff;
  background: var(--teal);
}

.student-sync-note {
  min-height: 18px;
  color: var(--muted);
  font-size: 11px;
}

.student-sync-note.is-ok { color: var(--teal-deep); }
.student-sync-note.is-error { color: var(--coral); }
