:root {
  --ink: #f3ece0;
  --ink-2: #c9bfae;
  --ink-3: #8f8676;
  --bg: #0d0c0b;
  --glass: rgba(20, 18, 16, 0.78);
  --glass-2: rgba(32, 28, 24, 0.86);
  --line: rgba(255, 236, 205, 0.12);
  --line-2: rgba(255, 236, 205, 0.22);
  --brass: #e0b26a;
  --brass-2: #b8894a;
  --ember: #ff7a3d;
  --xray: #66d9ff;
  --ok: #7fd18b;
  --warn: #f2c14e;
  --bad: #ff6b5e;
  --published: #7fd1c7;
  --serif:
    "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia,
    serif;
  --sans:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI",
    system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
}
button {
  font: inherit;
  color: inherit;
}
a {
  color: var(--brass);
}

#stage {
  position: fixed;
  inset: 0;
}
#stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}
#labels {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

/* ---------- top bar ---------- */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  pointer-events: none;
  z-index: 20;
  background: linear-gradient(180deg, rgba(8, 7, 6, 0.75), rgba(8, 7, 6, 0));
}
#topbar > * {
  pointer-events: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.brand .mark {
  font-size: 26px;
  color: var(--brass);
  filter: drop-shadow(0 0 8px rgba(224, 178, 106, 0.5));
}
.brand .name {
  font-family: var(--serif);
  font-size: 21px;
  letter-spacing: 0.06em;
}
.brand .sub {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
#crumbs {
  flex: 1;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--ink-2);
}
#crumbs .sep {
  color: var(--ink-3);
}
#crumbs button {
  background: none;
  border: 0;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink-2);
}
#crumbs button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}
.status {
  display: flex;
  align-items: center;
  gap: 14px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}
.dot.ok {
  background: var(--ok);
}
.dot.warn {
  background: var(--warn);
}
.dot.bad {
  background: var(--bad);
}

/* ---------- dock ---------- */
#dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 7px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  z-index: 20;
  max-width: calc(100vw - 32px);
  overflow-x: auto;
}
#dock button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 82px;
  padding: 8px 10px 7px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  color: var(--ink-2);
  transition:
    background 0.2s,
    color 0.2s,
    border-color 0.2s;
}
#dock button .ico {
  font-size: 18px;
  line-height: 1;
}
#dock button .txt {
  font-size: 11px;
  white-space: nowrap;
}
#dock button .key {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-3);
}
#dock button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}
#dock button.active {
  background: rgba(224, 178, 106, 0.14);
  border-color: rgba(224, 178, 106, 0.35);
  color: var(--ink);
}

/* ---------- side panel ---------- */
#panel {
  position: fixed;
  top: 76px;
  right: 16px;
  bottom: 104px;
  width: min(420px, calc(100vw - 32px));
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  z-index: 15;
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 30px));
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#panel.open {
  transform: none;
}
#panel.over-tool {
  z-index: 30;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--line);
}
.panel-kicker {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}
.panel-head h2,
.tool-head h2 {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 23px;
  line-height: 1.15;
}
.panel-body {
  padding: 14px 18px 18px;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.panel-body h3 {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--ink);
  font-size: 16px;
  margin: 18px 0 6px;
}
.panel-body p {
  margin: 6px 0 10px;
}
.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  width: 30px;
  height: 30px;
  border-radius: 9px;
  cursor: pointer;
  flex: none;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ---------- full tool overlay ---------- */
#tool {
  position: fixed;
  inset: 72px 16px 100px 16px;
  background: rgba(14, 12, 11, 0.94);
  border: 1px solid var(--line-2);
  border-radius: 18px;
  box-shadow: var(--shadow);
  z-index: 25;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.985);
  transition:
    opacity 0.3s,
    transform 0.3s;
}
#tool.open {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.tool-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.tool-head > div:first-child {
  flex: 1;
  min-width: 0;
}
.tool-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tool-body {
  flex: 1;
  min-height: 0;
  position: relative;
}

