:root {
  color-scheme: dark;
  --bg: #05080e;
  --bg-raised: #0a1018;
  --panel: rgba(9, 15, 23, 0.86);
  --panel-solid: #0a111a;
  --line: rgba(154, 184, 198, 0.13);
  --line-strong: rgba(168, 204, 219, 0.25);
  --text: #e6f0f2;
  --text-soft: #b4c3c9;
  --muted: #768b95;
  --faint: #4b5d66;
  --cyan: #7ce7ff;
  --cyan-soft: #54afc4;
  --mint: #45e3ad;
  --reindex: #55c7ff;
  --reuse: #a797ff;
  --swa: #ffb45e;
  --pink: #ff719a;
  --gold: #ffce6a;
  --violet: #c9a2ff;
  --orange: #ff8f66;
  --ivory: #f4efe2;
  --panel-gap: 9px;
  --radius: 9px;
  --font-ui: "Avenir Next", "Helvetica Neue", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "SF Mono", "Roboto Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, select, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 2px;
}
button:disabled { opacity: 0.38; cursor: default; }
::selection { background: rgba(124, 231, 255, 0.24); color: white; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(155, 186, 199, 0.22); border-radius: 20px; }

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr) 118px;
  background:
    radial-gradient(1300px 780px at 53% -8%, rgba(53, 98, 110, 0.18), transparent 56%),
    radial-gradient(900px 600px at 100% 90%, rgba(108, 64, 124, 0.09), transparent 60%),
    #05080e;
  position: relative;
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.045'/%3E%3C/svg%3E");
  z-index: 30;
  mix-blend-mode: soft-light;
}

/* ------------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(9, 15, 22, 0.94), rgba(7, 11, 17, 0.72));
  position: relative;
  z-index: 20;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124, 231, 255, 0.28) 22%, transparent 60%);
  pointer-events: none;
}

.brand-block { display: flex; align-items: center; gap: 11px; min-width: 345px; }

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  border: 1px solid rgba(124, 231, 255, 0.4);
  border-radius: 5px;
  padding: 3px;
  gap: 2px;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  box-shadow: inset 0 0 18px rgba(124, 231, 255, 0.08);
}
.brand-mark span { display: grid; place-items: center; border: 1px solid rgba(124, 231, 255, 0.16); }
.brand-mark span:nth-child(1) { background: rgba(124, 231, 255, 0.15); color: #d8fbff; }
.brand-mark span:nth-child(2) { color: var(--muted); }
.brand-mark span:nth-child(3) { color: var(--muted); }
.brand-mark span:nth-child(4) { background: rgba(255, 206, 106, 0.07); color: var(--gold); }

.brand-copy h1 {
  margin: 0 0 2px;
  font-size: 15px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.015em;
}
.brand-copy p {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.11em;
  white-space: nowrap;
}
.brand-copy .sep { color: var(--faint); padding: 0 4px; }

.spec-strip {
  display: flex;
  align-items: center;
  height: 34px;
  margin-left: auto;
  border-left: 1px solid var(--line);
}
.spec-strip > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 76px;
  padding: 0 12px;
  border-right: 1px solid var(--line);
}
.spec-strip span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.spec-strip strong {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.spec-strip .spec-accent strong { color: var(--pink); }

.top-actions { display: flex; gap: 6px; margin-left: 8px; }
.quiet-button {
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text-soft);
  font-size: 10px;
  letter-spacing: 0.02em;
  transition: border-color 160ms, color 160ms, background 160ms;
}
.quiet-button:hover { border-color: var(--line-strong); background: rgba(124, 231, 255, 0.04); color: var(--text); }
.button-glyph { font-family: var(--font-mono); color: var(--cyan); font-size: 11px; }

/* ---------------------------------------------------------------- workspace */

.workspace {
  display: grid;
  grid-template-columns: 269px minmax(0, 1fr) 354px;
  gap: var(--panel-gap);
  padding: var(--panel-gap) var(--panel-gap) 0;
  min-height: 0;
}

.panel {
  background:
    linear-gradient(145deg, rgba(16, 25, 35, 0.62), transparent 44%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow:
    0 16px 45px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(125deg, rgba(124, 231, 255, 0.03), transparent 26%, transparent 76%, rgba(255, 113, 154, 0.025));
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- directory */

.directory {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 13px 13px 10px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.panel-heading h2 {
  margin: 3px 0 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.015em;
}
.directory-actions { display: flex; gap: 4px; }
.icon-button {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
}
.icon-button:hover { color: var(--cyan); border-color: rgba(124, 231, 255, 0.35); }

.directory-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 7px 16px;
  scroll-behavior: smooth;
}

.dir-section { margin-bottom: 7px; }
.dir-section-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 5px 5px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.dir-section-head::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.dir-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-soft);
  text-align: left;
  font-size: 10.5px;
  line-height: 1.25;
  position: relative;
  transition: background 140ms, border-color 140ms, color 140ms;
}
.dir-item:hover { background: rgba(126, 177, 192, 0.055); color: var(--text); }
.dir-item.is-selected {
  background: linear-gradient(90deg, rgba(124, 231, 255, 0.11), rgba(124, 231, 255, 0.02));
  border-color: rgba(124, 231, 255, 0.23);
  color: #f1fdff;
}
.dir-item.is-selected::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 5px;
  bottom: 5px;
  width: 2px;
  border-radius: 2px;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(124, 231, 255, 0.5);
}
.dir-item.is-current:not(.is-selected) {
  background: rgba(255, 180, 94, 0.045);
  color: var(--ivory);
}
.dir-item.is-current:not(.is-selected)::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 7px;
  bottom: 7px;
  width: 2px;
  border-radius: 2px;
  background: var(--swa);
}
.dir-item.is-muted { color: var(--muted); }

