:root {
  /* Light grey palette. Surfaces are a step DARKER than the page rather than
     lighter, so cards and buttons read as raised blocks against the ground
     instead of floating white panels. */
  --bg: #e7e8eb;
  --bg-2: #e1e3e7;
  --surface: #d9dbe0;
  --surface-2: #cfd2d8;
  --surface-3: #c6cad1;
  --border: #c2c6cd;
  --border-soft: #d1d4da;

  --text: #1b1e23;
  --text-dim: #3d434c;
  --muted: #656c77;

  --accent: #b12c42;
  --accent-dim: #f3dde1;

  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Full-width content with breathing room at the edges. */
.wrap { width: 100%; margin: 0; padding: 0 40px; }
@media (max-width: 700px) { .wrap { padding: 0 18px; } }

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(231, 232, 235, 0.9);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 24px; }
.brand { text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand-mark { border-bottom: 3px solid var(--accent); padding-bottom: 2px; }
.nav { display: flex; gap: 24px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); font-size: 0.92rem; padding: 4px 0; transition: color .18s ease; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.nav .nav-api { font-family: var(--mono); font-size: 0.82rem; }

main { padding: 40px 0 72px; min-height: 60vh; }

/* ---------- typography ---------- */
h1 { font-size: 2rem; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; margin: 0 0 18px; letter-spacing: -0.01em; }
h3 { font-size: 1rem; margin: 20px 0 8px; }
.subtitle { color: var(--text-dim); font-size: 1.02rem; margin: 0 0 4px; max-width: 78ch; }
.authors { color: var(--muted); font-size: 0.9rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: var(--mono); font-size: 0.82rem; }
.hidden { display: none !important; }
a { color: #17527d; }

.page-head { margin-bottom: 26px; }
.module-tag {
  display: inline-block; font-family: var(--mono); font-size: 0.72rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent);
  border: 1px solid #ddb7bf; border-radius: 100px; padding: 2px 10px; margin-bottom: 10px;
}

.note {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px; margin-top: 32px;
}
.note h2 { margin-top: 0; }
.note p { font-size: 0.92rem; max-width: 84ch; color: var(--text-dim); }

/* ---------- section headings ---------- */
.section-head {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0 0 26px;
}

/* ---------- abstract ---------- */
.abstract {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 34px 32px;
  margin-top: 56px;
}
.abstract p {
  margin: 0; font-size: 1rem; line-height: 1.75;
  color: var(--text-dim);
  /* Full page width, per the brief -- no reading-measure cap. */
  max-width: none;
  text-align: justify;
}

/* ---------- landing tiles ---------- */
/* Four across, filling the page. Collapses to two and then one so the tiles
   never squeeze below a readable width. */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
@media (max-width: 1240px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px)  { .tiles { grid-template-columns: 1fr; } }

.tile {
  position: relative; display: block; overflow: hidden;
  min-height: 320px; padding: 28px 26px 24px;
  border-radius: 14px;
  border: 1px solid var(--border);
  /* A step darker than the page, per the brief. */
  background: var(--surface);
  color: var(--text); text-decoration: none; isolation: isolate;
  transition: transform .28s cubic-bezier(.2,.7,.3,1),
              box-shadow .28s ease, border-color .28s ease,
              background-color .28s ease;
}

/* Background art in its own layer so it can be filtered and scaled without
   affecting the text above it. Kept faint at rest -- it is a watermark, not
   a picture, and dark text has to stay readable across it. */
.tile-bg {
  position: absolute; inset: 0; z-index: -1;
  background-image: var(--tile-img);
  background-size: cover; background-position: center;
  filter: grayscale(1) contrast(0.75) brightness(1.06);
  opacity: 0.32; transform: scale(1.04);
  transition: filter .45s ease, opacity .45s ease,
              transform .6s cubic-bezier(.2,.7,.3,1);
}

/* Accent wash, invisible until hover. */
.tile::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(140deg,
              color-mix(in srgb, var(--tile-accent) 20%, transparent),
              transparent 62%);
  opacity: 0; transition: opacity .4s ease;
}