/* ---------- common widgets ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-2);
  color: var(--ink);
  font-size: 12.5px;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.11);
}
.btn.primary {
  background: linear-gradient(180deg, #e8bd78, #b98a4b);
  color: #1b140b;
  border-color: transparent;
  font-weight: 600;
}
.btn.primary:hover {
  filter: brightness(1.08);
}
.btn.on {
  background: rgba(102, 217, 255, 0.16);
  border-color: rgba(102, 217, 255, 0.5);
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  overflow: hidden;
}
.seg button {
  background: none;
  border: 0;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-2);
}
.seg button.on {
  background: rgba(224, 178, 106, 0.2);
  color: var(--ink);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.prize {
  border-color: rgba(224, 178, 106, 0.6);
  color: var(--brass);
}
.chip.read {
  border-color: rgba(127, 209, 139, 0.6);
  color: var(--ok);
}
.chip.ink {
  border-color: rgba(102, 217, 255, 0.55);
  color: var(--xray);
}
.chip.published {
  border-color: rgba(127, 209, 199, 0.6);
  color: var(--published);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  font-size: 12.5px;
  margin: 8px 0;
}
.kv dt {
  color: var(--ink-3);
}
.kv dd {
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-word;
}
.note {
  font-size: 11.5px;
  color: var(--ink-3);
  border-left: 2px solid var(--line-2);
  padding-left: 10px;
  margin: 10px 0;
}
.small {
  font-size: 11.5px;
  color: var(--ink-3);
}
.mono {
  font-family: var(--mono);
}
table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0;
}
table.t th,
table.t td {
  text-align: left;
  padding: 5px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.t th {
  color: var(--ink-3);
  font-weight: 500;
}
.photo {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
  margin: 8px 0;
  background: #000;
}
input[type="range"] {
  accent-color: var(--brass);
}
label.check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 12.5px;
  cursor: pointer;
}
select,
input[type="text"],
textarea {
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 12.5px;
}
textarea {
  width: 100%;
  resize: vertical;
  min-height: 64px;
}

/* ---------- tooltip & toasts ---------- */
#tip {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  background: rgba(10, 9, 8, 0.9);
  border: 1px solid var(--line-2);
  color: var(--ink);
  max-width: 320px;
  opacity: 0;
  transform: translate(14px, 14px);
  transition: opacity 0.12s;
}
#tip.show {
  opacity: 1;
}
#tip .t-k {
  color: var(--brass);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#toasts {
  position: fixed;
  left: 20px;
  bottom: 110px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 45;
}
.toast {
  background: var(--glass-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 12.5px;
  box-shadow: var(--shadow);
  animation: toast-in 0.35s ease-out;
  max-width: 420px;
}
.toast.bad {
  border-color: rgba(255, 107, 94, 0.6);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 3D labels (CSS2D) ---------- */
.beacon {
  pointer-events: auto;
  cursor: pointer;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(12, 10, 9, 0.72);
  border: 1px solid rgba(224, 178, 106, 0.4);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition:
    transform 0.2s,
    background 0.2s;
  backdrop-filter: blur(6px);
}
.beacon:hover {
  transform: scale(1.06);
  background: rgba(40, 30, 20, 0.9);
}
.beacon .n {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--brass);
}
.beacon.hide {
  display: none;
}
.tag3d {
  pointer-events: none;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(10, 9, 8, 0.78);
  border: 1px solid var(--line-2);
  color: var(--ink);
  white-space: nowrap;
  font-family: var(--sans);
}
.tag3d.xray {
  border-color: rgba(102, 217, 255, 0.55);
  color: #d8f5ff;
}
.tag3d .k {
  color: var(--brass);
  font-family: var(--mono);
  font-size: 10px;
  margin-right: 6px;
}

/* ---------- loader ---------- */
#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 40%, #241a12 0%, #0b0a09 70%);
  transition: opacity 0.8s;
}
#loader.done {
  opacity: 0;
  pointer-events: none;
}
.loader-inner {
  text-align: center;
}
.loader-greek {
  font-family: var(--serif);
  letter-spacing: 0.5em;
  color: rgba(224, 178, 106, 0.5);
  font-size: 15px;
  margin-bottom: 10px;
}
.loader-title {
  font-family: var(--serif);
  font-size: 46px;
  letter-spacing: 0.08em;
}
.loader-sub {
  color: var(--ink-3);
  margin: 8px 0 18px;
  font-size: 13px;
}
.loader-bar {
  width: 260px;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto;
}
#loader-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brass-2), var(--ember));
  transition: width 0.3s;
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .brand .sub,
  #crumbs {
    display: none;
  }
  #dock button {
    min-width: 64px;
  }
  #dock button .key {
    display: none;
  }
  #panel {
    top: auto;
    height: 46vh;
    bottom: 96px;
  }
  #tool {
    inset: 64px 8px 92px 8px;
  }
}

