:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-hover: #f0f4f8;
  --border: #dce3ed;
  --text: #1a2332;
  --muted: #5a6b82;
  --accent: #2563eb;
  --accent-dim: #1d4ed8;
  --success: #059669;
  --warning: #b45309;
  --error-bg: #fef2f2;
  --error-text: #b91c1c;
  --error-border: #fecaca;
  --code-bg: #eef1f6;
  --shadow-sm: 0 1px 2px rgba(26, 35, 50, 0.06);
  --shadow-md: 0 4px 12px rgba(26, 35, 50, 0.08);
  --radius: 12px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.site-header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--accent);
}

.tagline {
  font-size: 0.85rem;
  color: var(--muted);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

/* Chat panel */
.chat-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-md);
}

.chat-intro {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 1.15rem;
}

.chat-intro-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
}

.chat-panel h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.chat-panel .hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.chat-welcome {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.chat-thread {
  margin-top: 1rem;
}

.chat-thread[hidden],
.chat-welcome[hidden] {
  display: none !important;
}

.chat-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-input-wrap textarea {
  width: 100%;
  min-height: 100px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}

.chat-input-wrap textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dim);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.chat-status {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.chat-status.visible {
  display: flex;
}

.chat-status-dots {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: chat-spin 0.8s linear infinite;
}

@keyframes chat-spin {
  to { transform: rotate(360deg); }
}

.chat-answer {
  display: none;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.95rem;
  line-height: 1.65;
  word-break: break-word;
}

.chat-answer.visible {
  display: block;
}

.chat-answer.markdown-body {
  white-space: normal;
}

.chat-answer.markdown-body h1,
.chat-answer.markdown-body h2,
.chat-answer.markdown-body h3,
.chat-answer.markdown-body h4 {
  margin: 1.1em 0 0.5em;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.chat-answer.markdown-body h1 { font-size: 1.25rem; }
.chat-answer.markdown-body h2 { font-size: 1.12rem; }
.chat-answer.markdown-body h3 { font-size: 1.02rem; color: var(--accent); }

.chat-answer.markdown-body p {
  margin: 0.65em 0;
}

.chat-answer.markdown-body ul,
.chat-answer.markdown-body ol {
  margin: 0.5em 0 0.75em 1.25em;
  padding: 0;
}

.chat-answer.markdown-body li {
  margin: 0.35em 0;
}

.chat-answer.markdown-body strong {
  font-weight: 600;
  color: var(--text);
}

.chat-answer.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

.chat-answer.markdown-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 4px;
  color: var(--text);
}

.chat-answer.markdown-body pre {
  overflow-x: auto;
  padding: 0.75rem 1rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0.75em 0;
}

.chat-answer.markdown-body pre code {
  background: none;
  padding: 0;
}

.chat-answer.markdown-body blockquote {
  margin: 0.75em 0;
  padding-left: 1em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.chat-answer.markdown-body a {
  color: var(--accent);
}

.chat-answer.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75em 0;
  font-size: 0.9em;
}

.chat-answer.markdown-body th,
.chat-answer.markdown-body td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
}

.chat-answer.error {
  border-color: var(--error-border);
  color: var(--error-text);
  background: var(--error-bg);
}

.chat-answer a {
  color: var(--accent);
}

.chat-refs {
  display: none;
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
}

.chat-refs.visible {
  display: block;
}

.chat-refs-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem;
}

.chat-refs ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chat-refs li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.chat-refs li:last-child {
  border-bottom: none;
}

.ref-title {
  color: var(--muted);
}

.chat-refs a {
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}

