:root {
  --bg: #0b0d13;
  --panel: #131722;
  --panel-2: #171c29;
  --line: #232a3b;
  --ink: #e8ecf6;
  --ink-dim: #8f9ab5;
  --ink-faint: #5b6580;
  --accent: #39d98a;
  --warn: #ff6b9d;
  --radius: 14px;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(1100px 520px at 12% -10%, rgba(57, 217, 138, 0.10), transparent 60%),
    radial-gradient(900px 480px at 92% 0%, rgba(139, 147, 255, 0.12), transparent 62%);
}

/* ------------------------------------------------------------- topbar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 13, 19, 0.82);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 17px; margin: 0; letter-spacing: -0.01em; font-weight: 650; }

.dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(57, 217, 138, 0.16);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(57, 217, 138, 0.05); } }

.badge-disposable {
  font: 500 11px/1 var(--mono);
  color: #ffd479;
  background: rgba(255, 180, 84, 0.12);
  border: 1px solid rgba(255, 180, 84, 0.32);
  padding: 5px 9px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.store-legend { display: flex; gap: 7px; flex-wrap: wrap; }

.legend-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 12px/1 var(--font);
  color: var(--ink-dim);
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s, border-color 0.15s;
}
.legend-chip:hover { border-color: #36405c; }
.legend-chip[aria-pressed="true"] { color: var(--ink); border-color: currentColor; }
.legend-chip.dim { opacity: 0.38; }
.legend-chip .swatch { width: 9px; height: 9px; border-radius: 3px; background: currentColor; }
.legend-chip .n { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }

/* -------------------------------------------------------------- layout -- */
main {
  flex: 1;
  display: grid;
  gap: 16px;
  padding: 18px 22px 26px;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  /* Each name must form one rectangle. `beads` spans the two rows below
     `capture`; naming row 3 "capture" here would overlap `beads` and make the
     whole declaration invalid, which silently collapses the grid. */
  grid-template-areas:
    "capture graph"
    "beads   graph"
    "beads   feed";
  align-items: start;
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
}

.capture { grid-area: capture; }
.beads { grid-area: beads; }
.graph { grid-area: graph; }
.feed { grid-area: feed; }

@media (max-width: 1080px) {
  main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "capture" "graph" "beads" "feed";
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}

.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--ink-dim); font-weight: 650; }
.hint { font: 400 12px/1.4 var(--font); color: var(--ink-faint); }

/* --------------------------------------------------------------- mic ---- */
.mic-row { display: flex; gap: 12px; align-items: stretch; }

.mic {
  flex: 0 0 auto;
  width: 74px; min-height: 74px;
  border-radius: 18px;
  border: 1px solid rgba(57, 217, 138, 0.4);
  background: rgba(57, 217, 138, 0.10);
  color: var(--accent);
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
}
.mic svg { width: 30px; height: 30px; fill: currentColor; }
.mic:hover { background: rgba(57, 217, 138, 0.17); }
.mic:active, .mic.listening {
  background: rgba(255, 107, 157, 0.16);
  border-color: rgba(255, 107, 157, 0.55);
  color: var(--warn);
  transform: scale(0.97);
  animation: ring 1.3s ease-in-out infinite;
}
.mic[disabled] { opacity: 0.45; cursor: not-allowed; animation: none; }
@keyframes ring { 50% { box-shadow: 0 0 0 9px rgba(255, 107, 157, 0.07); } }

.transcript {
  flex: 1; min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.transcript[data-empty="true"] { color: var(--ink-faint); font-size: 13px; }
.transcript .placeholder { color: var(--ink-faint); }
.transcript .interim { color: var(--ink-dim); font-style: italic; }

.heard {
  margin-top: 11px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.02);
  font-size: 13px;
  color: var(--ink-dim);
}
.heard b { color: var(--ink); font-weight: 600; }
.heard code { font-family: var(--mono); font-size: 12px; color: var(--accent); }

