@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  --ink: #17243b;
  --muted: #8590a3;
  --line: #e9edf3;
  --blue: #4776e6;
  --blue-dark: #315fce;
  --canvas: #f8faff;
  font-family: "DM Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f4f6fa; color: var(--ink); }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { max-width: 1600px; min-height: 100vh; margin: 0 auto; padding: 0 42px; }
.topbar { height: 76px; display: flex; align-items: center; border-bottom: 1px solid #e8ebf1; }
.brand { display: inline-flex; gap: 11px; align-items: center; color: #1c2a42; font: 800 17px Manrope, sans-serif; letter-spacing: -.6px; text-decoration: none; }
.brand-light { font-weight: 500; color: #738097; }
.brand-mark { width: 25px; height: 25px; border-radius: 8px; background: #4776e6; position: relative; display: inline-block; transform: rotate(-7deg); }
.brand-mark span { width: 6px; height: 6px; background: white; border-radius: 50%; position: absolute; }
.brand-mark span:nth-child(1) { left: 5px; top: 5px; }
.brand-mark span:nth-child(2) { right: 5px; top: 9px; }
.brand-mark span:nth-child(3) { left: 9px; bottom: 4px; }
.course-tag { margin: 0 auto; color: #7c879a; font-size: 10px; font-weight: 700; letter-spacing: 1.1px; }
.course-dot, .live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #59b997; vertical-align: 1px; margin-right: 7px; }
.tag-divider { margin: 0 9px; color: #c4cad4; }
.top-link { color: #6f7a8e; font-size: 12px; text-decoration: none; }
.top-link span { color: #4776e6; margin-left: 5px; font-size: 15px; }
.workspace { display: grid; grid-template-columns: 276px minmax(0, 1fr); gap: 38px; max-width: 1300px; margin: 0 auto; padding: 38px 0 28px; }
.library-panel { border-right: 1px solid #e8ebf1; padding-right: 24px; min-height: calc(100vh - 115px); display: flex; flex-direction: column; }
.library-heading { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 18px; }
.eyebrow, .insight-label { font-size: 9px; font-weight: 700; letter-spacing: 1.1px; color: #9aa3b2; margin: 0 0 7px; }
.library-heading h1 { font: 700 16px Manrope, sans-serif; margin: 0; letter-spacing: -.3px; }
.count-badge { border: 1px solid #e6eaf0; color: #8c96a7; border-radius: 7px; padding: 4px 8px; font-size: 10px; font-weight: 600; }
.search-box { height: 39px; display: flex; align-items: center; gap: 9px; border: 1px solid #e6eaf0; background: #fff; padding: 0 10px; border-radius: 8px; }
.search-box svg { width: 15px; height: 15px; fill: none; stroke: #9ca6b7; stroke-width: 1.6; flex: none; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: #263650; font-size: 11px; background: transparent; }
.search-box input::placeholder { color: #a4adba; }
.search-box kbd { border: 1px solid #e6eaf0; border-radius: 4px; padding: 1px 5px; color: #a1aaba; font-size: 10px; background: #fafbfd; }
.filter-row { display: flex; gap: 6px; margin: 14px 0 12px; }
.filter-chip { border: 1px solid transparent; background: transparent; color: #8b95a6; padding: 5px 8px; border-radius: 6px; font-size: 10px; cursor: pointer; }
.filter-chip.active { color: #416cce; background: #eaf0ff; font-weight: 700; }
.molecule-list { display: grid; gap: 4px; align-content: start; }
.molecule-item { min-height: 55px; border: 1px solid transparent; background: transparent; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; display: flex; align-items: center; gap: 11px; cursor: pointer; transition: background .16s, border-color .16s; }
.molecule-item:hover { background: #edf1f8; }
.molecule-item.selected { background: white; border-color: #e5eaf2; box-shadow: 0 2px 5px #25365608; }
.molecule-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: #eff3fb; color: #5377c4; font: 700 12px Manrope, sans-serif; flex: none; }
.molecule-item.selected .molecule-avatar { background: #e9efff; color: #3e6bd0; }
.molecule-copy { min-width: 0; flex: 1; }
.molecule-copy strong { display: block; font-size: 11px; font-weight: 600; color: #334159; }
.molecule-copy small { color: #929cad; font-size: 10px; display: block; margin-top: 3px; }
.item-indicator { color: #b0b8c5; font-size: 9px; }
.selected .item-indicator { color: #4b78e1; }
.empty-list { color: #8c96a7; font-size: 11px; padding: 16px 8px; line-height: 1.6; }
.library-footer { border-top: 1px solid #e8ebf1; padding-top: 15px; margin-top: auto; color: #9ba4b2; font-size: 10px; }
.footer-spark { color: #6386dc; margin-right: 5px; }
.main-panel { min-width: 0; padding: 1px 0; }
.molecule-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 2px 20px; }
.title-kicker { color: #8e99aa; font-size: 9px; font-weight: 700; letter-spacing: 1.1px; margin-bottom: 8px; }
.kicker-line { display: inline-block; height: 1px; width: 18px; background: #7395e5; margin: 0 8px 3px 0; }
.title-block h2 { font: 800 26px Manrope, sans-serif; letter-spacing: -1px; margin: 0; color: #1c2a42; }
.formula-title { color: #708099; font: 600 18px "DM Sans", sans-serif; letter-spacing: -.3px; margin-left: 9px; }
.title-block > p { color: #8792a4; font-size: 11px; margin: 6px 0 0; }
.polarity-pill { flex: none; display: flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid #dfece7; border-radius: 18px; background: #f4faf7; color: #4f9a7f; font-size: 10px; font-weight: 600; }
.polarity-icon { font-size: 14px; font-weight: 700; }
.polarity-pill.nonpolar { color: #76849a; border-color: #e6eaf0; background: #fafbfd; }
.viewer-card { overflow: hidden; border: 1px solid #e6eaf0; border-radius: 12px; background: white; box-shadow: 0 5px 22px #2c426008; }
.viewer-toolbar { height: 51px; padding: 0 18px; border-bottom: 1px solid #edf0f4; display: flex; align-items: center; justify-content: space-between; }
.view-tabs { height: 100%; display: flex; gap: 20px; }
.view-tab { padding: 0 2px; position: relative; background: none; border: 0; color: #929cad; font-size: 10px; cursor: pointer; }
.view-tab.active { color: #3e68c5; font-weight: 700; }
.view-tab.active::after { content: ""; height: 2px; background: #527ce1; position: absolute; bottom: -1px; left: 0; right: 0; }
.tab-icon { font-size: 14px; margin-right: 5px; vertical-align: -1px; }
.drag-hint { color: #a1aab8; font-size: 10px; }
.drag-icon { font-size: 14px; margin-right: 4px; }
.canvas-wrap { height: 380px; position: relative; overflow: hidden; background: var(--canvas); touch-action: none; }
.canvas-grid { position: absolute; inset: 0; opacity: .48; background-image: linear-gradient(#e9eef7 1px, transparent 1px), linear-gradient(90deg, #e9eef7 1px, transparent 1px); background-size: 32px 32px; mask-image: radial-gradient(ellipse at center, black, transparent 76%); pointer-events: none; }
.canvas-label { position: absolute; z-index: 1; left: 19px; top: 16px; color: #9ba6b7; font-size: 8px; font-weight: 700; letter-spacing: 1px; }
.canvas-label .live-dot { width: 5px; height: 5px; margin-right: 5px; }
#molecule-canvas { width: 100%; height: 100%; position: relative; z-index: 1; overflow: visible; cursor: grab; }
#molecule-canvas.dragging { cursor: grabbing; }
.canvas-caption { position: absolute; z-index: 1; left: 0; right: 0; bottom: 14px; text-align: center; color: #9ba5b4; font-size: 10px; pointer-events: none; }
.legend { z-index: 1; position: absolute; right: 16px; bottom: 13px; display: flex; gap: 12px; color: #8190a3; font-size: 9px; }
.legend[hidden] { display: none; }
.legend span { display: flex; align-items: center; gap: 4px; }
.legend-atom { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #777; }
.legend-atom.carbon { background: #4b5565; }
.legend-atom.oxygen { background: #ed6a72; }
.legend-atom.hydrogen { background: #fff; border: 1px solid #b9c3d0; }
.legend-bond { width: 13px; height: 2px; background: #8692a2; }
.viewer-controls { min-height: 53px; padding: 0 18px; border-top: 1px solid #edf0f4; display: flex; align-items: center; gap: 19px; }
.controls-label { font-size: 8px; font-weight: 700; letter-spacing: 1px; color: #a1aaba; }
.control-divider { height: 17px; width: 1px; background: #e9edf2; margin-left: -9px; }
.toggle-control { display: inline-flex; align-items: center; gap: 7px; color: #6e7c91; font-size: 10px; cursor: pointer; white-space: nowrap; }
.toggle-control input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 27px; height: 15px; padding: 2px; display: inline-flex; align-items: center; border-radius: 9px; background: #dce1e9; transition: background .15s; }
.toggle-track span { display: block; width: 11px; height: 11px; background: white; border-radius: 50%; box-shadow: 0 1px 2px #17243b22; transition: transform .15s; }
.toggle-control input:checked + .toggle-track { background: #5b82e1; }
.toggle-control input:checked + .toggle-track span { transform: translateX(12px); }
.toggle-control input:focus-visible + .toggle-track { outline: 2px solid #7698ef; outline-offset: 2px; }
.arrow-sample { color: #5e83d6; font-size: 14px; }
.electron-sample { color: #7181a1; letter-spacing: -2px; font-size: 11px; }
.reset-button { margin-left: auto; background: none; border: 0; color: #8793a5; font-size: 10px; cursor: pointer; padding: 7px 0 7px 7px; }
.reset-button:hover { color: #456fce; }
.reset-button span { font-size: 15px; margin-right: 4px; vertical-align: -1px; }
.insight-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-top: 14px; }
.insight-card { min-width: 0; min-height: 88px; border: 1px solid #e7ebf1; border-radius: 9px; background: #fff; display: flex; align-items: center; padding: 14px 12px; gap: 10px; position: relative; }
.insight-icon { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 9px; font-size: 18px; }
.shape-icon { background: #eff3ff; color: #5b7fda; }
.bond-icon { background: #eef8f3; color: #53a181; }
.formula-icon { background: #f5f0ff; color: #8f6dd0; }
.insight-label { font-size: 8px; margin-bottom: 5px; letter-spacing: .8px; }
.insight-card h3 { margin: 0; font: 700 12px Manrope, sans-serif; color: #334159; }
.insight-detail { margin: 4px 0 0; font-size: 9px; color: #929cad; white-space: nowrap; }
.insight-arrow { align-self: flex-start; margin-left: auto; color: #c3cad5; font-size: 12px; }
.study-note { margin-top: 13px; border: 1px solid #e6ebf7; border-radius: 9px; background: #f7f9ff; min-height: 61px; padding: 12px 15px; display: flex; align-items: flex-start; gap: 11px; position: relative; overflow: hidden; }
.note-mark { display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid #9bb1e8; border-radius: 50%; color: #6684ce; font: 600 11px Georgia, serif; flex: none; }
.study-note strong { display: block; color: #5576c5; font-size: 10px; margin: 1px 0 4px; }
.study-note p { color: #78859b; font-size: 10px; line-height: 1.5; margin: 0; padding-right: 18px; }
.note-decoration { position: absolute; right: 14px; top: 15px; color: #dce4f7; font-size: 22px; }
.page-footer { display: flex; justify-content: space-between; color: #a0a9b7; font-size: 9px; margin: 18px 2px 0; }
.page-footer b { color: #c2c9d3; padding: 0 4px; }
@media (min-width: 1450px) {
  .workspace { grid-template-columns: 290px minmax(0, 1fr); gap: 46px; }
  .canvas-wrap { height: 410px; }
}
@media (max-width: 1050px) {
  .app-shell { padding: 0 24px; }
  .workspace { grid-template-columns: 240px minmax(0, 1fr); gap: 25px; }
  .library-panel { padding-right: 18px; }
  .canvas-wrap { height: 340px; }
  .viewer-controls { gap: 12px; padding: 0 12px; }
}
@media (max-width: 760px) {
  .app-shell { padding: 0 17px; }
  .topbar { height: 62px; }
  .course-tag { display: none; }
  .top-link { margin-left: auto; }
  .workspace { display: flex; flex-direction: column; gap: 22px; padding-top: 22px; }
  .library-panel { min-height: 0; border-right: 0; padding-right: 0; }
  .library-heading { margin-bottom: 12px; }
  .molecule-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 202px; overflow-y: auto; }
  .library-footer { display: none; }
  .molecule-heading { align-items: flex-start; }
  .title-block h2 { font-size: 23px; }
  .polarity-pill { margin-top: 8px; }
  .canvas-wrap { height: 320px; }
  .insight-grid { gap: 7px; }
  .insight-card { padding: 10px 8px; gap: 7px; }
  .insight-icon { width: 27px; height: 27px; }
  .insight-card h3 { font-size: 10px; }
  .insight-detail { font-size: 8px; }
}
@media (max-width: 500px) {
  .viewer-toolbar { padding: 0 12px; }
  .view-tabs { gap: 12px; }
  .view-tab { font-size: 9px; }
  .drag-hint { font-size: 0; }
  .drag-icon { font-size: 14px; }
  .canvas-wrap { height: 285px; }
  .viewer-controls { min-height: 76px; flex-wrap: wrap; gap: 10px 13px; padding: 10px 12px; }
  .control-divider { display: none; }
  .controls-label { margin-right: 2px; }
  .reset-button { margin-left: auto; }
  .insight-grid { grid-template-columns: 1fr; }
  .insight-card { min-height: 67px; padding: 10px 12px; }
  .insight-card h3 { font-size: 11px; }
  .insight-detail { font-size: 9px; }
  .page-footer { gap: 10px; font-size: 8px; }
}