/* ═══════════════════════════════════════════════════════════════════
   promptlibretto ensemble — "Compositing Room" theme
   Aligned with templatebuilder palette. Two voices, one stage.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --bg:           #0b0907;
  --panel:        #131008;
  --panel2:       #1a1510;
  --panel3:       #221c14;
  --border:       #2d2820;
  --border2:      #362e22;
  --border-subtle:#1e1912;
  --text:         #eee8de;
  --dim:          #c0b49f;
  --muted:        #7a6e5e;
  --muted-soft:   #524a3c;
  --accent:       #c98b40;
  --accent-glow:  rgba(201, 139, 64, 0.12);
  --accent2:      #8db0cc;
  --accent2-glow: rgba(141, 176, 204, 0.12);
  --rose:         #c06060;
  --warn:         #d4a84c;
  --mono: 'IBM Plex Mono', Consolas, monospace;
  --sans: 'Manrope', 'Segoe UI', sans-serif;
  --display: 'Crimson Pro', Georgia, serif;
  --noise: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background:
    radial-gradient(circle at top right, rgba(141, 176, 204, 0.05), transparent 28%),
    radial-gradient(circle at top left,  rgba(201, 139, 64,  0.05), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--noise);
  background-repeat: repeat;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.35;
}

button { font-family: inherit; cursor: pointer; }

* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 5px; height: 0; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* ── entrance animations ──────────────────────────────────── */

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes turnIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}
@keyframes stepPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 139, 64, 0.5); }
  50%      { box-shadow: 0 0 0 6px rgba(201, 139, 64, 0); }
}

/* ── header ──────────────────────────────────────────────── */

.header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 52px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent) 0%, rgba(201, 139, 64, 0.3) 45%, transparent 80%);
  opacity: 0.7;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header h1 {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.01em;
  color: var(--accent);
  margin: 0;
}

.header-page-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}

.header-page-link {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 160ms, background 160ms;
}
.header-page-link:hover:not(.active) {
  color: var(--dim);
  background: rgba(201, 139, 64, 0.06);
}
.header-page-link.active {
  color: var(--accent);
  background: var(--panel);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: default;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.panel-toggle {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 160ms, border-color 160ms, background 160ms;
}
.panel-toggle:hover {
  color: var(--text);
  border-color: rgba(201, 139, 64, 0.3);
  background: rgba(201, 139, 64, 0.04);
}

.conn-chip {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel2);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.conn-chip.missing { color: var(--rose); border-color: rgba(196, 96, 96, 0.3); }

/* ── overall layout ─────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: calc(100vh - 52px);
  overflow: hidden;
}
.main-row > * { min-width: 0; }

/* ── compact setup bar ──────────────────────────────────── */

.setup-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
  animation: fadeSlideUp 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#card-a {
  border-right: 1px solid var(--border);
}

.pcard {
  background: var(--panel);
  display: flex;
  flex-direction: column;
}

.pcard-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  user-select: none;
  font-size: 13px;
  border-left: 2px solid transparent;
  transition: background 0.15s;
}
.pcard-summary::-webkit-details-marker { display: none; }
.pcard-summary:hover { background: var(--panel2); }
#card-a .pcard-summary { border-left-color: var(--accent); }
#card-b .pcard-summary { border-left-color: var(--accent2); }

/* participant identity dots */
.pdot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pdot.a { background: var(--accent);  box-shadow: 0 0 6px rgba(201, 139, 64, 0.4); }
.pdot.b { background: var(--accent2); box-shadow: 0 0 6px rgba(141, 176, 204, 0.4); }

