:root {
  --text-xs: clamp(0.75rem, 0.72rem + 0.12vw, 0.8125rem);
  --text-sm: clamp(0.875rem, 0.85rem + 0.12vw, 0.9375rem);
  --text-base: clamp(1rem, 0.97rem + 0.12vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
  --text-xl: clamp(1.5rem, 1.3rem + 0.9vw, 2rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  --color-bg: #030812;
  --color-bg-2: #05101f;
  --color-panel: #06132a;
  --color-panel-2: #0a1d3d;
  --color-line: rgba(72, 142, 255, 0.34);
  --color-line-soft: rgba(72, 142, 255, 0.16);
  --color-primary: #3d8bff;
  --color-primary-bright: #86bbff;
  --color-primary-deep: #1a5fd8;
  --color-text: #d6e6ff;
  --color-text-muted: #94b0d8;
  --color-text-faint: #7190bd;
  --color-warn: #ffb454;
  --color-error: #ff7a88;

  --font-display: 'Chakra Petch', 'Trebuchet MS', sans-serif;
  --font-body: 'Satoshi', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --chamfer: 12px;
}

html,
body {
  height: 100%;
  overflow: hidden;
}
body {
  background: var(--color-bg);
}

/* ───────── backdrop ───────── */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 90% at 50% 38%, rgba(26, 95, 216, 0.16), transparent 62%),
    linear-gradient(rgba(72, 142, 255, 0.045) 1px, transparent 1px) 0 0 / 100% 44px,
    linear-gradient(90deg, rgba(72, 142, 255, 0.045) 1px, transparent 1px) 0 0 / 44px 100%,
    var(--color-bg);
}
.backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0, rgba(61, 139, 255, 0.05) 50%, transparent 100%);
  background-size: 100% 240px;
  background-repeat: no-repeat;
  animation: sweep 9s linear infinite;
}
@keyframes sweep {
  from {
    background-position: 0 -240px;
  }
  to {
    background-position: 0 110vh;
  }
}
.frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.frame polyline {
  fill: none;
  stroke: rgba(72, 142, 255, 0.38);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

/* ───────── shell ───────── */
.app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: var(--space-3) clamp(var(--space-3), 2vw, var(--space-8)) calc(var(--space-3) + env(safe-area-inset-bottom));
  gap: var(--space-3);
}
.skip {
  position: fixed;
  left: var(--space-3);
  top: -100px;
  z-index: 50;
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: #021027;
  font-weight: 700;
}
.skip:focus {
  top: var(--space-3);
}

/* chamfered HUD panel */
.panel {
  position: relative;
  isolation: isolate;
  padding: var(--space-4);
  min-width: 0;
}
.panel::before,
.panel::after {
  content: '';
  position: absolute;
  z-index: -1;
  clip-path: polygon(
    var(--chamfer) 0,
    100% 0,
    100% calc(100% - var(--chamfer)),
    calc(100% - var(--chamfer)) 100%,
    0 100%,
    0 var(--chamfer)
  );
  transition: background 0.4s var(--ease);
}
.panel::before {
  inset: 0;
  z-index: -2;
  background: var(--color-line);
}
.panel::after {
  inset: 1px;
  background: linear-gradient(160deg, rgba(10, 29, 61, 0.92), rgba(6, 19, 42, 0.92));
}
.panel-h {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-primary-bright);
}
.panel-h::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--color-primary);
  clip-path: polygon(0 0, 100% 0, 100% 60%, 60% 100%, 0 100%);
}
.panel-h::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--color-line), transparent);
}
.panel-h b {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--color-text);
}
.eyebrow {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

/* ───────── top bar ───────── */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-line-soft);
  min-width: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.brand-glyph {
  width: 14px;
  height: 22px;
  background: var(--color-primary);
  clip-path: polygon(0 0, 100% 0, 100% 70%, 45% 100%, 0 100%);
}
.brand h1 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.3em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 2px var(--space-3);
  border: 1px solid var(--color-line);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.app[data-state='listening'] .status,
.app[data-state='speaking'] .status {
  color: var(--color-primary-bright);
  border-color: var(--color-primary);
}
.app[data-state='listening'] .status::before,
.app[data-state='thinking'] .status::before,
.app[data-state='research'] .status::before {
  animation: blink 1s steps(2) infinite;
}
@keyframes blink {
  50% {
    opacity: 0.2;
  }
}
.readouts {
  display: flex;
  gap: var(--space-6);
  margin-left: auto;
}
.readouts div {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.readouts dt {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}
.readouts dd {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}
.tools {
  display: flex;
  gap: var(--space-2);
}
.tool {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-line);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  transition:
    color 0.2s,
    border-color 0.2s,
    background 0.2s;
}
.tool:hover,
.tool:focus-visible {
  color: var(--color-text);
  border-color: var(--color-primary);
  background: rgba(61, 139, 255, 0.1);
}
.tool:active {
  background: rgba(61, 139, 255, 0.22);
}
.tool svg,
.icon-btn svg,
.mic svg,
.cmd button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tool b {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--color-primary-bright);
}