.dir-overview {
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}
.dir-overview .dir-main strong { font-size: 11px; font-weight: 550; }
.dir-overview .dir-sub { margin-top: 2px; }
.dir-overview.is-selected { border-color: rgba(124, 231, 255, 0.33); }

.dir-branch { margin: 2px 0 4px; }
.dir-branch + .dir-section { margin-top: 6px; }
.branch-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 4px 5px;
  border-radius: 4px;
  color: var(--muted);
  text-align: left;
  font-size: 9.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.branch-head:hover { color: var(--text-soft); background: rgba(255, 255, 255, 0.018); }
.branch-caret {
  display: inline-block;
  width: 9px;
  color: var(--faint);
  font-size: 9px;
  transition: transform 140ms;
}
.branch-head[aria-expanded="true"] .branch-caret { transform: rotate(90deg); }
.branch-count { margin-left: auto; color: var(--faint); font-size: 8px; }
.branch-body { padding: 1px 0 3px 11px; }

.dir-group {
  margin: 2px 0;
}
.group-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 6px;
  border-radius: 4px;
  text-align: left;
  min-height: 28px;
}
.group-head:hover { background: rgba(255, 255, 255, 0.025); }
.group-head .branch-caret { flex: 0 0 9px; }
.group-swatch {
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: var(--group-color, var(--muted));
  opacity: 0.8;
  box-shadow: 0 0 8px color-mix(in srgb, var(--group-color, var(--muted)) 25%, transparent);
}
.group-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.group-copy strong { font-size: 9.5px; color: var(--text-soft); font-weight: 520; letter-spacing: 0.01em; }
.group-copy span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-badge {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  padding: 2px 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
}
.group-body { padding: 3px 0 4px 12px; border-left: 1px solid var(--line); margin-left: 11px; }

.dir-layer { min-height: 25px; }
.dir-layer .mode-bar {
  width: 2px;
  height: 13px;
  border-radius: 2px;
  background: var(--mode-color);
  opacity: 0.9;
  flex: 0 0 2px;
}
.dir-layer .dir-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.dir-layer .layer-name {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  color: var(--text-soft);
  white-space: nowrap;
}
.dir-layer .layer-sub {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dir-layer.is-selected .layer-name { color: #ffffff; }
.mode-tag {
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.03em;
  padding: 2px 4px;
  border-radius: 2px;
  color: var(--mode-color);
  background: color-mix(in srgb, var(--mode-color) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--mode-color) 18%, transparent);
  flex: 0 0 auto;
}
.current-glyph {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--swa);
  box-shadow: 0 0 6px var(--swa);
  flex: 0 0 5px;
}
.internal-block {
  margin-top: 6px;
  padding: 7px;
  border: 1px dashed rgba(140, 179, 192, 0.18);
  border-radius: 5px;
  background: rgba(3, 7, 11, 0.22);
}
.internal-title {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  margin-bottom: 5px;
}
.internal-title span:last-child { color: var(--cyan-soft); }
.internal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.internal-grid .dir-item { min-height: 23px; padding: 4px 5px; font-size: 8.8px; }
.internal-grid .dir-item.is-selected::before { display: none; }
.internal-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--dot, var(--cyan)); flex: 0 0 4px; }

.special-list { display: flex; flex-direction: column; gap: 1px; }
.special-list .dir-item { min-height: 25px; }
.special-list .dir-item .special-glyph {
  width: 16px;
  height: 16px;
  border: 1px solid color-mix(in srgb, var(--dot, var(--cyan)) 32%, transparent);
  border-radius: 3px;
  color: var(--dot, var(--cyan));
  font-family: var(--font-mono);
  font-size: 7px;
  display: grid;
  place-items: center;
  flex: 0 0 16px;
}
.special-list .dir-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.special-list strong { font-size: 9.4px; color: var(--text-soft); font-weight: 500; white-space: nowrap; }
.special-list span { font-size: 7.4px; color: var(--faint); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.directory-footer {
  height: 27px;
  flex: 0 0 27px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.status-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 7px var(--mint);
}

/* ----------------------------------------------------------------- viewport */

.viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 52% 39%, rgba(27, 59, 68, 0.2), transparent 52%),
    radial-gradient(ellipse at 7% 96%, rgba(93, 55, 112, 0.075), transparent 42%),
    linear-gradient(180deg, #060b12, #04070c);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
}
.viewport::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(90deg, rgba(5, 9, 13, 0.36), transparent 13%, transparent 87%, rgba(5, 9, 13, 0.34)),
    linear-gradient(180deg, rgba(5, 9, 13, 0.55), transparent 16%, transparent 86%, rgba(5, 9, 13, 0.38));
}
.viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background-image:
    linear-gradient(rgba(124, 231, 255, 0.023) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 231, 255, 0.023) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, transparent 4%, #000 35%, transparent 94%);
}

.canvas-wrap { position: absolute; inset: 0; }
#sceneCanvas { width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
.scene-loading {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(4, 8, 13, 0.94);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  transition: opacity 500ms ease;
}
.scene-loading.is-gone { opacity: 0; pointer-events: none; }
.loader-orbit {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(124, 231, 255, 0.18);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 1.3s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.scene-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.scene-layer button, .scene-layer input, .scene-layer select, .scene-layer a { pointer-events: auto; }

.scene-status {
  position: absolute;
  top: 13px;
  left: 14px;
  width: min(325px, 45%);
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(3, 6, 10, 0.9);
}
.status-topline {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--cyan-soft);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}
.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(124, 231, 255, 0.8);
}
.live-dot.is-paused { background: var(--muted); box-shadow: none; }
.status-sep { color: var(--faint); }
.status-main {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.status-main strong {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.015em;
  color: #eefbfd;
}
.layer-token {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  padding: 2px 6px;
  border: 1px solid rgba(124, 231, 255, 0.22);
  border-radius: 3px;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.03em;
  background: rgba(7, 20, 25, 0.54);
}
.scene-status p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
  max-width: 280px;
}