/* ------------------------------------------------------------- typed ---- */
.typed { display: flex; gap: 8px; margin-top: 12px; }
.typed input {
  flex: 1; min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.typed input:focus { border-color: rgba(57, 217, 138, 0.55); }
.typed input::placeholder { color: var(--ink-faint); }

button.primary, button.ghost {
  border-radius: 10px;
  padding: 10px 15px;
  font: 600 13px/1 var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
button.primary { background: var(--accent); color: #04160d; }
button.primary:hover { background: #4ff09a; }
button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-dim);
}
button.ghost:hover { border-color: #3a4562; color: var(--ink); }
button.small { padding: 6px 10px; font-size: 12px; }

.store-choice { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
#store-options { display: flex; gap: 6px; flex-wrap: wrap; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 12px/1 var(--font);
  color: var(--ink-dim);
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 999px;
  padding: 6px 10px;
  transition: all 0.15s;
}
.choice input:checked + span { color: var(--ink); border-color: currentColor; background: rgba(255, 255, 255, 0.05); }
.choice span .swatch { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: 0.9; }

/* -------------------------------------------------------------- beads --- */
.bead-list { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow-y: auto; }
.bead-list li {
  display: grid;
  grid-template-columns: 3px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 2px 9px 0;
  border-bottom: 1px solid rgba(35, 42, 59, 0.65);
  cursor: pointer;
}
.bead-list li:last-child { border-bottom: none; }
.bead-list li:hover .bead-title { color: var(--ink); }
.bead-list li.selected { background: rgba(255, 255, 255, 0.035); border-radius: 8px; }
.bead-rail { border-radius: 3px; }
.bead-main { min-width: 0; }
.bead-title { font-size: 13.5px; line-height: 1.35; color: var(--ink-dim); overflow-wrap: anywhere; }
.bead-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.bead-store { font: 600 10.5px/1 var(--mono); letter-spacing: 0.04em; }
.bead-id { font: 400 10.5px/1 var(--mono); color: var(--ink-faint); }
.bead-src {
  font: 500 10px/1 var(--font); color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 6px;
}
.bead-src.voice { color: var(--warn); border-color: rgba(255, 107, 157, 0.4); }

.empty-note { color: var(--ink-faint); font-size: 13px; padding: 14px 2px; }

/* -------------------------------------------------------------- graph --- */
.graph { display: flex; flex-direction: column; min-height: 520px; }
.graph-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.graph-wrap {
  position: relative;
  flex: 1;
  min-height: 380px;
  background:
    radial-gradient(circle at 50% 42%, rgba(57, 217, 138, 0.05), transparent 60%),
    #0d1018;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  cursor: grab;
}
.graph-wrap.panning { cursor: grabbing; }
#graph { width: 100%; height: 100%; display: block; touch-action: none; }
.graph-empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--ink-faint); font-size: 13px; pointer-events: none;
}
/* `display: grid` above outranks the UA [hidden] rule, so restate it. */
.graph-empty[hidden] { display: none; }

.link-line { stroke: #2b344a; stroke-width: 1.1; transition: stroke 0.18s, stroke-width 0.18s; }
.link-line.hot { stroke: rgba(255, 255, 255, 0.55); stroke-width: 1.9; }
.link-line.faded { stroke: rgba(43, 52, 74, 0.3); }

.node circle { cursor: pointer; transition: opacity 0.18s, stroke-width 0.15s; }
.node .halo { fill: none; stroke: currentColor; opacity: 0; transition: opacity 0.2s, r 0.2s; }
.node.selected .halo, .node.neighbour .halo { opacity: 0.32; }
.node text {
  font: 500 10px/1 var(--font);
  fill: var(--ink-dim);
  pointer-events: none;
  paint-order: stroke;
  stroke: #0d1018;
  stroke-width: 3px;
}
.node.selected text, .node.neighbour text { fill: var(--ink); }
.node.faded { opacity: 0.22; }
.node.new-bead circle.core { stroke: #fff; stroke-width: 2.4; }

.inspector {
  margin-top: 12px;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 12px 14px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.inspector-empty { color: var(--ink-faint); }
.inspector h3 { margin: 0 0 5px; font-size: 14px; line-height: 1.35; }
.inspector .ins-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 9px; flex-wrap: wrap; }
.inspector .ins-body { color: var(--ink-dim); margin-bottom: 9px; }
.inspector ul { margin: 0; padding-left: 17px; color: var(--ink-dim); }
.inspector li { margin-bottom: 3px; }
.inspector .no-links { color: var(--ink-faint); }

/* --------------------------------------------------------------- feed --- */
.event-feed { list-style: none; margin: 0; padding: 0; max-height: 22vh; overflow-y: auto; }
.event-feed li { font: 400 12px/1.5 var(--mono); color: var(--ink-dim); padding: 5px 0; border-bottom: 1px solid rgba(35, 42, 59, 0.5); }
.event-feed li:last-child { border-bottom: none; }
.event-feed .kind { color: var(--accent); }
.event-feed time { color: var(--ink-faint); margin-right: 7px; }

/* --------------------------------------------------------------- foot --- */
.foot {
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 11px 22px 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 12px;
}
.foot code { font-family: var(--mono); color: var(--ink-dim); }

@media (prefers-reduced-motion: reduce) {
  .dot, .mic.listening { animation: none; }
}
/* AI Added: the public deployment hides the reset button from the audience. */
button[hidden] { display: none; }