/* ───────── deck ───────── */
.deck {
  display: grid;
  grid-template-columns: minmax(230px, 290px) minmax(0, 1fr) minmax(250px, 320px);
  gap: var(--space-4);
  min-height: 0;
}
.rail {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 0;
  overflow: hidden;
  transition: opacity 0.4s var(--ease);
}
.rail .grow {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.rail .grow > :last-child {
  flex: 1;
  min-height: 0;
  height: auto;
  overflow: hidden;
}
.kv div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding: 5px 0;
  border-bottom: 1px dashed var(--color-line-soft);
}
.kv div:last-child {
  border-bottom: 0;
}
.kv dt {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  white-space: nowrap;
}
.kv dd {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text);
  text-align: right;
  overflow-wrap: anywhere;
}
.kv dd[data-tone='warn'] {
  color: var(--color-warn);
}
.kv dd[data-tone='on'] {
  color: var(--color-primary-bright);
}
.spectrum {
  width: 100%;
  height: 72px;
}
.mini-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.mini-list li {
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--color-text-muted);
}
.mini-list .empty {
  color: var(--color-text-faint);
}
.mini-list button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-2);
  text-align: left;
  font-size: var(--text-sm);
  line-height: 1.35;
  color: var(--color-text);
  border-left: 1px solid var(--color-line);
  transition:
    background 0.2s,
    border-color 0.2s;
}
.mini-list button:hover,
.mini-list button:focus-visible {
  background: rgba(61, 139, 255, 0.12);
  border-color: var(--color-primary-bright);
}
.mini-list button small {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.log {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  height: 100%;
  overflow: hidden;
  justify-content: flex-end;
}
.log li {
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  animation: rise 0.5s var(--ease);
}
.log li b {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-right: var(--space-2);
}
.log li.me {
  color: var(--color-text);
}
.log li.it b {
  color: var(--color-primary-bright);
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ───────── core ───────── */
.core-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-width: 0;
  min-height: 0;
}
.core {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 140px;
  max-height: 560px;
  border-radius: 0;
  -webkit-tap-highlight-color: transparent;
}
.core canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.core:focus-visible {
  outline-offset: -6px;
}
.caption {
  width: min(100%, 60ch);
  min-height: 5.2em;
  text-align: center;
}
.cap-user {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-faint);
  min-height: 1.5em;
  overflow-wrap: anywhere;
}
.cap-user:not(:empty)::before {
  content: '› ';
  color: var(--color-primary);
}
.cap-say {
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-text);
  max-height: 7em;
  overflow-y: auto;
}
.cap-sources {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 32px;
  padding: 2px var(--space-3);
  border: 1px solid var(--color-line);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    color 0.2s,
    border-color 0.2s;
}
.chip:hover,
.chip:focus-visible {
  color: var(--color-text);
  border-color: var(--color-primary-bright);
}
.cap-note {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-warn);
}