/* ---------- tracing tool ---------- */
.tracer {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(300px, 36%) 1fr;
  grid-template-rows: 1fr 230px 50px;
  gap: 1px;
  background: var(--line);
}
.tracer > div {
  background: #070708;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.tr-3d {
  grid-row: 1 / 3;
  grid-column: 1;
}
.tr-3d canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.tr-2d {
  grid-row: 1;
  grid-column: 2;
}
.tr-page {
  grid-row: 2;
  grid-column: 2;
}
.tr-page canvas {
  display: block;
  cursor: pointer;
}
.tr-foot {
  grid-row: 3;
  grid-column: 1 / 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: rgba(20, 18, 16, 0.96) !important;
  overflow-x: auto !important;
}
.tr-foot .btn {
  padding: 5px 9px;
}
.tr-foot .sep {
  width: 1px;
  height: 24px;
  background: var(--line-2);
  margin: 0 4px;
}
.tr-z {
  width: min(380px, 26vw);
}
.tr-zl {
  font-size: 12px;
  color: var(--ink);
  min-width: 140px;
}
.tr-status {
  color: var(--brass);
  white-space: nowrap;
}
.tr-legend {
  position: absolute;
  left: 12px;
  top: 10px;
  z-index: 2;
  background: rgba(8, 8, 8, 0.72);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 12px;
  color: var(--ink-2);
  max-width: 62%;
  pointer-events: none;
}
.tr-legend.right {
  left: auto;
  right: 12px;
  max-width: 52%;
}
.tr-legend .chips {
  margin: 5px 0;
}
.tr-title {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
}
.tr-readout {
  position: absolute;
  left: 12px;
  bottom: 58px;
  z-index: 2;
  font-size: 11.5px;
  color: #e9f6ff;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
}
.tool-picker {
  display: flex;
  gap: 8px;
  align-items: center;
}
.tool-picker select {
  max-width: 340px;
}

/* ---------- light table tool ---------- */
.lt {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 270px 1fr;
}
.lt-side {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(12, 11, 10, 0.9);
}
.lt-search {
  margin: 10px;
}
.lt-list {
  overflow-y: auto;
  padding: 0 6px 10px;
}
.lt-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--ink-2);
}
.lt-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.lt-item.on {
  background: rgba(224, 178, 106, 0.14);
  border-color: rgba(224, 178, 106, 0.35);
  color: var(--ink);
}
.lt-item .dot {
  width: 8px;
  height: 8px;
  flex: none;
  box-shadow: none;
}
.lt-name {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-size: 12.5px;
}
.lt-name small {
  color: var(--ink-3);
  font-size: 10.5px;
}
.lt-badges {
  font-size: 11px;
  color: var(--ember);
}
.lt-main {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 0;
}
.lt-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 14, 12, 0.92);
}
.lt-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  margin-right: 4px;
}
.lt-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.lt-slice {
  width: min(300px, 22vw);
}
.lt-slicelabel {
  min-width: 150px;
}
.lt-stage {
  position: relative;
  min-height: 0;
  background: #050505;
  overflow: hidden;
}
.lt-hint {
  position: absolute;
  left: 12px;
  top: 10px;
  background: rgba(0, 0, 0, 0.55);
  padding: 4px 9px;
  border-radius: 6px;
  pointer-events: none;
}
.lt-empty {
  padding: 40px;
  color: var(--ink-3);
}
.lt-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: rgba(12, 11, 10, 0.92);
}
.lt-strip.empty {
  display: none;
}
.lt-thumb {
  flex: none;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  position: relative;
}
.lt-thumb img {
  display: block;
  height: 64px;
  width: auto;
  border-radius: 5px;
}
.lt-thumb span {
  position: absolute;
  left: 4px;
  bottom: 2px;
  font-size: 9.5px;
  color: var(--ink-2);
  text-shadow: 0 1px 2px #000;
}
.lt-thumb:hover {
  border-color: var(--brass);
}
.lt-drawer {
  position: absolute;
  top: 50px;
  right: 12px;
  bottom: 12px;
  width: min(420px, 42%);
  background: rgba(16, 14, 12, 0.97);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 12px 14px;
  overflow-y: auto;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.35s;
  font-size: 12.5px;
  color: var(--ink-2);
  z-index: 3;
}
.lt-drawer.open {
  transform: none;
}
.lt-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 15px;
  color: var(--ink);
  font-family: var(--serif);
}
.lt-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}
.lt-enh-img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #000;
  min-height: 120px;
  image-rendering: auto;
}
.lt-weights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  margin: 6px 0;
}
.lt-weights label {
  display: flex;
  flex-direction: column;
}
.tr-gate {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  width: 300px;
  background: rgba(8, 8, 8, 0.82);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--ink-2);
}
.tr-gate .t td {
  padding: 2px 4px;
}
.tr-gate-head {
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.tr-worst {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 6px;
}
.tr-worst .chip {
  cursor: pointer;
  background: none;
}
.tr-worst .chip:hover {
  border-color: var(--brass);
  color: var(--ink);
}

/* Tracer: curated spot of interest (lab/data/spots.json) */
.tr-spot {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  max-height: 66%;
  overflow: auto;
  background: rgba(8, 8, 8, 0.88);
  border: 1px solid rgba(255, 79, 216, 0.55);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--ink-2);
}
.tr-spot-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
}
.tr-obs {
  margin: 3px 0;
  line-height: 1.3;
  font-size: 11.5px;
}
.tr-spot .tr-spot .tr-q {
  color: #f6dcf1;
  margin: 5px 0;
}
.tr-insp {
  display: block;
  margin: 6px auto 0;
  border-radius: 6px;
  cursor: crosshair;
}
.tr-insp-note {
  margin-top: 4px;
}

