/* Copyright 2026 VibeThinker J Lens contributors. SPDX-License-Identifier: Apache-2.0
 *
 * Baseline explorer styles, formerly embedded in lens-explorer.html.
 * Keep this block before the editorial product layer below so saved artifacts
 * and current responsive overrides share one reviewable cascade.
 */

@font-face { font-family: "EB Garamond"; src: url("assets/fonts/EBGaramond-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("assets/fonts/EBGaramond-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("assets/fonts/JetBrainsMono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("assets/fonts/JetBrainsMono-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #eef3f7;
  --panel: #ffffff;
  --panel-soft: #f7fbfe;
  --ink: #273449;
  --muted: #8a9bb5;
  --line: #d7e4f0;
  --line-strong: #bad2e6;
  --blue: #1888ce;
  --blue-dark: #0b6eaf;
  --cyan: #55c4ef;
  --orange: #d67d34;
  --green: #5d9b69;
  --slate: #6b7b90;
  --danger: #c84f4f;
  --mono: "JetBrains Mono", monospace;
  --serif: "EB Garamond", Georgia, serif;
  --sans: "JetBrains Mono", monospace;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(47, 87, 124, 0.045) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(0deg, rgba(47, 87, 124, 0.04) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
.token:focus-visible {
  outline: 3px solid rgba(24, 136, 206, 0.42);
  outline-offset: 2px;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

@media (min-width: 1281px) {
  .app {
    height: 100vh;
    overflow: hidden;
  }

  .workspace {
    height: 100%;
    overflow: hidden;
  }
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 251, 254, 0.82);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  color: inherit;
  text-decoration: none;
}

.mark {
  width: 34px;
  height: 34px;
  border: 2px solid var(--ink);
  background:
    linear-gradient(135deg, var(--orange) 0 34%, transparent 34%),
    linear-gradient(45deg, transparent 0 51%, var(--blue) 51% 66%, transparent 66%),
    var(--panel);
  box-shadow: 4px 4px 0 rgba(39, 52, 73, 0.18);
}

.brand strong,
.brand span {
  display: block;
  line-height: 1.05;
}

.brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.bar-actions a,
.ghost-button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 8px 12px;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 700;
}

.bar-actions a:hover,
.ghost-button:hover {
  border-color: var(--blue);
  box-shadow: 0 8px 20px rgba(24, 136, 206, 0.12);
}

.ghost-button.primary {
  border-color: rgba(24, 136, 206, 0.58);
  background: #edf8ff;
  color: var(--blue-dark);
}

.ghost-button.compact {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.76rem;
}

.panel-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: #526983;
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.panel-toggle:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
  box-shadow: 0 6px 16px rgba(24, 136, 206, 0.12);
}

.artifact-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(520px, 1.55fr) minmax(420px, 1fr);
  gap: 16px;
  padding: 20px;
}

.conversation-shell,
.readout-shell {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 44px rgba(64, 92, 118, 0.16);
  overflow: hidden;
}

.conversation-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 22px;
  background: rgba(239, 246, 251, 0.86);
}

.messages {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  padding: 2px 8px 10px;
}

.message {
  width: min(100%, 900px);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(105, 136, 168, 0.12);
  padding: 18px 20px;
}

.message.user {
  align-self: flex-end;
  max-width: 830px;
  border-left: 4px solid var(--blue);
}

.message.assistant {
  align-self: flex-start;
  max-width: 810px;
  border-left: 4px solid var(--orange);
}

.role {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.role-title {
  color: #273449;
  font-family: var(--sans);
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.role-marker {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5f9fd;
  color: #7588a0;
  padding: 2px 7px;
  font-family: var(--mono);
  font-size: 0.68rem;
}

.role-meta {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid #d9e7f3;
  border-radius: 999px;
  background: #f7fbff;
  color: #6c7f98;
  padding: 2px 7px;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: none;
}

.role-end {
  margin: 8px 0 0;
}

.text-flow {
  font-family: var(--serif);
  font-size: clamp(1.02rem, 1.28vw, 1.24rem);
  line-height: 1.58;
}

body.text-scale-small .text-flow {
  font-size: clamp(0.94rem, 1.08vw, 1.08rem);
  line-height: 1.52;
}

body.text-scale-large .text-flow {
  font-size: clamp(1.08rem, 1.52vw, 1.42rem);
  line-height: 1.62;
}

.token {
  --score: 0;
  --focus: 0;
  position: relative;
  display: inline;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  padding: 1px 2px;
  cursor: crosshair;
  transition: background 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.token.hot {
  color: #132539;
  background:
    linear-gradient(
      90deg,
      rgba(85, 196, 239, calc(0.08 + var(--score) * 0.34)),
      rgba(24, 136, 206, calc(0.04 + var(--score) * 0.16))
    );
  box-shadow:
    inset 0 -1px 0 rgba(24, 136, 206, calc(0.2 + var(--score) * 0.32)),
    0 0 0 calc(var(--focus) * 2px) rgba(24, 136, 206, 0.38);
}

.token.related {
  background: rgba(214, 125, 52, 0.18);
  box-shadow:
    inset 0 -1px 0 rgba(214, 125, 52, 0.42),
    0 0 0 calc(var(--focus) * 2px) rgba(214, 125, 52, 0.44);
}

.token.concept-hit {
  background: rgba(93, 155, 105, 0.18);
  box-shadow:
    inset 0 -1px 0 rgba(93, 155, 105, 0.44),
    0 0 0 calc(var(--focus) * 2px) rgba(93, 155, 105, 0.44);
}

.token.related.concept-hit {
  background: linear-gradient(90deg, rgba(214, 125, 52, 0.2), rgba(93, 155, 105, 0.22));
}

.token.selected {
  background: rgba(24, 136, 206, 0.22);
  outline: 2px solid rgba(24, 136, 206, 0.55);
  outline-offset: 1px;
}

.token.no-readout {
  cursor: help;
  color: #72839a;
}

.token.whitespace-token {
  border: 1px solid rgba(138, 155, 181, 0.42);
  background: rgba(255, 255, 255, 0.64);
  color: #6a7d96;
  font-family: var(--mono);
  font-size: 0.72em;
  padding: 0 3px;
  vertical-align: 0.08em;
}

.trace-browser {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  overflow: auto;
  scrollbar-gutter: stable;
  resize: vertical;
  min-height: 56px;
  max-height: min(36vh, 340px);
  box-shadow: 0 8px 24px rgba(64, 92, 118, 0.12);
}

.trace-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  font-weight: 700;
}

.trace-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.trace-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.trace-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 12px;
}

.trace-browser.collapsed .trace-list {
  display: none;
}

.trace-browser.collapsed .trace-head {
  border-bottom: 0;
}

.trace-card {
  flex: 0 0 230px;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fcfe;
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.trace-card:hover,
.trace-card.active {
  border-color: #62c2fa;
  background: rgba(93, 190, 245, 0.12);
  box-shadow: inset 0 0 0 1px rgba(93, 190, 245, 0.22);
}

.trace-card strong,
.trace-card span {
  display: block;
}

.trace-card strong {
  margin-bottom: 5px;
  font-size: 0.9rem;
  line-height: 1.18;
}

.trace-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.trace-card p {
  margin: 8px 0 0;
  color: #586a82;
  font-size: 0.78rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.conversation-shell.compact-context .trace-card p {
  -webkit-line-clamp: 3;
}

.text-size-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbfe;
  padding: 3px;
}

.text-size-controls button {
  min-width: 30px;
  min-height: 26px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #60748c;
  font-weight: 950;
  line-height: 1;
}

.text-size-controls button.active {
  background: var(--blue);
  color: #fff;
}

.text-size-controls button:focus-visible {
  outline: 2px solid rgba(24, 136, 206, 0.36);
  outline-offset: -2px;
}

.trace-card small {
  display: inline-block;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #6f839d;
  padding: 3px 7px;
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.trace-meta {
  color: #6f839d;
  font-family: var(--mono);
  text-transform: none;
}

.readout-shell {
  position: relative;
  z-index: 60;
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
  background: rgba(255, 255, 255, 0.96);
}

.readout-toolbar {
  display: flex;
  justify-content: flex-end;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
  padding: 10px 14px;
}

.readout-head {
  display: grid;
  grid-template-columns: minmax(230px, 0.9fr) minmax(280px, 1.35fr);
  gap: 18px;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.control-label {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mode-stack {
  min-width: 0;
}

.segmented {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr) minmax(0, 0.85fr);
  border: 1px solid var(--blue);
  border-radius: 7px;
  overflow: hidden;
  min-height: 42px;
}

.segmented button {
  border: 0;
  border-right: 1px solid var(--blue);
  background: var(--panel);
  color: var(--blue);
  font-size: 0.84rem;
  font-weight: 900;
  text-transform: uppercase;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--blue);
  color: #fff;
}

.segmented button:disabled {
  cursor: not-allowed;
  background: #f1f6fb;
  color: #9aadc4;
}

.mode-status {
  margin: 8px 0 0;
  color: #6f839d;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.artifact-alert {
  display: none;
  margin: 10px 0 0;
  border: 1px solid rgba(214, 125, 52, 0.36);
  border-radius: 8px;
  background: rgba(214, 125, 52, 0.09);
  color: #805122;
  padding: 8px 9px;
  font-size: 0.74rem;
  font-weight: 850;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.artifact-alert.visible {
  display: block;
}

.artifact-alert.good {
  border-color: rgba(93, 155, 105, 0.36);
  background: rgba(93, 155, 105, 0.1);
  color: #426f4a;
}

.model-card {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fcfe;
  padding: 12px;
}

.model-card .eyebrow,
.model-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.35;
}

.model-card .eyebrow {
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.model-card strong {
  display: block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.25;
}

.model-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 9px;
}

.model-facts span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #50647d;
  padding: 4px 7px;
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
}

.layer-panel {
  min-width: 0;
}

.layer-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.layer-values {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 900;
}

.layer-strip {
  position: relative;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #eef5fa;
  overflow: hidden;
  cursor: col-resize;
  user-select: none;
}

.layer-bars {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--layer-count, 64), 1fr);
  gap: 1px;
  padding: 3px;
}