.jobs {
  width: min(100%, 52ch);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.job {
  padding: var(--space-3) var(--space-4);
  animation: rise 0.5s var(--ease);
  text-align: left;
}
.job .panel-h {
  margin-bottom: var(--space-2);
}
.job-topic {
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.job-steps {
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.job-steps li {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.job-steps li:last-child {
  color: var(--color-primary-bright);
}
.job-bar {
  position: relative;
  height: 2px;
  margin-top: var(--space-3);
  background: var(--color-line-soft);
  overflow: hidden;
}
.job-bar::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 34%;
  background: var(--color-primary-bright);
  animation: scan 1.6s ease-in-out infinite alternate;
}
@keyframes scan {
  to {
    transform: translateX(195%);
  }
}

/* ───────── stage (data on screen) ───────── */
.stage {
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: var(--space-2);
  container-type: inline-size;
  scrollbar-width: thin;
  scrollbar-color: var(--color-line) transparent;
}
.stage:focus {
  outline: none;
}
.app[data-view='data'] .deck {
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
}
.app[data-view='data'] .rail {
  display: none;
}
.app[data-view='data'] .core {
  flex: 0 0 auto;
  height: clamp(160px, 26vh, 260px);
}
.app[data-view='data'] .core-zone {
  justify-content: flex-start;
}
.app[data-view='data'] .cap-say {
  font-size: var(--text-base);
}
.stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-line-soft);
  animation: rise 0.6s var(--ease);
}
.stage-head h2 {
  margin: var(--space-1) 0 var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-text);
}
.stage-head .summary {
  max-width: 78ch;
  font-size: var(--text-base);
  color: var(--color-text-muted);
}
.stage-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 1px solid var(--color-line);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text);
  white-space: nowrap;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s,
    transform 0.2s;
}
.btn:hover,
.btn:focus-visible {
  border-color: var(--color-primary-bright);
  background: rgba(61, 139, 255, 0.14);
}
.btn:active {
  transform: translateY(1px);
}
.btn.primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #021027;
}
.btn.primary:hover,
.btn.primary:focus-visible {
  background: var(--color-primary-bright);
  border-color: var(--color-primary-bright);
}
.btn.danger {
  color: var(--color-error);
  border-color: rgba(255, 122, 136, 0.4);
}
.btn.danger:hover,
.btn.danger:focus-visible {
  background: rgba(255, 122, 136, 0.12);
  border-color: var(--color-error);
}
.btn[disabled] {
  opacity: 0.5;
  cursor: default;
}

.blocks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
  grid-auto-flow: dense;
  gap: var(--space-3);
}
@container (min-width: 600px) {
  .block.wide {
    grid-column: span 2;
  }
}
.block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  animation: blockIn 0.7s var(--ease) forwards;
  animation-delay: calc(var(--i) * 70ms + 120ms);
  scroll-margin: var(--space-6);
}
@keyframes blockIn {
  to {
    opacity: 1;
    transform: none;
  }
}
.block .panel-h {
  margin-bottom: 0;
}
.block .tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--color-text-faint);
  order: 3;
}
.block.active::before {
  background: var(--color-primary-bright);
}
.block.active::after {
  background: linear-gradient(160deg, rgba(20, 58, 122, 0.95), rgba(8, 28, 62, 0.95));
}
.block p,
.block li {
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--color-text-muted);
}
.block .body {
  color: var(--color-text);
  font-size: var(--text-base);
}
.block .stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 500;
  line-height: 1.1;
  color: var(--color-primary-bright);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.block .stat-label {
  color: var(--color-text) !important;
  font-weight: 500;
}
.block ul.points {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
}
.block ul.points li {
  position: relative;
  padding-left: var(--space-4);
  color: var(--color-text);
}
.block ul.points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  background: var(--color-primary);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr) auto;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
}
.bar-row .name {
  color: var(--color-text);
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.bar-row .track {
  height: 10px;
  background: rgba(72, 142, 255, 0.12);
  overflow: hidden;
}
.bar-row .fill {
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(90deg, var(--color-primary) 0 6px, transparent 6px 8px);
  transition: width 1.1s var(--ease) 0.5s;
}
.bar-row .num {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--color-primary-bright);
  white-space: nowrap;
}
.timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
}
.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
  gap: var(--space-3);
  padding: 0 0 var(--space-3) var(--space-4);
  border-left: 1px solid var(--color-line);
  color: var(--color-text);
}
.timeline li:last-child {
  padding-bottom: 0;
}
.timeline li::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 0.55em;
  width: 7px;
  height: 7px;
  background: var(--color-primary-bright);
}
.timeline .when {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-primary-bright);
  padding-top: 2px;
}
.refs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: auto;
  padding-top: var(--space-2);
}
.ref {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 28px;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-line-soft);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-decoration: none;
}
.ref:hover,
.ref:focus-visible {
  color: var(--color-text);
  border-color: var(--color-primary-bright);
}
.sources {
  margin-top: var(--space-4);
  animation: rise 0.6s var(--ease) 0.6s backwards;
}
.sources summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-primary-bright);
  list-style: none;
}
.sources summary::-webkit-details-marker {
  display: none;
}
.sources summary::before {
  content: '+';
  font-family: var(--font-mono);
  width: 1em;
}
.sources[open] summary::before {
  content: '–';
}
.sources ol {
  list-style: none;
  display: grid;
  gap: var(--space-3);
  padding-top: var(--space-2);
}
.sources li {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: var(--space-2);
  font-size: var(--text-sm);
  line-height: 1.4;
}
.sources li .n {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  padding-top: 2px;
}
.sources li a {
  color: var(--color-text);
  text-decoration-color: var(--color-line);
  text-underline-offset: 3px;
}
.sources li a:hover {
  text-decoration-color: var(--color-primary-bright);
}
.sources li .url {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  overflow-wrap: anywhere;
  user-select: all;
}
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: var(--space-3);
}
.lib-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  opacity: 0;
  transform: translateY(14px);
  animation: blockIn 0.7s var(--ease) forwards;
  animation-delay: calc(var(--i) * 80ms + 120ms);
}
.lib-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
}
.lib-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-card .meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.lib-card .btn {
  align-self: flex-start;
  margin-top: var(--space-2);
}