.pcard-title {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  font-style: italic;
}
.pcard-meta {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.02em;
}
.pcard-chips { display: flex; gap: 4px; }
.pcard-chip {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 3px;
  border: 1px solid var(--border2);
  color: var(--muted);
  background: var(--panel2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.pcard-chip.human  { color: var(--accent);  border-color: rgba(201, 139, 64, 0.35); background: rgba(201, 139, 64, 0.07); }
.pcard-chip.memory { color: var(--accent2); border-color: rgba(141, 176, 204, 0.35); background: rgba(141, 176, 204, 0.07); }

.pcard-spacer { flex: 1; }
.pcard-toggle {
  font-size: 10px;
  color: var(--muted-soft);
  transition: transform 0.18s ease;
}
.pcard[open] .pcard-toggle { transform: rotate(180deg); }

.pcard-body {
  padding: 10px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
  background: rgba(11, 9, 7, 0.45);
}

/* ── participant config fields ──────────────────────────── */

.pcard-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1.4fr;
  gap: 8px;
}
.pcard-row.pcard-toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.pfield {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.pfield > span {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
}

input[type="text"],
input[type="number"],
textarea,
select {
  background: rgba(16, 13, 10, 0.9);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 9px;
  outline: none;
  transition: border-color 140ms, box-shadow 140ms, background 140ms;
  width: 100%;
}
input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: rgba(201, 139, 64, 0.5);
  box-shadow: 0 0 0 3px rgba(201, 139, 64, 0.1);
  background: rgba(20, 16, 12, 0.95);
}
input[type="text"]:not(:placeholder-shown),
input[type="number"]:not(:placeholder-shown),
textarea:not(:placeholder-shown) {
  border-color: rgba(201, 139, 64, 0.28);
  background: rgba(18, 15, 11, 0.95);
}

select { cursor: pointer; }
select option { background: var(--panel); }

textarea {
  resize: vertical;
  min-height: 90px;
  max-height: 240px;
  line-height: 1.5;
  font-family: var(--mono);
}

.model-row { display: flex; gap: 5px; width: 100%; }
.model-row input { flex: 1; min-width: 0; }

.ghost {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 8px;
  transition: color 140ms, border-color 140ms;
  flex-shrink: 0;
}
.ghost:hover { color: var(--accent); border-color: rgba(201, 139, 64, 0.35); }

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: color 140ms;
}
.inline-toggle input[type="checkbox"] {
  margin: 0;
  accent-color: var(--accent);
}
.inline-toggle:hover { color: var(--dim); }

.btn-reset-store {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 5px;
  transition: color 140ms, border-color 140ms;
}
.btn-reset-store:hover { color: var(--rose); border-color: rgba(192, 96, 96, 0.4); }

.btn-view-store {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 5px;
  transition: color 140ms, border-color 140ms;
}
.btn-view-store:hover { color: var(--accent); border-color: rgba(201, 139, 64, 0.35); }
.btn-view-store + .btn-reset-store { margin-left: 0; }

/* ── collapsible tuning / json / tvars ──────────────────── */

.pcard-tuning,
.pcard-json,
.pcard-tvars-detail {
  font-size: 11px;
  margin-top: 2px;
}
.pcard-tuning > summary,
.pcard-json > summary,
.pcard-tvars-detail > summary {
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  user-select: none;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 140ms;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.pcard-tuning > summary::before,
.pcard-json > summary::before,
.pcard-tvars-detail > summary::before {
  content: '▶';
  font-size: 8px;
  color: var(--muted-soft);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.pcard-tuning[open] > summary::before,
.pcard-json[open] > summary::before,
.pcard-tvars-detail[open] > summary::before { transform: rotate(90deg); }
.pcard-tuning > summary::-webkit-details-marker,
.pcard-json > summary::-webkit-details-marker,
.pcard-tvars-detail > summary::-webkit-details-marker { display: none; }
.pcard-tuning > summary:hover,
.pcard-json > summary:hover,
.pcard-tvars-detail > summary:hover { color: var(--dim); }

.pcard-json[open] textarea { margin-top: 5px; }

.pcard-tuning-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  align-items: end;
  margin-top: 6px;
}
.pcard-tuning-grid input[type="number"] {
  width: 100%;
  background: rgba(16, 13, 10, 0.9);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 8px;
}
.pfield-toggle {
  align-self: end;
  padding-bottom: 6px;
}

.pcard-notes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pcard-notes-grid textarea {
  font-size: 11.5px;
  line-height: 1.45;
  min-height: 56px;
}


.pcard-tvars-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.pcard-tvar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.pcard-tvar-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pcard-tvar-sec {
  color: var(--muted-soft);
}
.pcard-tvar-input {
  width: 100%;
}

.muted { color: var(--muted); }
.small { font-size: 10px; }

/* ── three-column main row ──────────────────────────────── */

.main-row {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr minmax(300px, 380px);
  min-height: 0;
  overflow: hidden;
}
.main-row.hide-a { grid-template-columns: 0 1fr minmax(300px, 380px); }
.main-row.hide-b { grid-template-columns: minmax(300px, 380px) 1fr 0; }
.main-row.hide-a.hide-b { grid-template-columns: 0 1fr 0; }
.main-row.hide-a #side-a,
.main-row.hide-b #side-b { display: none; }

/* ── side panels ────────────────────────────────────────── */

.side-panel {
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
}
.side-panel-b {
  border-right: none;
  border-left: 1px solid var(--border);
}

.side-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel2);
  flex-shrink: 0;
}
.side-panel-title {
  font-family: var(--display);
  font-size: 14px;
  font-style: italic;
  font-weight: 600;
}
.side-panel-model {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-left: auto;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ── side panel tabs ────────────────────────────────────── */

.side-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--panel2);
  flex-shrink: 0;
}
.side-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 8px 0;
  transition: color 140ms, background 140ms, border-bottom-color 140ms;
}
.side-tab:last-child { border-right: none; }
.side-tab:hover { color: var(--dim); background: rgba(255, 255, 255, 0.02); }
.side-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(201, 139, 64, 0.04);
}
.side-panel-b .side-tab.active {
  color: var(--accent2);
  border-bottom-color: var(--accent2);
  background: rgba(141, 176, 204, 0.04);
}

