/* zcurvejs -- local analysis page.
   The visual language follows ZcurveHub: a dark fixed sidebar, a light page with
   one white card, dashed dividers, gradient buttons and a cyan accent. */

:root {
  --sidebar: #1b1f27;
  --sidebar-hover: #2d333b;
  --page: #f5f5f5;
  --card: #ffffff;
  --ink: #333333;
  --ink-soft: #555555;
  --ink-muted: #6c757d;
  --border: #dee2e6;
  --border-soft: #dddddd;
  --accent: #30cfd0;
  --blue-a: #228be6;
  --blue-b: #1c7ed6;
  --green-a: #40c057;
  --green-b: #2b8a3e;
  --radius: 8px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
}

/* an explicit display rule would otherwise beat the hidden attribute */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
    Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ sidebar */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  background: var(--sidebar);
  color: #ffffff;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

/* the menu grew a fourth group; on a short window the mark gives back the room
   instead of pushing the last links into a scroll */
@media (max-height: 880px) and (min-width: 1001px) {
  .sidebar {
    padding-bottom: 12px;
  }

  .logo {
    margin-top: 18px;
  }

  .logo img {
    width: 62px;
    height: 62px;
  }

  .logo-title {
    margin-bottom: 0;
  }

  .group-title {
    padding-top: 7px;
  }

  .group-title::after {
    margin-top: 6px;
  }

  .sidebar .menu-item {
    padding-top: 7px;
    padding-bottom: 7px;
  }
}

/* The bar and the wrapper only exist for the narrow layout; on a wide screen
   the sidebar keeps its column and these two rules stay out of the way. */
.sidebar-bar {
  display: none;
}

.sidebar-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  /* the column can be taller than a short window; the list scrolls, the mark
     and the name stay where they are */
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #3b4450 transparent;
}

.sidebar-home {
  position: absolute;
  top: 18px;
  left: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  text-decoration: none;
  font-size: 12px;
  opacity: 0.75;
}

.sidebar-home:hover {
  opacity: 1;
}

.sidebar-home span {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logo {
  display: block;
  text-align: center;
  margin-top: 42px;
  transition: transform 0.3s ease-in-out;
}

.logo img {
  width: 104px;
  height: 104px;
  object-fit: contain;
}

.logo:hover {
  animation: shake 1s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(5deg); }
  40% { transform: rotate(-5deg); }
  60% { transform: rotate(5deg); }
  80% { transform: rotate(-5deg); }
}

.logo-title {
  text-align: center;
  margin-bottom: 6px;
}

.logo-title h2 a {
  color: inherit;
  text-decoration: none;
}

.logo-title h2 a:hover {
  color: var(--accent);
}

.logo-title h2 {
  margin: 4px 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.logo-title p {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.85;
}

.group-title {
  text-align: center;
  font-weight: 700;
  color: #aaaaaa;
  padding: 14px 20px 4px;
  font-size: 14px;
}

.group-title::after {
  content: '';
  display: block;
  height: 1px;
  margin-top: 8px;
  background: linear-gradient(to right, transparent, #555555, transparent);
}

.menu {
  display: flex;
  flex-direction: column;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 28px;
  color: #ffffff;
  text-decoration: none;
  font-size: 15px;
  transition: background-color 0.2s;
}

.menu-item svg {
  width: 17px;
  height: 17px;
  opacity: 0.85;
  flex: none;
}

.menu-item:hover,
.menu-item.active {
  background: var(--sidebar-hover);
}

.menu-item.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-misc {
  margin-top: auto;
  padding-top: 6px;
}

/* ------------------------------------------------------------------ content */

.content {
  margin-left: 250px;
  padding: 30px 20px 60px;
}

.panel {
  max-width: 1600px;
  margin: 0 auto;
  padding: 30px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}

.description {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.6;
}

.divider {
  margin: 22px 0;
  border: 0;
  height: 1px;
  background: repeating-linear-gradient(
    to right,
    #cccccc,
    #cccccc 5px,
    transparent 5px,
    transparent 10px
  );
}

.section-title {
  margin: 18px 0 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
}

/* -------------------------------------------------------------------- input */

.drop-zone {
  border: 2px dashed var(--border-soft);
  border-radius: 10px;
  background: #f8f9fa;
  padding: 26px;
  text-align: center;
  transition: border-color 0.2s, background-color 0.2s;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--accent);
  background: rgba(48, 207, 208, 0.06);
}

.drop-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--ink-muted);
}

.drop-label strong {
  color: var(--ink-soft);
  font-size: 15px;
}

.drop-label span {
  font-size: 13px;
}

.input-drop {
  padding: 12px 16px;
  text-align: left;
}

.input-drop .drop-label {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: left;
}