/* ───────── dock ───────── */
.dock {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}
.hints {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.hints:empty {
  display: none;
}
.hint {
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-line-soft);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition:
    color 0.2s,
    border-color 0.2s,
    background 0.2s;
}
.hint:hover,
.hint:focus-visible {
  color: var(--color-text);
  border-color: var(--color-primary);
  background: rgba(61, 139, 255, 0.1);
}
.dock-row {
  display: flex;
  gap: var(--space-3);
  width: min(100%, 760px);
  margin: 0 auto;
}
.mic {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: var(--color-primary);
  color: #021027;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition:
    background 0.2s,
    transform 0.2s;
}
.mic svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.8;
}
.mic:hover,
.mic:focus-visible {
  background: var(--color-primary-bright);
}
.mic:active {
  transform: scale(0.96);
}
.mic[aria-pressed='true'] {
  background: #eaf3ff;
  animation: micPulse 1.2s ease-in-out infinite;
}
@keyframes micPulse {
  50% {
    background: var(--color-primary-bright);
  }
}
.mic[disabled] {
  background: var(--color-panel-2);
  color: var(--color-text-faint);
  cursor: default;
  animation: none;
}
.cmd {
  flex: 1;
  display: flex;
  min-width: 0;
  border: 1px solid var(--color-line);
  background: rgba(6, 19, 42, 0.85);
  transition: border-color 0.2s;
}
.cmd:focus-within {
  border-color: var(--color-primary-bright);
}
.cmd input {
  flex: 1;
  min-width: 0;
  height: 50px;
  padding: 0 var(--space-4);
  background: transparent;
  border: 0;
  outline: none;
  font-size: var(--text-base);
  color: var(--color-text);
}
.cmd input::placeholder {
  color: var(--color-text-faint);
}
.cmd button {
  width: 52px;
  display: grid;
  place-items: center;
  color: var(--color-primary-bright);
  border-left: 1px solid var(--color-line-soft);
  transition: background 0.2s;
}
.cmd button:hover,
.cmd button:focus-visible {
  background: rgba(61, 139, 255, 0.16);
}