.side-tab-pane[hidden] { display: none !important; }
.side-tab-pane[data-tab="thoughts"] {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.side-tab-pane[data-tab="trace"] {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 8px 12px;
  gap: 4px;
  overflow-y: auto;
}

.side-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.side-panel-body > .side-tab-pane { width: 100%; }

.side-panel-empty {
  padding: 24px 8px;
  text-align: center;
  color: var(--muted-soft);
  font-size: 11px;
  font-family: var(--mono);
  font-style: italic;
}

/* ── thoughts panes ─────────────────────────────────────── */

.thoughts-pane {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-bottom: 1px solid var(--border);
}
.thoughts-pane:last-child { border-bottom: none; }

.thoughts-pane-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 700;
  color: var(--muted);
  padding: 7px 12px 6px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.thoughts-self  .thoughts-pane-label { color: var(--accent); }
.thoughts-other .thoughts-pane-label { color: var(--accent2); }

.thoughts-pane-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.62;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--display);
}
.thoughts-pane-body .side-panel-empty {
  padding: 16px 4px;
  font-family: var(--mono);
  font-size: 11px;
}

/* Markdown in thoughts */
.thoughts-pane-body p { margin: 0 0 0.55em; }
.thoughts-pane-body p:last-child { margin-bottom: 0; }
.thoughts-pane-body strong { color: var(--text); font-weight: 700; }
.thoughts-pane-body em { color: var(--accent); font-style: italic; }
.thoughts-other .thoughts-pane-body em { color: var(--accent2); }
.thoughts-pane-body ul, .thoughts-pane-body ol { padding-left: 18px; margin: 0 0 0.55em; }
.thoughts-pane-body li { margin-bottom: 0.2em; }
.thoughts-pane-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 4px;
  border-radius: 3px;
}
.thoughts-pane-body h1,
.thoughts-pane-body h2,
.thoughts-pane-body h3 {
  font-family: var(--display);
  margin: 0 0 0.35em;
  font-size: 1em;
  color: var(--accent);
}
.thoughts-other .thoughts-pane-body h1,
.thoughts-other .thoughts-pane-body h2,
.thoughts-other .thoughts-pane-body h3 { color: var(--accent2); }

/* ── side panel sections / trace ────────────────────────── */

.side-section {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(11, 9, 7, 0.6);
  margin-bottom: 4px;
}
.side-section > summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  transition: color 140ms;
}
.side-section > summary::-webkit-details-marker { display: none; }
.side-section > summary:hover { color: var(--dim); }
.side-section[open] > summary {
  border-bottom: 1px solid var(--border);
  color: var(--dim);
}
.side-section-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-left: auto;
  text-transform: none;
  letter-spacing: 0;
}
.side-section-body {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
}
.opinion-prompt-ta {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.5;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 8px;
  resize: vertical;
}
.side-section-body pre {
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  max-height: 260px;
  overflow-y: auto;
  color: var(--muted);
  margin: 0;
}
.side-section-body .chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 6px;
  margin: 2px 2px 0 0;
  border-radius: 3px;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.side-chunk {
  font-size: 11px;
  padding: 4px 6px;
  margin-bottom: 3px;
  border-radius: 4px;
  background: var(--panel2);
  border: 1px solid var(--border);
}
.side-chunk-meta {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
  margin-bottom: 2px;
}