/* Tracer v2: tool bar, side view, tabbed bottom panel */
.btn.active {
  background: rgba(255, 200, 90, 0.18);
  border-color: rgba(255, 200, 90, 0.75);
  color: #ffe2a6;
}
.tr-tabs {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 8px;
  z-index: 3;
  display: flex;
  gap: 6px;
  align-items: center;
}
.tr-tabs .btn {
  padding: 4px 10px;
}
.tr-tabs-title {
  margin-left: 6px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tr-side {
  position: absolute;
  left: 0;
  right: 0;
  top: 44px;
  bottom: 0;
}
.tr-side canvas {
  display: block;
  cursor: crosshair;
}
.tr-side-hint {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  background: rgba(8, 8, 8, 0.72);
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--ink-2);
  pointer-events: none;
}
.tr-tools {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 3;
  max-width: calc(100% - 20px);
}
.tr-tools .btn {
  padding: 5px 10px;
}
.tr-hint {
  margin-top: 5px;
  background: rgba(8, 8, 8, 0.72);
  border-radius: 8px;
  padding: 4px 8px;
  color: var(--ink-2);
  max-width: 640px;
  pointer-events: none;
}
.tr-pane {
  position: absolute;
  inset: 0;
}
.tr-pagetabs {
  position: absolute;
  right: 8px;
  top: 6px;
  z-index: 3;
  display: flex;
  gap: 6px;
}
.tr-pagetabs .btn {
  padding: 3px 9px;
  font-size: 12px;
}
.tr-spotpane {
  display: grid;
  grid-template-columns: minmax(220px, 34%) 1fr;
  gap: 10px;
  padding: 8px 10px;
}
.tr-spotinfo {
  overflow: auto;
  font-size: 12px;
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tr-spotinfo details {
  margin: 2px 0;
}
.tr-spotinfo .tr-spotinfo .tr-inspview {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding-right: 90px;
}
.tr-inspview .btn {
  padding: 3px 8px;
  font-size: 12px;
}
.tr-gate-head[data-toggle] {
  cursor: pointer;
}
.tr-gate {
  width: auto;
  max-width: 300px;
}

/* Checker: the simple one-question-per-picture check (lab/js/tools/checker.js) */
.ck-wait {
  padding: 40px;
  color: var(--ink-2);
  font-size: 15px;
}
.ck-intro {
  max-width: 720px;
  margin: 30px auto;
  padding: 0 20px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-2);
}
.ck-intro h2 {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--ink);
  font-size: 28px;
  margin: 0 0 12px;
}
.ck-big {
  font-size: 16px;
  padding: 10px 20px;
}
.ck-q {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 18px;
  gap: 10px;
}
.ck-progress {
  color: var(--ink-3, #9a8f80);
  font-size: 13px;
  letter-spacing: 0.08em;
}
.ck-ask {
  font-size: 19px;
  color: var(--ink);
  text-align: center;
}
.ck-pics {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 16px;
  justify-content: center;
  width: 100%;
}
.ck-pics figure {
  margin: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.ck-img {
  height: calc(100% - 26px);
  max-width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #000;
}
.ck-pics figcaption,
.ck-ba figcaption {
  color: var(--ink-2);
  font-size: 13px;
  margin-top: 6px;
}
.ck-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.ck-yes {
  background: rgba(127, 209, 139, 0.18);
  border-color: rgba(127, 209, 139, 0.7);
}
.ck-no {
  background: rgba(255, 107, 94, 0.16);
  border-color: rgba(255, 107, 94, 0.7);
}
.ck-opt1 {
  background: rgba(90, 209, 255, 0.18);
  border-color: rgba(90, 209, 255, 0.8);
}
.ck-opt2 {
  background: rgba(255, 79, 216, 0.18);
  border-color: rgba(255, 79, 216, 0.8);
}
.ck-sep {
  width: 1px;
  height: 30px;
  background: var(--line-2);
  margin: 0 6px;
}
.ck-ask2 {
  font-size: 16px;
  color: var(--ink);
  margin-right: 6px;
}
.ck-status {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-2);
}
.ck-ba {
  display: flex;
  gap: 14px;
  margin: 10px 0;
}
.ck-ba figure {
  margin: 0;
  flex: 1;
}
.ck-ba img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
}