/* ───────── boot overlay ───────── */
.boot {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: var(--space-6);
  background: rgba(3, 8, 18, 0.82);
  backdrop-filter: blur(6px);
  transition:
    opacity 0.7s var(--ease),
    visibility 0.7s;
}
.boot.off {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boot-card {
  width: min(100%, 440px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}
.boot-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: 0.42em;
  margin-right: -0.42em;
  color: var(--color-text);
}
.boot-copy {
  color: var(--color-text-muted);
}
.boot-fine {
  font-size: var(--text-sm);
  color: var(--color-text-faint);
}
.boot-link {
  font-size: var(--text-sm);
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.boot .cmd {
  width: 100%;
}
.boot .btn.primary {
  min-width: 200px;
  min-height: 52px;
}

/* ───────── drawers ───────── */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(2, 6, 14, 0.6);
  animation: fade 0.3s ease;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  background: var(--color-bg-2);
  border-left: 1px solid var(--color-line);
  animation: slide 0.45s var(--ease);
}
@keyframes slide {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
}
.drawer-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-line-soft);
}
.drawer-h h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--color-text-muted);
}
.icon-btn:hover,
.icon-btn:focus-visible {
  color: var(--color-text);
  background: rgba(61, 139, 255, 0.12);
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  scrollbar-width: thin;
  scrollbar-color: var(--color-line) transparent;
}
.fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.fields fieldset {
  border: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.fields legend,
.mem-admin h3 {
  margin-bottom: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-primary-bright);
}
.fields label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.fields label i {
  font-style: normal;
  color: var(--color-text-faint);
}
.fields input:not([type='radio']):not([type='checkbox']),
.fields select {
  height: 46px;
  padding: 0 var(--space-3);
  background: var(--color-panel);
  border: 1px solid var(--color-line);
  border-radius: 0;
  font-size: var(--text-base);
  color: var(--color-text);
}
.fields select {
  /* Safari draws its own white dropdown unless told not to */
  -webkit-appearance: none;
  appearance: none;
  padding-right: var(--space-8);
  background-color: var(--color-panel);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%238fb8ff' stroke-width='1.6'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 12px 8px;
}
.fields select option {
  background: #06122b;
  color: #e8f0ff;
}
.fields input:focus,
.fields select:focus {
  outline: none;
  border-color: var(--color-primary-bright);
}
.fields small {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.seg label {
  position: relative;
}
.seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
}
.seg span {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 56px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-line);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  cursor: pointer;
}
.seg span small {
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.seg label + label span {
  border-left: 0;
}
.seg.stack {
  grid-template-columns: 1fr;
}
.seg.stack label + label span {
  border-left: 1px solid var(--color-line);
  margin-top: -1px;
}
.seg.stack input:checked + span {
  position: relative;
  z-index: 1;
}
.seg input:checked + span {
  background: rgba(61, 139, 255, 0.18);
  border-color: var(--color-primary-bright);
  color: var(--color-text);
}
.seg input:focus-visible + span {
  outline: 2px solid var(--color-primary-bright);
  outline-offset: 2px;
}
.fields label.switch {
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
}
.switch input {
  appearance: none;
  flex: 0 0 auto;
  width: 44px;
  height: 24px;
  margin-top: 2px;
  border: 1px solid var(--color-line);
  background: var(--color-panel);
  position: relative;
  cursor: pointer;
  transition:
    background 0.25s,
    border-color 0.25s;
}
.switch input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--color-text-faint);
  transition:
    transform 0.25s var(--ease),
    background 0.25s;
}
.switch input:checked {
  background: rgba(61, 139, 255, 0.3);
  border-color: var(--color-primary-bright);
}
.switch input:checked::after {
  transform: translateX(20px);
  background: var(--color-primary-bright);
}
.switch span {
  display: flex;
  flex-direction: column;
}
.switch b {
  font-weight: 500;
  color: var(--color-text);
}
.saved {
  min-height: 1.4em;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-primary-bright);
}
.saved[data-tone='error'] {
  color: var(--color-error);
}
.mem-admin ul,
.lib-admin {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
}
.mem-admin li,
.lib-admin li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--color-line-soft);
  font-size: var(--text-sm);
  color: var(--color-text);
}
.mem-admin li span,
.lib-admin li .grow {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.lib-admin li {
  flex-direction: column;
}
.lib-admin h3 {
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.3;
}
.lib-admin .meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.lib-admin .row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-10) var(--space-4);
  color: var(--color-text-muted);
}
.empty-state svg {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 1.3;
}
.empty-state h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
}
.empty-state p {
  max-width: 34ch;
  font-size: var(--text-sm);
}

/* ───────── responsive ───────── */
@media (max-width: 1100px) {
  .deck {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  }
  .rail-left {
    display: none;
  }
}
@media (max-width: 820px) {
  .deck {
    grid-template-columns: minmax(0, 1fr);
  }
  .rail {
    display: none;
  }
  .readouts .ro-wide,
  .tool span {
    display: none;
  }
  .tool {
    min-width: 44px;
    justify-content: center;
  }
  .app[data-view='data'] .deck {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .app[data-view='data'] .core-zone {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3);
  }
  .app[data-view='data'] .core {
    width: 96px;
    height: 96px;
    min-height: 0;
  }
  .app[data-view='data'] .caption {
    min-height: 0;
    text-align: left;
  }
  .app[data-view='data'] .cap-say {
    font-size: var(--text-sm);
    max-height: 4.4em;
  }
  .app[data-view='data'] .cap-sources {
    display: none;
  }
  .app[data-view='data'] .jobs {
    grid-column: 1 / -1;
  }
  .app[data-view='data'] .hints {
    display: none;
  }
  .stage-head {
    flex-direction: column;
  }
}
@media (max-width: 520px) {
  .readouts {
    display: none;
  }
  .tools {
    margin-left: auto;
  }
  .topbar {
    gap: var(--space-2);
  }
  .brand h1 {
    letter-spacing: 0.2em;
  }
  .status {
    padding: 2px var(--space-2);
  }
  .hints {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .hint {
    flex: 0 0 auto;
  }
  .bar-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .bar-row .track {
    grid-column: 1 / -1;
    order: 3;
  }
}
@media (max-height: 620px) {
  .caption {
    min-height: 3.2em;
  }
  .hints {
    display: none;
  }
}

@media (pointer: coarse) {
  .hint {
    min-height: 44px;
  }
}