.view-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: flex-start;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 430px;
}
.view-button {
  height: 27px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid rgba(160, 193, 205, 0.17);
  border-radius: 4px;
  color: var(--text-soft);
  background: rgba(7, 13, 20, 0.68);
  backdrop-filter: blur(10px);
  font-size: 8.5px;
  white-space: nowrap;
  transition: 140ms;
}
.view-button:hover, .view-button.is-active {
  border-color: rgba(124, 231, 255, 0.38);
  color: var(--cyan);
  background: rgba(16, 39, 47, 0.74);
}
.tool-icon { font-family: var(--font-mono); font-size: 12px; line-height: 1; color: var(--cyan-soft); }
.explode-control {
  width: 123px;
  height: 27px;
  padding: 3px 8px 0;
  border: 1px solid rgba(160, 193, 205, 0.13);
  border-radius: 4px;
  background: rgba(7, 13, 20, 0.66);
  backdrop-filter: blur(10px);
}
.explode-control label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 7.5px;
  line-height: 1;
}
.explode-control b { color: var(--text-soft); font-family: var(--font-mono); font-weight: 500; font-size: 7px; }
.explode-control input[type="range"] {
  appearance: none;
  width: 100%;
  height: 9px;
  margin: 0;
  background: transparent;
  cursor: ew-resize;
}
.explode-control input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: rgba(160, 193, 205, 0.28);
}
.explode-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 6px;
  height: 6px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px rgba(124, 231, 255, 0.6);
}
.explode-control input[type="range"]::-moz-range-track { height: 1px; background: rgba(160, 193, 205, 0.28); }
.explode-control input[type="range"]::-moz-range-thumb { width: 6px; height: 6px; border: 0; border-radius: 50%; background: var(--cyan); }
.shell-opacity-control { width: 132px; }

.scene-breadcrumb {
  position: absolute;
  left: 14px;
  top: 89px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.04em;
}
.scene-breadcrumb button { color: var(--cyan-soft); font-size: inherit; font-family: inherit; }
.scene-breadcrumb button:hover { color: var(--cyan); }
.scene-breadcrumb span:last-child { color: var(--muted); }

.scene-toast {
  position: absolute;
  left: 50%;
  bottom: 54px;
  transform: translate(-50%, 6px);
  padding: 7px 10px;
  border: 1px solid rgba(255, 180, 94, 0.24);
  border-radius: 4px;
  background: rgba(18, 15, 9, 0.88);
  color: #ffd99c;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 180ms, transform 180ms;
  pointer-events: none;
  white-space: nowrap;
}
.scene-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.scene-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 1px 6px #05080e;
}
.scene-hint i { width: 2px; height: 2px; border-radius: 50%; background: var(--faint); }
.hint-emphasis { color: var(--cyan-soft); }

.legend {
  position: absolute;
  left: 13px;
  bottom: 12px;
  width: 186px;
  background: rgba(7, 13, 20, 0.72);
  border-color: rgba(160, 193, 205, 0.13);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}
.legend-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 9px;
  text-align: left;
}
.legend-toggle .eyebrow { color: var(--muted); }
.legend-caret { color: var(--faint); font-size: 10px; transition: transform 160ms; }
.legend-toggle[aria-expanded="false"] .legend-caret { transform: rotate(-90deg); }
.legend-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 5px;
  padding: 0 9px 7px;
  overflow: hidden;
  max-height: 120px;
  transition: max-height 180ms ease, padding 180ms ease, opacity 180ms ease;
  opacity: 1;
}
.legend-body.is-collapsed { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; }
.legend-body > div { display: flex; align-items: center; gap: 5px; font-size: 8px; color: var(--text-soft); }
.swatch { width: 8px; height: 3px; background: var(--c); border-radius: 2px; display: inline-block; flex: 0 0 8px; }
.swatch.dot { width: 5px; height: 5px; border-radius: 50%; }
.swatch.dash {
  width: 10px;
  height: 0;
  background: none;
  border-top: 1px dashed var(--c);
  border-radius: 0;
}
.legend-caveat {
  border-top: 1px solid var(--line);
  padding: 5px 9px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
}

.selection-card {
  position: absolute;
  right: 13px;
  bottom: 12px;
  max-width: 205px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(7, 13, 20, 0.7);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
}
.selection-flag {
  color: var(--cyan-soft);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.14em;
}
.selection-card strong { color: var(--text-soft); font-size: 9px; font-weight: 500; }
.selection-card > span:last-child { color: var(--faint); font-size: 7.5px; font-family: var(--font-mono); }

.annotation {
  position: absolute;
  top: 51%;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(134, 160, 170, 0.38);
  font-family: var(--font-mono);
  font-size: 6px;
  letter-spacing: 0.12em;
  writing-mode: vertical-rl;
  pointer-events: none;
}
.crosshair {
  width: 7px;
  height: 7px;
  border-left: 1px solid rgba(134, 160, 170, 0.38);
  border-bottom: 1px solid rgba(134, 160, 170, 0.38);
}