/* A quieter public lab: the original overlays, with fewer controls. */
.welcome {
  position: fixed;
  left: 24px;
  bottom: 126px;
  max-width: 350px;
  background: rgba(27, 25, 21, 0.87);
  border: 1px solid var(--line);
  padding: 20px 42px 20px 22px;
  border-radius: 12px;
  z-index: 15;
  backdrop-filter: blur(14px);
}
.welcome[hidden] {
  display: none;
}
.welcome > span {
  font: 22px var(--serif);
  color: var(--ink);
}
.welcome p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-2);
}
.welcome small {
  font-size: 10px;
  color: var(--ink-3);
}
#welcome-close {
  position: absolute;
  right: 8px;
  top: 8px;
  padding: 3px 8px;
}
.learn-slider {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 0;
  font-size: 13px;
}
.learn-slider input {
  accent-color: var(--brass);
  width: 100%;
}
.brand:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 4px;
}
@media (max-width: 700px) {
  .brand .sub {
    display: none;
  }
  #topbar {
    padding: 0 12px;
    gap: 8px;
  }
  .brand .name {
    font-size: 16px;
  }
  #crumbs {
    font-size: 10px;
  }
  #about {
    font-size: 10px;
    padding: 7px;
  }
  #dock button {
    min-width: 65px;
  }
  .welcome {
    left: 15px;
    right: 15px;
    bottom: 117px;
    max-width: 340px;
  }
  #panel {
    width: min(440px, calc(100vw - 24px));
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Shelf controls stay in the room; there is no catalog overlay. */
.archive-rail {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 122px;
  z-index: 20;
  width: min(850px, calc(100vw - 28px));
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #1a1b16e8;
  backdrop-filter: blur(10px);
}
.archive-rail-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
.archive-rail input {
  min-width: 90px;
  flex: 1;
  padding: 8px 10px;
  background: #0e110ccc;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  color: var(--ink);
}
.archive-rail label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--ink-2);
}
.archive-rail select {
  max-width: 170px;
  font-size: 11px;
}
.archive-rail p {
  font-size: 10px;
  color: var(--ink-3);
  margin: 8px 0 0;
}
.archive-rail [data-count] {
  min-width: 75px;
  text-align: center;
  font-size: 11px;
  color: var(--ink);
}
.archive-object-label {
  pointer-events: auto !important;
  cursor: pointer;
  text-align: center;
  padding: 6px 12px;
  background: #171a14ed;
  border: 1px solid #dcc38966;
  border-radius: 6px;
  color: #eee2c8;
  min-width: 142px;
  box-shadow: 0 3px 12px #0006;
}
.archive-object-label strong {
  display: block;
  font: 18px var(--serif);
}
.archive-object-label span {
  display: block;
  font: 10px var(--sans);
  margin-top: 5px;
}
.archive-object-label small {
  display: block;
  font: 9px var(--sans);
  color: #aaa995;
  margin-top: 5px;
}
.archive-label-status.read,
.archive-detail-status.read {
  color: #a3e5a8;
}
.archive-label-status.letters,
.archive-detail-status.letters {
  color: #d7c2ff;
}
.archive-label-status.ink,
.archive-detail-status.ink {
  color: #9bdcf2;
}
.archive-label-status.segmenting {
  color: #e6c57a;
}
.archive-detail-status {
  border-left: 3px solid currentColor;
  padding-left: 10px;
  font-size: 14px;
}
.letter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 18px;
}
.letter-grid button {
  border: 1px solid var(--line-2);
  padding: 5px;
  border-radius: 7px;
  background: #ffffff06;
  cursor: pointer;
}
.letter-grid img {
  width: 100%;
  height: 88px;
  object-fit: contain;
  background: #090a08;
}
.letter-grid span {
  display: block;
  font-size: 10px;
  color: var(--ink-2);
  margin: 7px 0 4px;
}
.trace-diagram {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: block;
  margin: 15px 0 8px;
}
.pipeline-stage-list {
  padding-left: 18px;
}
.pipeline-stage-list li {
  margin: 9px 0;
}
.pipeline-stage-list button {
  text-align: left;
  font-size: 11px;
}
@media (max-width: 700px) {
  .archive-rail {
    bottom: 112px;
  }
  .archive-rail-controls {
    flex-wrap: wrap;
  }
  .archive-rail input {
    flex-basis: 35%;
  }
  .archive-rail select {
    max-width: 145px;
  }
  .archive-rail p {
    font-size: 9px;
  }
  .archive-object-label {
    min-width: 100px;
    padding: 5px;
  }
  .archive-object-label strong {
    font-size: 14px;
  }
  .archive-object-label small {
    font-size: 8px;
  }
  .archive-object-label span {
    font-size: 9px;
  }
}
.walk-help {
  position: fixed;
  left: 20px;
  bottom: 125px;
  z-index: 21;
  background: #191b15eb;
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  max-width: 380px;
}
.walk-help[hidden] {
  display: none;
}
.walk-help strong {
  display: block;
  font: 21px var(--serif);
  margin-bottom: 7px;
}
.walk-help > span {
  display: block;
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 280px;
}
.walk-pad {
  display: grid;
  grid-template-columns: repeat(3, 40px);
  gap: 5px;
  margin: 12px 0;
}
.walk-pad button {
  border: 1px solid var(--line-2);
  background: #ffffff0a;
  color: var(--ink);
  border-radius: 6px;
  height: 36px;
  cursor: pointer;
  touch-action: none;
}
.walk-pad [data-direction="forward"] {
  grid-column: 2;
}
.walk-pad [data-direction="left"] {
  grid-column: 1;
  grid-row: 2;
}
.walk-pad [data-direction="back"] {
  grid-column: 2;
  grid-row: 2;
}
.walk-pad [data-direction="right"] {
  grid-column: 3;
  grid-row: 2;
}
.walk-mode #stage {
  cursor: grab;
}
.walk-mode #stage:active {
  cursor: grabbing;
}
.walk-mode .archive-rail,
.walk-mode .archive-object-label {
  display: none !important;
}
#walk-toggle[aria-pressed="true"] {
  border-color: var(--brass);
  color: var(--brass);
}
@media (max-width: 700px) {
  #walk-toggle {
    font-size: 10px;
    padding: 7px;
  }
  .status {
    gap: 5px;
  }
  .walk-help {
    left: 12px;
    bottom: 113px;
    padding: 10px;
    max-width: 240px;
  }
  .walk-help > span {
    font-size: 10px;
  }
  .walk-pad {
    grid-template-columns: repeat(3, 36px);
  }
  .walk-help strong {
    font-size: 18px;
  }
}

