/* Proto-CKY Interactive Demo — Single panel */

#nca-demo {
  margin: 1.5rem 0 2.5rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Toolbar: model selector + status ────────────────────── */
.demo-toolbar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.5rem;
}
.demo-model-select {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.demo-select-label {
  font-size: 0.65rem;
  color: rgba(0,0,0,0.35);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.demo-model-select select {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 4px;
  background: #fff;
  color: rgba(0,0,0,0.7);
  cursor: pointer;
  max-width: 280px;
}
.demo-model-select select:hover { border-color: rgba(0,0,0,0.25); }

.demo-status {
  font-size: 0.65rem;
  color: rgba(0,0,0,0.3);
  margin-left: auto;
  white-space: nowrap;
}

/* ── Expression + tags ───────────────────────────────────── */
.demo-expr {
  padding: 0.6rem 0;
  font-family: Menlo, Monaco, Consolas, monospace;
  font-size: 1.1rem;
  line-height: 1.8;
}
.demo-tid { color: #1a5276; }
.demo-top { color: #922b21; font-weight: 600; }
.demo-tpar { color: #7d6608; }
.demo-tags {
  margin-left: 0.6rem;
  display: inline-flex;
  gap: 0.3rem;
  vertical-align: baseline;
}
.demo-tag {
  padding: 0.12rem 0.5rem;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: 'Inter', -apple-system, sans-serif;
}
.demo-tag.valid { background: #d5f5e3; color: #1e8449; }
.demo-tag.invalid { background: #fadbd8; color: #922b21; }
.demo-tag.converged { background: #e8f4f8; color: #1a6b8a; }
.demo-tag.not-converged { background: #fef3cd; color: #856404; }
.demo-tag.step { background: #f0f0f0; color: rgba(0,0,0,0.5); }

/* ── Main: canvas left, controls right ───────────────────── */
.demo-body {
  display: flex;
  gap: 0;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 6px;
  background: #fafafa;
}

.demo-canvas-wrap {
  flex: 1;
  min-width: 0;
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  position: relative;
}

#demo-canvas { border-radius: 3px; }

.demo-tooltip {
  position: absolute;
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: Menlo, Monaco, monospace;
  font-size: 0.6rem;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

/* ── Controls panel ──────────────────────────────────────── */
.demo-controls {
  width: 180px;
  flex-shrink: 0;
  padding: 1.5rem 1.25rem;
  border-left: 1px solid rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

@media (max-width: 640px) {
  .demo-body { flex-direction: column; }
  .demo-controls {
    width: 100%;
    border-left: none;
    border-top: 1px solid rgba(0,0,0,0.06);
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.8rem 1.25rem;
  }
}

.demo-playback {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.demo-play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #2a6e6e;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(42,110,110,0.25);
}
.demo-play-btn:hover { background: #1e5555; transform: scale(1.05); }
.demo-play-btn:active { transform: scale(0.95); }

.demo-reset-btn {
  width: 38px;
  height: 38px;
  background: #f0f0f0;
  color: rgba(0,0,0,0.5);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.demo-reset-btn:hover { background: #e4e4e4; color: rgba(0,0,0,0.7); }

.demo-step-btn {
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
  background: #fff;
  color: rgba(0,0,0,0.5);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.12s;
  width: 100%;
  text-align: center;
}
.demo-step-btn:hover { background: #f5f5f5; color: rgba(0,0,0,0.7); }

.demo-slider-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
}
.demo-slider-label {
  font-size: 0.65rem;
  color: rgba(0,0,0,0.35);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.demo-slider-row input[type="range"],
.demo-generate input[type="range"] {
  width: 100%;
  accent-color: #2a6e6e;
}

.demo-channel {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  color: rgba(0,0,0,0.4);
}
.demo-ch {
  padding: 0.15rem 0.5rem;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 3px;
  background: #fff;
  color: rgba(0,0,0,0.4);
  font-family: Menlo, monospace;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.12s;
}
.demo-ch:hover { background: #f5f5f5; }
.demo-ch.active {
  background: #eef6f6;
  border-color: rgba(42,110,110,0.25);
  color: #2a6e6e;
  font-weight: 600;
}

/* ── Generate controls ───────────────────────────────────── */
.demo-generate {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: center;
}
.demo-gen-btns {
  display: flex;
  gap: 0.3rem;
  width: 100%;
}
.demo-gen-btn {
  flex: 1;
  padding: 0.3rem 0;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
  background: #fff;
  color: rgba(0,0,0,0.5);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
}
.demo-gen-btn:hover { background: #f5f5f5; color: rgba(0,0,0,0.7); }

/* ── Token input + examples ──────────────────────────────── */
.demo-input {
  padding: 0.8rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.demo-tokens {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}
.demo-tok {
  padding: 0.25rem 0.6rem;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 3px;
  background: #fff;
  color: rgba(0,0,0,0.7);
  font-family: Menlo, Monaco, monospace;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.12s;
}
.demo-tok:hover { background: #f0f0f0; border-color: rgba(0,0,0,0.2); }
.demo-del { color: rgba(0,0,0,0.4); }

.demo-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.demo-ex {
  padding: 0.15rem 0.5rem;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  background: #fff;
  color: rgba(0,0,0,0.5);
  font-family: Menlo, Monaco, monospace;
  font-size: 0.6rem;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.demo-ex:hover { background: #f5f5f5; color: rgba(0,0,0,0.7); }
.demo-inv { border-style: dashed; }