.layer-bar {
  min-width: 2px;
  border: 0;
  border-radius: 2px;
  background: rgba(44, 88, 126, 0.1);
  padding: 0;
  font-size: 0;
  transition: background 140ms ease, transform 140ms ease;
}

.layer-bar.in-window {
  background: rgba(24, 136, 206, 0.75);
}

.layer-bar.current {
  background: var(--orange);
  transform: scaleY(1.08);
}

.layer-ruler {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 900;
}

.layer-ruler span:last-child {
  text-align: right;
}

.range-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.range-control {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
  padding: 7px 8px;
}

.range-control span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.range-control output {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.76rem;
}

.range-control input {
  width: 100%;
  accent-color: var(--blue);
}

.play-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 0 20px 16px;
}

.motion-status {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.66rem;
  font-weight: 650;
  line-height: 1.35;
}

.motion-status[hidden] {
  display: none;
}

.layer-range {
  width: 100%;
  accent-color: var(--blue);
}

.readout-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.readout-state {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  background: #fbfdff;
  color: #4f647e;
  padding: 10px 20px;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.35;
}

.readout-state strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.readout-state span {
  color: var(--muted);
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  min-width: 0;
}

.searchbox input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  font-weight: 700;
}

.layer-note {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 900;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: nowrap;
}

.readout-table {
  min-height: 0;
  overflow: auto;
  padding: 0 20px 18px;
  scrollbar-gutter: stable;
}

.table-head,
.readout-row {
  display: grid;
  grid-template-columns: 24px minmax(140px, 1.3fr) 60px 64px minmax(160px, 1.3fr);
  gap: 10px;
  align-items: center;
}

.table-head {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 0 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.96);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.readout-row {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 8px 4px 0;
  margin-bottom: 4px;
  cursor: pointer;
}

.readout-row:nth-child(odd) {
  background-color: rgba(248, 251, 254, 0.54);
}

.readout-row:hover,
.readout-row:focus-visible,
.readout-row.active {
  border-color: #62c2fa;
  background: rgba(93, 190, 245, 0.1);
  box-shadow: inset 0 0 0 1px rgba(93, 190, 245, 0.24);
}

.readout-row.active {
  border-color: rgba(24, 136, 206, 0.82);
  background: #eaf7ff;
  box-shadow:
    inset 4px 0 0 var(--blue),
    inset 0 0 0 1px rgba(24, 136, 206, 0.24);
}

.readout-row.related {
  border-color: rgba(214, 125, 52, 0.58);
  background: rgba(214, 125, 52, 0.1);
}

.readout-row.inspecting {
  border-color: rgba(93, 155, 105, 0.72);
  background: rgba(93, 155, 105, 0.1);
}