/* Restrained museum wayfinding: one icon family, generous type, clear focus. */
#dock {
  border-radius: 16px;
  background: rgba(24, 27, 22, 0.93);
  box-shadow:
    0 10px 40px #0005,
    inset 0 1px #ffffff08;
  gap: 3px;
}
#dock button {
  min-width: 79px;
  padding: 10px 11px 8px;
  gap: 6px;
  border-radius: 10px;
}
#dock button .ico {
  width: 22px;
  height: 22px;
  color: #b6b69e;
}
#dock button .ico svg {
  width: 100%;
  height: 100%;
  display: block;
}
#dock button.active .ico {
  color: #e6c28a;
}
#dock button.active {
  background: #bca87816;
  border-color: #c4ab6b59;
  box-shadow: inset 0 1px #efddb51a;
}
#dock button .txt {
  font-size: 11px;
  letter-spacing: 0.01em;
}
#dock button .key {
  font-size: 8px;
  opacity: 0.65;
}
#topbar {
  height: 76px;
  background: linear-gradient(#12140fe8, #12140f00);
  padding: 0 26px;
}
.brand .name {
  font-size: 23px;
  letter-spacing: 0.015em;
}
.brand .sub {
  font-size: 10px;
  letter-spacing: 0.035em;
}
.brand .mark {
  filter: none;
}
#panel {
  background: rgba(24, 27, 22, 0.95);
  border-color: #d1bd8a30;
  box-shadow: 0 16px 55px #0004;
  backdrop-filter: blur(16px);
}
.panel-body {
  line-height: 1.75;
}
.panel-body p {
  font-size: 13px;
}
.panel-kicker {
  font-size: 10px;
  letter-spacing: 0.16em;
}
.btn {
  min-height: 36px;
  border-radius: 8px;
}
.btn.primary {
  background: #d5ba83;
  color: #1c2117;
  border-color: #e5cba0;
  box-shadow: inset 0 1px #fff5;
}
.welcome {
  max-width: 360px;
  padding: 28px;
  background: #181c16ef;
  border-color: #b9ab7b40;
  box-shadow: 0 18px 60px #0005;
  border-radius: 14px;
}
.welcome > span {
  display: block;
  font-size: 30px;
  line-height: 1.16;
  letter-spacing: -0.025em;
  margin-top: 14px;
}
.welcome .welcome-eyebrow {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: #c4ac7e;
}
.welcome p {
  font-size: 13px;
  line-height: 1.7;
  margin: 16px 0 20px;
}
.welcome > .btn.primary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  margin-bottom: 15px;
  font-size: 12px;
}
.welcome > small:last-of-type {
  display: block;
  font-size: 10px;
  line-height: 1.6;
}
select {
  min-height: 32px;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
@media (max-width: 700px) {
  #topbar {
    height: 62px;
    padding: 0 12px;
  }
  .brand .name {
    font-size: 17px;
  }
  .brand .mark {
    display: none;
  }
  #crumbs {
    display: none;
  }
  #dock {
    bottom: 10px;
    max-width: calc(100vw - 20px);
    justify-content: flex-start;
  }
  #dock button {
    min-width: 66px;
    padding: 9px 8px;
  }
  #dock button .ico {
    width: 20px;
    height: 20px;
  }
  .welcome {
    padding: 22px;
    bottom: 110px;
  }
  .welcome > span {
    font-size: 27px;
  }
  #panel {
    top: 70px;
    bottom: 105px;
  }
  .status {
    margin-left: auto;
  }
}
@media (max-width: 700px) {
  #panel {
    top: auto;
    bottom: 104px;
    left: 12px;
    right: 12px;
    width: auto;
    height: 43vh;
    border-radius: 16px;
  }
  .panel-head {
    padding: 14px 17px;
  }
  .panel-body {
    padding: 0 17px 18px;
  }
  .panel-head h2 {
    font-size: 22px;
  }
  .archive-rail {
    bottom: 108px;
  }
  .archive-rail p {
    display: none;
  }
}
#dock button.visited:not(.active) .ico {
  color: #aec4a5;
}
#dock button.visited:not(.active) .txt:after {
  content: " ·";
  color: #aec4a5;
}
.beacon {
  width: 30px;
  height: 30px;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  background: #1c241bdf;
  border: 1px solid #d9c18d99;
  box-shadow: 0 3px 12px #0004;
  color: #e0c797;
}
.beacon .n {
  margin: 0;
  color: inherit;
  font: 12px var(--mono);
}
.beacon .beacon-text {
  display: none;
}
.beacon:hover,
.beacon:focus-visible {
  background: #c9b17f;
  color: #172015;
}