/* ── trace panel ────────────────────────────────────────── */

.trace-panel {
  margin-bottom: 6px;
  font-size: 12px;
}
.trace-panel > summary {
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  padding: 4px 8px;
  border: 1px dashed var(--border2);
  border-radius: 5px;
  user-select: none;
  font-size: 11px;
  transition: color 140ms, border-color 140ms;
}
.trace-panel > summary::-webkit-details-marker { display: none; }
.trace-panel > summary:hover { color: var(--dim); border-color: var(--accent); }
.trace-panel[open] > summary { border-style: solid; border-color: rgba(201, 139, 64, 0.4); color: var(--dim); }

.trace-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 5px 5px;
  background: rgba(11, 9, 7, 0.4);
}
.trace-line { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.trace-section-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 700;
}
.trace-rule {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--panel2);
  padding: 2px 6px;
  margin-bottom: 2px;
  border-radius: 3px;
}
.trace-chunk {
  background: var(--panel2);
  padding: 4px 6px;
  margin-bottom: 4px;
  border-radius: 3px;
  font-size: 12px;
}
.trace-prompt {
  font-family: var(--mono);
  font-size: 11px;
  white-space: pre-wrap;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 8px 10px;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  color: var(--muted);
}

/* ── conversation area ──────────────────────────────────── */

.conversation-area {
  overflow-y: auto;
  padding: 24px 28px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(201, 139, 64, 0.03), transparent 45%),
    radial-gradient(ellipse at 85% 0%, rgba(141, 176, 204, 0.03), transparent 45%),
    var(--bg);
}
.conversation-area::after {
  content: "";
  display: block;
  flex-shrink: 0;
  height: 32px;
}

/* seed / opening message display */
.seed-display {
  align-self: center;
  text-align: center;
  padding: 14px 24px;
  margin-bottom: 24px;
  border: 1px dashed rgba(201, 139, 64, 0.2);
  border-radius: 10px;
  color: var(--dim);
  font-size: 13px;
  line-height: 1.65;
  max-width: 58%;
  background: rgba(11, 9, 7, 0.6);
}
.seed-display .seed-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--muted);
  margin-bottom: 5px;
  font-family: var(--sans);
}

/* conversation turns */
.turn {
  display: flex;
  flex-direction: column;
  max-width: 70%;
  margin-bottom: 18px;
  animation: turnIn 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.turn.speaker-a { align-self: flex-start; }
.turn.speaker-b { align-self: flex-end; }

.turn-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 5px;
  font-family: var(--sans);
  display: flex;
  align-items: baseline;
  gap: 0;
}
.turn.speaker-a .turn-label { color: var(--accent);  padding-left: 6px; }
.turn.speaker-b .turn-label { color: var(--accent2); justify-content: flex-end; padding-right: 6px; }

.turn-bubble {
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.68;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
}
.turn.speaker-a .turn-bubble {
  background: rgba(201, 139, 64, 0.05);
  border: 1px solid rgba(201, 139, 64, 0.14);
  border-top-left-radius: 3px;
  box-shadow: -3px 0 0 0 rgba(201, 139, 64, 0.28), 0 4px 14px rgba(0, 0, 0, 0.18);
}
.turn.speaker-b .turn-bubble {
  background: rgba(141, 176, 204, 0.05);
  border: 1px solid rgba(141, 176, 204, 0.14);
  border-top-right-radius: 3px;
  box-shadow: 3px 0 0 0 rgba(141, 176, 204, 0.28), 0 4px 14px rgba(0, 0, 0, 0.18);
}

/* streaming cursor */
.turn-cursor {
  display: inline-block;
  width: 2px; height: 1em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 0.9s step-end infinite;
}
.turn.speaker-b .turn-cursor { background: var(--accent2); }

/* done / error markers */
.done-marker, .error-marker {
  text-align: center;
  font-size: 10px;
  color: var(--muted-soft);
  font-family: var(--mono);
  padding: 10px;
  letter-spacing: 0.04em;
}
.error-marker {
  color: var(--rose);
  border: 1px solid rgba(192, 96, 96, 0.22);
  border-radius: 8px;
  margin: 6px 0;
  background: rgba(192, 96, 96, 0.04);
}

