/* ==========================================================================
   DAE designer and 3D viewer
   Layout: shared top bar → page toolbar → resizable panels → status bar.
   Colours come from the app's --app-* tokens so day and night match the site.
   ========================================================================== */

.dae-root {
  color-scheme: light;
  --ink: var(--app-fg, #1c2128);
  --muted: var(--app-muted, #4b5563);
  --rule: var(--app-line, rgb(28 33 40 / 0.14));
  --rule-strong: rgb(28 33 40 / 0.26);
  --paper: var(--app-bg, #f3efe6);
  --surface: var(--app-raised, #ffffff);
  --inset: var(--app-inset, #e7e2d6);
  --navy: #1e3a5f;
  --navy-soft: #e9eef6;
  --accent: var(--app-accent, #1d4ed8);
  --accent-hover: var(--app-accent-hover, #1e40af);
  --on-accent: #ffffff;
  --focus: var(--app-accent, #1d4ed8);
  --field: #ffffff;
  --field-line: rgb(28 33 40 / 0.24);
  --btn: #ffffff;
  --btn-line: rgb(28 33 40 / 0.2);
  --btn-hover: #edf1f7;
  --grip: rgb(28 33 40 / 0.34);
  --overlay: rgb(255 255 255 / 0.92);
  --card-shadow: 0 1px 2px rgb(15 23 42 / 0.05);
  --menu-shadow: 0 14px 36px rgb(15 23 42 / 0.18), 0 2px 6px rgb(15 23 42 / 0.08);
  --radius: 10px;
  --dae-viewport: #ece9e2;
  --dae-schematic: #faf8f3;
  --dae-viewer: #f4f1ea;
  --dae-viewer-ink: #1c1917;
  --dae-viewer-muted: #5f5a54;
  --dae-ok: #2f5d45;
  --dae-bad: #7a3b2e;
  /* One type family across the site: Geist, with Geist Mono only for sequences, indices and numbers. */
  --font-sans: var(--font-geist-sans), ui-sans-serif, system-ui, sans-serif;
  --font-mono: var(--font-geist-mono), ui-monospace, monospace;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
}

html[data-theme="night"] .dae-root {
  color-scheme: dark;
  --rule-strong: rgb(255 255 255 / 0.26);
  --navy: #93c5fd;
  --navy-soft: #2b3340;
  --focus: #93c5fd;
  /* The app's night hover blue is 3.7:1 under white text; stay on the darker blue. */
  --accent-hover: #1d4ed8;
  --field: #1f242d;
  --field-line: rgb(255 255 255 / 0.2);
  --btn: #3a4150;
  --btn-line: rgb(255 255 255 / 0.16);
  --btn-hover: #465062;
  --grip: rgb(255 255 255 / 0.36);
  --overlay: rgb(42 48 60 / 0.92);
  --card-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  --menu-shadow: 0 14px 36px rgb(0 0 0 / 0.5), 0 2px 6px rgb(0 0 0 / 0.3);
}

.dae-root *,
.dae-root *::before,
.dae-root *::after {
  box-sizing: border-box;
}

.dae-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.dae-stage > .workbench {
  height: 100%;
}

/* ---------- Shared top bar ---------- */

.dae-dnaos-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  min-height: 46px;
  padding: 0 0.9rem;
  background: var(--app-header, #242a32);
  border-bottom: 1px solid var(--app-line, rgb(255 255 255 / 0.14));
  color: var(--app-fg, #f4f3f0);
}

.dae-dnaos-bar a {
  color: inherit;
  text-decoration: none;
}

.dae-dnaos-label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--app-muted, #c5ccd6);
  white-space: nowrap;
}

.dae-dnaos-divider {
  width: 1px;
  height: 22px;
  background: var(--app-line, rgb(255 255 255 / 0.14));
}

.dae-dnaos-theme {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.page-nav {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--app-btn, rgb(28 33 40 / 0.07));
}

.page-nav .ghost-btn {
  min-height: 30px;
  padding: 0 0.8rem;
  border-color: transparent;
  background: transparent;
  color: var(--app-fg, var(--ink));
  font-size: 0.8rem;
  text-decoration: none;
}

.page-nav .ghost-btn:hover {
  background: var(--app-btn-hover, var(--btn-hover));
  border-color: transparent;
}

.page-nav .ghost-btn.on-tool,
.page-nav .ghost-btn.on-tool:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.design-name {
  display: block;
  width: 15rem;
  max-width: 24vw;
  min-height: 32px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--app-fg, var(--ink));
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0.2rem 0.5rem;
  text-overflow: ellipsis;
}

.design-name:hover {
  border-color: var(--app-line, var(--rule));
}

.design-name:focus {
  outline: none;
  border-color: var(--focus);
  background: var(--field);
}

/* ---------- Page frame ---------- */

.workbench {
  display: flex;
  height: 100%;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.topbar,
.app-chrome {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  min-height: 50px;
  padding: 0.4rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.cmd-bar {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 0.4rem;
  min-width: 0;
}

.cmd-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
}

.cmd-bar > .cmd-group + .cmd-group {
  margin-left: 0.75rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--rule);
}

.cmd-bar > .cmd-group-push,
.cmd-bar > .cmd-group + .cmd-group-push {
  margin-left: auto;
}

.cmd-label {
  flex: 0 0 auto;
  margin-right: 0.15rem;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}

@media (max-width: 1279px) {
  .cmd-label {
    display: none;
  }

  .cmd-bar > .cmd-group + .cmd-group {
    margin-left: 0.5rem;
    padding-left: 0.5rem;
  }
}

.cmd-bar .ghost-btn,
.cmd-bar .primary-btn {
  padding: 0 0.7rem;
}

.seg-group {
  display: inline-flex;
}

.seg-group > .hint-wrap > .seg-btn {
  border-radius: 0;
}

.seg-group > .hint-wrap + .hint-wrap > .seg-btn {
  margin-left: -1px;
}

.seg-group > .hint-wrap:first-child > .seg-btn {
  border-radius: 7px 0 0 7px;
}

.seg-group > .hint-wrap:last-child > .seg-btn {
  border-radius: 0 7px 7px 0;
}

.seg-group .seg-btn.on-tool,
.seg-group .seg-btn:focus-visible {
  position: relative;
  z-index: 1;
}

.seg-group + .seg-group {
  margin-left: 0.35rem;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.1rem;
  flex-shrink: 0;
  min-height: 32px;
  padding: 0.3rem 1rem;
  border-top: 1px solid var(--rule);
  background: var(--surface);
}

.status {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-warn {
  margin: 0;
  color: #7a4b12;
  font-size: 0.78rem;
}

/* ---------- Resizable stage ---------- */

.stage,
.viewer-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 8px;
  background: var(--paper);
}

[data-group] {
  min-width: 0;
  min-height: 0;
}

[data-panel] {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

[data-panel] > div {
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.split-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

.rail,
.canvas-col,
.right-col,
.workspace-group,
.view-split {
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.split-panel.is-hidden {
  visibility: hidden;
  border: 0;
}

.right-col > .split-panel {
  height: 100%;
}

.rail-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* Separators: an 8 px gutter with a visible grip; the library widens the pointer target further. */
.split-handle {
  position: relative;
  flex: 0 0 8px;
  background: transparent;
  outline: none;
  touch-action: none;
}

.split-handle[aria-orientation="vertical"] {
  width: 8px;
  cursor: col-resize;
}

.split-handle[aria-orientation="horizontal"] {
  height: 8px;
  cursor: row-resize;
}

.split-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 3px;
  background: var(--grip);
  transform: translate(-50%, -50%);
  transition: background-color 0.12s ease, width 0.12s ease, height 0.12s ease;
}

.split-handle[aria-orientation="vertical"]::before {
  width: 3px;
  height: 36px;
}

.split-handle[aria-orientation="horizontal"]::before {
  width: 36px;
  height: 3px;
}

.split-handle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: transparent;
  transition: background-color 0.12s ease;
}

.split-handle:is([data-separator="hover"], [data-separator="active"], [data-separator="focus"])::after {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.split-handle:is([data-separator="hover"], [data-separator="active"], [data-separator="focus"])::before {
  background: var(--accent);
}

.split-handle[aria-orientation="vertical"]:is([data-separator="active"], [data-separator="focus"])::before {
  height: 56px;
}

.split-handle[aria-orientation="horizontal"]:is([data-separator="active"], [data-separator="focus"])::before {
  width: 56px;
}

.split-handle:focus-visible::after {
  outline: 2px solid var(--focus);
  outline-offset: -1px;
}

html[data-theme="night"] .dae-root .split-handle:is([data-separator="hover"], [data-separator="active"], [data-separator="focus"])::before {
  background: var(--navy);
}

/* Collapsed side panel: a narrow strip that reopens it. */
.panel-strip {
  align-items: stretch;
}

.strip-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  height: 100%;
  padding: 0.7rem 0;
  border: 0;
  background: transparent;
  color: var(--navy);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.panel-strip > .hint-wrap {
  display: flex;
  flex: 1;
  min-height: 0;
}

.strip-btn:hover {
  background: var(--btn-hover);
}

.strip-title {
  writing-mode: vertical-rl;
  letter-spacing: 0.04em;
}

.chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ---------- Panels ---------- */

.panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.panel-head {
  flex-shrink: 0;
  min-height: 42px;
  padding: 0.3rem 0.5rem 0.3rem 0.85rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.panel-head[draggable="true"] {
  cursor: grab;
  user-select: none;
}

.panel-head[draggable="true"]:active {
  cursor: grabbing;
}

.panel-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
  flex-shrink: 0;
}

.panel-head h1 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-count {
  display: inline-flex;
  align-items: center;
  min-width: 1.5rem;
  height: 1.25rem;
  padding: 0 0.4rem;
  justify-content: center;
  border-radius: 999px;
  background: var(--inset);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.panel-head p,
.muted {
  margin: 0.12rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.panel-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}

.table-panel.is-collapsed .panel-head {
  border-bottom-color: transparent;
}

.slide-btns {
  display: flex;
  gap: 0.15rem;
  flex-shrink: 0;
}

.slide-btn,
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.slide-btn:hover:not(:disabled),
.icon-btn:hover {
  background: var(--btn-hover);
  border-color: var(--btn-line);
  color: var(--ink);
}

.icon-btn[aria-pressed="true"] {
  background: var(--navy-soft);
  border-color: var(--btn-line);
  color: var(--navy);
}

.slide-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

/* ---------- Buttons ---------- */

.primary-btn,
.ghost-btn,
.preset-btn,
.tiny-btn,
.tab,
.tool-btn,
.process-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 32px;
  border-radius: 7px;
  border: 1px solid var(--btn-line);
  background: var(--btn);
  color: var(--navy);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 550;
  line-height: 1.2;
  padding: 0 0.8rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.primary-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.preset-btn {
  justify-content: flex-start;
  text-align: left;
}

.preset-btn:hover,
.ghost-btn:hover,
.tiny-btn:hover,
.tab:hover,
.tool-btn:hover:not(.on),
.process-btn:hover:not(.on) {
  background: var(--btn-hover);
  border-color: var(--rule-strong);
}

.primary-btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.tool-btn.on,
.process-btn.on,
.ghost-btn.on-tool,
.tiny-btn.on-base,
.tab.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.tool-btn.on:hover,
.ghost-btn.on-tool:hover,
.tiny-btn.on-base:hover,
.tab.on:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.tiny-btn {
  min-height: 28px;
  padding: 0 0.6rem;
  font-size: 0.76rem;
}

.primary-btn:disabled,
.ghost-btn:disabled,
.tool-btn:disabled,
.tiny-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dae-root :is(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.hint-wrap {
  display: inline-flex;
  vertical-align: middle;
}

.hint-bubble {
  position: fixed;
  z-index: 60;
  max-width: 280px;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: #152238;
  color: #f8f5ef;
  font-size: 0.78rem;
  line-height: 1.4;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
  pointer-events: none;
}

/* ---------- Menus ---------- */

.dae-menu {
  position: relative;
  display: inline-flex;
}

.menu-caret {
  width: 12px;
  height: 12px;
  margin-right: -0.15rem;
}

.ghost-btn[aria-expanded="true"] {
  background: var(--navy-soft);
  border-color: var(--rule-strong);
}

.dae-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  min-width: 15rem;
  padding: 0.35rem;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--menu-shadow);
}

.dae-menu-list.align-end {
  left: auto;
  right: 0;
}

.dae-menu-list .hint-wrap {
  display: block;
}

.dae-menu-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  min-height: 32px;
  padding: 0 0.7rem 0 0.35rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.dae-menu-item:hover,
.dae-menu-item:focus-visible {
  background: var(--btn-hover);
  outline-offset: -2px;
}

.dae-menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dae-menu-check {
  width: 1rem;
  flex-shrink: 0;
  text-align: center;
  color: var(--navy);
  font-weight: 700;
}

.dae-menu-sep {
  height: 1px;
  margin: 0.3rem 0.25rem;
  background: var(--rule);
}

.dae-menu-heading {
  margin: 0.45rem 0.7rem 0.15rem 1.75rem;
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.dae-menu-heading:first-child {
  margin-top: 0.2rem;
}

/* ---------- Form fields ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.5rem 0;
  font-size: 0.8rem;
  color: var(--ink);
}

.field input,
.field select,
.seg select,
.seg input,
.name-input {
  min-height: 32px;
  background: var(--field);
  border: 1px solid var(--field-line);
  color: var(--ink);
  border-radius: 7px;
  padding: 0.25rem 0.5rem;
  font: inherit;
  font-size: 0.82rem;
}

.seg input {
  width: 5.5rem;
}

.field input:focus,
.field select:focus,
.seg select:focus,
.seg input:focus,
.name-input:focus,
.seq-input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 0;
  border-color: var(--focus);
}

.field em {
  font-style: italic;
  color: var(--muted);
  font-size: 0.72rem;
}

.check {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.82rem;
  margin: 0.4rem 0;
}

.seg {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.name-input {
  width: 8.5rem;
  max-width: 100%;
  min-height: 30px;
  font-weight: 500;
  color: var(--navy);
}

.seq-input {
  width: 100%;
  min-width: 12rem;
  min-height: 30px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  border: 1px solid var(--field-line);
  background: var(--field);
  color: var(--ink);
  border-radius: 6px;
  padding: 0.3rem 0.45rem;
}

.field-error {
  margin: 0.15rem 0 0;
  color: #9a3412;
  font-size: 0.74rem;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.4rem 0;
  font-size: 0.8rem;
}

.field-readout {
  padding: 0.32rem 0;
  color: var(--muted);
}

/* ---------- Design rail ---------- */

.process-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--rule);
}

.process-stack-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.rail-form {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.75rem 0.9rem 1.1rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
}

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

.tool-btn,
.process-btn {
  width: 100%;
  padding: 0 0.4rem;
  font-size: 0.8rem;
}

.tool-grid .hint-wrap,
.process-stack .hint-wrap,
.side-actions .hint-wrap {
  display: block;
}

.tool-grid .hint-wrap > button,
.process-stack .hint-wrap > button,
.side-actions .hint-wrap > button {
  width: 100%;
}

.rail-form .hint-wrap {
  display: flex;
}

.rail-form .hint-wrap > .field,
.rail-form .hint-wrap > .check-field {
  flex: 1;
  min-width: 0;
}

.rail-form .grid .hint-wrap {
  display: flex;
}

.rail-form .grid .hint-wrap > :is(button, label) {
  width: 100%;
}

.side-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.lattice-box {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.5rem 0.65rem 0.65rem;
}

.lattice-box summary {
  cursor: pointer;
  min-height: 28px;
  display: flex;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
}

/* ---------- Path diagram and 3D model ---------- */

.edit-bar {
  display: flex;
  flex-wrap: wrap;
  flex-shrink: 0;
  align-items: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.3rem 0.85rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.78rem;
  color: var(--muted);
}

.edit-bar > span:first-child {
  margin-right: 0.3rem;
}

.schematic-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.schematic-scroll {
  flex: 1;
  min-height: 0;
  margin: 0.5rem;
  background: var(--dae-schematic);
  border: 1px solid var(--rule);
  border-radius: 6px;
}

.schematic-download {
  position: absolute;
  right: 0.9rem;
  bottom: 0.9rem;
  z-index: 3;
}

.schematic-empty,
.view3d-empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
  min-height: 12rem;
  padding: 1.4rem 1.6rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.schematic-empty p:first-child,
.view3d-empty {
  font-family: var(--font-sans);
  color: var(--navy);
  font-size: 1.05rem;
}

.view3d-empty {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background: transparent;
  min-height: 0;
}

.view3d-wrap {
  flex: 1;
  min-height: 0;
  height: 100%;
  background: var(--dae-viewport);
  position: relative;
}

.view3d-wrap > div:not(.helix-pad):not(.view3d-empty):not(.model-shot),
.view3d-wrap canvas {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  background: var(--dae-viewport);
}

.view3d-wrap > .view3d-empty {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  background: transparent !important;
  color: var(--navy);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  padding: 1.4rem;
}

.model-shot {
  position: absolute;
  z-index: 3;
  right: 0.6rem;
  bottom: 0.6rem;
  pointer-events: auto;
}

.helix-pad {
  position: absolute;
  z-index: 3;
  left: 0.6rem;
  bottom: 0.6rem;
  display: grid;
  grid-template-columns: 32px 36px 32px;
  grid-template-areas:
    ". up ."
    "left down right"
    "ccw sixty cw"
    "tiltn ang tiltp"
    ". del .";
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--overlay);
  pointer-events: none;
}

.helix-pad > :nth-child(1) {
  grid-area: up;
}
.helix-pad > :nth-child(2) {
  grid-area: left;
}
.helix-pad > :nth-child(3) {
  grid-area: down;
}
.helix-pad > :nth-child(4) {
  grid-area: right;
}
.helix-pad > :nth-child(5) {
  grid-area: ccw;
}
.helix-pad > :nth-child(6) {
  grid-area: sixty;
}
.helix-pad > :nth-child(7) {
  grid-area: cw;
}
.helix-pad > :nth-child(8) {
  grid-area: tiltn;
}
.helix-pad > :nth-child(9) {
  grid-area: ang;
}
.helix-pad > :nth-child(10) {
  grid-area: tiltp;
}
.helix-pad > :nth-child(11) {
  grid-area: del;
}

.helix-pad .hint-wrap {
  pointer-events: auto;
}

.helix-pad-btn {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  line-height: 1;
}

.helix-pad-btn-wide {
  width: 100%;
  font-size: 0.72rem;
  letter-spacing: 0;
}

.helix-pad-angle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  min-height: 32px;
  font-size: 0.64rem;
  line-height: 1.05;
  color: var(--navy);
  text-align: center;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.helix-pad-angle em {
  font-style: normal;
  font-weight: 650;
  font-size: 0.72rem;
}

/* ---------- Oligonucleotide drawer ---------- */

.drawer-head .tiny-btn {
  margin-right: 0.15rem;
}

.empty-oligos {
  padding: 1.1rem 1.2rem;
}

.strand-table,
.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.strand-table th,
.mini-table th {
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--rule-strong);
}

.strand-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.strand-table th,
.mini-table th,
.strand-table td,
.mini-table td {
  padding: 0.4rem 0.7rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.strand-table tbody tr:hover td {
  background: color-mix(in srgb, var(--navy-soft) 55%, transparent);
}

.mini-table tr.row-weakest td {
  font-weight: 600;
}

/* ---------- Analysis column ---------- */

.analysis-panel > :not(.panel-head) {
  flex: 1;
  min-height: 0;
  height: auto;
}

.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  min-width: 0;
  border-radius: 9px;
  background: var(--inset);
}

.tab {
  min-height: 28px;
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  padding: 0 0.8rem;
}

.tab:hover {
  background: var(--btn-hover);
  border-color: transparent;
}

.verdict {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
}

.verdict-pass {
  border-color: #2f5d45;
  background: #f1f7f3;
}

.verdict-caution {
  border-color: #8a7548;
  background: #f8f4ea;
}

.verdict-fail {
  border-color: #7a3b2e;
  background: #f8eee9;
}

.verdict-line {
  margin: 0.2rem 0 0;
  font-size: 0.84rem;
}

.checklist {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
}

.checklist li {
  font-size: 0.8rem;
  margin: 0.12rem 0;
}

.check-ok {
  color: #2f5d45;
}

.check-no {
  color: #7a3b2e;
}

.hit-list {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  color: #7a3b2e;
  font-size: 0.78rem;
}

.ok-line {
  color: #2f5d45;
  font-size: 0.8rem;
  margin: 0.35rem 0 0;
}

.warn-bar {
  display: none;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.workflow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.help-copy h2 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  margin: 0.95rem 0 0.3rem;
  color: var(--navy);
}

.help-copy p,
.help-copy li {
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--ink);
  max-width: 68ch;
}

.help-copy ol,
.help-copy ul {
  padding-left: 1.15rem;
}

.swatch {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.crash {
  padding: 1rem;
  color: #6b3a32;
  font-size: 0.85rem;
}

.crash pre {
  white-space: pre-wrap;
  color: #8a4036;
}

/* ---------- 3D viewer ---------- */

.viewer-page .app-chrome {
  max-height: none;
  overflow: visible;
}

.viewer-rail {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.viewer-inspector {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.25rem 0 1rem;
  display: flex;
  flex-direction: column;
}

.inspector-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--rule);
}

.inspector-section:last-child {
  border-bottom: 0;
}

.inspector-section .panel-kicker {
  margin: 0;
}

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

.transform-pad {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
}

.transform-pad .seg {
  justify-content: space-between;
}

.move-pad {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.move-row {
  display: grid;
  grid-template-columns: 2.6rem 1fr 1fr;
  align-items: center;
  gap: 0.3rem;
}

.move-row .hint-wrap,
.move-row .hint-wrap > button {
  width: 100%;
}

.move-axis {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.viewer-canvas-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--dae-viewer);
}

.viewer-view-bar {
  position: absolute;
  z-index: 5;
  top: 0.6rem;
  right: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.3rem;
  max-width: calc(100% - 1.2rem);
  padding: 0.35rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--overlay);
  box-shadow: var(--card-shadow);
}

.viewer-view-bar .seg {
  padding: 0 0.3rem;
}

.viewer-empty {
  color: var(--dae-viewer-muted);
  z-index: 3;
}

.viewer-empty p:first-child {
  color: var(--dae-viewer-ink);
}

.box-select {
  position: absolute;
  z-index: 4;
  border: 1px dashed #6f93cf;
  background: rgba(90, 130, 190, 0.16);
  pointer-events: none;
}

.strand-mini {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.strand-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-height: 32px;
  text-align: left;
  border: 1px solid var(--rule);
  background: var(--btn);
  border-radius: 7px;
  padding: 0.25rem 0.5rem;
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink);
  cursor: pointer;
}

.strand-chip.on,
.strand-chip:hover {
  border-color: var(--navy);
  background: var(--navy-soft);
}

.seq-caption {
  font-size: 0.78rem;
  color: var(--muted);
}

.viewer-seq {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
}

.viewer-note {
  border-top: 1px solid var(--rule);
  padding-top: 0.2rem;
}

.viewer-note h2 {
  margin-top: 0.35rem;
}

.viewer-rail .tool-grid .hint-wrap {
  display: block;
}

.hidden {
  display: none;
}

.tabular {
  font-family: var(--font-mono);
  font-size: 0.95em;
  font-variant-numeric: tabular-nums;
}

/* ---------- Night: status colours ---------- */

html[data-theme="night"] .dae-root .verdict-pass {
  border-color: #34d399;
  background: #1b2e26;
}

html[data-theme="night"] .dae-root .verdict-caution {
  border-color: #fbbf24;
  background: #2a2618;
}

html[data-theme="night"] .dae-root .verdict-fail {
  border-color: #f87171;
  background: #2a1b18;
}

html[data-theme="night"] .dae-root .footer-warn {
  color: #fbbf24;
}

html[data-theme="night"] .dae-root .crash,
html[data-theme="night"] .dae-root .crash pre {
  color: #fca5a5;
}

@media (prefers-reduced-motion: reduce) {
  .dae-root *,
  .dae-root *::before,
  .dae-root *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Domain Tm strip, twist table, lattice preview, melt curves ---------- */
.dae-root {
  --st-pass: #2f5d45;
  --st-pass-fill: #dcebe1;
  --st-caution: #8a7548;
  --st-caution-fill: #f1e6c9;
  --st-fail: #7a3b2e;
  --st-fail-fill: #f2d9d1;
  --st-sticky: #5c564e;
  --st-sticky-fill: #ebe6dc;
  --lat-a: #dfe7f1;
  --lat-b: #efe4d2;
}

html[data-theme="night"] .dae-root {
  --st-pass: #34d399;
  --st-pass-fill: #1b3a2e;
  --st-caution: #fbbf24;
  --st-caution-fill: #3a3016;
  --st-fail: #f87171;
  --st-fail-fill: #3d201c;
  --st-sticky: #c5ccd6;
  --st-sticky-fill: #2b313c;
  --lat-a: #23324a;
  --lat-b: #3a2f22;
}

.domain-strip,
.lattice-preview {
  margin: 0.35rem 0 0;
}

.domain-strip-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.domain-strip svg,
.lattice-preview svg {
  display: block;
}

.strip-axis {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--muted);
}

.strip-rail {
  stroke: var(--rule);
  stroke-width: 1;
}

.strip-fill {
  stroke-width: 1;
}

.strip-pass {
  fill: var(--st-pass-fill);
  stroke: var(--st-pass);
}

.strip-caution {
  fill: var(--st-caution-fill);
  stroke: var(--st-caution);
}

.strip-fail {
  fill: var(--st-fail-fill);
  stroke: var(--st-fail);
}

.strip-sticky {
  fill: var(--st-sticky-fill);
  stroke: var(--st-sticky);
  stroke-dasharray: 3 2;
}

.strip-weakest {
  stroke-width: 2.5;
}

.strip-seg:focus-visible .strip-fill,
.strip-seg:hover .strip-fill {
  stroke-width: 2.5;
  outline: none;
}

.strip-label {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--ink);
  pointer-events: none;
}

.strip-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.strip-key {
  display: inline-block;
  width: 0.8rem;
  height: 0.55rem;
  border: 1px solid;
  border-radius: 2px;
  margin-right: 0.25rem;
  vertical-align: middle;
}

.strip-key.strip-pass {
  background: var(--st-pass-fill);
  border-color: var(--st-pass);
}

.strip-key.strip-caution {
  background: var(--st-caution-fill);
  border-color: var(--st-caution);
}

.strip-key.strip-fail {
  background: var(--st-fail-fill);
  border-color: var(--st-fail);
}

.strip-key.strip-sticky {
  background: var(--st-sticky-fill);
  border-color: var(--st-sticky);
  border-style: dashed;
}

.strip-key.lat-A {
  background: var(--lat-a);
  border-color: var(--navy);
}

.strip-key.lat-B {
  background: var(--lat-b);
  border-color: var(--st-caution);
}

.strip-key.lat-sticky {
  background: var(--st-sticky-fill);
  border-color: var(--st-sticky);
  border-style: dashed;
}

.strip-key.strip-dot {
  width: 0.55rem;
  border-radius: 50%;
  background: #c9a227;
  border-color: #8a6d12;
}

.cell-warn {
  color: var(--st-caution);
  font-weight: 600;
}

.cell-fail {
  color: var(--st-fail);
  font-weight: 600;
}

.lat-tile {
  stroke-width: 1;
}

.lat-A {
  fill: var(--lat-a);
  stroke: var(--navy);
}

.lat-B {
  fill: var(--lat-b);
  stroke: var(--st-caution);
}

.lat-sticky {
  fill: var(--st-sticky-fill);
  stroke: var(--st-sticky);
  stroke-dasharray: 2 2;
  stroke-width: 0.75;
}

.lat-helix {
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
}

.lat-xo {
  stroke: var(--st-fail);
  stroke-width: 2;
}

.lat-hairpin {
  fill: #c9a227;
  stroke: var(--surface);
  stroke-width: 1.5;
}

.lat-label {
  font-family: var(--font-sans);
  font-size: 10px;
  fill: var(--ink);
}

.melt-table td {
  vertical-align: middle;
}

.melt-spark {
  display: block;
  cursor: crosshair;
}

.melt-bg {
  fill: transparent;
}

.melt-line {
  fill: none;
  stroke: var(--navy);
  stroke-width: 2;
  stroke-linejoin: round;
}

.melt-check {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 2 2;
}

.melt-cross {
  stroke: var(--ink);
  stroke-width: 1;
}

.note-list {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.mod-pickers {
  display: flex;
  gap: 0.25rem;
}

.mod-select {
  min-height: 28px;
  font: inherit;
  font-size: 0.72rem;
  border: 1px solid var(--field-line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  padding: 0.1rem 0.25rem;
}

/* ---------- Night: drawn surfaces and status text ---------- */
html[data-theme="night"] .dae-root {
  --dae-viewport: #1f242d;
  --dae-schematic: #232833;
  --dae-viewer: #16181e;
  --dae-viewer-ink: #f4f1ea;
  --dae-viewer-muted: #d7d2c8;
  --dae-ok: #34d399;
  --dae-bad: #f87171;
}

html[data-theme="night"] .dae-root :is(.check-ok, .ok-line) {
  color: var(--dae-ok);
}

html[data-theme="night"] .dae-root :is(.check-no, .hit-list, .field-error) {
  color: var(--dae-bad);
}

html[data-theme="night"] .dae-root :is(.strand-table th, .mini-table th) {
  border-bottom-color: var(--rule-strong);
}