.input-drop .drop-label > svg {
  flex: 0 0 auto;
}

.drop-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.sequence {
  width: 100%;
  min-height: 110px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  color: #343a40;
  resize: vertical;
}

.sequence:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(48, 207, 208, 0.12);
}

/* ----------------------------------------------------------------- controls */

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin-top: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 200px;
  max-width: 340px;
}

.field > span {
  color: #495057;
  font-size: 13.5px;
  font-weight: 500;
}

.field em {
  color: var(--blue-a);
  font-style: normal;
  font-weight: 700;
}

.field select,
.field input[type='range'] {
  width: 100%;
}

.field select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: #343a40;
  font-size: 14px;
}

.field select:focus {
  outline: none;
  border-color: var(--accent);
}

.field input[type='range'] {
  accent-color: var(--accent);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #444444;
  font-size: 14px;
  cursor: pointer;
  padding-bottom: 7px;
}

.checkbox input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 20px;
  border: none;
  border-radius: 6px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.25s, transform 0.1s, background 0.25s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.button:active {
  transform: scale(0.98);
}

.button:disabled {
  background: #adb5bd !important;
  cursor: not-allowed;
  box-shadow: none;
}

#rotate-ori:disabled {
  background: #ffffff !important;
  color: var(--ink-soft);
  cursor: default;
}

.button-primary {
  background: linear-gradient(135deg, var(--blue-a) 0%, var(--blue-b) 100%);
}

.button-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--blue-b) 0%, var(--blue-a) 100%);
  box-shadow: 0 4px 8px rgba(28, 126, 214, 0.3);
}

.button-green {
  background: linear-gradient(135deg, var(--green-a) 0%, var(--green-b) 100%);
}

.button-ghost {
  background: #ffffff;
  color: var(--ink-soft);
  border: 1px solid var(--border);
  box-shadow: none;
}

.button-ghost:hover:not(:disabled) {
  background: #f1f3f5;
  color: var(--ink);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.button-green:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--green-b) 0%, var(--green-a) 100%);
  box-shadow: 0 4px 8px rgba(43, 138, 62, 0.3);
}

.download-control {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
}

.rotation-control {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
}

.rotation-control select,
.rotation-control input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-right: 0;
  background: #ffffff;
  color: var(--ink-soft);
  font-size: 13.5px;
}

.rotation-control select {
  min-width: 112px;
  border-radius: 6px 0 0 6px;
}

.rotation-control input {
  width: 112px;
}

.rotation-control select:focus,
.rotation-control input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(48, 207, 208, 0.12);
}

.rotation-control .button {
  border-radius: 0 6px 6px 0;
}

.download-control select {
  min-width: 205px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  background: #ffffff;
  color: var(--ink-soft);
  font-size: 13.5px;
}

.download-control select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(48, 207, 208, 0.12);
}

.download-control option:disabled {
  color: #adb5bd;
  background: #f8f9fa;
}

.download-control .button {
  border-radius: 0 6px 6px 0;
}

.status {
  color: var(--ink-muted);
  font-size: 13.5px;
  padding-bottom: 8px;
}

.status.error {
  color: #c92a2a;
}

/* -------------------------------------------------------------------- meta */

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 18px;
  padding: 16px;
  background: #f8f9fa;
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.meta-grid > div,
.stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  color: var(--ink-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-value {
  color: var(--ink);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* -------------------------------------------------------------------- plot */

/* The documentation view: the contents on the left, the page on the right. The
   Markdown behind it keeps its own heading levels, so the type scale here has
   to hold h2 through h4. */
.docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 820px);
  justify-content: center;
  gap: 40px;
  align-items: start;
}

.docs-nav {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 16px 2px 2px;
  border-right: 1px solid var(--border-soft);
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}

.docs-nav-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 8px;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border-soft);
}

.docs-nav-title span {
  color: #1e293b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs-nav-title em {
  color: var(--ink-muted);
  font-size: 11.5px;
  font-style: normal;
}

.docs-nav-group {
  display: flex;
  flex-direction: column;
}

.docs-nav-page {
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
}

.docs-nav-page:hover {
  background: #f1f4f9;
}

.docs-nav-group.open .docs-nav-page {
  background: #eef4ff;
  color: #0a2463;
}

.docs-nav-subtitle {
  padding: 8px 10px 3px 22px;
  color: #7c8798;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs-nav-sub {
  padding: 5px 10px 5px 22px;
  color: var(--ink-muted);
  font-size: 12.5px;
  line-height: 1.35;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.docs-nav-sub:hover,
.docs-nav-sub.active {
  color: var(--ink);
  border-left-color: var(--accent);
  background: #f5faff;
}

/* a narrow window stacks the contents above the page */
@media (max-width: 1000px) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .docs-nav {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 5px;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
    padding: 0 0 14px;
    max-height: none;
  }

  .docs-nav-title {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
    padding: 0 2px 8px;
  }

  .docs-nav-group {
    min-width: 0;
  }

  .docs-nav-page {
    height: 100%;
    padding: 8px 10px;
    background: #f8fafc;
    font-size: 12.5px;
    text-align: center;
  }

  .docs-nav-subtitle,
  .docs-nav-sub {
    display: none;
  }
}