/* turn label anatomy */
.turn-label-name  { font-weight: 700; }
.turn-label-sep   { margin: 0 5px; opacity: 0.4; }
.turn-label-num   { font-weight: 500; opacity: 0.8; }
.turn-label-stats {
  display: inline-flex;
  gap: 6px;
  margin-left: 10px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.5;
}
.turn-label-stats .stat {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--panel2);
}

/* ── empty state ────────────────────────────────────────── */

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted-soft);
  font-size: 12px;
  letter-spacing: 0.04em;
  pointer-events: none;
  user-select: none;
}
.empty-state-icon {
  font-size: 28px;
  opacity: 0.18;
}
.empty-state strong {
  color: var(--accent);
  font-weight: 700;
}

/* ── human input ────────────────────────────────────────── */

.human-input-bubble {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
}
.human-input {
  width: 100%;
  resize: vertical;
  min-height: 56px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: rgba(16, 13, 10, 0.9);
  border: 1px solid var(--border2);
  border-radius: 7px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 140ms, box-shadow 140ms;
}
.human-input:focus {
  border-color: rgba(201, 139, 64, 0.5);
  box-shadow: 0 0 0 3px rgba(201, 139, 64, 0.1);
}
.human-input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.human-input-hint {
  font-size: 10px;
  color: var(--muted-soft);
  font-family: var(--mono);
}

/* ── sticky action bar ──────────────────────────────────── */

.action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  position: relative;
}
.action-bar::before {
  content: '';
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 139, 64, 0.18) 50%, transparent);
}

.seed-input {
  flex: 1;
  font-family: var(--sans);
  font-size: 13px;
  padding: 8px 12px;
  min-width: 200px;
}

.action-turns {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.action-turns input {
  width: 54px;
  text-align: center;
  font-family: var(--mono);
  padding: 5px 6px;
}

.action-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  user-select: none;
  transition: color 140ms;
}
.action-toggle input { accent-color: var(--accent); }
.action-toggle:hover { color: var(--dim); }

.btn-run {
  background: linear-gradient(180deg, #dba060, #c08338);
  border: none;
  border-radius: 7px;
  color: #0b0805;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 24px;
  transition: filter 140ms, transform 110ms, box-shadow 140ms;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(201, 139, 64, 0.3) inset;
}
.btn-run:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3); }
.btn-run:active { transform: translateY(0); }
.btn-run:disabled { opacity: 0.38; cursor: not-allowed; filter: none; transform: none; box-shadow: none; }

.btn-stop {
  background: transparent;
  border: 1px solid rgba(192, 96, 96, 0.5);
  border-radius: 7px;
  color: var(--rose);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 7px 18px;
  display: none;
  transition: background 140ms, border-color 140ms;
}
.btn-stop.visible { display: block; }
.btn-stop:hover { background: rgba(192, 96, 96, 0.08); border-color: var(--rose); }