.tile:hover, .tile:focus-visible {
  transform: translateY(-5px);
  background: var(--surface-2);
  border-color: var(--tile-accent);
  box-shadow: 0 14px 34px rgba(30, 36, 48, 0.18);
}
.tile:hover .tile-bg, .tile:focus-visible .tile-bg {
  filter: grayscale(0) contrast(1) brightness(1);
  opacity: 0.72; transform: scale(1.12);
}
.tile:hover::after, .tile:focus-visible::after { opacity: 1; }

.tile-body { position: relative; display: flex; flex-direction: column; height: 100%; }
.tile-icon {
  font-size: 2rem; line-height: 1; margin-bottom: 14px;
  transition: transform .3s cubic-bezier(.2,.7,.3,1);
}
.tile:hover .tile-icon { transform: translateY(-2px) scale(1.12); }
.tile-title {
  font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em;
  margin-bottom: 9px;
}
.tile-desc {
  font-size: 0.92rem; line-height: 1.55; color: var(--text-dim);
  max-width: 46ch;
}
.tile-go {
  margin-top: auto; padding-top: 18px;
  font-size: 0.9rem; font-weight: 600; color: var(--accent);
  transition: transform .28s ease;
}
.tile:hover .tile-go { transform: translateX(5px); }

.tile-disabled { pointer-events: none; }
.tile-disabled .tile-title, .tile-disabled .tile-desc { color: var(--muted); }
.tile-soon {
  align-self: flex-start; font-weight: 600;
  border: 1px solid var(--border); border-radius: 100px;
  padding: 3px 12px; font-size: 0.78rem; color: var(--muted);
}