.label-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 6;
}
.map-label {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-soft);
  font-size: 8.8px;
  line-height: 1.2;
  letter-spacing: 0.015em;
  white-space: nowrap;
  text-shadow: 0 1px 4px #04070a, 0 0 10px #04070a;
  opacity: 0;
  will-change: transform, opacity;
  transition: opacity 130ms;
}
.map-label.is-visible { opacity: 1; }
.map-label .label-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--label-color, var(--cyan));
  box-shadow: 0 0 6px var(--label-color, var(--cyan));
}
.map-label .label-text {
  padding: 1px 3px;
  border-radius: 2px;
  background: rgba(5, 10, 15, 0.58);
  backdrop-filter: blur(2px);
}
.map-label .label-sub {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.02em;
}
.map-label.kind-selected {
  color: #effeff;
  font-size: 11px;
  letter-spacing: 0.035em;
}
.map-label.kind-selected .label-text {
  background: rgba(4, 10, 15, 0.7);
  padding: 3px 7px;
  border: 1px solid rgba(124, 231, 255, 0.28);
}
.map-label.kind-selected .label-sub { font-size: 7px; color: var(--cyan-soft); }
.map-label.kind-selected .label-dot {
  width: 4px;
  height: 4px;
  box-shadow: 0 0 10px var(--label-color, var(--cyan));
}
.map-label.kind-current {
  color: #ffe2b0;
}
.map-label.kind-current .label-text {
  border: 1px solid rgba(255, 180, 94, 0.18);
  background: rgba(26, 17, 7, 0.63);
}
.map-label.kind-current .label-dot { background: var(--swa); box-shadow: 0 0 9px var(--swa); }
.map-label.kind-secondary { font-size: 8px; color: var(--muted); }
.map-label.kind-muted { opacity: 0.55; }
.map-label.kind-module {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.01em;
  color: #b8d4da;
}
.map-label.kind-module .label-text { background: rgba(4, 9, 13, 0.64); color: #d3edf1; }
.map-label.is-selected-module .label-text {
  color: var(--cyan);
  border: 1px solid rgba(124, 231, 255, 0.2);
}
.map-label .label-chip {
  color: var(--label-color, var(--cyan));
  font-family: var(--font-mono);
  font-size: 6px;
  padding: 0 3px;
  border: 1px solid color-mix(in srgb, var(--label-color, var(--cyan)) 25%, transparent);
  border-radius: 2px;
}
.hover-tip {
  position: absolute;
  z-index: 10;
  max-width: 220px;
  padding: 5px 7px;
  border: 1px solid rgba(124, 231, 255, 0.26);
  border-radius: 3px;
  background: rgba(6, 12, 18, 0.9);
  color: var(--text);
  font-size: 9px;
  line-height: 1.35;
  pointer-events: none;
  opacity: 0;
  transform: translate(9px, 9px);
  transition: opacity 100ms;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}
.hover-tip.is-visible { opacity: 1; }
.hover-tip span { color: var(--muted); font-family: var(--font-mono); font-size: 7px; display: block; margin-top: 2px; }

/* ----------------------------------------------------------------- inspector */

.inspector {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--panel-gap);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 1px;
  scrollbar-gutter: stable;
}
.inspector .panel { flex: 0 0 auto; padding: 11px 12px; }
.mini-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mini-actions { display: flex; gap: 8px; }
.text-button {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.02em;
  padding: 0;
}
.text-button:hover { color: var(--cyan); }
.selected-kicker {
  color: var(--cyan-soft);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-top: 9px;
}
.selected-title {
  margin: 4px 0 6px;
  font-size: 17px;
  line-height: 1.18;
  font-weight: 520;
  letter-spacing: 0.01em;
  color: #f0fbfc;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 7px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 5px;
  border: 1px solid var(--tag-color, var(--line));
  border-radius: 2px;
  color: var(--tag-color, var(--text-soft));
  background: color-mix(in srgb, var(--tag-color, var(--cyan)) 5%, transparent);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.02em;
}
.tag::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.selected-description {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #aebfc5;
  font-size: 10.3px;
  line-height: 1.56;
}
.selected-role {
  margin-top: 7px;
  padding: 6px 7px;
  border-left: 2px solid rgba(124, 231, 255, 0.36);
  background: rgba(124, 231, 255, 0.035);
  color: #a9c3c9;
  font-size: 9px;
  line-height: 1.45;
}
.selected-role strong { color: var(--cyan); font-weight: 500; }
.selected-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.action-button {
  min-height: 25px;
  padding: 0 8px;
  border: 1px solid rgba(124, 231, 255, 0.25);
  border-radius: 3px;
  color: var(--cyan);
  background: rgba(124, 231, 255, 0.035);
  font-size: 9px;
  transition: 140ms;
}
.action-button:hover { background: rgba(124, 231, 255, 0.09); border-color: rgba(124, 231, 255, 0.46); }
.action-button.is-active { color: #ffe1ad; border-color: rgba(255, 180, 94, 0.4); background: rgba(255, 180, 94, 0.07); }
.source-link {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.02em;
}
.source-link:hover { color: var(--cyan); }

.sequence-panel { padding-bottom: 10px !important; }
.seq-count {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
}
.inspector-token-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  margin: 8px 0 7px;
  min-height: 25px;
}
.insp-token {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 2px 5px;
  border: 1px solid rgba(154, 184, 198, 0.16);
  border-radius: 3px;
  color: #c2d5da;
  background: rgba(6, 12, 17, 0.36);
  font-family: var(--font-mono);
  font-size: 8px;
  white-space: pre;
}
.insp-token.is-generated {
  color: #dffdf2;
  border-color: rgba(69, 227, 173, 0.27);
  background: rgba(69, 227, 173, 0.055);
}
.insp-token.is-last {
  border-color: rgba(124, 231, 255, 0.44);
  box-shadow: 0 0 0 1px rgba(124, 231, 255, 0.08);
}
.insp-token.is-last::after {
  content: "SOURCE";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -12px;
  color: var(--cyan-soft);
  font-family: var(--font-mono);
  font-size: 5.5px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.token-ellipsis { color: var(--faint); font-family: var(--font-mono); font-size: 9px; padding: 0 2px; }
.target-line {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}
.target-line-main { display: flex; align-items: center; gap: 6px; }
.target-label { color: var(--muted); font-size: 8.5px; }
.target-index {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 8px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 2px;
}
.target-ghost {
  width: 20px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(124, 231, 255, 0.3);
  border-radius: 2px;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  background: rgba(124, 231, 255, 0.025);
}
.target-source { color: var(--faint); font-size: 8px; line-height: 1.35; }
.micro-note { margin-top: 6px; color: #5c737d; font-family: var(--font-mono); font-size: 7px; line-height: 1.4; }

.execution-panel { position: relative; }
.phase-pill {
  color: var(--cyan-soft);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.07em;
  padding: 2px 4px;
  border: 1px solid rgba(124, 231, 255, 0.17);
  border-radius: 2px;
}
.phase-pill.is-live { color: #ffe2ae; border-color: rgba(255, 180, 94, 0.28); }
.exec-layer-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 8px;
}
.exec-layer-number {
  min-width: 39px;
  height: 31px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 180, 94, 0.2);
  border-radius: 3px;
  color: var(--swa);
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(255, 180, 94, 0.03);
  letter-spacing: 0.02em;
}
.exec-layer-line > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.exec-layer-line strong { font-size: 10.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exec-layer-line span:not(.exec-layer-number):not(.exec-badge) { color: var(--faint); font-family: var(--font-mono); font-size: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exec-badge {
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 6px;
  padding: 2px 3px;
  letter-spacing: 0.03em;
}
.exec-badge.is-live { color: var(--mint); border-color: rgba(69, 227, 173, 0.23); }
.op-rail {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}
.op-rail > div {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 6.5px;
  line-height: 1.15;
  min-width: 0;
}
.op-rail > div::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 7px;
  right: -5px;
  height: 1px;
  background: var(--line);
}
.op-rail > div:last-child::after { display: none; }
.op-rail i {
  position: relative;
  z-index: 1;
  width: 4px;
  height: 4px;
  border: 1px solid rgba(140, 170, 180, 0.46);
  border-radius: 50%;
  background: #0b1219;
}
.op-rail span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-rail > div.is-past { color: var(--muted); }
.op-rail > div.is-past i { border-color: var(--cyan-soft); background: var(--cyan-soft); }
.op-rail > div.is-active { color: #ffe3b1; }
.op-rail > div.is-active i { border-color: var(--swa); background: var(--swa); box-shadow: 0 0 6px rgba(255, 180, 94, 0.55); }
.op-rail > div.is-dim { opacity: 0.38; }
.exec-detail {
  min-height: 25px;
  margin: 8px 0 7px;
  color: #9db4ba;
  font-size: 9px;
  line-height: 1.45;
}
.state-strip {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.9fr;
  gap: 4px;
}
.state-cell {
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(4, 9, 14, 0.25);
}
.state-cell span { display: block; color: var(--faint); font-family: var(--font-mono); font-size: 5.8px; letter-spacing: 0.04em; margin-bottom: 3px; white-space: nowrap; }
.state-cell strong { display: block; color: var(--text-soft); font-family: var(--font-mono); font-size: 7px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.state-cell strong.is-hot { color: var(--pink); }
.state-cell strong.is-ready { color: var(--mint); }

.output-panel { padding-bottom: 10px !important; }
.sim-badge {
  color: var(--gold);
  border: 1px solid rgba(255, 206, 106, 0.22);
  border-radius: 2px;
  padding: 1px 3px;
  font-family: var(--font-mono);
  font-size: 6px;
  letter-spacing: 0.06em;
}
.output-placeholder {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 7px 0 5px;
  padding: 8px;
  border: 1px dashed rgba(140, 170, 180, 0.14);
  border-radius: 4px;
  color: var(--faint);
}
.pending-mark { color: var(--faint); font-family: var(--font-mono); font-size: 19px; line-height: 1; opacity: 0.6; }
.output-placeholder div { display: flex; flex-direction: column; gap: 3px; }
.output-placeholder strong { color: var(--muted); font-size: 9px; font-weight: 500; }
.output-placeholder span { font-size: 8px; line-height: 1.4; }
.prob-list { display: flex; flex-direction: column; gap: 5px; margin: 8px 0 7px; }
.prob-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 35px;
  gap: 6px;
  align-items: center;
  min-height: 15px;
}
.prob-row .prob-token {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 8px;
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prob-row.is-chosen .prob-token { color: var(--mint); }
.prob-bar {
  height: 3px;
  background: rgba(148, 177, 187, 0.1);
  border-radius: 2px;
  overflow: hidden;
}
.prob-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, rgba(124, 231, 255, 0.72), rgba(69, 227, 173, 0.95));
  border-radius: inherit;
  transition: width 420ms cubic-bezier(.2,.8,.2,1);
}
.prob-row.is-chosen .prob-fill { background: linear-gradient(90deg, rgba(69, 227, 173, 0.8), #d6ffb8); box-shadow: 0 0 8px rgba(69, 227, 173, 0.22); }
.prob-row .prob-value { color: var(--muted); font-family: var(--font-mono); font-size: 7.5px; text-align: right; }
.prob-row.is-chosen .prob-value { color: var(--mint); }
.output-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.output-meta > span:first-child { color: var(--faint); font-size: 7.5px; line-height: 1.4; max-width: 76%; }
.sample-chip {
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1px 3px;
  font-family: var(--font-mono);
  font-size: 6px;
  white-space: nowrap;
}
.sample-chip.is-sampled { color: var(--mint); border-color: rgba(69, 227, 173, 0.25); }

/* ----------------------------------------------------------------- transport */

.transport {
  margin: var(--panel-gap);
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 11px 7px;
  overflow: hidden;
}
.transport-main {
  display: flex;
  align-items: center;
  gap: 17px;
  min-height: 48px;
}
.transport-controls { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.round-button {
  width: 27px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 17px;
  line-height: 1;
}
.round-button:hover:not(:disabled) { color: var(--text); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.025); }
.play-button {
  height: 35px;
  min-width: 111px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(124, 231, 255, 0.48);
  border-radius: 4px;
  color: #061217;
  background: linear-gradient(180deg, #a5f4ff, #6cd9ed);
  box-shadow: 0 0 20px rgba(124, 231, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: 160ms;
}
.play-button:hover { filter: brightness(1.08); box-shadow: 0 0 25px rgba(124, 231, 255, 0.2); }
.play-button.is-playing {
  color: var(--cyan);
  background: rgba(9, 28, 34, 0.78);
  border-color: rgba(255, 180, 94, 0.38);
  box-shadow: 0 0 16px rgba(255, 180, 94, 0.06);
}
.play-icon { font-family: var(--font-mono); font-size: 10px; }
.speed-select {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 5px;
}
.speed-select label { color: var(--faint); font-family: var(--font-mono); font-size: 6.5px; letter-spacing: 0.05em; }
.speed-select select {
  appearance: none;
  min-width: 50px;
  height: 21px;
  padding: 0 17px 0 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 9px) 8px / 3px 3px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 6px) 8px / 3px 3px no-repeat,
    rgba(6, 11, 16, 0.7);
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 8px;
}
.transport-progress { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.transport-meta { display: flex; align-items: center; gap: 10px; color: var(--faint); font-family: var(--font-mono); font-size: 7px; letter-spacing: 0.01em; white-space: nowrap; }
.transport-meta > span:nth-child(2) { margin-left: auto; color: var(--muted); }
.transport-meta > span:last-child { color: var(--mint); }
.round-chips { display: flex; align-items: center; gap: 4px; }
.round-chip {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(5, 10, 15, 0.22);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  transition: 140ms;
}
.round-chip .round-index { color: var(--muted); flex: 0 0 auto; }
.round-chip .round-token { overflow: hidden; text-overflow: ellipsis; color: var(--faint); }
.round-chip.is-complete { border-color: rgba(69, 227, 173, 0.17); color: var(--mint); }
.round-chip.is-complete .round-index, .round-chip.is-complete .round-token { color: var(--mint); }
.round-chip.is-active { border-color: rgba(255, 180, 94, 0.4); background: rgba(255, 180, 94, 0.055); color: #ffe6bd; }
.round-chip.is-active .round-index, .round-chip.is-active .round-token { color: #ffe6bd; }
.round-chip.is-future { opacity: 0.5; }
.round-chip:disabled { cursor: default; }
.progress-track { height: 2px; background: rgba(149, 177, 185, 0.11); border-radius: 3px; overflow: hidden; }
#progressFill { height: 100%; width: 0; background: linear-gradient(90deg, rgba(124, 231, 255, 0.58), #8ff3ff 55%, #ffcf8b); border-radius: 3px; transition: width 180ms linear; }
.transport-jump { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.secondary-button {
  height: 27px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-size: 8.5px;
  white-space: nowrap;
}
.secondary-button:hover:not(:disabled) { color: var(--cyan); border-color: rgba(124, 231, 255, 0.3); }
.secondary-button span { font-family: var(--font-mono); font-size: 9px; }
.transport-hint { color: var(--faint); font-family: var(--font-mono); font-size: 6.5px; white-space: nowrap; }
.layer-scrub-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  min-height: 27px;
}
.scrub-label {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.06em;
}
.scrub-label > span:last-child { color: var(--cyan-soft); letter-spacing: 0.01em; }
.layer-scrub { display: flex; align-items: center; gap: 2px; flex: 1 1 auto; min-width: 0; }
.layer-scrub .scrub-group-label {
  font-family: var(--font-mono);
  font-size: 6px;
  color: var(--faint);
  padding: 0 3px 0 5px;
  white-space: nowrap;
}
.layer-scrub .scrub-group-label:first-child { padding-left: 0; }
.layer-tick {
  position: relative;
  flex: 1 1 0;
  min-width: 5px;
  max-width: 26px;
  height: 17px;
  border: 1px solid color-mix(in srgb, var(--tick-color, var(--line)) 28%, transparent);
  border-radius: 2px;
  background: color-mix(in srgb, var(--tick-color, transparent) 6%, transparent);
  padding: 0;
  overflow: hidden;
}
.layer-tick::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 3px;
  height: 2px;
  background: var(--tick-color, var(--line));
  opacity: 0.55;
}
.layer-tick:hover { border-color: var(--tick-color); background: color-mix(in srgb, var(--tick-color) 14%, transparent); }
.layer-tick.is-past { opacity: 0.58; }
.layer-tick.is-current {
  border-color: var(--swa);
  background: rgba(255, 180, 94, 0.16);
  box-shadow: 0 0 8px rgba(255, 180, 94, 0.14);
  opacity: 1;
}
.layer-tick.is-selected { outline: 1px solid var(--cyan); outline-offset: 1px; }
.layer-tick.is-future { opacity: 0.34; }
.mini-tick-label {
  position: absolute;
  top: 5px;
  left: 0;
  right: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 5.5px;
  text-align: center;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
}

/* -------------------------------------------------------------------- dialogs */

.dialog {
  width: min(880px, calc(100vw - 60px));
  max-height: min(80vh, 720px);
  padding: 0;
  border: 1px solid rgba(154, 184, 198, 0.24);
  border-radius: 8px;
  background: #0a1119;
  color: var(--text);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.dialog::backdrop { background: rgba(1, 4, 7, 0.72); backdrop-filter: blur(6px); }
.dialog[open] { animation: dialog-in 180ms ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(7px) scale(0.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
.small-dialog { width: min(720px, calc(100vw - 60px)); }
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 17px 19px 13px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 35, 44, 0.55), transparent);
}
.dialog-head h2 { margin: 4px 0 0; font-size: 18px; font-weight: 500; }
.dialog-close { width: 26px; height: 26px; color: var(--muted); font-size: 17px; border: 1px solid var(--line); border-radius: 3px; }
.dialog-close:hover { color: var(--text); border-color: var(--line-strong); }
.dialog-tabs { display: flex; gap: 2px; padding: 9px 19px 0; border-bottom: 1px solid var(--line); }
.dialog-tab {
  padding: 7px 9px;
  color: var(--muted);
  border-bottom: 1px solid transparent;
  font-size: 9.5px;
}
.dialog-tab.is-active { color: var(--cyan); border-bottom-color: var(--cyan); }
.dialog-body { padding: 15px 19px 18px; overflow-y: auto; max-height: calc(80vh - 166px); }
.dialog-footer {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 19px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
}
.dialog-footer a { color: var(--cyan-soft); font-family: var(--font-mono); font-size: 7.5px; text-decoration: none; }
.dialog-footer a:hover { color: var(--cyan); }
.dialog-footer span:last-child { margin-left: auto; }
.source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.source-card {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(4, 9, 14, 0.35);
}
.source-card.is-target { border-color: rgba(124, 231, 255, 0.35); background: rgba(124, 231, 255, 0.035); }
.source-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.source-card h3 { margin: 0; font-size: 10px; font-weight: 500; color: var(--text-soft); }
.source-card .source-page { color: var(--faint); font-family: var(--font-mono); font-size: 7px; white-space: nowrap; }
.source-card blockquote { margin: 0 0 6px; padding-left: 7px; border-left: 1px solid rgba(124, 231, 255, 0.22); color: #8fa7ae; font-family: var(--font-mono); font-size: 7.5px; line-height: 1.55; }
.source-card p { margin: 0; color: #647b85; font-size: 8px; line-height: 1.5; }
.limits-body h3 { margin: 16px 0 5px; color: var(--text-soft); font-size: 10px; font-weight: 500; }
.limits-body h3:first-child { margin-top: 0; }
.limits-body p { margin: 0; color: #82969d; font-size: 9.5px; line-height: 1.7; }
.limits-body .limit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.limits-body .limit-grid > div { padding: 9px; border: 1px solid var(--line); border-radius: 4px; }
.limits-body .limit-grid strong { display: block; font-size: 9px; color: var(--text-soft); font-weight: 500; margin-bottom: 3px; }
.limits-body .limit-grid span { color: var(--faint); font-size: 8px; line-height: 1.5; }
.disclaimer-box {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(255, 206, 106, 0.17);
  background: rgba(255, 206, 106, 0.035);
  color: #b59e74;
  font-size: 9px;
  line-height: 1.6;
}
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.help-grid > div { padding: 10px; border: 1px solid var(--line); border-radius: 4px; }
.help-grid b { color: var(--cyan-soft); font-family: var(--font-mono); font-size: 8px; display: block; margin-bottom: 5px; }
.help-grid span { color: var(--text-soft); font-size: 10px; display: block; margin-bottom: 4px; }
.help-grid p { margin: 0; color: #7c9097; font-size: 9px; line-height: 1.6; }
.help-disclaimer { margin-top: 12px; color: #8c9ea3; font-size: 9.5px; line-height: 1.6; }
.help-disclaimer strong { color: var(--text-soft); font-weight: 500; }

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

@media (max-width: 1320px) {
  .workspace { grid-template-columns: 247px minmax(0, 1fr) 332px; }
  .brand-block { min-width: 305px; }
  .spec-strip > div { min-width: 65px; padding: 0 9px; }
  .spec-strip > div:nth-child(2) { display: none; }
  .inspector .panel { padding: 9px 10px; }
  .selected-description { -webkit-line-clamp: 3; }
  .view-tools { max-width: 400px; }
}

@media (max-width: 1140px) {
  .workspace { grid-template-columns: 224px minmax(0, 1fr) 312px; }
  .brand-block { min-width: 280px; }
  .spec-strip > div:nth-child(4) { display: none; }
  .view-button span:last-child { display: none; }
  .view-button { width: 27px; padding: 0; justify-content: center; }
  .view-tools { gap: 4px; }
  .explode-control { width: 104px; }
  .legend { width: 168px; }
  .scene-status { width: 240px; }
  .scene-status p { display: none; }
  .transport-main { gap: 10px; }
  .transport-hint { display: none; }
}

@media (max-height: 780px) {
  .app-shell { grid-template-rows: 52px minmax(0, 1fr) 106px; }
  .topbar { padding: 0 13px; }
  .brand-copy h1 { font-size: 14px; }
  .spec-strip > div { min-width: 66px; padding: 0 9px; }
  .inspector { gap: 7px; }
  .workspace { gap: 7px; padding: 7px 7px 0; }
  .transport { margin: 7px; padding: 6px 9px; }
  .transport-main { min-height: 42px; }
  .selected-title { font-size: 15px; }
  .selected-description { -webkit-line-clamp: 3; font-size: 9.8px; line-height: 1.52; }
  .sequence-panel .micro-note { display: none; }
  .selected-panel { padding-top: 9px !important; }
  .layer-scrub-wrap { margin-top: 4px; padding-top: 4px; min-height: 23px; }
  .layer-tick { height: 14px; }
  .annotation { display: none; }
  .scene-hint { display: none; }
}

@media (max-height: 650px) {
  .inspector .selected-description { -webkit-line-clamp: 2; }
  .app-shell { grid-template-rows: 48px minmax(0, 1fr) 96px; }
  .output-placeholder { min-height: 45px; }
  .op-rail { margin-top: 2px; }
}

@media (max-width: 960px) {
  .workspace { grid-template-columns: 205px minmax(0, 1fr) 290px; }
  .brand-copy p { display: none; }
  .brand-block { min-width: 230px; }
  .spec-strip { display: none; }
  .top-actions { margin-left: auto; }
  .inspector .selected-description { -webkit-line-clamp: 2; }
  .transport-jump { display: none; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-rows: 50px minmax(0, 1fr) 112px; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 205px; }
  .directory { display: none; }
  .inspector { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; overflow-y: auto; }
  .inspector .panel { min-width: 0; }
  .selected-panel { display: none; }
  .sequence-panel, .execution-panel { grid-column: span 1; }
  .output-panel { grid-column: span 2; }
  .transport { margin: 6px; }
  .transport-controls { gap: 3px; }
  .round-button { width: 23px; height: 26px; }
  .play-button { min-width: 88px; height: 30px; }
  .speed-select { display: none; }
  .round-chips { gap: 2px; }
  .round-chip { padding: 3px 4px; font-size: 6px; }
  .round-chip .round-token { display: none; }
  .layer-scrub .scrub-group-label { display: none; }
  .scrub-label { display: none; }
  .scene-status { width: 62%; }
  .view-tools { max-width: 200px; }
  .explode-control, .shell-opacity-control { width: 80px; }
  .legend { display: none; }
  .selection-card { display: none; }
}

/* flow facts injected after initial layout */
.flow-facts {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 0.9fr 0.9fr;
  gap: 3px;
  margin: 1px 0 7px;
}
.flow-facts > div {
  min-width: 0;
  padding: 4px 5px;
  border: 1px solid rgba(154, 184, 198, 0.1);
  border-radius: 3px;
  background: rgba(4, 9, 14, 0.18);
}
.flow-facts span {
  display: block;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 5.8px;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.flow-facts strong {
  display: block;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 6.8px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flow-facts strong.is-cache { color: var(--pink); }
.flow-facts strong.is-out { color: var(--mint); }

@media (max-height: 840px) {
  .flow-facts { display: none; }
}

[hidden] { display: none !important; }

/* generic directory copy blocks (input, special and vision branches) */
.dir-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.dir-overview .dir-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dir-overview .dir-main strong {
  display: block;
}
.dir-overview .dir-main .dir-sub {
  display: block;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
}
.special-list .dir-item strong,
.dir-item .dir-copy strong { line-height: 1.2; }
.dir-copy span { line-height: 1.2; }


.label-leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 0;
}
.label-leaders path {
  filter: drop-shadow(0 0 2px rgba(124, 231, 255, 0.18));
}
.map-label { z-index: 1; }

/* --------------------------------------------------------------------------
   Inspector compression: keep the selected brief, current input, operation,
   next-token distribution and playback visible together on desktop screens.
   -------------------------------------------------------------------------- */
.flow-facts { display: none; }
.selected-panel { padding: 9px 11px !important; }
.selected-description { -webkit-line-clamp: 2; line-height: 1.52; font-size: 10px; }
.selected-kicker { margin-top: 7px; }
.selected-title { margin: 3px 0 5px; font-size: 16px; }
.tag-row { margin-bottom: 5px; }
.selected-role { margin-top: 5px; padding: 5px 6px; font-size: 8.5px; line-height: 1.42; }
.selected-actions { margin-top: 7px; }
.sequence-panel { padding-bottom: 8px !important; }
.inspector-token-row { margin: 6px 0 5px; }
.target-line { gap: 4px; margin-top: 6px; padding-top: 6px; }
.micro-note { margin-top: 4px; }
.execution-panel { padding-bottom: 8px !important; }
.exec-layer-line { margin: 6px 0 6px; }
.op-rail { padding-top: 6px; }
.exec-detail { margin: 6px 0 6px; min-height: 22px; }
.state-cell { padding: 4px 5px; }
.output-panel { padding-bottom: 8px !important; }
.output-placeholder { min-height: 50px; margin: 6px 0 4px; padding: 7px; }
.prob-list { gap: 3px; margin: 6px 0 5px; }
.prob-row { min-height: 13px; }
.prob-row .prob-token { font-size: 7.7px; }
.prob-row .prob-value { font-size: 7px; }
.output-meta { padding-top: 5px; }

@media (max-height: 840px) {
  .selected-role { display: none; }
  .tag-row { display: none; }
  .sequence-panel .micro-note { display: none; }
  .target-source { display: none; }
  .selected-actions { display: none; }
  .inspector { gap: 7px; }
  .inspector .panel { padding: 8px 10px !important; }
  .selected-description { -webkit-line-clamp: 2; }
  .exec-detail { min-height: 18px; line-height: 1.4; margin: 5px 0; }
  .state-strip { display: grid; }
  .state-cell { padding: 4px 4px; }
  .op-rail > div span { font-size: 6px; }
  .app-shell { grid-template-rows: 52px minmax(0, 1fr) 108px; }
  .transport { padding: 6px 9px; }
  .transport-main { min-height: 42px; }
  .layer-scrub-wrap { min-height: 23px; margin-top: 4px; padding-top: 4px; }
  .layer-tick { height: 14px; }
}

@media (max-height: 760px) {
  .selected-description { display: none; }
  .selected-panel .selected-actions { margin-top: 5px; }
  .target-line { display: none; }
  .exec-layer-line { margin: 4px 0 5px; }
  .output-placeholder { min-height: 42px; }
}


.prob-row.is-leading .prob-token { color: var(--gold); }
.prob-row.is-leading .prob-fill { background: linear-gradient(90deg, rgba(255, 206, 106, 0.65), rgba(255, 181, 92, 0.95)); }
.prob-row.is-leading .prob-value { color: var(--gold); }


/* HUD and controls always sit above the floating HTML map labels */
.scene-status, .view-tools, .scene-breadcrumb, .scene-toast, .scene-hint,
.legend, .selection-card { z-index: 7; }
.label-layer { z-index: 6; }