.btn-step {
  background: linear-gradient(180deg, #dba060, #c08338);
  border: none;
  border-radius: 7px;
  color: #0b0805;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 18px;
  animation: stepPulse 1.4s ease-in-out infinite;
}
.btn-step[hidden] { display: none; }

.status-chip {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  letter-spacing: 0.02em;
}

/* ── memory view modal ──────────────────────────────────── */

.memview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 4, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.memview-overlay[hidden] { display: none; }

.memview-dialog {
  width: min(820px, 100%);
  max-height: calc(100vh - 48px);
  background: linear-gradient(180deg, #161209 0%, #100e09 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02) inset, 0 24px 60px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.memview-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.memview-title {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  font-style: italic;
  color: var(--accent);
}
.memview-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
  letter-spacing: 0.02em;
}
.memview-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  padding: 3px 8px;
  border-radius: 5px;
  transition: color 140ms, background 140ms;
}
.memview-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.memview-body {
  padding: 14px 18px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.memview-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(11, 9, 7, 0.6);
}
.memview-section > summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: var(--dim);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 140ms;
}
.memview-section > summary::-webkit-details-marker { display: none; }
.memview-section[open] > summary { border-bottom: 1px solid var(--border); color: var(--text); }
.memview-section-meta {
  font-family: var(--mono);
  font-size: 10px;
  margin-left: auto;
  text-transform: none;
  color: var(--muted);
  letter-spacing: 0;
}
.memview-section-body {
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.55;
}
.memview-section-body pre {
  font-family: var(--mono);
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 10px 12px;
  max-height: 360px;
  overflow-y: auto;
  margin: 0;
  color: var(--dim);
}
.memview-prompt-pre {
  font-family: var(--mono);
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 12px 14px;
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}
.memview-turn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  margin-bottom: 4px;
  border-left: 2px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0 5px 5px 0;
}
.memview-turn.user      { border-left-color: var(--accent2); }
.memview-turn.assistant { border-left-color: var(--accent); }
.memview-turn-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  display: flex;
  gap: 8px;
}
.memview-turn-text {
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.memview-empty {
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
  padding: 8px 4px;
}
.memview-paths {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 4px;
}
.memview-paths div { word-break: break-all; margin-bottom: 2px; }

/* ── prompt pre-gen highlighting ────────────────────────── */

.stage-prompt-pre { white-space: pre-wrap; word-break: break-word; }
.stage-prompt-pre .tvar-injection {
  background: rgba(201, 139, 64, 0.14);
  color: var(--accent);
  border-bottom: 1px dotted rgba(201, 139, 64, 0.5);
  padding: 0 2px;
  border-radius: 2px;
  cursor: help;
}
.stage-prompt-pre .tvar-injection:hover { background: rgba(201, 139, 64, 0.26); }
.stage-prompt-pre .random-injection {
  background: rgba(141, 176, 204, 0.09);
  color: var(--accent2);
  border-bottom: 1px dashed rgba(141, 176, 204, 0.5);
  padding: 0 2px;
  border-radius: 2px;
  cursor: help;
}
.stage-prompt-pre .random-injection:hover { background: rgba(141, 176, 204, 0.2); }

.pregen-note {
  margin-top: 8px;
  padding: 6px 9px;
  border: 1px dashed var(--border);
  border-radius: 5px;
  font-size: 10.5px;
  font-family: var(--mono);
  color: var(--dim);
  background: rgba(255, 255, 255, 0.02);
}
.pregen-note-line { margin: 2px 0; }
.pregen-note-line code {
  font-family: inherit;
  background: rgba(255, 255, 255, 0.05);
  padding: 0 4px;
  border-radius: 2px;
}

/* ── blurred bubble (queued TTS) ────────────────────────── */

.turn-bubble.bubble-blurred {
  filter: blur(4px);
  cursor: pointer;
  transition: filter 200ms ease;
  position: relative;
}
.turn-bubble.bubble-blurred::after {
  content: "click to skip ahead ▸";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: rgba(11, 9, 7, 0.88);
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid var(--accent);
  filter: blur(0);
  pointer-events: none;
  white-space: nowrap;
}
.turn.speaker-b .turn-bubble.bubble-blurred::after {
  color: var(--accent2);
  border-color: var(--accent2);
}
.turn-bubble.bubble-blurred:hover { filter: blur(2px); }

/* ── hide model fields when human-driven ──────────────���─── */
.pcard.is-human .model-only { display: none !important; }

/* ── hide memory-specific panels when memory is off ─────── */
.pcard.is-no-memory .memory-only { display: none !important; }

/* ── global memory disabled (workspace toggle) ───────────── */
body.memory-globally-disabled .memory-feature,
body.memory-globally-disabled .memory-only { display: none !important; }

/* opinion toggle: only visible when memory is globally disabled */
.opinion-only { display: none !important; }
body.memory-globally-disabled .opinion-only { display: flex !important; }

.opinion-window-label {
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.opinion-window-input {
  width: 3em;
  padding: 1px 4px;
  font-size: 12px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--panel2);
  color: var(--text);
}

/* ── hide TTS voice/speed when TTS is off ───────────────── */
.pcard.is-no-tts .tts-detail { display: none !important; }

/* ── human toggle in summary header ─────────────────────── */
.summary-human-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: color 140ms, border-color 140ms, background 140ms;
  user-select: none;
  flex-shrink: 0;
}
.summary-human-toggle:hover {
  color: var(--text-dim);
  border-color: var(--border);
  background: rgba(255,255,255,0.04);
}
.summary-human-toggle input[type="checkbox"] {
  accent-color: var(--accent2);
  width: 13px;
  height: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.pcard.is-human .summary-human-toggle {
  color: var(--accent2);
  border-color: rgba(141,176,204,0.3);
  background: rgba(141,176,204,0.07);
}

/* ── responsive ─────────────────────────────────────────── */

@media (max-width: 1200px) {
  .pcard-tuning-grid { grid-template-columns: repeat(3, 1fr); }
  .main-row { grid-template-columns: minmax(240px, 300px) 1fr minmax(240px, 300px); }
}
@media (max-width: 900px) {
  .setup-bar { grid-template-columns: 1fr; }
  .pcard-row { grid-template-columns: 1fr; }
  .pcard-tuning-grid { grid-template-columns: repeat(2, 1fr); }
  .pcard-notes-grid { grid-template-columns: 1fr; }
  .turn { max-width: 92%; }
  .main-row { grid-template-columns: 1fr; }
  .main-row .side-panel { display: none; }
  .header-page-nav { display: none; }
  .header h1 { font-size: 18px; }
}

/* ═══ PCARD REDESIGN ════════════════════════════════════════ */

/* body: sections self-pad, no outer gap */
.pcard-body {
  padding: 0;
  gap: 0;
  background: rgba(11, 9, 7, 0.55);
  border-top: 1px solid var(--border);
}

/* ── main identity row: name | registry | model ──────────── */
.pcard-row {
  display: grid;
  grid-template-columns: minmax(96px, 120px) 1fr 1fr;
  gap: 12px;
  padding: 12px 16px;
  align-items: end;
  border-bottom: 1px solid var(--border-subtle);
}

/* ── behaviour toggles row ────────────────────────────────── */
.pcard-row.pcard-toggles {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.012);
  /* reset grid from parent selector */
  grid-template-columns: unset;
}
/* flex spacer: pushes action buttons to the right */
.pcard-sep { flex: 1; min-width: 4px; }
.pcard-toggles .btn-reset-store,
.pcard-toggles .btn-view-store { margin-left: 0; flex-shrink: 0; }