.readout-row.active.inspecting {
  border-color: rgba(24, 136, 206, 0.82);
  background: linear-gradient(90deg, #eaf7ff, rgba(93, 155, 105, 0.12));
}

.check {
  width: 15px;
  height: 15px;
  border: 2px solid #aac0d7;
  border-radius: 4px;
  margin-left: 10px;
  background: #fff;
}

.readout-row.active .check {
  border-color: var(--blue);
  background: linear-gradient(135deg, var(--blue) 0 55%, #fff 55%);
}

.token-name {
  min-width: 0;
  display: block;
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.18;
  overflow-wrap: anywhere;
  white-space: normal;
}

.token-name small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
}

.count,
.layer-value {
  color: #8aa0bd;
  font-family: var(--mono);
  font-weight: 900;
  text-align: right;
}

.spark {
  height: 28px;
  display: grid;
  grid-template-columns: repeat(var(--layer-count, 64), 1fr);
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  background: #f5f8fb;
}

.readout-empty {
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: #f9fcfe;
  color: #667991;
  padding: 14px;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.readout-note {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fcfe;
  color: #667991;
  padding: 10px 12px;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.35;
}

.spark span {
  min-width: 0;
  background: rgba(68, 83, 100, 0.08);
  cursor: crosshair;
}

.spark span.current {
  outline: 2px solid rgba(24, 136, 206, 0.75);
  z-index: 1;
}

.spark span:hover {
  outline: 2px solid rgba(214, 125, 52, 0.78);
  z-index: 2;
}

.spark.diff span.pos {
  background: rgba(24, 136, 206, var(--a));
}

.spark.diff span.neg {
  background: rgba(214, 125, 52, var(--a));
}

.tooltip {
  position: fixed;
  z-index: 100;
  width: min(320px, calc(100vw - 24px));
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 14px 36px rgba(51, 81, 110, 0.22);
  padding: 12px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.tooltip h3 {
  margin: 0 0 7px;
  font-size: 0.92rem;
}

.tooltip p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.tooltip-grid {
  display: grid;
  gap: 5px;
}

.tooltip-row {
  display: grid;
  grid-template-columns: 1fr 50px;
  gap: 8px;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 900;
}

.tooltip-row.token-list {
  grid-template-columns: 56px minmax(0, 1fr);
}

.tooltip-row.token-list span:last-child {
  text-align: left;
  line-height: 1.25;
  overflow-wrap: anywhere;
  white-space: normal;
}

.mini-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  grid-column: 1 / -1;
}

.mini-bar span {
  display: block;
  height: 100%;
  width: calc(var(--w) * 100%);
  background: var(--blue);
}

.inspector-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  background: transparent;
  pointer-events: none;
}

.inspector-backdrop.visible {
  display: none;
}

.token-inspector {
  position: fixed;
  z-index: 90;
  left: var(--inspector-left, 50%);
  top: var(--inspector-top, auto);
  bottom: var(--inspector-bottom, 28px);
  width: min(760px, calc(100vw - 28px));
  min-width: min(440px, calc(100vw - 28px));
  min-height: 330px;
  max-width: calc(100vw - 24px);
  max-height: min(76vh, 760px);
  display: none;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(50, 76, 101, 0.28);
  overflow: hidden;
  resize: both;
  transform: var(--inspector-transform, translateX(-50%));
}

.token-inspector.visible {
  display: grid;
}

.inspector-head {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: #50647d;
  font-weight: 900;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.token-inspector.dragging .inspector-head {
  cursor: grabbing;
}

.inspector-title,
.inspector-space {
  padding: 0 22px;
}

.inspector-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.inspector-chip {
  max-width: 210px;
  border-radius: 7px;
  background: #e8eff6;
  color: #425872;
  padding: 7px 10px;
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-position {
  color: #4a5d75;
  white-space: nowrap;
}

.inspector-space {
  justify-self: end;
  color: #4a5d75;
}

.inspector-close {
  margin-right: 14px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: #526983;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
}

.inspector-controls {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  background: #f9fcfe;
}

.all-layers-button {
  min-height: 58px;
  border: 2px solid #8aa0bd;
  border-radius: 9px;
  background: #edf4fa;
  color: #435873;
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.all-layers-button.active {
  border-color: var(--blue);
  background: #e7f6ff;
  color: var(--blue-dark);
}

.inspector-slider-stack {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.inspector-copy {
  margin: 0;
  color: #7e92ad;
  font-size: 0.84rem;
  font-weight: 850;
  text-align: center;
}

.inspector-layer-strip {
  position: relative;
  height: 45px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eef5fa;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.inspector-layer-bars {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--layer-count, 64), 1fr);
  gap: 1px;
  padding: 4px;
}

.inspector-layer-bars button {
  min-width: 2px;
  border: 0;
  border-radius: 2px;
  background: rgba(44, 88, 126, 0.08);
  padding: 0;
  font-size: 0;
  cursor: pointer;
}

.inspector-layer-bars button.in-window {
  background: rgba(151, 173, 194, 0.38);
}

.inspector-layer-bars button.current {
  background: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.inspector-ruler {
  display: flex;
  justify-content: space-between;
  color: #91a5bf;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 900;
}

.inspector-warning {
  display: block;
  visibility: hidden;
  min-height: 26px;
  margin: 8px 22px 0;
  border: 1px solid rgba(214, 125, 52, 0.38);
  border-radius: 8px;
  background: #fff9ec;
  color: #b95c00;
  padding: 4px 10px;
  font-size: 0.72rem;
  line-height: 1.25;
  font-weight: 850;
}

.inspector-warning.visible {
  visibility: visible;
}

.inspector-warning.scope {
  visibility: visible;
  border-color: rgba(69, 111, 157, 0.3);
  background: #f1f6fb;
  color: #334f73;
}

.inspector-table {
  min-height: 0;
  overflow: auto;
  padding: 14px 22px 22px;
}

.inspector-table-head,
.inspector-row {
  display: grid;
  grid-template-columns: 24px minmax(130px, 1.1fr) 70px minmax(190px, 1.3fr);
  gap: 12px;
  align-items: center;
}

.inspector-table-head {
  position: sticky;
  top: -14px;
  z-index: 2;
  padding: 0 0 10px;
  background: rgba(255, 255, 255, 0.98);
  color: #91a5bf;
  font-size: 0.76rem;
  font-weight: 950;
  text-transform: uppercase;
}

.inspector-row {
  min-height: 40px;
  border-radius: 8px;
  color: #425872;
}

.inspector-row.active {
  background: rgba(24, 136, 206, 0.08);
}

.inspector-row .token-name {
  font-size: 0.92rem;
}

.inspector-row .count {
  text-align: right;
}

.inspector-empty {
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: #f9fcfe;
  color: #667991;
  padding: 14px;
  font-size: 0.82rem;
  font-weight: 850;
}

@media (max-width: 1500px) {
  .readout-head {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1280px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .conversation-shell {
    height: clamp(640px, calc(100vh - 96px), 760px);
  }

  .readout-shell {
    min-height: 760px;
  }
}

@media (max-width: 720px) {
  .bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .bar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bar-actions a,
  .bar-actions .ghost-button {
    text-align: center;
  }

  .workspace {
    padding: 10px;
  }

  .conversation-shell {
    padding: 12px;
  }

  .table-head,
  .readout-row {
    grid-template-columns: 22px minmax(100px, 1fr) 48px minmax(120px, 1fr);
  }

  .trace-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .trace-title,
  .trace-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .trace-card {
    flex-basis: 210px;
  }

  .readout-state {
    padding: 10px 14px;
  }

  .token-inspector {
    bottom: 10px;
    max-height: 82vh;
  }

  .inspector-head {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px 12px;
  }

  .inspector-title {
    grid-column: 1;
    grid-row: 1;
    padding: 0;
    flex-wrap: wrap;
  }

  .inspector-space {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    padding: 0;
  }

  .inspector-close {
    grid-column: 2;
    grid-row: 1;
    margin-right: 0;
  }

  .inspector-controls {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .all-layers-button {
    min-height: 42px;
  }

  .inspector-warning {
    margin: 10px 14px 0;
  }

  .inspector-table {
    padding: 12px 14px 16px;
  }

  .inspector-table-head,
  .inspector-row {
    grid-template-columns: 22px minmax(0, 1fr) 52px;
  }

  .inspector-table-head span:nth-child(4) {
    display: none;
  }
}

@media (max-width: 520px) {
  .readout-tools {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .readout-toolbar {
    justify-content: flex-start;
  }

  .layer-note {
    white-space: normal;
  }

  .table-head {
    grid-template-columns: 22px minmax(0, 1fr) 48px;
    gap: 8px;
  }

  .table-head span:nth-child(5) {
    display: none;
  }

  .readout-row {
    grid-template-columns: 22px minmax(0, 1fr) 48px;
    grid-template-areas:
      "check name count"
      ". spark spark";
    gap: 7px 8px;
    align-items: center;
    padding: 8px 6px 8px 0;
  }

  .readout-row .check {
    grid-area: check;
    margin-left: 6px;
  }

  .readout-row .token-name {
    grid-area: name;
  }

  .readout-row .count {
    grid-area: count;
  }

  .readout-row .spark {
    grid-area: spark;
    height: 24px;
  }
}

@media (max-width: 380px) {
  .workspace {
    padding: 8px;
  }

  .readout-head,
  .play-row,
  .readout-tools {
    padding-left: 12px;
    padding-right: 12px;
  }

  .readout-tools {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .readout-table {
    padding: 0 10px 14px;
  }

  .table-head,
  .readout-row {
    grid-template-columns: 20px minmax(0, 1fr) 38px;
    gap: 6px;
  }

  .readout-row {
    padding-right: 4px;
  }

  .token-name {
    font-size: 0.86rem;
  }

  .count {
    font-size: 0.84rem;
  }
}

/* VibeThinker J Lens explorer layout and component styles. */

:root {
  --bg: #f1eee4;
  --panel: #faf8f1;
  --panel-soft: #f5f2e9;
  --panel-strong: #fffdf7;
  --ink: #17262b;
  --ink-soft: #324249;
  --muted: #5e6b6c;
  --muted-strong: #46565c;
  --line: #b9b8ad;
  --line-strong: #999b92;
  --blue: #0a9eaa;
  --blue-dark: #08727a;
  --cyan: #35bcb0;
  --orange: #d44e2f;
  --orange-dark: #a94320;
  --green: #6b8f26;
  --lime: #d9ef78;
  --focus-ring: #17262b;
  --focus-halo: #fffdf7;
  --slate: #52636a;
  --danger: #b63e35;
  --shadow: 0 18px 46px rgba(20, 33, 38, 0.1);
  --mono: "JetBrains Mono", monospace;
  --serif: "EB Garamond", Georgia, serif;
  --sans: "JetBrains Mono", monospace;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(20, 33, 38, 0.08) 0.7px, transparent 0.7px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(0, 143, 136, 0.16);
}

button,
input,
summary,
a {
  touch-action: manipulation;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[role="slider"]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  box-shadow: 0 0 0 7px var(--focus-halo);
}

.bar a:focus-visible,
.bar button:focus-visible {
  outline-color: var(--lime);
  box-shadow: 0 0 0 7px #122126, 0 0 0 10px var(--focus-halo);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 7px;
  background: var(--lime);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 150ms ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
}

.app {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}

/* Header */

.bar {
  position: relative;
  z-index: 200;
  top: auto;
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(250px, auto) minmax(220px, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 11px max(18px, env(safe-area-inset-right)) 11px max(18px, env(safe-area-inset-left));
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: #122126;
  color: #f8f8f2;
  box-shadow: 0 4px 24px rgba(20, 33, 38, 0.16);
  backdrop-filter: none;
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.mark {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 7px;
  background: #f8f8f2;
  box-shadow: none;
}

.mark::before {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 8px;
  height: 5px;
  background: var(--blue);
  box-shadow: 0 8px 0 var(--blue), 0 16px 0 var(--orange);
  transform: skewX(-18deg);
}

.mark::after {
  content: "";
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--lime);
}

.brand-copy,
.brand-copy strong,
.brand-copy span {
  display: block;
  min-width: 0;
}

.brand .compact-brand-copy {
  display: none;
}

.brand-copy strong {
  color: #fff;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.005em;
}

.brand-copy span {
  margin-top: 3px;
  color: #aebbc0;
  font-family: var(--mono);
  font-size: 0.66rem;
  line-height: 1.2;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.artifact-context {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding-left: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.artifact-context span {
  color: #9eacb1;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.artifact-context strong {
  min-width: 0;
  overflow: hidden;
  color: #eef4f1;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

.compact-action-label {
  display: none;
}

.bar-actions a,
.ghost-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  padding: 8px 12px;
  box-shadow: none;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.bar-actions a {
  border-color: transparent;
  background: transparent;
  color: #c6d0d3;
}

.bar-actions a:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  box-shadow: none;
}

.bar-actions a[aria-current="page"] {
  color: #fff;
  box-shadow: inset 0 -2px 0 var(--lime);
}

.bar-actions .ghost-button {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.bar-actions .ghost-button:hover {
  border-color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

.bar-actions .ghost-button[hidden] {
  display: none !important;
}

.bar-actions .ghost-button.primary {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--ink);
}

.bar-actions .ghost-button.primary:hover {
  border-color: #efffb3;
  background: #e7f89a;
  color: var(--ink);
}

.artifact-file[hidden] {
  display: none;
}

.artifact-load-panel[hidden],
.synthetic-demo-banner[hidden],
.artifact-load-actions[hidden],
.artifact-demo-note[hidden],
.artifact-progress-text[hidden],
.artifact-load-card progress[hidden] {
  display: none !important;
}

.artifact-load-panel {
  position: fixed;
  z-index: 180;
  inset: 68px 0 0;
  display: grid;
  align-items: safe center;
  justify-items: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  background:
    linear-gradient(rgba(241, 238, 228, 0.94), rgba(241, 238, 228, 0.98)),
    radial-gradient(rgba(23, 38, 43, 0.12) 0.7px, transparent 0.7px) 0 0 / 22px 22px;
}

.artifact-load-card {
  width: min(620px, 100%);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ink);
  border-top: 7px solid var(--blue);
  background: var(--panel-strong);
  padding: clamp(24px, 5vw, 46px);
  box-shadow: 12px 12px 0 rgba(23, 38, 43, 0.14);
}

.artifact-load-card > strong {
  display: block;
  margin-top: 7px;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1;
}

.artifact-load-card > p {
  color: var(--muted-strong);
  line-height: 1.5;
}

.artifact-load-card progress {
  width: 100%;
  height: 11px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--panel-soft);
  accent-color: var(--blue);
}

.artifact-load-card progress::-webkit-progress-bar {
  background: var(--panel-soft);
}

.artifact-load-card progress::-webkit-progress-value {
  background: var(--blue);
}

.artifact-progress-text,
.artifact-demo-note {
  margin: 6px 0 0;
  font-family: var(--mono);
  font-size: 0.68rem;
}

.artifact-load-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.artifact-load-actions button,
.synthetic-demo-banner button {
  min-height: 40px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  font: 750 0.72rem var(--mono);
  cursor: pointer;
}

.artifact-load-actions button + button {
  background: var(--panel-strong);
  color: var(--ink);
}

.synthetic-demo-banner {
  position: fixed;
  z-index: 170;
  top: 80px;
  right: 12px;
  left: 12px;
  max-width: 940px;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--ink);
  border-left: 7px solid var(--orange);
  background: #fff1e7;
  color: var(--ink);
  padding: 10px 12px;
  box-shadow: 6px 6px 0 rgba(23, 38, 43, 0.12);
  font-size: 0.72rem;
  line-height: 1.4;
}

.synthetic-demo-banner strong {
  display: inline;
  margin-right: 5px;
  text-transform: uppercase;
}

.synthetic-demo-banner button {
  flex: 0 0 auto;
  min-height: 34px;
  background: var(--panel-strong);
  color: var(--ink);
}

@media (min-width: 1051px) {
  body[data-artifact-kind="synthetic-demo"] .workspace,
  body[data-artifact-kind="local-synthetic"] .workspace {
    padding-top: 72px;
  }
}

@media (max-height: 500px) {
  .artifact-load-panel {
    align-items: start;
    padding: 10px 14px;
  }

  .artifact-load-card {
    padding: 14px 18px;
    box-shadow: 6px 6px 0 rgba(23, 38, 43, 0.14);
  }

  .artifact-load-card > strong {
    font-size: clamp(1.45rem, 4vw, 2rem);
  }

  .artifact-load-card > p {
    margin: 8px 0 0;
    line-height: 1.35;
  }

  .artifact-load-panel[data-state="error"] .eyebrow {
    order: 0;
  }

  .artifact-load-panel[data-state="error"] #artifactLoadTitle {
    order: 1;
  }

  .artifact-load-panel[data-state="error"] #artifactLoadActions {
    order: 2;
    margin-top: 10px;
  }

  .artifact-load-panel[data-state="error"] #artifactLoadDetail {
    order: 3;
  }

  .artifact-load-panel[data-state="error"] #artifactDemoNote {
    order: 4;
  }
}

.mobile-view-tabs {
  display: none;
}

.mobile-readout-boundary {
  margin: 0;
}

/* Main research workspace */

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(520px, 1.16fr) minmax(480px, 0.84fr);
  gap: 12px;
  padding: 12px;
}

.conversation-shell,
.readout-shell {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(251, 250, 245, 0.97);
  box-shadow: var(--shadow);
}

.conversation-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  padding: 0;
}

.conversation-heading {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.heading-copy {
  min-width: 0;
}

.eyebrow,
.control-label,
.guide-label {
  display: block;
  margin: 0 0 5px;
  color: var(--muted-strong);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  line-height: 1.25;
  text-transform: uppercase;
}

.conversation-heading h1,
.readout-toolbar h2,
.probe-guide h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 800;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.conversation-heading h1 {
  font-size: clamp(1.22rem, 1.65vw, 1.62rem);
  line-height: 1.13;
}

.conversation-heading p {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  text-wrap: pretty;
}

.focus-badge {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--lime);
  color: var(--ink);
  padding: 4px 5px 4px 10px;
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 750;
}

.focus-badge[hidden] {
  display: none;
}

.focus-badge i {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.76rem;
  font-style: normal;
  line-height: 1;
}

.readout-focus-badge {
  display: none;
  margin: 0;
}

.workflow-hint {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-hint li {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted-strong);
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.workflow-hint li:not(:last-child)::after {
  content: "→";
  margin-left: 1px;
  color: var(--line-strong);
}

.workflow-hint li span {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.62rem;
}

/* Trace rail */

.trace-browser {
  position: relative;
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  resize: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #f3f3ed;
  box-shadow: none;
}

.trace-head {
  min-height: 43px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 100px 7px 14px;
  border: 0;
  border-bottom: 1px solid rgba(157, 167, 163, 0.55);
  color: var(--muted-strong);
  font-size: 0.68rem;
  font-weight: 750;
  text-transform: none;
}

.trace-title,
.trace-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.trace-title > span:first-child {
  margin-right: 2px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.trace-meta {
  min-width: 0;
  max-width: 48ch;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 600;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.panel-toggle {
  min-height: 29px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--ink-soft);
  padding: 5px 8px;
  font-size: 0.66rem;
  font-weight: 750;
  line-height: 1;
  text-transform: none;
  white-space: nowrap;
}

.panel-toggle:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
  box-shadow: none;
}

.text-size-controls {
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  padding: 2px;
}

.text-size-controls button {
  min-width: 26px;
  min-height: 24px;
  border-radius: 5px;
  color: var(--muted-strong);
  font-size: 0.68rem;
}

.text-size-controls button.active {
  background: var(--ink);
  color: #fff;
}

.trace-list {
  min-height: 84px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 9px 12px 11px;
  scrollbar-color: var(--line-strong) transparent;
}

.trace-scroll {
  position: absolute;
  z-index: 8;
  top: 5px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: rgba(251, 250, 245, 0.96);
  color: var(--ink);
  padding: 0 0 2px;
  box-shadow: 0 3px 12px rgba(20, 33, 38, 0.16);
  font-size: 1.25rem;
  line-height: 1;
}

.trace-scroll-prev {
  right: 47px;
}

.trace-scroll-next {
  right: 7px;
}

.trace-scroll:hover:not(:disabled) {
  background: var(--ink);
  color: #fff;
}

.trace-scroll:disabled {
  visibility: hidden;
}

.trace-scroll[hidden],
.trace-browser.collapsed .trace-scroll {
  display: none;
}

.trace-browser.collapsed .trace-list {
  display: none;
}

.trace-browser.collapsed .trace-head {
  border-bottom: 0;
}

.trace-card {
  position: relative;
  flex: 0 0 174px;
  min-height: 65px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-strong);
  color: var(--ink);
  padding: 10px 11px;
  text-align: left;
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.trace-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
}

.trace-card:hover {
  border-color: var(--line-strong);
  background: #fafbf6;
  box-shadow: none;
  transform: translateY(-1px);
}

.trace-card.active {
  border-color: var(--ink);
  background: var(--lime);
  box-shadow: none;
}

.trace-card.active::before {
  background: var(--ink);
}

.trace-card > span,
.trace-card strong {
  display: block;
}

.trace-card > span {
  margin-bottom: 5px;
  overflow: hidden;
  color: var(--muted-strong);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.trace-card strong {
  margin: 0;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trace-card p,
.trace-card small {
  display: none;
}

/* Transcript */

.messages {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  padding: 18px 22px 28px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.mobile-token-hint {
  display: none;
}

.message {
  width: 100%;
  max-width: 980px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-strong);
  box-shadow: 0 4px 15px rgba(20, 33, 38, 0.035);
  padding: 17px 20px 19px;
}

.message.user {
  align-self: stretch;
  max-width: none;
  border-left: 4px solid var(--blue);
}

.message.assistant {
  align-self: stretch;
  max-width: none;
  border-left: 4px solid var(--orange);
  background: #fffaf4;
}

.capture-limit-note {
  margin: 10px 0 0;
  color: var(--muted-strong);
  font-family: var(--mono);
  font-size: 0.67rem;
  font-weight: 650;
  line-height: 1.35;
}

.role {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.role-title {
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.role-marker,
.role-meta {
  min-height: 21px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted-strong);
  padding: 2px 6px;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
}

.role-meta {
  font-family: var(--sans);
  font-weight: 750;
}

.role-end {
  display: none;
}

.text-flow,
body.text-scale-small .text-flow,
body.text-scale-large .text-flow {
  color: #1b2b35;
  font-family: var(--serif);
  font-size: clamp(1.02rem, 1.14vw, 1.16rem);
  font-variant-ligatures: common-ligatures;
  line-height: 1.66;
  letter-spacing: 0.002em;
  text-wrap: pretty;
}

body.text-scale-small .text-flow {
  font-size: clamp(0.94rem, 1vw, 1.04rem);
  line-height: 1.58;
}

body.text-scale-large .text-flow {
  font-size: clamp(1.1rem, 1.3vw, 1.3rem);
  line-height: 1.7;
}

.token {
  --score: 0;
  --focus: 0;
  appearance: none;
  position: relative;
  display: inline;
  min-width: 0;
  margin: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  box-shadow: none;
  padding: 1px 0;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-align: inherit;
  white-space: pre-wrap;
}

button.token {
  cursor: pointer;
}

button.token[data-inspectable="true"] {
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-color: rgba(0, 112, 107, 0.72);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

.token:not(.no-readout):hover {
  background: rgba(0, 143, 136, 0.11);
  box-shadow: inset 0 -1px 0 rgba(0, 143, 136, 0.52);
}

.token.hot {
  color: var(--ink);
  background: rgba(0, 143, 136, calc(0.08 + var(--score) * 0.18));
  box-shadow: inset 0 -2px 0 rgba(0, 143, 136, calc(0.3 + var(--score) * 0.42));
}

.token.related {
  background: rgba(216, 95, 50, 0.14);
  box-shadow: inset 0 -2px 0 rgba(216, 95, 50, 0.5);
}

.token.concept-hit {
  background: rgba(217, 239, 120, 0.72);
  box-shadow: inset 0 -2px 0 var(--green);
}

.token.contrast-left:not(.selected) {
  box-shadow: inset 0 -2px 0 var(--orange);
}

.token.contrast-right:not(.selected) {
  box-shadow: inset 0 -2px 0 var(--blue);
}

.token.contrast-left.contrast-right:not(.selected) {
  background: linear-gradient(90deg, rgba(216, 95, 50, 0.13) 0 50%, rgba(0, 143, 136, 0.13) 50% 100%);
  box-shadow: inset 0 -2px 0 var(--ink);
}

.token.selected {
  background: var(--lime);
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.token.no-readout {
  color: inherit;
  cursor: text;
}

.token.whitespace-token {
  min-width: 0.25em;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  vertical-align: baseline;
}

.conversation-shell.compact-context .message {
  padding-top: 13px;
  padding-bottom: 14px;
}

.conversation-shell.compact-context .text-flow {
  font-size: 0.98rem;
  line-height: 1.48;
}

/* Readout rail */

.readout-shell {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-rows: auto auto auto auto auto auto minmax(0, 1fr);
  background: rgba(251, 250, 245, 0.98);
}

.readout-shell:has(.comparison-panel:not([hidden])) {
  overflow-y: auto;
  grid-template-rows: auto auto auto auto auto auto auto minmax(220px, auto);
  scrollbar-gutter: auto;
  overscroll-behavior: contain;
}

.readout-shell:has(.comparison-panel:not([hidden])) .readout-toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
}

.readout-toolbar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--ink);
  color: #fff;
}

.readout-toolbar .eyebrow {
  margin-bottom: 2px;
  color: #9fb0b5;
}

.readout-toolbar h2 {
  color: #fff;
  font-size: 1.05rem;
  line-height: 1.15;
}

.readout-toolbar .ghost-button,
.readout-toolbar .panel-toggle {
  min-height: 32px;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.readout-toolbar .ghost-button:hover,
.readout-toolbar .panel-toggle:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.share-status {
  grid-column: 1 / -1;
  margin: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #eef4f1;
  padding: 7px 9px;
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.35;
}

.readout-boundary {
  grid-column: 1 / -1;
  margin: 0;
  color: #d5e0e2;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.share-status.good {
  box-shadow: inset 3px 0 0 var(--lime);
}

.share-status.warn {
  box-shadow: inset 3px 0 0 var(--orange);
}

.share-status[hidden] {
  display: none;
}

.ghost-button.compact {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 0.7rem;
}

.readout-state {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #eef4eb;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.4;
}

.readout-state strong {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.25;
}

.readout-state span {
  min-width: 0;
  color: var(--muted-strong);
  font-family: var(--sans);
  overflow-wrap: anywhere;
}

.readout-head {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 13px;
  padding: 14px 16px 12px;
  border-bottom: 0;
  background: var(--panel);
}

.layer-panel {
  min-width: 0;
  order: -1;
}

.layer-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.layer-topline .control-label {
  margin: 0;
}

.layer-note {
  min-width: 0;
  color: var(--muted-strong);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.layer-values {
  display: grid;
  grid-template-columns: 30px 1fr 30px;
  align-items: center;
  gap: 7px;
  color: var(--muted-strong);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.layer-values > span:last-child {
  text-align: right;
}

.layer-strip {
  position: relative;
  height: 38px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #e7eae4;
  cursor: col-resize;
  touch-action: pan-y;
  user-select: none;
}

.layer-strip.dragging,
.inspector-layer-strip.dragging {
  border-color: var(--ink);
  cursor: ew-resize;
  box-shadow: inset 0 0 0 2px rgba(238, 255, 65, 0.72);
}

.layer-bars {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--layer-count, 64), minmax(1px, 1fr));
  gap: 1px;
  padding: 4px;
}

.layer-bar {
  min-width: 2px;
  border: 0;
  border-radius: 2px;
  background: rgba(20, 33, 38, 0.11);
  padding: 0;
  font-size: 0;
  transition: background-color 120ms ease, transform 120ms ease;
}

.layer-bar.in-window {
  background: rgba(0, 143, 136, 0.52);
}

.layer-bar.current {
  background: var(--ink);
  transform: scaleY(1.08);
}

.layer-bar.output-layer {
  background-image: repeating-linear-gradient(-45deg, rgba(216, 95, 50, 0.85) 0 3px, rgba(216, 95, 50, 0.38) 3px 6px);
}

.layer-bar.output-layer.current {
  background: var(--orange);
}

.layer-ruler {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
}

.layer-ruler span:nth-child(2) {
  text-align: center;
}

.layer-ruler span:last-child {
  text-align: right;
}

.layer-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 7px;
  color: var(--muted-strong);
  font-size: 0.68rem;
  font-weight: 650;
}

.layer-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.layer-legend i {
  width: 11px;
  height: 7px;
  display: inline-block;
  border-radius: 2px;
  background: var(--blue);
}

.layer-legend .output-row-swatch {
  background: repeating-linear-gradient(-45deg, var(--orange) 0 3px, #efb09a 3px 5px);
}

.range-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}

.range-control {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  padding: 6px 8px;
}

.range-control span {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted-strong);
  font-size: 0.66rem;
  font-weight: 750;
  text-transform: uppercase;
}

.range-control output {
  color: var(--ink);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.range-control input {
  width: 100%;
  accent-color: var(--blue);
}

.mode-stack {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(200px, 1fr);
  align-items: center;
  gap: 6px 10px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.mode-stack > .control-label {
  margin: 0;
}

.segmented {
  min-height: 34px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 7px;
}

.segmented button {
  border: 0;
  border-right: 1px solid var(--ink);
  background: var(--panel-strong);
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: none;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--ink);
  color: #fff;
}

.segmented button:disabled {
  background: #eceee9;
  color: #788589;
}

.mode-status {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.artifact-alert {
  grid-column: 1 / -1;
  margin: 0;
  border-radius: 7px;
  font-size: 0.68rem;
}

.model-card {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  padding: 0;
}

.model-card summary {
  padding: 7px 9px;
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 750;
}

.model-card-body {
  padding: 0 9px 9px;
}

.model-card strong {
  margin-bottom: 7px;
  font-family: var(--mono);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.model-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 7px;
}

.model-facts span {
  border-color: var(--line);
  border-radius: 5px;
  color: var(--ink-soft);
  padding: 3px 5px;
  font-size: 0.66rem;
  white-space: normal;
}

.model-card p {
  color: var(--muted-strong);
  font-size: 0.7rem;
  line-height: 1.4;
}

.play-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.play-row .ghost-button {
  min-height: 32px;
  border-color: var(--ink);
  background: var(--panel-strong);
  font-size: 0.7rem;
}

.play-row .ghost-button:hover {
  background: var(--ink);
  color: #fff;
}

.layer-range {
  width: 100%;
  accent-color: var(--orange);
}

/* Guided probe context */

.probe-guide {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(160px, 1.35fr) minmax(130px, 1fr);
  gap: 10px 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #f7f7f1;
}

.probe-guide-copy {
  grid-row: 1 / span 2;
  min-width: 0;
}

.probe-guide.generic {
  grid-template-columns: 1fr;
}

.probe-guide.generic .probe-guide-copy {
  grid-row: auto;
}

.probe-guide.generic .guide-group {
  display: none;
}

.probe-guide h3 {
  font-size: 0.86rem;
  line-height: 1.2;
}

.probe-guide p {
  margin: 4px 0 0;
  color: var(--muted-strong);
  font-size: 0.7rem;
  line-height: 1.42;
  text-wrap: pretty;
}

.guide-status {
  grid-column: 1 / -1;
  margin: 0;
  border-left: 3px solid var(--orange);
  color: var(--muted-strong);
  padding-left: 8px;
  font-size: 0.75rem;
  line-height: 1.4;
}

.guide-status[hidden] {
  display: none;
}

.guide-group {
  min-width: 0;
}

.guide-label {
  margin-bottom: 4px;
  font-size: 0.75rem;
}

.guide-chips,
.guide-pairs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.guide-chip,
.pair-term,
.compare-pair {
  min-height: 25px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--ink-soft);
  padding: 4px 7px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
}

.guide-chip:hover,
.pair-term:hover,
.compare-pair:hover:not(:disabled) {
  border-color: var(--blue);
  background: rgba(0, 143, 136, 0.08);
  color: var(--blue-dark);
}

.guide-pair {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.compare-pair {
  min-height: 25px;
  margin-left: 2px;
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
  padding-left: 8px;
  padding-right: 8px;
}

.compare-pair.active {
  border-color: var(--orange-dark);
  background: var(--orange-dark);
  color: #fff;
}

.compare-pair:disabled {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--muted);
}

/* Focused contrast */

.comparison-panel {
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: #f4f2e9;
  padding: 12px 16px 14px;
}

.comparison-panel[hidden] {
  display: none !important;
}

.comparison-head {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.comparison-head h3 {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comparison-head p {
  max-width: 78ch;
  margin: 4px 0 0;
  color: var(--muted-strong);
  font-size: 0.82rem;
  line-height: 1.4;
}

.icon-button.comparison-close {
  position: static;
  width: 30px;
  height: 30px;
  border-color: var(--line-strong);
  background: var(--panel-strong);
  color: var(--ink);
}

.icon-button.comparison-close:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.comparison-legend {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 750;
}

.comparison-key {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comparison-key i {
  width: 14px;
  height: 3px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--orange);
}

.comparison-key.right i {
  background: var(--blue);
}

.comparison-key strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.comparison-layer {
  margin-left: auto;
  color: var(--muted-strong);
}

.comparison-chart {
  min-width: 0;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 5px;
}

.comparison-chart svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.comparison-grid line {
  stroke: rgba(20, 33, 38, 0.12);
  stroke-width: 1;
}

.comparison-grid text,
.comparison-x-label,
.comparison-current-label {
  fill: #68777b;
  font-family: var(--mono);
  font-size: 10px;
}

.comparison-current {
  stroke: var(--ink);
  stroke-dasharray: 3 4;
  stroke-width: 1.5;
}

.comparison-line {
  fill: none;
  stroke: var(--orange);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3.5;
  vector-effect: non-scaling-stroke;
}

.comparison-line.right {
  stroke: var(--blue);
}

.comparison-point {
  fill: var(--panel-strong);
  stroke: var(--orange);
  stroke-width: 3;
}

.comparison-point.right {
  stroke: var(--blue);
}

.comparison-output-band {
  fill: rgba(216, 95, 50, 0.1);
}

.comparison-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}

.comparison-stat {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  border-left: 3px solid var(--orange);
  background: rgba(255, 255, 255, 0.64);
  padding: 7px 8px;
}

.comparison-stat.right {
  border-left-color: var(--blue);
}

.comparison-stat span {
  overflow: hidden;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comparison-stat strong {
  grid-row: 1 / span 2;
  grid-column: 2;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.comparison-stat small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.comparison-summary > p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.35;
}

/* Search + data table */

.readout-tools {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}

.searchbox {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-strong);
}

.searchbox input {
  min-width: 0;
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  padding: 7px 9px;
  font-size: 0.74rem;
  font-weight: 650;
}

.searchbox input::placeholder {
  color: var(--muted);
}

.readout-table {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 0 14px max(14px, env(safe-area-inset-bottom));
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  background: var(--panel-strong);
}

.readout-data-table,
.inspector-data-table {
  width: 100%;
  display: block;
  border: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.readout-data-table thead,
.readout-data-table tbody,
.inspector-data-table thead,
.inspector-data-table tbody {
  width: 100%;
  display: block;
}

.readout-data-table th,
.readout-data-table td,
.inspector-data-table th,
.inspector-data-table td {
  min-width: 0;
  padding: 0;
  border: 0;
  text-align: left;
}

.readout-data-table .count,
.readout-data-table .layer-value,
.inspector-data-table .count {
  text-align: right;
}

.spark-cell {
  min-width: 0;
}

.spark-cell .spark {
  width: 100%;
}

#readoutRows > tr:not(.readout-row),
#inspectorRows > tr:not(.inspector-row),
#readoutRows > tr:not(.readout-row) > td,
#inspectorRows > tr:not(.inspector-row) > td {
  width: 100%;
  display: block;
}

.table-head,
.readout-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 22px minmax(120px, 1.15fr) 82px 72px minmax(126px, 1fr);
  gap: 8px;
  align-items: center;
}

.table-head {
  position: static;
  z-index: 5;
  min-height: 38px;
  padding: 7px 6px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--muted-strong);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 750;
  line-height: 1.2;
  text-transform: uppercase;
}

.table-head .layer-value,
.table-head th:nth-child(5) {
  border-left: 1px solid var(--line);
  padding-left: 7px;
}

.readout-data-table thead {
  position: sticky;
  z-index: 6;
  top: 0;
  background: rgba(255, 255, 255, 0.96);
}

.readout-row {
  min-height: 46px;
  margin: 0;
  padding: 5px 6px;
  border: 0;
  border-bottom: 1px solid #e3e5df;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: auto 46px;
}

.readout-row:nth-child(odd) {
  background: #fafaf6;
}

.readout-row:hover,
.readout-row:focus-visible,
.readout-row.inspecting {
  border-color: transparent;
  background: #edf6f3;
  box-shadow: inset 3px 0 0 var(--blue);
}

.readout-row.active {
  border-color: transparent;
  background: #eff7c6;
  box-shadow: inset 3px 0 0 var(--ink);
}

.readout-row.related {
  border-color: transparent;
  background: #fff1e7;
  box-shadow: inset 3px 0 0 var(--orange);
}

.check {
  position: relative;
  width: 22px;
  height: 32px;
  margin: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  padding: 0;
}

.check::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}

.check:hover::before {
  border-color: var(--blue);
}

.readout-row.active .check,
.inspector-row.active .check {
  border: 0;
  background: transparent;
}

.readout-row.active .check::before,
.inspector-row.active .check::before {
  border: 3px solid var(--ink);
  background: var(--lime);
}

.token-name {
  min-width: 0;
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.token-name small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.64rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count,
.layer-value {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
}

.spark {
  height: 25px;
  display: grid;
  grid-template-columns: repeat(var(--layer-count, 64), minmax(1px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f0f2ed;
  cursor: col-resize;
  touch-action: pan-y;
}

.spark span {
  min-width: 0;
  background: rgba(20, 33, 38, 0.08);
  cursor: inherit;
}

.spark span.current {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

.layer-bar.preview,
.inspector-layer-bars span.preview,
.spark span.preview {
  position: relative;
  z-index: 2;
  outline: 2px dashed var(--orange);
  outline-offset: -2px;
}

.layer-strip.previewing,
.inspector-layer-strip.previewing,
.spark.previewing {
  cursor: col-resize;
}

.spark span.output-layer {
  box-shadow: inset -2px 0 0 var(--orange);
}

.spark.diff span.pos {
  background: rgba(0, 143, 136, var(--a));
}

.spark.diff span.neg {
  background: rgba(216, 95, 50, var(--a));
}

.spark.unavailable {
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  cursor: default;
}

.spark.unavailable small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.readout-empty,
.readout-note,
.measure-note,
.metric-notes {
  margin: 10px 0;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted-strong);
  padding: 11px;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.4;
}

.measure-note {
  border-style: solid;
  border-left: 4px solid var(--blue);
}

.metric-notes {
  border-style: solid;
}

.ghost-button:disabled,
.all-layers-button:disabled,
.play-row button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.metric-notes summary {
  color: var(--ink-soft);
  cursor: pointer;
  font-weight: 750;
}

.metric-notes p {
  margin: 8px 0 0;
}

/* Collapsed desktop rail */

@media (min-width: 1051px) {
  body.readout-collapsed .workspace {
    grid-template-columns: minmax(0, 1fr) 52px;
  }

  body.readout-collapsed .readout-shell {
    z-index: 120;
    min-width: 52px;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 8px 0;
  }

  body.readout-collapsed .readout-head,
  body.readout-collapsed .play-row,
  body.readout-collapsed .readout-state,
  body.readout-collapsed .probe-guide,
  body.readout-collapsed .comparison-panel,
  body.readout-collapsed .readout-tools,
  body.readout-collapsed .readout-table,
  body.readout-collapsed .readout-toolbar > div,
  body.readout-collapsed .copy-link,
  body.readout-collapsed .readout-boundary {
    display: none;
  }

  body.readout-collapsed .readout-toolbar {
    display: block;
    border: 0;
    padding: 0;
    background: transparent;
  }

  body.readout-collapsed .readout-collapse {
    min-height: 170px;
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
  }

  body.readout-collapsed .readout-collapse:hover {
    border-color: var(--blue-dark);
    background: var(--blue-dark);
    color: #fff;
  }
}

/* Tooltip */

.tooltip {
  z-index: 300;
  width: min(320px, calc(100vw - 24px));
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 18px 44px rgba(20, 33, 38, 0.25);
  padding: 12px;
  pointer-events: none;
}

.tooltip h3 {
  color: #fff;
}

.tooltip p,
.tooltip-row {
  color: #c9d3d6;
}

.mini-bar {
  background: rgba(255, 255, 255, 0.16);
}

.mini-bar span {
  background: var(--lime);
}

/* Exact-token inspector */

.inspector-backdrop {
  z-index: 250;
}

.token-inspector {
  z-index: 260;
  width: min(var(--inspector-width, 720px), calc(100vw - 28px));
  min-width: min(440px, calc(100vw - 28px));
  min-height: 330px;
  max-height: min(74dvh, 720px);
  overflow: hidden;
  overscroll-behavior: contain;
  border: 1px solid var(--ink);
  border-radius: 13px;
  background: var(--panel-strong);
  box-shadow: 0 28px 80px rgba(20, 33, 38, 0.3);
}

.inspector-head {
  min-height: 56px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  background: var(--ink);
  color: #fff;
}

.inspector-chip {
  max-width: 240px;
  border-radius: 6px;
  background: var(--lime);
  color: var(--ink);
  font-size: 0.78rem;
}

.inspector-position,
.inspector-space {
  color: #d2dcde;
  font-size: 0.72rem;
}

.inspector-space {
  font-family: var(--mono);
}

.icon-button {
  border-color: rgba(255, 255, 255, 0.3);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.icon-button:hover {
  border-color: var(--lime);
  color: var(--lime);
}

.inspector-controls {
  grid-template-columns: 142px 1fr;
  gap: 13px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.all-layers-button {
  min-height: 48px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 0.68rem;
  line-height: 1.2;
  text-transform: none;
}

.all-layers-button.active {
  border-color: var(--ink);
  background: var(--lime);
  color: var(--ink);
}

.inspector-copy {
  color: var(--muted-strong);
  font-size: 0.74rem;
}

.inspector-layer-strip {
  height: 39px;
  border-color: var(--line-strong);
  border-radius: 7px;
  background: #e7eae4;
  touch-action: pan-y;
}

.inspector-layer-bars span {
  min-width: 2px;
  display: block;
  border-radius: 2px;
  background: rgba(20, 33, 38, 0.08);
}

.inspector-layer-bars span.in-window {
  background: rgba(0, 143, 136, 0.36);
}

.inspector-layer-bars span.current {
  background: var(--ink);
}

.inspector-layer-bars span.output-layer {
  background-image: repeating-linear-gradient(-45deg, var(--orange) 0 3px, #efb09a 3px 5px);
}

.inspector-ruler {
  color: var(--muted);
  font-size: 0.68rem;
}

.inspector-warning {
  min-height: 28px;
  margin: 8px 18px 0;
  border-radius: 7px;
  font-size: 0.8rem;
}

.inspector-table {
  padding: 12px 18px max(18px, env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

.inspector-data-table {
  min-width: 0;
}

.inspector-table-head,
.inspector-row {
  grid-template-columns: 20px minmax(120px, 1.1fr) 78px minmax(160px, 1.25fr);
  gap: 9px;
}

.inspector-table-head {
  color: var(--muted-strong);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.inspector-row {
  min-height: 42px;
  border-bottom: 1px solid #e3e5df;
  border-radius: 0;
  content-visibility: auto;
}

.inspector-row:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: -3px;
}

.inspector-row.active {
  background: #eff7c6;
  box-shadow: inset 3px 0 0 var(--ink);
}

/* Responsive behavior: never stack two full desktop applications. */

@media (min-width: 1051px) {
  .app {
    height: 100dvh;
    overflow: hidden;
  }

  .workspace {
    height: 100%;
    overflow: hidden;
  }

  .conversation-shell,
  .readout-shell {
    height: 100%;
  }
}

@media (max-width: 1320px) and (min-width: 1051px) {
  .workspace {
    grid-template-columns: minmax(500px, 1.06fr) minmax(470px, 0.94fr);
  }

  .artifact-context {
    display: none;
  }

  .bar {
    grid-template-columns: minmax(240px, 1fr) auto;
  }

  .secondary-nav:nth-of-type(1) {
    display: none;
  }

  .workflow-hint {
    display: none;
  }

  .table-head,
  .readout-row {
    grid-template-columns: 20px minmax(108px, 1fr) 72px 62px minmax(105px, 0.9fr);
    gap: 6px;
  }
}

@media (max-height: 1000px) and (min-width: 1051px) {
  .conversation-heading {
    padding-top: 14px;
    padding-bottom: 11px;
  }

  .trace-list {
    min-height: 72px;
    padding-top: 7px;
    padding-bottom: 8px;
  }

  .trace-card {
    min-height: 54px;
  }

  .readout-head {
    grid-template-columns: minmax(0, 1.35fr) minmax(170px, 0.8fr);
    align-items: start;
    gap: 9px;
    padding-top: 8px;
    padding-bottom: 7px;
  }

  .mode-stack {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    padding-top: 0;
  }

  .readout-state {
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .readout-state span {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .layer-strip {
    height: 34px;
  }

  .play-row {
    padding-bottom: 7px;
  }

  .probe-guide {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .probe-guide-copy p {
    display: block;
  }

  .readout-tools {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .readout-shell {
    overflow-y: auto;
    grid-template-rows: auto auto auto auto auto auto minmax(180px, 1fr);
    scrollbar-gutter: auto;
    overscroll-behavior: contain;
  }

  .readout-shell > .readout-toolbar {
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .readout-shell:has(.comparison-panel:not([hidden])) {
    overflow-y: auto;
    grid-template-rows: auto auto auto auto auto auto auto minmax(180px, auto);
  }

  .readout-table {
    min-height: 180px;
    height: auto;
  }
}

@media (max-width: 1050px) {
  .inspector-backdrop.visible {
    display: block;
    background: rgba(20, 33, 38, 0.42);
    pointer-events: auto;
  }

  .readout-focus-badge:not([hidden]) {
    min-height: 44px;
    display: inline-flex;
    grid-column: 1 / -1;
    justify-self: start;
  }

  .app {
    height: 100dvh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .bar {
    min-height: 62px;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 12px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .artifact-load-panel {
    inset: 62px 0 0;
    padding: 18px;
  }

  .synthetic-demo-banner {
    position: relative;
    inset: auto;
    flex: 0 0 auto;
    max-width: none;
    margin: 8px 10px 0;
  }

  .artifact-context {
    display: none;
  }

  .secondary-nav {
    display: none !important;
  }

  .mobile-view-tabs {
    position: relative;
    z-index: 150;
    flex: 0 0 auto;
    min-height: 104px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--line);
    background: rgba(235, 236, 231, 0.96);
  }

  .mobile-readout-boundary {
    border-left: 3px solid var(--blue);
    background: var(--panel-strong);
    color: var(--muted-strong);
    padding: 5px 8px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.35;
  }

  body.mobile-view-readout .mobile-readout-boundary {
    display: none;
  }

  .mobile-workspace-switch,
  .mobile-site-nav {
    min-width: 0;
    display: grid;
    gap: 4px;
  }

  .mobile-workspace-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-site-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .mobile-view-tabs button,
  .mobile-view-tabs a {
    min-width: 0;
    min-height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: var(--panel-strong);
    color: var(--muted-strong);
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
  }

  .mobile-view-tabs button.active {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
  }

  .mobile-site-nav a[aria-current="page"] {
    border-color: var(--ink);
    background: var(--lime);
    color: var(--ink);
    box-shadow: inset 0 -3px 0 var(--ink);
  }

  .workspace {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    display: block;
    overflow: hidden;
    padding: 9px;
  }

  .conversation-shell,
  .readout-shell {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .readout-shell {
    display: none;
  }

  body.mobile-view-readout .conversation-shell {
    display: none;
  }

  body.mobile-view-readout .readout-shell {
    display: grid;
    overflow-y: auto;
    grid-template-rows: repeat(8, auto);
    scrollbar-gutter: auto;
    overscroll-behavior: contain;
  }

  body.mobile-view-readout .readout-table {
    min-height: 180px;
    height: max-content;
    overflow: visible;
  }

  .readout-collapse {
    display: none;
  }

  .conversation-heading {
    padding: 15px 17px 12px;
  }

  .workflow-hint {
    display: none;
  }

  .mobile-token-hint {
    display: block;
    margin: 0;
    border-left: 3px solid var(--blue);
    background: var(--panel-soft);
    color: var(--muted-strong);
    padding: 7px 9px;
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.35;
  }

  .messages {
    padding: 14px 16px 22px;
  }

  .readout-table {
    min-height: 120px;
  }
}

@media (max-width: 640px) {
  .bar {
    min-height: 58px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding-left: max(11px, env(safe-area-inset-left));
    padding-right: max(11px, env(safe-area-inset-right));
  }

  .mark {
    width: 34px;
    height: 34px;
  }

  .brand-copy strong {
    font-size: 0.84rem;
  }

  .brand-copy span {
    display: none;
  }

  .bar-actions {
    gap: 5px;
  }

  .bar-actions .ghost-button {
    min-height: 44px;
    padding: 6px 9px;
    font-size: 0.68rem;
  }

  #resetButton {
    display: inline-flex;
  }

  .mobile-view-tabs {
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }

  .workspace {
    padding: 7px;
  }

  .conversation-shell,
  .readout-shell {
    border-radius: 11px;
  }

  .conversation-heading {
    padding: 13px 14px 11px;
  }

  .conversation-heading h1 {
    font-size: 1.12rem;
  }

  .conversation-heading p {
    font-size: 0.74rem;
  }

  .trace-head {
    min-height: 72px;
    align-items: flex-start;
    flex-direction: row;
    padding: 7px 92px 7px 9px;
  }

  .trace-title {
    width: auto;
    flex: 1;
    overflow: visible;
    flex-wrap: wrap;
    row-gap: 5px;
  }

  .trace-title .panel-toggle {
    min-height: 44px;
  }

  .text-size-controls {
    flex: 0 0 auto;
  }

  .text-size-controls button {
    min-width: 44px;
    min-height: 44px;
  }

  .trace-title > span:first-child,
  .trace-actions {
    display: none;
  }

  #traceCollapseButton {
    display: inline-flex;
  }

  .trace-list {
    min-height: 76px;
    padding: 8px 9px;
  }

  .trace-card {
    flex-basis: 148px;
    min-height: 58px;
    padding: 8px 9px;
  }

  .trace-card strong {
    font-size: 0.72rem;
  }

  .messages {
    gap: 10px;
    padding: 12px 13px 18px;
  }

  .message {
    border-radius: 9px;
    padding: 13px 14px 15px;
  }

  .role-marker {
    display: none;
  }

  .text-flow,
  body.text-scale-small .text-flow,
  body.text-scale-large .text-flow {
    font-size: 1rem;
    line-height: 1.58;
  }

  body.text-scale-small .text-flow {
    font-size: 0.92rem;
  }

  body.text-scale-large .text-flow {
    font-size: 1.12rem;
  }

  .readout-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px 13px;
  }

  .copy-link {
    font-size: 0.64rem;
  }

  .readout-state,
  .readout-head,
  .probe-guide,
  .readout-tools {
    padding-left: 13px;
    padding-right: 13px;
  }

  .readout-state span {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .mode-status {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .readout-head {
    gap: 9px;
    padding-top: 8px;
    padding-bottom: 7px;
  }

  .range-controls {
    display: grid;
  }

  .layer-ruler {
    display: grid;
  }

  .layer-legend {
    display: flex;
    margin-top: 5px;
  }

  .mode-stack {
    padding-top: 8px;
  }

  .play-row {
    padding: 0 13px 10px;
  }

  .play-row .ghost-button,
  .copy-link {
    min-height: 40px;
  }

  .probe-guide {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .probe-guide-copy {
    grid-row: auto;
  }

  .guide-group {
    display: block;
  }

  .probe-guide-copy p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .guide-chips,
  .guide-pairs {
    flex-wrap: nowrap;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .guide-pair {
    max-width: none;
    flex: 0 0 auto;
  }

  .guide-pair .pair-term,
  .guide-pair > span {
    display: none;
  }

  .guide-chip,
  .pair-term,
  .compare-pair {
    min-height: 44px;
  }

  .trace-scroll {
    width: 44px;
    height: 44px;
  }

  .trace-scroll-prev {
    right: 58px;
  }

  .guide-pair .compare-pair {
    margin-left: 0;
    font-size: 0;
  }

  .guide-pair .compare-pair::before {
    content: attr(data-pair-label);
    font-size: 0.62rem;
  }

  .comparison-panel {
    padding: 11px 13px 13px;
  }

  .comparison-chart {
    overflow: hidden;
  }

  .comparison-chart svg {
    min-width: 0;
  }

  .comparison-grid text,
  .comparison-x-label,
  .comparison-current-label {
    font-size: 15px;
  }

  .readout-tools {
    grid-template-columns: 1fr;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .readout-tools > .layer-note {
    display: none;
  }

  .readout-table {
    padding-left: 9px;
    padding-right: 9px;
  }

  .table-head {
    grid-template-columns: 18px minmax(0, 1fr) 54px 58px;
    grid-template-areas:
      "check name count value"
      ". profile profile profile";
    gap: 6px;
  }

  .table-head th:nth-child(1) { grid-area: check; }
  .table-head th:nth-child(2) { grid-area: name; }
  .table-head .count { grid-area: count; }
  .table-head .layer-value {
    grid-area: value;
    display: block;
  }
  .table-head th:nth-child(5) {
    grid-area: profile;
    display: block;
    text-align: right;
  }

  .readout-row {
    grid-template-columns: 18px minmax(0, 1fr) 54px 58px;
    grid-template-areas:
      "check name count value"
      ". spark spark spark";
    gap: 5px 6px;
    padding: 7px 5px;
  }

  .readout-row .check {
    grid-area: check;
  }

  .readout-row .token-name {
    grid-area: name;
  }

  .readout-row .count {
    grid-area: count;
  }

  .readout-row .layer-value {
    display: block;
    grid-area: value;
  }

  .readout-row .spark-cell {
    grid-area: spark;
  }

  .readout-row .spark {
    height: 20px;
  }

  .token-inspector {
    left: max(7px, env(safe-area-inset-left)) !important;
    right: max(7px, env(safe-area-inset-right));
    bottom: max(7px, env(safe-area-inset-bottom)) !important;
    top: auto !important;
    width: auto;
    min-width: 0;
    max-width: none;
    max-height: 78dvh;
    border-radius: 13px;
    resize: none;
    transform: none !important;
  }

  .inspector-head {
    grid-template-columns: 1fr auto;
    padding: 9px 11px;
  }

  .inspector-title {
    padding: 0;
  }

  .inspector-space {
    display: none;
  }

  .inspector-close {
    margin: 0;
  }

  .inspector-controls {
    grid-template-columns: 1fr;
    padding: 11px 13px;
  }

  .all-layers-button {
    min-height: 36px;
  }

  .inspector-warning {
    margin-left: 13px;
    margin-right: 13px;
  }

  .inspector-table {
    padding: 10px 13px max(14px, env(safe-area-inset-bottom));
  }

  .inspector-table-head,
  .inspector-row {
    grid-template-columns: 18px minmax(0, 1fr) 64px;
    grid-template-areas:
      "check name rank"
      ". profile profile";
    gap: 7px;
  }

  .inspector-table-head th:nth-child(1),
  .inspector-row td:nth-child(1) {
    grid-area: check;
  }

  .inspector-table-head th:nth-child(2),
  .inspector-row td:nth-child(2) {
    grid-area: name;
  }

  .inspector-table-head th:nth-child(3),
  .inspector-row td:nth-child(3) {
    grid-area: rank;
  }

  .inspector-table-head th:nth-child(4),
  .inspector-row .spark-cell {
    grid-area: profile;
    display: block;
  }

  .inspector-table-head th:nth-child(4) {
    padding-top: 3px;
    text-align: right;
  }

  .inspector-row .spark {
    height: 20px;
    display: grid;
  }
}

@media (max-width: 1050px) and (max-height: 700px) and (min-width: 641px) {
  .readout-state {
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .readout-state span {
    display: block;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .readout-head {
    grid-template-columns: minmax(0, 1.25fr) minmax(210px, 0.8fr);
    align-items: start;
    gap: 8px 12px;
    padding-top: 7px;
    padding-bottom: 6px;
  }

  .range-controls {
    display: grid;
  }

  .layer-ruler {
    display: grid;
  }

  .layer-panel {
    order: -1;
  }

  .mode-stack {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    padding-top: 0;
  }

  .mode-status {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .play-row {
    padding-bottom: 6px;
  }

  .probe-guide {
    grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
    gap: 6px 10px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .probe-guide-copy {
    grid-row: auto;
  }

  .probe-guide-copy p {
    display: block;
  }

  .guide-chips,
  .guide-pairs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .guide-pair {
    flex: 0 0 auto;
  }

  .guide-pair .pair-term,
  .guide-pair > span {
    display: none;
  }

  .guide-pair .compare-pair {
    margin-left: 0;
    font-size: 0;
  }

  .guide-pair .compare-pair::before {
    content: attr(data-pair-label);
    font-size: 0.62rem;
  }

  .readout-tools {
    padding-top: 6px;
    padding-bottom: 6px;
  }
}

@media (max-width: 640px) and (max-height: 700px) {
  .readout-state {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .readout-state span { display: block; }

  .mode-status,
  .probe-guide-copy p {
    display: block;
  }

  .readout-head {
    gap: 5px;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .mode-stack {
    padding-top: 3px;
  }

  .layer-strip {
    height: 32px;
  }

  .play-row {
    padding-bottom: 6px;
  }

  .probe-guide {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .guide-label {
    display: none;
  }

  .readout-tools {
    padding-top: 5px;
    padding-bottom: 5px;
  }
}

@media (max-width: 640px) {
  .full-action-label {
    display: none;
  }

  .compact-action-label {
    display: inline;
  }

  .synthetic-demo-banner {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
  }

  .synthetic-demo-banner button {
    align-self: flex-start;
  }

  .brand {
    min-height: 44px;
  }

  button.token {
    padding: 5px 1px;
    touch-action: manipulation;
  }

  button.token.whitespace-token {
    padding: 5px 1px;
  }

  .readout-toolbar .ghost-button,
  .readout-toolbar .panel-toggle,
  .segmented,
  .segmented button,
  .range-control input,
  .layer-range,
  .play-row .ghost-button,
  .copy-link {
    min-height: 44px;
  }

  .layer-strip {
    height: 44px;
  }
}

@media (max-width: 360px) {
  .bar {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 6px;
  }

  .brand {
    width: 82px;
    gap: 6px;
  }

  .brand .brand-copy {
    display: none;
  }

  .brand .compact-brand-copy {
    width: 40px;
    display: block;
    margin-top: 0;
    color: #fff;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    line-height: 1.05;
    text-transform: uppercase;
  }

  .bar-actions .ghost-button {
    min-width: 0;
    padding-left: 7px;
    padding-right: 7px;
  }
}

@media (max-width: 1050px) and (max-height: 500px) {
  .app {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .workspace {
    flex: 0 0 360px;
    height: 360px;
    min-height: 360px;
  }
}

@media (max-width: 640px) and (max-height: 500px) {
  .synthetic-demo-banner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .bar-actions,
  .mobile-view-tabs,
  .panel-toggle,
  .play-row,
  .copy-link {
    display: none !important;
  }

  .app,
  .workspace {
    height: auto;
    overflow: visible;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .conversation-shell,
  .readout-shell {
    box-shadow: none;
    break-inside: avoid;
  }
}