.chat-refs-note {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Feature grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.feature-card {
  display: flex;
  flex-direction: column;
  padding: 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.feature-card:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.feature-card .icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.feature-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.feature-card p {
  font-size: 0.8rem;
  color: var(--muted);
  flex: 1;
}

.feature-card .badge {
  margin-top: 0.65rem;
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 500;
}

.feature-card.external .badge::after {
  content: " ↗";
}

/* Mol recognition page */
.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.back-link:hover {
  color: var(--accent);
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 1rem;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.upload-zone input {
  display: none;
}

.upload-zone p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.preview-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 1;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.results-panel {
  margin-top: 1.5rem;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.result-card h4 {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.result-card .smi {
  font-family: var(--mono);
  font-size: 0.85rem;
  word-break: break-all;
  background: var(--bg);
  padding: 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.result-meta .score-low {
  color: var(--warning);
}

.site-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* Demo mini-games */
.game-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}

.game-hud strong {
  color: var(--accent);
}

.game-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin: 1rem 0;
}

@media (max-width: 520px) {
  .game-board {
    grid-template-columns: repeat(2, 1fr);
  }
}

.game-card {
  aspect-ratio: 1.1;
  padding: 0.5rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-break: break-word;
}

.game-card:hover:not(:disabled) {
  border-color: var(--accent);
}

.game-card.flipped,
.game-card.matched {
  background: rgba(37, 99, 235, 0.08);
  border-color: var(--accent);
  color: var(--text);
}

.game-card.matched {
  cursor: default;
  opacity: 0.85;
}

.game-card.back {
  color: transparent;
  user-select: none;
}

.game-card.back::after {
  content: "?";
  color: var(--muted);
  font-family: var(--font);
  font-size: 1.25rem;
  font-weight: 600;
}

.game-card:disabled {
  cursor: default;
}

.game-vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: stretch;
  margin: 1.25rem 0;
}

.game-vs-mid {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.game-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  font-family: inherit;
  color: inherit;
  text-align: center;
}

.game-pick:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.game-pick:disabled {
  cursor: default;
  opacity: 0.7;
}

.game-pick .formula {
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--accent);
}

.game-pick .name {
  font-size: 0.88rem;
  color: var(--muted);
}

.game-pick.correct {
  border-color: var(--success);
  background: #ecfdf5;
}

.game-pick.wrong {
  border-color: var(--error-border);
  background: var(--error-bg);
}

.game-result {
  text-align: center;
  padding: 1rem;
  margin-top: 1rem;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

.game-result.win {
  border-color: rgba(5, 150, 105, 0.35);
  color: var(--success);
}

.game-result.leaderboard {
  white-space: pre-line;
  text-align: left;
  line-height: 1.55;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

.game-demo-note {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-left: 3px solid var(--accent);
  background: var(--bg);
  border-radius: 0 6px 6px 0;
}

.game-canvas-wrap {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}

.game-canvas-wrap canvas {
  max-width: 100%;
  height: auto;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
  touch-action: none;
}

.game-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.game-pad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.game-pad-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0;
}

.game-pad-row {
  display: flex;
  gap: 0.35rem;
}

.game-pad-btn {
  width: 3rem;
  height: 3rem;
  font-size: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.game-pad-btn:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.game-2048-wrap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  max-width: 320px;
  margin: 1rem auto;
  padding: 0.65rem;
  background: #bbada0;
  border-radius: var(--radius);
  outline: none;
}

.game-2048-wrap:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.game-2048-tile {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 700;
  font-family: var(--font);
  user-select: none;
}

.game-board-memory {
  grid-template-columns: repeat(4, 1fr);
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

.game-card-emoji {
  font-family: inherit;
  font-size: 1.75rem;
}

.game-ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  max-width: 280px;
  margin: 1rem auto;
}

.game-ttt-cell {
  aspect-ratio: 1;
  font-size: 2rem;
  font-weight: 600;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.game-ttt-cell:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.game-ttt-cell:disabled {
  cursor: default;
  opacity: 0.9;
}

.game-mole-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  max-width: 320px;
  margin: 1rem auto;
}

.game-mole-hole {
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: #d4a574;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, border-color 0.15s;
}

.game-mole-hole:hover:not(:disabled) {
  border-color: var(--accent);
  transform: scale(1.03);
}

.game-mole-hole:disabled {
  cursor: default;
  opacity: 0.85;
}

.game-mole-hole-idle {
  cursor: pointer;
}

.game-mole-board.game-mole-cooldown .game-mole-hole {
  pointer-events: none;
}

.game-mole-board.game-mole-cooldown {
  opacity: 0.92;
}

.game-mole-hole-cooldown {
  cursor: not-allowed;
  opacity: 0.75;
}

.game-mole-face {
  font-size: 2rem;
  line-height: 1;
  pointer-events: none;
}

.game-simon-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  max-width: 260px;
  margin: 1rem auto;
}

.game-simon-pad {
  aspect-ratio: 1;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.12s, transform 0.1s;
}

.game-simon-pad:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.game-simon-pad.active {
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.2);
}

.game-simon-pad.red { background: #ef4444; }
.game-simon-pad.blue { background: #3b82f6; }
.game-simon-pad.green { background: #22c55e; }
.game-simon-pad.yellow { background: #eab308; }

.game-rps-show {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin: 1.25rem 0;
  text-align: center;
}

.game-rps-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.game-rps-emoji {
  font-size: 3rem;
  line-height: 1;
}

.game-rps-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

.game-rps-btn {
  padding: 0.65rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.game-rps-btn:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.game-guess-row {
  display: flex;
  gap: 0.65rem;
  max-width: 320px;
  margin: 1rem auto;
}

.game-guess-input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  font-size: 1.1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
}

.game-guess-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* NMR prediction */
.nmr-step + .nmr-step {
  margin-top: 1.5rem;
}

.nmr-editor-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  margin: 1rem 0;
}

@media (max-width: 768px) {
  .nmr-editor-layout {
    grid-template-columns: 1fr;
  }
}

.nmr-panel-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nmr-jsme-host,
.nmr-ketcher-frame {
  display: block;
  width: 100%;
  min-height: 420px;
  height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.nmr-ketcher-preview {
  min-height: 420px;
  height: 420px;
  pointer-events: none;
}

#predict-error[hidden],
#predict-status[hidden] {
  display: none !important;
}

.nmr-jsme-status {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.nmr-jsme-status.error {
  color: var(--error-text);
}

.nmr-side-panel {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.nmr-upload-zone {
  margin-bottom: 0;
  padding: 1.25rem 1rem;
}

.nmr-upload-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}

.nmr-upload-preview img {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: contain;
}

.nmr-clear-upload {
  width: 100%;
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--border);
}

.nmr-inline-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

.nmr-inline-hint.error {
  color: var(--error-text);
}

.nmr-smiles-field {
  display: block;
  margin: 1rem 0;
}

.nmr-smiles-field textarea {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.85rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}

.nmr-confirmed-mol {
  margin-bottom: 1rem;
}

.nmr-spectrum-wrap {
  margin-top: 1rem;
}

.nmr-spectrum-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.nmr-spectrum-card {
  margin: 0;
}

.nmr-spectrum-card figcaption {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.nmr-spectrum-wrap img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.auth-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.auth-user {
  font-size: 0.85rem;
  font-weight: 500;
}

.auth-role {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.auth-logout {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.login-page main.login-shell {
  min-height: calc(100vh - 2rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.75rem;
}

.login-brand {
  margin-bottom: 1.25rem;
}

.login-brand .hint {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-form {
  display: grid;
  gap: 0.85rem;
}

.login-field {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.login-field input {
  font: inherit;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: #fff;
}

.login-field input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  border-color: var(--accent);
}

.login-error {
  color: var(--error-text);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-size: 0.85rem;
}

.login-submit {
  width: 100%;
  margin-top: 0.25rem;
}

.login-footnote {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

body.read-only-user .btn-primary:not(.auth-logout) {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 愚公实验室 iframe 嵌入（/smart-lab.html） */
body.lab-embed-page main {
  max-width: 1200px;
}

.lab-status-panel .lab-checklist {
  margin: 1rem 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.lab-status-panel .lab-checklist li {
  margin-bottom: 0.35rem;
}

.lab-frame-wrap {
  margin-top: 0.5rem;
}

.lab-console-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 10rem);
  height: calc(100vh - 10rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.lab-preview-panel h2 {
  margin-bottom: 0.5rem;
}

.lab-preview-notice {
  margin-bottom: 1.25rem;
  line-height: 1.65;
  color: var(--muted);
}

.lab-preview-poster-wrap {
  margin: 0 0 1.5rem;
}

.lab-preview-poster {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.lab-preview-videos-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

.lab-video-list {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 720px) {
  .lab-video-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

.lab-video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.75rem 1rem;
  box-shadow: var(--shadow-sm);
}

.lab-video-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--muted);
}

.lab-video-stage {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #111;
  aspect-ratio: 16 / 9;
}

.lab-video-play-btn {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: #111;
  position: relative;
}

.lab-video-play-btn:disabled {
  cursor: wait;
}

.lab-video-poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lab-video-poster-fallback {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.lab-video-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: rgba(15, 23, 42, 0.35);
  color: #fff;
  transition: background 0.15s ease;
}

.lab-video-play-btn:hover .lab-video-play-overlay,
.lab-video-play-btn:focus-visible .lab-video-play-overlay {
  background: rgba(15, 23, 42, 0.5);
}

.lab-video-play-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.92);
  font-size: 1.1rem;
  line-height: 1;
  padding-left: 0.15rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.lab-video-play-label {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.lab-video-player {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