/* divider between toggles and action buttons */
.pcard-toggles .pcard-sep + .btn-view-store { border-left: 1px solid var(--border); padding-left: 12px; }

/* inline label+select in the toggles row or tuning grid */
.pcard-tuning-grid .pfield-inline { grid-column: 1 / -1; }
.pfield-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.pfield-inline select {
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  padding: 3px 6px;
}

/* ── TTS row: flex strip instead of cramped 3-col grid ───── */
.pcard-row.pcard-tts-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.008);
  grid-template-columns: unset;
}
.pcard-row.pcard-tts-row > label:first-child { flex-shrink: 0; }
.pcard-tts-voice { width: 220px; flex-shrink: 0; }
.pcard-tts-speed { flex: 1; max-width: 180px; }

/* ── collapsible section headers ─────────────────────────── */
.pcard-tuning,
.pcard-json {
  margin: 0;
  font-size: 11px;
  border-bottom: 1px solid var(--border-subtle);
}

.pcard-tuning > summary,
.pcard-json > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.013);
  user-select: none;
  transition: color 140ms, background 140ms;
}
.pcard-tuning > summary::-webkit-details-marker,
.pcard-json > summary::-webkit-details-marker { display: none; }

/* chevron indicator */
.pcard-tuning > summary::before,
.pcard-json > summary::before {
  content: '›';
  font-size: 13px;
  line-height: 1;
  color: var(--muted-soft);
  transition: transform 0.15s ease;
  flex-shrink: 0;
  font-style: normal;
  font-family: var(--sans);
}
.pcard-tuning[open] > summary::before,
.pcard-json[open] > summary::before { transform: rotate(90deg); }

.pcard-tuning[open] > summary,
.pcard-json[open] > summary {
  color: var(--dim);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
}
.pcard-tuning > summary:hover,
.pcard-json > summary:hover { color: var(--dim); background: rgba(255, 255, 255, 0.022); }

/* muted inline meta text inside summary */
.pcard-tuning > summary .muted,
.pcard-json > summary .muted {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

/* ── generation / memory tuning grid: 3-col ──────────────── */
.pcard-tuning-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px 16px 14px;
  margin-top: 0;
  align-items: end;
}

/* ── notes grid: 2-col ───────────────────────────────────── */
.pcard-notes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 16px;
  margin-top: 0;
}

/* ── registry JSON textarea ───────────────────────────────── */
.pcard-json[open] textarea {
  display: block;
  margin: 10px 16px 12px;
  width: calc(100% - 32px);
}

/* ── live side-panel stats tab ──────────────────────────────────── */

#side-a-stats,
#side-b-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px 14px;
}