.docs-page {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.65;
}

.docs-page > :first-child {
  margin-top: 0;
}

.docs-page-header {
  margin-bottom: 26px;
  padding: 2px 0 22px;
  border-bottom: 1px solid var(--border-soft);
}

.docs-page-index {
  display: inline-block;
  margin-bottom: 8px;
  color: #1c62c9;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs-page-header h1 {
  margin: 0;
  color: #10213d;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.docs-page-header p {
  max-width: 660px;
  margin: 9px 0 0;
  color: var(--ink-muted);
  font-size: 14px;
}

.docs-content > :first-child {
  margin-top: 0;
}

.docs-content h2,
.docs-content h3,
.docs-content h4 {
  scroll-margin-top: 24px;
}

.docs-page h2 {
  margin: 30px 0 10px;
  font-size: 20px;
  font-weight: 700;
  color: #12233f;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}

.docs-page h3 {
  margin: 24px 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: #22324b;
}

.docs-page h4 {
  margin: 20px 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: #33415c;
}

.docs-page p {
  margin: 10px 0;
}

.docs-page ul,
.docs-page ol {
  margin: 10px 0;
  padding-left: 22px;
}

.docs-page li {
  margin: 4px 0;
}

.docs-page a {
  color: #1c62c9;
}

.docs-page code {
  padding: 1px 5px;
  border-radius: 5px;
  background: #f1f4f9;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.docs-code {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: #f8fafc;
  overflow-x: auto;
}

.docs-code code {
  padding: 0;
  background: none;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
}

.docs-page blockquote {
  margin: 14px 0;
  padding: 2px 16px;
  border-left: 3px solid #b9cbe8;
  background: #f6f9fd;
  border-radius: 0 8px 8px 0;
  color: #3d4a5c;
}

.docs-page hr {
  margin: 22px 0;
  border: 0;
  border-top: 1px solid var(--border-soft);
}

.docs-table {
  margin: 14px 0;
  overflow-x: auto;
}

.docs-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.docs-page th,
.docs-page td {
  padding: 6px 12px;
  border: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

.docs-page th {
  background: #f4f7fb;
  font-weight: 600;
}

.docs-figure {
  margin: 20px 0 22px;
  padding: 0;
}

.docs-figure img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: #ffffff;
}

.docs-figure img[src$=".png"] {
  width: 100%;
  box-shadow: 0 8px 26px rgba(20, 45, 80, 0.09);
}

.docs-figure figcaption {
  margin-top: 8px;
  color: var(--ink-muted);
  font-size: 12.5px;
  line-height: 1.5;
  padding-left: 2px;
}

.docs-error {
  color: #c92a2a;
}

.docs-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--border-soft);
}

.docs-pager-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #ffffff;
  color: #163763;
  text-decoration: none;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.docs-pager-link:hover {
  border-color: #b8d5f3;
  background: #f6faff;
  transform: translateY(-1px);
}

.docs-pager-link.next {
  text-align: right;
}

.docs-pager-link small {
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs-pager-link span {
  font-size: 13.5px;
  font-weight: 600;
}

@media (max-width: 620px) {
  .docs-page-header h1 {
    font-size: 26px;
  }

  .docs-pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .docs-pager-link.next {
    text-align: left;
  }
}

/* The tool views are read, not scanned: a column narrower than the database's
   tables keeps the prose and the controls at a comfortable line length. */
#view-plotter,
#view-plotter3d,
#view-encoder,
#view-docs {
  max-width: 1280px;
}

.plot-container {
  position: relative;
  margin-top: 18px;
  height: 600px;
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: #ffffff;
}

.plot-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.plot-container.zoomed canvas {
  cursor: zoom-out;
}

.plot-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #adb5bd;
  font-size: 15px;
  pointer-events: none;
}

.plot-tooltip {
  position: absolute;
  pointer-events: none;
  padding: 6px 9px;
  background: rgba(27, 31, 39, 0.92);
  color: #ffffff;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  transform: translate(-50%, -130%);
  z-index: 4;
}

/* -------------------------------------------------------------------- tabs */

.tabs {
  margin-top: 8px;
}