/* ---------- videos ---------- */
.video-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; }
@media (max-width: 1100px) { .video-grid { grid-template-columns: 1fr; } }
.video-card { margin: 0; }
/* Title above the player, which is all this page carries. */
.video-title {
  margin: 0 0 12px; font-size: 1.15rem; font-weight: 700;
  letter-spacing: -0.01em; text-align: center; color: var(--text);
}
.video-frame {
  background: #10131a; aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.video-frame video { width: 100%; height: 100%; object-fit: contain; }
.video-placeholder { text-align: center; color: #8d94a1; padding: 20px; }
.play-icon { font-size: 2.4rem; opacity: 0.5; }

/* ---------- controls ---------- */
.controls {
  display: flex; gap: 22px; align-items: flex-end; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 20px; margin-bottom: 18px;
}
.control { display: flex; flex-direction: column; gap: 5px; }
.control label { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.control select, .lookup input {
  font: inherit; padding: 8px 11px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--surface-2); color: var(--text); min-width: 180px;
}
.control select:focus, .lookup input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.control.status { margin-left: auto; font-size: 0.85rem; color: var(--muted); }

/* ---------- graph layout ---------- */
/* --detail-w is adjustable at runtime by dragging #split-handle (see
   explore.js); the graph panel takes whatever space is left. Both panels
   also carry their own `resize: vertical` handle so their heights can be
   pulled independently of each other. */
.graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8px var(--detail-w, 460px);
  gap: 12px; align-items: start;
}
@media (max-width: 1100px) {
  .graph-layout { grid-template-columns: 1fr; }
  .split-handle { display: none; }
}

.split-handle {
  align-self: stretch; min-height: 320px;
  border-radius: 100px; background: var(--border);
  cursor: col-resize; position: relative;
}
.split-handle::after {
  content: ""; position: absolute; inset: 0 -6px;
}
.split-handle:hover, .split-handle.dragging { background: var(--accent); }

/* The Plotly scene is fully transparent, so the panel supplies the ground:
   a cool vertical wash with two faint highlights, which reads as depth
   behind the floating point cloud instead of a flat card. */
.graph-panel {
  position: relative;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; resize: vertical;
  height: 50vh; min-height: 320px; max-height: 92vh;
  background:
    radial-gradient(900px 420px at 18% 8%, rgba(120, 170, 210, 0.16), transparent 62%),
    radial-gradient(760px 400px at 86% 92%, rgba(150, 130, 205, 0.13), transparent 60%),
    linear-gradient(168deg, #eceef2 0%, #dcdfe6 58%, #d3d7df 100%);
}
#graph-plot { width: 100%; height: 100%; }

.detail-panel {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 20px;
  height: 74vh; min-height: 320px; max-height: 92vh;
  overflow-y: auto; resize: vertical;
}
.detail-empty { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 48px 10px; }
.detail-panel h2 { margin: 0 0 14px; font-size: 1.15rem; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.detail-head h2 { margin: 0; }

.members-head { display: flex; align-items: center; justify-content: space-between; }
.members-actions { display: flex; gap: 6px; }

.node-meta { margin: 0; display: grid; gap: 7px; }
.node-meta > div {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 0.88rem; border-bottom: 1px dotted var(--border); padding-bottom: 6px;
}
.node-meta dt { color: var(--muted); margin: 0; }
.node-meta dd { margin: 0; font-weight: 600; text-align: right; }

.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  font-family: var(--mono); font-size: 0.74rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 100px; padding: 2px 9px;
  cursor: pointer; color: var(--text-dim);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

.dist-bars { display: grid; gap: 5px; }
.dist-row { display: grid; grid-template-columns: 116px 1fr 46px; align-items: center; gap: 8px; font-size: 0.78rem; }
.dist-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-track { background: var(--surface-3); border-radius: 3px; height: 9px; overflow: hidden; }
.dist-fill { height: 100%; border-radius: 3px; }
.dist-val { text-align: right; font-family: var(--mono); color: var(--muted); }

/* Wafer tiles in the side panel: big enough to recognise a pattern and pick
   the right one, small enough that a 500-member node stays scannable. The
   full-size look happens on the board below. */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 7px; }
.member {
  border: 2px solid transparent; border-radius: 6px; overflow: hidden;
  background: #10131a; cursor: pointer; position: relative;
}
.member.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(177,44,66,0.25); }
.member-canvas { width: 100%; display: block; aspect-ratio: 1; background: #000; image-rendering: pixelated; }
.member-label {
  font-size: 0.62rem; padding: 3px 2px; color: #fff; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}

/* ---------- selected samples (full width, under the graph) ---------- */
.sample-board {
  margin-top: 18px; padding: 16px 18px 18px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.sample-board .board-head h2 .muted { font-weight: 400; font-size: 0.9rem; }

.selected-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.sel-card {
  border: 1px solid var(--border); border-radius: 9px; overflow: hidden;
  background: var(--bg-2);
}
.sel-img {
  width: 100%; display: block; aspect-ratio: 1; object-fit: contain;
  background: #000; image-rendering: pixelated;
}
.sel-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 9px; }
.sel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; font-size: 0.82rem;
}
.sel-facts { margin: 0; display: grid; gap: 4px; }
.sel-facts > div {
  display: flex; justify-content: space-between; gap: 10px; font-size: 0.79rem;
  border-bottom: 1px dotted var(--border); padding-bottom: 3px;
}
.sel-facts dt { margin: 0; color: var(--muted); }
.sel-facts dd { margin: 0; font-weight: 600; }
.sel-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.btn {
  font: inherit; padding: 8px 15px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--surface-3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: #99263a; color: #fff; border-color: #99263a; }
.btn-accent { background: #1f5f8b; color: #fff; border-color: #1f5f8b; font-weight: 600; }
.btn-accent:hover:not(:disabled) { background: #184a6d; color: #fff; border-color: #184a6d; }

/* ---------- lookup ---------- */
.lookup { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.lookup input { min-width: 280px; font-family: var(--mono); }
.examples { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.example-chip { font-family: var(--mono); font-size: 0.75rem; }

.download-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 18px 0 4px; padding-top: 16px; border-top: 1px solid var(--border);
}
.btn-download {
  font: inherit; font-weight: 600; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  cursor: pointer;
}
.btn-download:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-3); }

.alert {
  background: var(--accent-dim); border: 1px solid #e0bcc4; color: #8a2436;
  padding: 12px 16px; border-radius: var(--radius); margin: 16px 0; font-size: 0.9rem;
}

.sample-card {
  display: grid; grid-template-columns: 380px 1fr; gap: 28px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-top: 20px; background: var(--surface);
}
@media (max-width: 820px) { .sample-card { grid-template-columns: 1fr; } }
.sample-image { background: #10131a; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.sample-image img { width: 100%; display: block; }
#sample-canvas { width: 100%; height: auto; display: block; background: #000; image-rendering: pixelated; border-radius: 4px; }
.sample-info h2 { margin-top: 0; font-family: var(--mono); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 100px; color: #fff; font-size: 0.78rem; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.35); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; background: var(--bg-2); }
.site-footer p { margin: 2px 0; font-size: 0.85rem; color: var(--text-dim); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .tile, .tile-bg, .tile-icon, .tile-go, .tile::after { transition-duration: .01ms; }
  .tile:hover { transform: none; }
  .tile:hover .tile-bg { transform: scale(1.04); }
}

/* ==========================================================================
   Demo console additions: Label, Wafer Analysis, and the shared bits
   (toast, cart badge, small buttons) neither this stylesheet nor F_Website
   ever needed before, since that site never had a labeling UI.
   ========================================================================== */

/* ---------- shared bits ---------- */
.spacer { flex: 1; }
.pill { display: inline-block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 100px; padding: 5px 12px; font-size: 0.85rem; }
.pill.strong { font-weight: 700; background: var(--surface-3); }
.btn-sm { padding: 5px 11px; font-size: 0.85rem; }
.btn-danger { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 15px; cursor: pointer; font: inherit; }
.btn-danger:hover { border-color: #a01f2e; color: #a01f2e; }
.text-input { font: inherit; padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); color: var(--text); min-width: 190px; }
.badge-outline { background: transparent !important; color: var(--text-dim); border: 1px solid var(--border); text-shadow: none; }
.badge-count { background: var(--accent); color: #fff; border-radius: 100px; font-size: 0.72rem; font-weight: 700; padding: 1px 7px; min-width: 20px; text-align: center; display: inline-block; }
.sec-head { margin-top: 26px; }
.table-scroll { overflow-x: auto; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #1b1e23; color: #fff; padding: 11px 20px; border-radius: 8px;
  font-size: 0.9rem; box-shadow: 0 8px 26px rgba(0,0,0,0.28); z-index: 100;
  max-width: 80vw;
}
.toast-ok { background: #17603f; }
.toast-warn { background: #7c4f06; }
.toast-error { background: #8a2436; }

/* ---------- wafer analysis ---------- */
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.board-head h2 { margin: 0; }
.board-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.fig-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 4px; }
@media (max-width: 980px) { .fig-row { grid-template-columns: 1fr; } }
.fig { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px; }
.fig h3 { margin: 0 0 10px; }
.fig-body { background: var(--bg-2); border-radius: 8px; padding: 10px; display: flex; align-items: center; justify-content: center; }
.fig-body canvas, .fig-body svg { width: 100%; max-width: 340px; height: auto; display: block; }
.fig-body canvas { image-rendering: pixelated; border-radius: 6px; background: #000; }
.fig figcaption { margin-top: 9px; }

.heat-table { border-collapse: collapse; font-size: 0.76rem; width: 100%; }
.heat-table th, .heat-table td { border: 1px solid var(--border); padding: 4px 6px; text-align: center; white-space: nowrap; }
.heat-table th { background: var(--surface-2); font-weight: 600; }
.heat-table th.corner { background: var(--surface-3); text-align: left; }
.heat-table th.rowhead { text-align: left; color: #4a3a18; }
.heat-table td.total, .heat-table th.total { background: var(--surface-2); font-weight: 700; }
.heat-table td.total-cell { background: var(--surface); font-weight: 600; }
.heat-table td.grand { background: #2574c7; color: #fff; font-weight: 700; }

.profile-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; }
@media (max-width: 980px) { .profile-row { grid-template-columns: 1fr; } }
.profile { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px; }
.profile h3 { margin: 0 0 6px; }

.feature-groups { display: grid; gap: 10px; }
.feature-group { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 10px 14px; }
.feature-group summary { cursor: pointer; font-weight: 600; font-size: 0.95rem; padding: 3px 0; }
.feature-list { margin: 10px 0 4px; display: grid; gap: 4px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.feature-list > div { display: flex; justify-content: space-between; gap: 12px; font-size: 0.79rem; border-bottom: 1px dotted var(--border); padding-bottom: 3px; }
.feature-list dt { margin: 0; color: var(--muted); }
.feature-list dd { margin: 0; font-weight: 600; }

/* ---------- label layout ---------- */
.label-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px; align-items: start;
}
@media (max-width: 1100px) { .label-layout { grid-template-columns: 1fr; } }

.label-side {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 18px;
  position: sticky; top: 74px;
}
.label-side h3:first-child { margin-top: 0; }
.label-side .btn { width: 100%; }
.label-side hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

.model-status { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-ok { background: #2f9e44; }
.dot-off { background: #9aa1ad; }
.dot-busy { background: #e8a33d; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.btn-accent.flash-ok { animation: flashOk 0.9s ease; }
@keyframes flashOk {
  0%   { background: #2f9e44; border-color: #2f9e44; }
  100% { background: #1f5f8b; border-color: #1f5f8b; }
}

.confetti-piece {
  position: fixed; width: 8px; height: 8px; border-radius: 2px;
  pointer-events: none; z-index: 500;
  animation-name: confettiFall; animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}
@keyframes confettiFall {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), 420px) rotate(var(--rot)); opacity: 0; }
}

.palette {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 12px;
}
.palette-title {
  display: block; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); margin-bottom: 9px;
}
.palette-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.pal-btn {
  font: inherit; font-size: 0.84rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.pal-btn:hover { border-color: var(--pal); background: var(--surface-3); }
.pal-swatch {
  width: 11px; height: 11px; border-radius: 3px; background: var(--pal);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}
.pal-btn kbd {
  font-family: var(--mono); font-size: 0.68rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 4px;
  background: var(--bg);
}
.pal-btn.chosen {
  border-color: var(--pal); background: var(--pal); color: #fff;
  font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.pal-btn.chosen .pal-swatch { background: #fff; }

.bulk-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }

/* One sample per row: image, its facts, then its own class buttons. */
.label-list { display: flex; flex-direction: column; gap: 10px; }

.lab-row {
  position: relative;
  display: grid; grid-template-columns: 180px 190px minmax(0, 1fr);
  gap: 16px; align-items: start;
  border: 2px solid var(--border); border-radius: 8px;
  background: var(--surface); padding: 12px; cursor: pointer;
}
@media (max-width: 900px) {
  .lab-row { grid-template-columns: 140px minmax(0, 1fr); }
  .lab-row .lab-choices { grid-column: 1 / -1; }
}
.lab-row.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(177,44,66,0.22); }
.lab-row.assigned { background: var(--bg-2); }

/* Submit "locks in" a row before it disappears from the cart -- a green
   flash and a checkmark, rather than the row just vanishing mid-click. */
.lab-row.locking {
  pointer-events: none;
  animation: lockIn 0.65s ease forwards;
}
.lab-row.locking::after {
  content: "\2713";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; font-weight: 700; color: #17603f;
  background: rgba(215, 237, 225, 0.55); border-radius: 8px;
  animation: lockInCheck 0.65s ease forwards;
}
@keyframes lockIn {
  0%   { box-shadow: 0 0 0 0 rgba(23,96,63,0); background: var(--surface); }
  35%  { box-shadow: 0 0 0 3px rgba(23,96,63,0.55); background: #d7ede1; }
  100% { box-shadow: 0 0 0 3px rgba(23,96,63,0.55); background: #d7ede1;
         opacity: 0; transform: scale(0.94); }
}
@keyframes lockInCheck {
  0%   { opacity: 0; transform: scale(0.5); }
  40%  { opacity: 1; transform: scale(1.15); }
  60%  { opacity: 1; transform: scale(1); }
  100% { opacity: 1; transform: scale(1); }
}

.lab-img {
  width: 100%; display: block; aspect-ratio: 1;
  background: #000; image-rendering: pixelated; border-radius: 6px;
}

.lab-meta { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.lab-id { font-size: 0.85rem; font-weight: 600; }
.lab-analyze { font-weight: 400; font-size: 0.72rem; margin-left: 6px; white-space: nowrap; }
.lab-facts { margin: 0; display: grid; gap: 3px; }
.lab-facts > div { display: flex; justify-content: space-between; gap: 8px; font-size: 0.76rem; }
.lab-facts dt { margin: 0; color: var(--muted); }
.lab-facts dd { margin: 0; font-weight: 600; text-align: right; }

.lab-tag {
  align-self: flex-start; border-radius: 100px;
  padding: 3px 11px; font-size: 0.72rem; font-weight: 700; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.lab-tag-empty { background: var(--surface-3); color: var(--muted); font-weight: 500; text-shadow: none; }

.lab-choices { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start; align-content: flex-start; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