/* The text is the exhibit; source context stays secondary. */
.recovered-text { margin: 1.4rem 0 1rem; font: 2rem/1.45 Georgia, serif; color: #ead6ad; overflow-wrap: anywhere; }
.reading-translation { font: 1.2rem/1.5 Georgia, serif; }
.discovery-reading > .btn { display: inline-block; margin: .4rem .4rem .4rem 0; }
.discovery-reading .chips { margin-top: 1.3rem; }
.early-study canvas { display:block; width:100%; height:auto; border:1px solid #80745755; border-radius:8px; }
.early-study { border-top:1px solid #80745755; margin:1rem 0; padding-top:.5rem; }
.discovery-reading a:has(.full-scroll-image) { display:block; overflow-x:auto; background:#111; border-radius:6px; }
.discovery-reading .full-scroll-image { width:2000px; max-width:none; height:auto; }
.archive-rail { display:flex; flex-wrap:wrap; gap:.45rem; align-items:center; justify-content:center; max-width:calc(100vw - 32px); }
.archive-rail[hidden] { display:none; }
.archive-rail > select { max-width:185px; }
.archive-rail > input { max-width:150px; }
@media (min-width: 1000px) { .archive-rail { width: min(1050px, calc(100vw - 40px)); } }
.reading-nav { position:fixed; bottom:124px; left:50%; transform:translateX(-50%); z-index:20; }
.reading-nav select { max-width:calc(100vw - 32px); padding:12px 16px; border:1px solid var(--line); border-radius:10px; color:var(--text); background:#20241e; font:inherit; }
.reading-nav[hidden] { display:none; }
@media(max-width:700px){.reading-nav{bottom:92px;}}
.scroll-name { pointer-events:auto; display:flex; flex-direction:column; align-items:center; gap:2px; padding:4px 7px; background:#181c18e8; color:#f5ead3; border:1px solid #b9a77e70; border-radius:6px; font:12px/1.2 system-ui,sans-serif; cursor:pointer; box-shadow:0 2px 8px #0004; }
.scroll-name strong { font-weight:550; white-space:nowrap; }
.scroll-name .scroll-stat { font-size:10px; color:#cabf9f; max-width:120px; }
.scroll-name:hover,.scroll-name:focus-visible { background:#3b4135; border-color:#e7c782; z-index:99; }
.table-caption { pointer-events:auto; display:flex; flex-direction:column; align-items:center; padding:8px 13px; color:#f0dfb8; background:#25291fec; border:1px solid #b7a16a; border-radius:7px; font:15px/1.3 Georgia,serif; cursor:pointer; }
.table-caption span { font:11px/1.5 system-ui,sans-serif; color:#c9c2ad; }
.walk-mode #walk-toggle { width:42px; min-width:42px; padding:6px; font-size:25px; }
.scroll-name { pointer-events:none; padding:10px 14px; font-size:18px; border-radius:8px; }
.scroll-name .scroll-stat { font-size:13px; max-width:250px; }

#walk-toggle[hidden]{display:none!important}

.table-caption { width:110px; box-sizing:border-box; padding:7px 6px; font-size:14px; white-space:normal; }
.table-caption span { font-size:10px; }

.map-attribution {position:fixed;bottom:18px;left:16px;z-index:20;padding:6px 9px;background:#18251fef;color:#e9dfc8;font:12px system-ui;border-radius:5px;}
.map-attribution[hidden]{display:none}

.beam-scale-tag {display:flex;flex-direction:column;gap:4px;padding:8px 12px;background:#17241fed;border:1px solid #a88f5b;color:#f7e7c4;border-radius:6px;font:14px system-ui;max-width:220px;text-align:center;pointer-events:none;}
.beam-scale-tag span{font-size:11px;color:#d5cbb6}

.scanner-zoom-nav{position:fixed;top:82px;left:18px;display:flex;gap:6px;z-index:18;padding:7px;background:#18221ee8;border:1px solid #8c7950;border-radius:9px;flex-wrap:wrap;max-width:calc(100vw - 36px)}
.scanner-zoom-nav[hidden]{display:none}
@media(max-width:700px){.scanner-zoom-nav{top:100px;font-size:12px}}

.fragment-photo{width:72px;height:58px;padding:4px;background:#eee3cd;border:1px solid #a88b56;border-radius:3px;box-shadow:0 3px 9px #0007;cursor:pointer;pointer-events:auto}
.fragment-photo img{display:block;width:100%;height:100%;object-fit:contain}
.fragment-photo:hover,.fragment-photo:focus-visible{outline:2px solid #e4bd76}
.fragment-detail-photo{display:block;width:100%;max-height:330px;object-fit:contain;background:#e6dfd0;border-radius:5px;margin:14px 0}

.panel-actions{display:flex;flex-wrap:wrap;align-items:center;gap:12px;margin-top:20px}.panel-actions>a{padding:10px 2px}