.tab-header {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.tab-button {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-muted);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.tab-button:hover {
  color: #4dabf7;
}

.tab-button.active {
  background: #ffffff;
  border-bottom-color: #4dabf7;
  color: #4dabf7;
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ------------------------------------------------------------------ tables */

.table-wrap {
  max-height: 320px;
  overflow: auto;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

table.result,
table.kv {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

table.result th,
table.result td {
  padding: 8px 14px;
  text-align: right;
  border-bottom: 1px solid #f1f3f5;
}

table.result th:first-child,
table.result td:first-child {
  text-align: left;
}

table.result thead th {
  position: sticky;
  top: 0;
  background: #f8f9fa;
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

table.result tbody tr:hover {
  background: rgba(48, 207, 208, 0.07);
}

table.result tbody tr.empty td {
  color: var(--ink-muted);
  text-align: center;
  font-style: italic;
}

table.kv {
  margin-top: 18px;
}

table.kv th {
  width: 140px;
  text-align: left;
  color: var(--ink-muted);
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 1px solid #f1f3f5;
}

table.kv td {
  padding: 6px 0;
  border-bottom: 1px solid #f1f3f5;
}

/* --------------------------------------------------------------- responsive */

/* Below a thousand pixels the column would eat the page, so the sidebar
   becomes a bar across the top holding the name and one button. The menu sits
   behind that button: nothing else competes for the width. */
@media (max-width: 1000px) {
  .sidebar {
    position: fixed;
    inset: 0 0 auto 0;
    width: auto;
    height: auto;
    flex-direction: column;
    padding: 0;
    overflow: visible;
    z-index: 30;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
  }

  .sidebar-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 14px;
  }

  .sidebar-brand {
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-decoration: none;
  }

  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 8px;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
  }

  .sidebar-toggle svg {
    width: 20px;
    height: 20px;
  }

  .sidebar-toggle .icon-close {
    display: none;
  }

  .sidebar.open .sidebar-toggle .icon-open {
    display: none;
  }

  .sidebar.open .sidebar-toggle .icon-close {
    display: block;
  }

  /* the menu, and only while the button says so */
  .sidebar-body {
    display: none;
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    max-height: calc(100vh - 52px);
    padding: 6px 0 14px;
    overflow-y: auto;
    background: var(--sidebar);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .sidebar.open .sidebar-body {
    display: flex;
  }

  /* the bar already names the page; the big mark would only push the menu down */
  .sidebar .sidebar-home,
  .sidebar .logo,
  .sidebar .logo-title {
    display: none;
  }

  .sidebar .menu {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .group-title {
    margin: 10px 0 2px;
    padding: 0 18px;
    text-align: left;
  }

  .menu-item {
    padding: 10px 18px;
    border-radius: 0;
    font-size: 14px;
    white-space: normal;
  }

  .menu-item svg {
    width: 16px;
    height: 16px;
  }

  .menu-item.active {
    box-shadow: none;
  }

  .sidebar-misc {
    margin: 8px 0 0;
    padding: 8px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .content {
    margin-left: 0;
    padding: 64px 12px 40px;
  }

  .panel {
    padding: 18px 16px;
  }

  .plot-container {
    height: 360px;
  }

  .plot3d-stage {
    height: 360px;
  }
}

/* --------------------------------------------------------------- extras */

.hint {
  margin: 12px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.55;
}

.field.grow {
  max-width: none;
}

.field input[type='text'] {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: #343a40;
}

.field input[type='text']:focus {
  outline: none;
  border-color: var(--accent);
}

.field input[type='text']:disabled {
  background: #f1f3f5;
  color: #adb5bd;
  cursor: not-allowed;
}

.notice {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-top: 18px;
  padding: 14px 16px;
  background: rgba(48, 207, 208, 0.09);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  color: #2b8a8b;
  font-size: 14.5px;
}

.notice strong {
  color: #1f7a7a;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #f1f3f5;
  color: var(--ink-muted);
  font-size: 12.5px;
  font-weight: 600;
}

.badge.on {
  background: rgba(64, 192, 87, 0.15);
  color: #2b8a3e;
}

.badge.off {
  background: rgba(233, 196, 106, 0.25);
  color: #b07d09;
}

/* a wide parameter matrix: the first columns stay put while the rest scroll */
.table-wrap.tall {
  max-height: 460px;
}

table.matrix th,
table.matrix td {
  text-align: right;
  white-space: nowrap;
  padding: 7px 12px;
}

/* the parameter names are case sensitive: p0.x, not P0.X */
table.matrix thead th {
  text-transform: none;
  font-size: 12.5px;
}

table.matrix th.left,
table.matrix td.left {
  text-align: left;
}

table.matrix tbody td:nth-child(2) {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

table.matrix tbody tr:hover td {
  background: rgba(48, 207, 208, 0.07);
}

/* ------------------------------------------------------------------ tracks */

.tracks {
  position: relative;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.track {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.track-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border-soft);
}

.track-name {
  font-weight: 700;
  color: var(--ink);
  font-size: 14px;
  min-width: 62px;
}

.track-component {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: #343a40;
  font-size: 13.5px;
}

.track-component:focus {
  outline: none;
  border-color: var(--accent);
}

.track-head .checkbox {
  font-size: 13px;
  padding-bottom: 0;
}

.track-summary {
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.track-summary.error {
  color: #c92a2a;
}

.icon-button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
}

.icon-button:hover {
  border-color: #e03131;
  color: #e03131;
  background: #fff5f5;
}

/* Every island parameter sits on the same row, with its slider and number box
   aligned in one column. */
.finder-grid {
  display: grid;
  grid-template-columns: max-content repeat(3, minmax(0, 1fr)) max-content;
  align-items: end;
  gap: 10px 20px;
  margin-top: 12px;
}

.finder-grid .finder-label {
  align-self: center;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.finder-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.field.compact {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.field.compact > span {
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field.compact em {
  font-size: 12.5px;
}

/* slider on the left, its number box on the right, every column the same */
.slider-row {
  display: grid;
  grid-template-columns: minmax(50px, 1fr) 72px;
  align-items: center;
  gap: 8px;
}

.slider-row input[type='range'] {
  width: 100%;
  min-width: 0;
}

.slider-row input[type='number'] {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12.5px;
  color: #343a40;
  font-variant-numeric: tabular-nums;
}

.slider-row input[type='number']:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(48, 207, 208, 0.15);
}

/* two columns when there is no room for five */
@media (max-width: 1000px) {
  .finder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
  }

  .finder-grid .finder-label {
    grid-column: 1 / -1;
    margin-top: 4px;
  }

  .finder-grid .button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .finder-actions {
    grid-column: 1 / -1;
  }
}

.slider-row input[type='number'].invalid {
  border-color: #e03131;
  background: #fff5f5;
}

.field em.invalid {
  color: #e03131;
}

/* one plot for every track */
.plot-tall {
  height: 460px;
  margin-top: 14px;
}

.plot-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 4px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.legend-chip:hover {
  background: #f1f3f5;
}

.legend-chip:focus-visible {
  outline: 2px solid var(--blue-a);
  outline-offset: 2px;
}

.legend-chip.is-hidden {
  color: #adb5bd;
}

.legend-chip.is-hidden .track-dot {
  opacity: 0.3;
}

.legend-chip.is-hidden .vpoint-dot {
  opacity: 0.3;
}

.island-swatch {
  width: 12px;
  height: 9px;
  border: 1px dashed currentColor;
  border-radius: 2px;
  flex: none;
}

.legend-chip.is-hidden .island-swatch {
  opacity: 0.3;
}

.vpoint-dot {
  display: inline-block;
  width: 2px;
  height: 13px;
  border-radius: 999px;
  flex: none;
}

.vpoint-ori {
  color: #0b7285;
}

.vpoint-ori .vpoint-dot {
  background: #0b7285;
}

.vpoint-ter {
  color: #9c36b5;
}

.vpoint-ter .vpoint-dot {
  background: repeating-linear-gradient(
    to bottom,
    #9c36b5 0 3px,
    transparent 3px 5px
  );
}

.plot-range-hint {
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-size: 12px;
}

.legend-help {
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 11.5px;
}

.track-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

.track-results {
  margin-top: 10px;
  font-size: 13px;
}

.track-results summary {
  cursor: pointer;
  color: var(--ink-muted);
  font-weight: 600;
  padding: 4px 0;
}

.track-results summary:hover {
  color: #4dabf7;
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 8px;
}

.results-grid > div {
  min-width: 0;
}

.results-grid h4 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.results-grid .count {
  display: inline-block;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f1f3f5;
  color: var(--ink-muted);
  font-size: 11.5px;
  text-align: center;
}

.results-grid .table-wrap {
  width: 100%;
  max-height: 220px;
  margin-top: 0;
}

.results-grid .islands-table {
  min-width: 720px;
}

/* ------------------------------------------------------------- plotter (3D) */

.plot3d-stage {
  position: relative;
  height: 660px;
  margin-top: 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 30% 20%, rgba(34, 139, 230, 0.05), transparent 60%),
    #fbfcfd;
  overflow: hidden;
}

.plot3d-sigma-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 2px;
  color: #495057;
  font-size: 13px;
}

.plot3d-sigma-field input {
  width: 74px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink-soft);
  font-size: 13.5px;
}

.plot3d-sigma-field input:disabled {
  color: #adb5bd;
  background: #f8f9fa;
}

.plot3d-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.plot3d-stage canvas.is-hovering {
  cursor: crosshair;
}

.plot3d-stage canvas.dragging {
  cursor: grabbing;
}

.plot3d-hint {
  position: absolute;
  left: 14px;
  bottom: 10px;
  margin: 0;
  padding: 0;
  color: var(--ink-muted);
  font-size: 11.5px;
  pointer-events: none;
}

.plot3d-tooltip {
  position: absolute;
  z-index: 6;
  min-width: 190px;
  max-width: 320px;
  padding: 8px 10px;
  border-left: 4px solid #64748b;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.2);
  pointer-events: none;
}

.plot3d-tooltip .title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  overflow: hidden;
  color: #ffffff;
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plot3d-tooltip .swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.plot3d-tooltip .name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.plot3d-tooltip .row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.plot3d-tooltip .key {
  color: #cbd5e1;
}

.plot3d-tooltip b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.plot3d-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.plot3d-legend-item {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 5px 10px 5px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: #ffffff;
  font-size: 12.5px;
  cursor: pointer;
}

.plot3d-legend-item.is-rotated {
  border-color: rgba(28, 126, 214, 0.35);
}

.plot3d-legend-item.is-hidden {
  opacity: 0.5;
}

.plot3d-legend-item.is-hidden .plot3d-name {
  text-decoration: line-through;
}

.plot3d-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.plot3d-name {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.plot3d-length {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.plot3d-index {
  color: var(--ink-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.plot3d-shape {
  padding: 2px 7px;
  border-radius: 999px;
  background: #f1f3f5;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.plot3d-target,
.plot3d-position {
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink-soft);
  font-size: 11.5px;
}

.plot3d-position {
  width: 82px;
}

.plot3d-target:focus,
.plot3d-position:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(48, 207, 208, 0.12);
}

.plot3d-rotate {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink-soft);
  font-size: 11.5px;
  cursor: pointer;
}

.plot3d-rotate:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--ink);
}

.plot3d-rotate.is-active {
  border-color: var(--accent);
  color: #0b7285;
}

.plot3d-rotate:disabled {
  color: #adb5bd;
  background: #f8f9fa;
  cursor: default;
}

.plot3d-legend-item input[type='checkbox'] {
  margin: 0;
  accent-color: var(--accent);
}

.plot3d-remove {
  border: 0;
  background: none;
  padding: 0 2px;
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.plot3d-remove:hover {
  color: #e03131;
}

.plot3d-empty {
  color: var(--ink-muted);
  font-size: 12.5px;
  font-style: italic;
}

/* ------------------------------------------------------------------- home */

/* The home page borrows ZcurveHub's language: graph-paper ground, gradient
   headings, and panels that lift in as they scroll into view. It drops the card
   that every other view wears -- on this page the paper is the ground, so a
   panel edge and its shadow would read as a frame drawn across it. */
.home {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 0 34px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* The graph paper fills the whole page behind the content. It is a fixed layer,
   so it reaches every edge and does not scroll away or stop at a panel's
   rounded corner. */
.home-paper {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 250px;
  z-index: -1;
  background-color: #f8f9fa;
  background-image:
    linear-gradient(rgba(150, 150, 150, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150, 150, 150, 0.22) 1px, transparent 1px),
    linear-gradient(rgba(200, 200, 200, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200, 200, 200, 0.16) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.home-paper.visible {
  opacity: 1;
}

@media (max-width: 1000px) {
  .home-paper {
    left: 0;
  }
}

.home-hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px 10px 26px;
  margin: 0 24px;
}

.home-welcome {
  margin: 0;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.5px;
  /* A blue that stays blue at the ends: the near-black the sweep used to run
     through read as a hole in the heading rather than as the shallow end of a
     gradient. */
  background: linear-gradient(100deg, #1f5fae 0%, #228be6 40%, #3ad2d4 55%, #1f5fae 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: home-shine 9s linear infinite;
}

@keyframes home-shine {
  to {
    background-position: -220% center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-welcome {
    animation: none;
  }
}

.home-subtitle {
  margin: 12px auto 0;
  max-width: 760px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.6;
}

.home-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid #4dabf7;
  border-radius: 999px;
  background: #f8f9fa;
  color: #1c7ed6;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.chip:hover {
  background: #e7f5ff;
  border-color: #1c7ed6;
  color: #1864ab;
}

.home-panel {
  margin: 26px 24px 0;
  padding: 26px 30px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(5px);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.home-panel.visible {
  opacity: 1;
  transform: translateY(0);
}

.home-panel-title {
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(90deg, #228be6, #30cfd0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.home-text {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.75;
  text-align: justify;
}

.home-text:last-child {
  margin-bottom: 0;
}

.home-text a {
  color: #1c7ed6;
  text-decoration: none;
}

.home-text a:hover {
  text-decoration: underline;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 26px;
  margin: 26px 24px 0;
}

.home-card {
  display: flex;
  flex-direction: column;
  padding: 22px 24px 20px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
  backdrop-filter: blur(5px);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out, box-shadow 0.25s ease;
}

.home-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.home-card:hover {
  box-shadow: 0 10px 28px rgba(34, 139, 230, 0.18);
}

.home-card:hover {
  box-shadow: 0 6px 20px rgba(34, 139, 230, 0.14);
  transform: translateY(-2px);
}

.home-card h3 {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 16.5px;
  font-weight: 700;
}

.home-card h3 a {
  color: var(--ink);
  text-decoration: none;
}

.home-card h3 a:hover {
  color: var(--accent);
}

.home-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.65;
}

/* ---- the database card: rotating figure on the left, counters on the right */
.home-db-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 250px;
  margin: 16px -4px 12px;
}

.home-gif {
  flex: 0 0 auto;
  max-width: 60%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 16px;
  background: #ffffff;
  transition: transform 0.3s ease;
}

.home-gif:hover {
  transform: scale(1.05);
}

.home-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
}

.home-stat-value {
  display: block;
  color: #0a2463;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.home-stat-label {
  display: block;
  margin-top: 1px;
  color: #4d4d4d;
  font-size: 11.5px;
  line-height: 1.25;
}

/* Every card gives its figure the same box, so the three of them sit on one
   line whatever the drawing inside is shaped like. */
.home-figure {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 250px;
  margin: 16px -8px 12px;
}

.home-figure img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 8px;
}

.home-figure svg {
  width: 100%;
  max-width: 260px;
  height: auto;
  border-radius: 8px;
}

.home-note {
  margin-top: auto;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.5;
  font-style: italic;
}

/* the "not yet wired up" line, clearly not part of the borrowed copy */
.home-status {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
  color: #868e96;
  font-size: 12px;
  line-height: 1.5;
}

.home-list {
  margin: 0 0 12px;
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.75;
}

.home-list li {
  margin-bottom: 4px;
}

.home-list strong {
  color: var(--ink);
  font-weight: 600;
}

.home-footer {
  margin: 26px 0 4px;
  text-align: center;
  color: #adb5bd;
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 720px) {
  .home-welcome {
    font-size: 30px;
  }
}

/* ------------------------------------------------------- genome information */

.genome-card {
  margin-top: 18px;
  padding: 16px 18px;
  background: #f8f9fa;
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius);
}

.genome-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-soft);
}

.genome-title {
  min-width: 0;
  flex: 1 1 320px;
}

.genome-title h4 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.genome-title p {
  margin: 3px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.genome-title p:empty {
  display: none;
}

.genome-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.genome-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-soft);
}

.genome-stat {
  display: flex;
  flex: 1 1 105px;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border-soft);
}

.genome-stat-label {
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.genome-stat-value {
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.genome-composition {
  flex: 1 0 100%;
}

.base-composition {
  display: flex;
  width: 100%;
  height: 9px;
  margin-top: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9ecef;
}

.base-segment {
  display: block;
  min-width: 0;
  height: 100%;
}

.base-a {
  background: #2f9e44;
}

.base-c {
  background: #1c7ed6;
}

.base-g {
  background: #f59f00;
}

.base-t {
  background: #e8590c;
}

.base-composition-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--ink-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.base-composition-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 3px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.base-composition-item:hover {
  background: #f1f3f5;
}

.base-composition-item:focus-visible {
  outline: 2px solid var(--blue-a);
  outline-offset: 1px;
}

.base-composition-item.is-hidden {
  color: #adb5bd;
}

.base-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: none;
}

.base-composition-item.is-hidden .base-swatch {
  opacity: 0.25;
}

.plot-vtype-result {
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12.5px;
}

.plot-vtype-result.is-pending,
.plot-vtype-result.is-not-assessed {
  background: #f1f3f5;
  color: #64748b;
}

.plot-vtype-result.is-yes {
  background: #ebfbee;
  color: #2b8a3e;
}

.plot-vtype-result.is-no {
  background: #fff5f5;
  color: #c92a2a;
}

.genome-extra {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
  color: var(--ink-soft);
  font-size: 13px;
  font-style: italic;
}

/* ----------------------------------------------------------- feature track */

.feature-track {
  margin-top: 10px;
  padding: 10px 0 6px;
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius);
  background: #ffffff;
}

.feature-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 0 14px 6px;
}

.feature-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.feature-count {
  color: var(--ink-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.feature-hover {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#feature-canvas {
  display: block;
  width: 100%;
  cursor: crosshair;
}

.encoder-intro {
  margin: 14px 0 4px;
  padding: 14px 20px;
  border-left: 3px solid #d0ebff;
  border-radius: 0 10px 10px 0;
  background: #f8fafc;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.65;
}

.encoder-lead {
  margin: 0;
}

.encoder-lead + .encoder-lead {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
}

.encoder-lead em {
  font-style: normal;
  color: #1864ab;
}

.encoder-reference {
  color: #1864ab;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(24, 100, 171, 0.35);
  transition: color 0.16s ease, border-color 0.16s ease;
}

.encoder-reference:hover {
  color: #0b4f91;
  border-bottom-color: currentColor;
}

.encoder-reference:focus-visible {
  outline: 2px solid rgba(24, 100, 171, 0.35);
  outline-offset: 2px;
  border-radius: 2px;
}

/* variables are italic, everywhere they appear */
.encoder-lead i,
.formula-label i,
.formula-math i {
  font-style: italic;
  color: #1e293b;
}

.formula-block {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 24px;
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border-soft);
  font-size: 13px;
}

.formula-column {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.formula-column + .formula-column {
  padding-left: 24px;
  border-left: 1px dashed var(--border-soft);
}

.formula-line {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.formula-label {
  flex: 0 0 74px;
  color: var(--ink-muted);
  font-size: 12px;
  text-align: right;
}

.formula-math {
  font-family: Cambria, Georgia, "Times New Roman", serif;
  color: #1e293b;
  letter-spacing: 0.2px;
  font-style: normal;
}

.formula-math sup,
.formula-math sub {
  font-size: 10.5px;
}

.formula-math sup sub,
.formula-math sub sup,
.formula-math sup sup {
  font-size: 8.5px;
}

.formula-note {
  color: var(--ink-muted);
  font-family: system-ui, sans-serif;
  font-size: 11.5px;
}

@media (max-width: 900px) {
  .formula-block {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 4px;
  }

  .formula-column + .formula-column {
    margin-top: 12px;
    padding-top: 12px;
    padding-left: 0;
    border-top: 1px dashed var(--border-soft);
    border-left: 0;
  }
}

/* --------------------------------------------------------------- encoder layers */

.layers {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.layer-row {
  --layer-accent: #228be6;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px 12px 16px;
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--layer-accent);
  border-radius: 10px;
  background: #ffffff;
  transition: box-shadow 120ms ease, transform 120ms ease;
}

.layer-row:hover {
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.07);
  transform: translateY(-1px);
}

.layer-badge {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--layer-accent);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.layer-body {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 8px;
}

.layer-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.layer-row select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  font-size: 13px;
  color: var(--ink);
}

.layer-row select:focus {
  outline: 2px solid color-mix(in srgb, var(--layer-accent) 35%, transparent);
  outline-offset: 1px;
}

.layer-columns {
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.layer-columns b {
  color: var(--layer-accent);
  font-size: 14px;
}

.layer-shape {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 5px;
  background: #f1f3f5;
  color: var(--ink-soft);
  font-family: Cambria, Georgia, serif;
  font-size: 11.5px;
}

.layer-track {
  height: 4px;
  border-radius: 2px;
  background: #f1f3f5;
  overflow: hidden;
}

.layer-fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  transition: width 200ms ease;
}

.layer-row .layer-remove {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #adb5bd;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.layer-row .layer-remove:hover:not(:disabled) {
  background: #fff0f0;
  border-color: #ffc9c9;
  color: #e03131;
}

.layer-row .layer-remove:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* the phases toggle, drawn from a hidden checkbox */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-soft);
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: relative;
  width: 34px;
  height: 19px;
  border-radius: 10px;
  background: #dee2e6;
  transition: background 140ms ease;
}

.switch-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 140ms ease;
}

.switch input:checked + .switch-track {
  background: var(--layer-accent, #228be6);
}

.switch input:checked + .switch-track .switch-dot {
  transform: translateX(15px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid color-mix(in srgb, var(--layer-accent, #228be6) 45%, transparent);
  outline-offset: 2px;
}

.layer-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.layer-summary:empty {
  display: none;
}

.layer-chip {
  --layer-accent: #228be6;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px 4px 5px;
  border: 1px solid color-mix(in srgb, var(--layer-accent) 28%, #ffffff);
  border-radius: 999px;
  background: color-mix(in srgb, var(--layer-accent) 9%, #ffffff);
  color: var(--ink-soft);
  font-size: 12px;
}

.layer-chip .chip-badge {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--layer-accent);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.layer-chip b {
  color: var(--layer-accent);
  font-weight: 600;
}

.layer-chip .chip-range {
  margin-left: 2px;
  padding-left: 8px;
  border-left: 1px solid color-mix(in srgb, var(--layer-accent) 25%, #ffffff);
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