.ss-section { display: flex; flex-direction: column; gap: 6px; }

.ss-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--dim);
}
.ss-meta {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}

/* emotion dimension bars */
.ss-dim-row {
  display: grid;
  grid-template-columns: 80px 1fr 32px;
  align-items: center;
  gap: 6px;
}
.ss-dim-name {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ss-dim-track {
  position: relative;
  height: 5px;
  background: var(--panel3);
  border-radius: 3px;
  overflow: visible;
}
.ss-dim-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}
.ss-dim-neutral {
  position: absolute;
  left: 50%;
  top: -2px;
  width: 1px;
  height: 9px;
  background: var(--border2);
  transform: translateX(-50%);
}
.ss-dim-val {
  font-family: var(--mono);
  font-size: 10px;
  text-align: right;
  transition: color .4s;
}

/* confidence */
.ss-conf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 10px;
  color: var(--muted);
}

/* tags */
.ss-tag-list { display: flex; flex-direction: column; gap: 4px; }
.ss-tag-row {
  display: grid;
  grid-template-columns: 1fr 60px 20px;
  align-items: center;
  gap: 6px;
}
.ss-tag-name {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ss-tag-track {
  height: 4px;
  background: var(--panel3);
  border-radius: 2px;
  overflow: hidden;
}
.ss-tag-fill {
  height: 100%;
  background: var(--accent2);
  border-radius: 2px;
  transition: width .3s;
}
.ss-tag-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-align: right;
}

/* ── post-run analytics panel ───────────────────────────────────── */

.analytics-area {
  position: fixed;
  bottom: 53px; /* sit above the action-bar */
  left: 0;
  right: 0;
  z-index: 400;
  max-height: 62vh;
  overflow-y: auto;
  background: transparent;
  border-top: none;
  box-shadow: none;
  padding: 0 24px 24px;
}

.btn-analytics {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 12px;
  border: 1px solid var(--border2);
  border-radius: 4px;
  background: var(--panel2);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-analytics:hover {
  background: var(--panel3);
  border-color: var(--accent);
}

.analytics-panel {
  margin: 20px auto 0;
  max-width: 680px;
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: 8px;
  overflow: hidden;
}

.analytics-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dim);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.analytics-summary:hover { color: var(--text); }
.analytics-panel[open] .analytics-summary { color: var(--accent); }

.analytics-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.an-section { display: flex; flex-direction: column; gap: 8px; }
.an-section > details > summary { cursor: pointer; }

.an-section-title {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.an-meta {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}

/* tag / rule bars */
.an-bars { display: flex; flex-direction: column; gap: 5px; }
.an-bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 28px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.an-bar-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.an-bar-label-sm { font-size: 10px; }
.an-bar-track {
  height: 6px;
  background: var(--panel3);
  border-radius: 3px;
  overflow: hidden;
}
.an-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .3s;
}
.an-bar-fill-b { background: var(--accent2); }
.an-bar-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

/* confidence stacked bar */
.an-conf-row { display: flex; align-items: center; gap: 10px; }
.an-conf-bar {
  flex: 1;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  background: var(--panel3);
}
.an-conf-seg { height: 100%; }
.an-conf-certain  { background: var(--accent); }
.an-conf-possible { background: #c8a84b; }
.an-conf-uncertain{ background: var(--muted-soft); }
.an-conf-legend {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}
.an-conf-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 3px;
}
.an-conf-dot.certain   { background: var(--accent); }
.an-conf-dot.possible  { background: #c8a84b; }
.an-conf-dot.uncertain { background: var(--muted-soft); }

/* emotion trajectory chart */
.an-em-chart {
  display: block;
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: var(--panel2);
}
.an-em-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--dim);
}
.an-em-leg-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.an-em-leg-item strong { color: var(--text); }
.an-em-neutral-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  padding: 6px 0;
}
.an-em-neutral-hint code {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  background: var(--panel3);
  padding: 1px 4px;
  border-radius: 3px;
}

/* re-declare responsive breakpoints after redesign overrides */
@media (max-width: 900px) {
  .pcard-row { grid-template-columns: 1fr; }
  .pcard-row.pcard-toggles,
  .pcard-row.pcard-tts-row { flex-wrap: wrap; }
  .pcard-tuning-grid { grid-template-columns: repeat(2, 1fr); }
  .pcard-notes-grid { grid-template-columns: 1fr; }
}
