.chatbot-lab-page {
  background:
    radial-gradient(circle at 15% 0%, rgba(147, 219, 239, 0.28), transparent 30%),
    radial-gradient(circle at 89% 10%, rgba(183, 210, 239, 0.33), transparent 35%),
    linear-gradient(180deg, #f8fcfe 0%, #edf3f7 100%);
}

.chatbot-lab-page .hero h1 {
  max-width: 860px;
}

.lab-intro-panel {
  margin-top: 0.2rem;
}

.lab-shell {
  margin: 1.1rem auto 2.2rem;
  display: grid;
  grid-template-columns: minmax(290px, 1fr) minmax(620px, 1.7fr) minmax(290px, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.lab-mobile-dock {
  display: none;
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.lab-overlay-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(8, 21, 33, 0.55);
  backdrop-filter: blur(3px);
  z-index: 45;
}

.lab-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
}

.lab-controls {
  display: grid;
  gap: 0.75rem;
  margin-top: 4.55rem;
}

.lab-panel-head h2,
.lab-stage-head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.lab-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem 0.65rem;
}

.lab-panel-head p {
  grid-column: 1 / -1;
}

.lab-panel-close {
  display: none;
  border: 1px solid #bed3dc;
  border-radius: 999px;
  background: #ffffff;
  color: #1d4556;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.31rem 0.62rem;
  cursor: pointer;
}

.lab-panel-head p,
.lab-stage-head p {
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
  font-size: 0.93rem;
}

.lab-block-title {
  margin: 0 0 0.5rem;
  font-weight: 700;
  color: #154355;
  font-size: 0.84rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.lab-preset-block {
  margin-top: 0.95rem;
}

.lab-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.42rem;
}

.lab-chip {
  border: 1px solid #bdd6df;
  border-radius: 999px;
  background: #f6fbfe;
  color: #1d4253;
  padding: 0.45rem 0.65rem;
  font-weight: 700;
  font-size: 0.79rem;
  cursor: pointer;
  transition: all 170ms var(--easing);
}

.lab-chip:hover,
.lab-chip:focus-visible {
  border-color: #7faec0;
  background: #ffffff;
  transform: translateY(-1px);
  outline: none;
}

.lab-chip.active {
  border-color: #0f6e87;
  background: linear-gradient(135deg, #0d8aa8, #0a6279);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(13, 90, 120, 0.25);
}

.lab-sliders {
  display: grid;
  gap: 0.54rem;
  margin-top: 1rem;
}

.lab-slider-row {
  display: grid;
  gap: 0.32rem;
}

.lab-slider-row span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.87rem;
  color: #274858;
}

.lab-slider-row input[type="range"] {
  width: 100%;
  accent-color: #0d8aa8;
}

.lab-config-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.lab-config-grid label {
  display: grid;
  gap: 0.28rem;
  font-size: 0.8rem;
  color: #345665;
}

.lab-config-help {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #5a7583;
}

.lab-config-grid select {
  border-radius: 9px;
  border: 1px solid #c2d9e2;
  background: #ffffff;
  padding: 0.44rem 0.5rem;
  font-size: 0.85rem;
  color: var(--ink);
}

.lab-config-grid select:disabled {
  background: #f3f7fa;
  color: #4f6573;
  cursor: not-allowed;
}

.lab-config-note {
  grid-column: 1 / -1;
  margin: 0.15rem 0 0;
  color: #5b7482;
  font-size: 0.74rem;
}

.lab-stage-wrap {
  display: grid;
  gap: 0.75rem;
}

.lab-stage {
  border: 1px solid #c5dce5;
  border-radius: var(--radius-lg);
  min-height: 680px;
  background:
    radial-gradient(circle at 50% 22%, rgba(206, 236, 247, 0.78), rgba(238, 247, 251, 0.7) 54%, rgba(255, 255, 255, 0.94) 100%);
  box-shadow: 0 18px 38px rgba(15, 48, 65, 0.11);
  padding: 1rem;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 1rem;
}

.lab-stage-state {
  margin: 0;
  font-size: 0.9rem;
  color: #2f5466;
}

.lab-stage-state strong {
  color: #0f3f52;
}

.lab-brain-shell {
  width: min(920px, 100%);
  display: grid;
  justify-items: stretch;
  gap: 0.55rem;
}

.lab-brain-toolbar {
  display: grid;
  gap: 0.38rem;
}

.lab-brain-toolbar-label {
  margin: 0;
  color: #19485b;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}

.lab-brain-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.lab-brain-filter {
  border: 1px solid #bdd6df;
  border-radius: 999px;
  background: rgba(247, 253, 255, 0.92);
  color: #184556;
  padding: 0.33rem 0.58rem;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 170ms var(--easing), border-color 170ms var(--easing), background 170ms var(--easing);
}

.lab-brain-filter:hover,
.lab-brain-filter:focus-visible {
  transform: translateY(-1px);
  border-color: #77a6b8;
  background: #ffffff;
  outline: none;
}

.lab-brain-filter.active {
  border-color: #0f6e87;
  color: #ffffff;
  background: linear-gradient(135deg, #0d8aa8, #0a6279);
}

.lab-brain-guide {
  border: 1px solid #c3d8e2;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  padding: 0.52rem 0.62rem;
}

.lab-brain-guide h4 {
  margin: 0;
  font-size: 0.78rem;
  color: #173f51;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.lab-brain-guide ul {
  margin: 0.4rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.22rem;
}

.lab-brain-guide li {
  color: #345a69;
  font-size: 0.77rem;
  line-height: 1.3;
}

.lab-brain-canvas {
  width: 100%;
  min-height: 500px;
  height: clamp(500px, 58vh, 640px);
  position: relative;
  border: 1px solid #b8d6e2;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 44%, rgba(233, 247, 252, 0.95), rgba(203, 229, 239, 0.9) 40%, rgba(181, 216, 229, 0.82) 100%);
  box-shadow: inset 0 0 28px rgba(255, 255, 255, 0.62), 0 20px 40px rgba(10, 53, 71, 0.16);
  overflow: hidden;
}

.lab-brain-canvas canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.lab-brain-label-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.lab-brain-label {
  display: inline-block;
  max-width: 120px;
  min-width: 18px;
  text-align: center;
  color: #053246;
  background: rgba(238, 248, 253, 0.5);
  border: 1px solid rgba(127, 174, 191, 0.48);
  border-radius: 999px;
  padding: 0.04rem 0.22rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 160ms linear, font-size 160ms linear;
}

.lab-brain-label.title-mode {
  border-radius: 0;
  font-weight: 520;
  background: transparent;
  border-color: transparent;
  color: rgba(241, 250, 255, 0.9);
  text-shadow:
    0 1px 0 rgba(3, 31, 44, 0.28),
    0 0 2px rgba(3, 31, 44, 0.26);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-overflow: clip;
  letter-spacing: 0.005em;
  line-height: 1.06;
  padding: 0;
}

.lab-brain-label.focus {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(31, 138, 161, 0.92);
  color: #08384b;
}

.lab-brain-hint {
  margin: 0;
  text-align: center;
  color: #365f70;
  font-size: 0.86rem;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.lab-brain-inspector {
  padding: 0.72rem 0.82rem;
}

.lab-brain-inspector h3 {
  margin: 0;
  font-size: 0.95rem;
}

.lab-brain-inspector p {
  margin: 0.32rem 0 0;
  font-size: 0.82rem;
  color: #345767;
}

.lab-brain-inspector-text {
  margin-top: 0.5rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.lab-brain-links-wrap {
  margin-top: 0.52rem;
}

.lab-brain-links-wrap p {
  margin: 0;
}

.lab-brain-links {
  margin: 0.32rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.24rem;
}

.lab-brain-links li {
  font-size: 0.8rem;
  color: #3b5e6d;
}

.lab-avatar {
  position: relative;
  width: min(350px, 100%);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1px solid #b6d2de;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.98), rgba(219, 240, 248, 0.95) 42%, rgba(198, 227, 238, 0.85) 100%);
  box-shadow: inset 0 2px 12px rgba(255, 255, 255, 0.8), 0 22px 42px rgba(12, 62, 82, 0.16);
  overflow: hidden;
  display: none;
}

.lab-brain-fallback .lab-avatar {
  display: block;
}

.lab-brain-fallback .lab-brain-canvas {
  display: none;
}

.lab-core {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 106px;
  height: 106px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: linear-gradient(145deg, #1fa0c0, #0f6c86);
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 0 10px rgba(101, 185, 212, 0.2), 0 15px 30px rgba(12, 57, 75, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  text-shadow: 0 2px 5px rgba(6, 37, 48, 0.34);
}

.lab-wave {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 144px;
  height: 144px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(17, 127, 157, 0.3);
  opacity: 0.55;
  pointer-events: none;
}

.lab-neuron {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #7caec0;
  background: rgba(244, 251, 255, 0.96);
  color: #1a4f60;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(16, 76, 98, 0.16);
  transition: transform 170ms var(--easing), box-shadow 170ms var(--easing), border-color 170ms ease;
}

.lab-neuron:hover,
.lab-neuron:focus-visible {
  transform: translateY(-2px) scale(1.02);
  border-color: #4e8fa6;
  box-shadow: 0 12px 22px rgba(12, 70, 92, 0.26);
  outline: none;
}

.lab-neuron.active {
  background: linear-gradient(135deg, #22a4c5, #0f6e87);
  color: #ffffff;
  border-color: #0f6e87;
}

.lab-neuron.n1 {
  left: 18%;
  top: 11%;
}

.lab-neuron.n2 {
  left: 52%;
  top: 6%;
}

.lab-neuron.n3 {
  right: 12%;
  top: 28%;
}

.lab-neuron.n4 {
  right: 14%;
  bottom: 24%;
}

.lab-neuron.n5 {
  left: 52%;
  bottom: 7%;
}

.lab-neuron.n6 {
  left: 13%;
  bottom: 24%;
}

.lab-stage-caption {
  display: block;
  margin: 0.48rem 0 0;
  text-align: center;
  font-size: 0.82rem;
  color: rgba(38, 86, 103, 0.92);
  letter-spacing: 0.01em;
  min-height: 1.2em;
  overflow-wrap: anywhere;
}

.lab-stage-caption-meta {
  display: none;
  margin: 0.12rem 0 0;
  text-align: center;
  font-size: 0.68rem;
  color: rgba(38, 86, 103, 0.62);
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.lab-tour {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.lab-tour.is-active {
  pointer-events: none;
}

.lab-tour-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 18, 24, 0.6);
  pointer-events: none;
}

.lab-tour-spotlight {
  position: absolute;
  border-radius: 18px;
  box-shadow: 0 0 0 9999px rgba(6, 18, 24, 0.62);
  transition: all 220ms ease;
  border: 1px solid rgba(175, 220, 235, 0.5);
  pointer-events: none;
}

.lab-tour-card {
  position: absolute;
  max-width: 320px;
  background: rgba(10, 30, 40, 0.9);
  color: #e7f5fb;
  border: 1px solid rgba(162, 217, 235, 0.35);
  border-radius: 18px;
  box-shadow: 0 20px 40px rgba(3, 10, 14, 0.35);
  padding: 1rem 1rem 0.85rem;
  transition: transform 220ms ease, opacity 220ms ease;
  pointer-events: auto;
  touch-action: manipulation;
}

.lab-tour-card h3 {
  margin: 0.2rem 0 0.5rem;
  font-size: 1.02rem;
  color: #e9f7fd;
}

.lab-tour-card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.35;
  color: rgba(231, 245, 251, 0.9);
}

.lab-tour-step-count {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(188, 226, 240, 0.8);
}

.lab-tour-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.lab-tour-actions .btn {
  flex: 1;
  padding: 0.5rem 0.8rem;
  pointer-events: auto;
}

.lab-tour-close {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  background: transparent;
  border: none;
  color: rgba(231, 245, 251, 0.8);
  font-size: 1.2rem;
  cursor: pointer;
  pointer-events: auto;
}

@media (max-width: 900px) {
  .lab-tour-card {
    max-width: calc(100% - 2.2rem);
  }
}

@media (max-width: 720px) {
  .lab-tour-spotlight {
    transition: none;
  }

  .lab-tour-card {
    width: min(92vw, 360px);
    max-width: 92vw;
    padding: 0.85rem 0.9rem 0.75rem;
    border-radius: 16px;
    transition: none;
  }

  .lab-tour-card h3 {
    font-size: 0.98rem;
  }

  .lab-tour-card p {
    font-size: 0.86rem;
  }
}

.lab-stage[data-state="listening"] .lab-core {
  transform: translate(-50%, -50%) scale(1.03);
}

.lab-stage[data-state="retrieving"] .lab-wave {
  animation: lab-wave-pulse 0.95s ease-in-out infinite;
}

.lab-stage[data-state="composing"] .lab-core {
  animation: lab-core-think 0.9s ease-in-out infinite;
}

.lab-stage[data-state="responding"] .lab-core {
  animation: lab-core-speak 0.65s ease-in-out 2;
}

.lab-stage[data-state="fallback"] .lab-core {
  background: linear-gradient(135deg, #2f8ead, #15556a);
}

.lab-stage[data-state="conflict-fallback"] .lab-core {
  background: linear-gradient(135deg, #be7a2f, #7b2c15);
}

.lab-stage[data-state="conflict-fallback"] .lab-wave {
  animation: lab-wave-pulse 1.1s ease-in-out infinite;
}

.lab-workbench {
  display: grid;
  gap: 0.75rem;
  margin-top: 4.55rem;
}

.lab-brain-viewport {
  position: relative;
  width: 100%;
}

.lab-kb-box {
  border: 1px solid #ccdde5;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  padding: 0.68rem;
}

.lab-kb-feed {
  display: grid;
  gap: 0.4rem;
}

.lab-kb {
  max-height: 210px;
  min-height: 210px;
  overflow-y: auto;
  display: grid;
  gap: 0.3rem;
  padding-right: 0.12rem;
  scrollbar-gutter: stable;
}

.lab-kb-item {
  border: 1px solid #c7dce4;
  border-radius: 8px;
  background: #f7fbfd;
  padding: 0.32rem 0.4rem;
}

.lab-kb-item h4 {
  margin: 0;
  font-size: 0.74rem;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  line-height: 1.15;
}

.lab-kb-item p {
  margin: 0.16rem 0 0;
  font-size: 0.69rem;
  line-height: 1.24;
  color: #365969;
}

.lab-kb-item .lab-kb-meta {
  margin-top: 0.16rem;
  font-size: 0.63rem;
  color: #4e6f7e;
}

.lab-kb-empty {
  margin: 0;
  border: 1px dashed #bfd6e1;
  border-radius: 9px;
  background: rgba(247, 252, 255, 0.95);
  color: #3f6070;
  padding: 0.5rem;
  font-size: 0.75rem;
  line-height: 1.3;
}

.lab-kb-item button {
  margin-top: 0.4rem;
  border: 1px solid #bfd2da;
  border-radius: 999px;
  background: #ffffff;
  color: #204657;
  padding: 0.25rem 0.52rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.lab-kb-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.lab-kb-form .lab-block-title {
  margin: 0;
  padding: 0.58rem;
  border-bottom: 1px solid #d4e4ea;
}

.lab-discovery-box {
  display: grid;
  gap: 0.4rem;
}

.lab-kb-form input,
.lab-kb-form textarea {
  width: 100%;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid #d4e4ea;
  background: #f9fcfe;
  padding: 0.56rem 0.62rem;
  font: inherit;
  font-size: 0.9rem;
}

.lab-kb-form textarea {
  min-height: 300px;
  max-height: 420px;
  resize: vertical;
}

.lab-kb-form-actions {
  display: flex;
  align-items: center;
  padding: 0.58rem;
  min-width: 0;
}

.lab-kb-form-actions .btn {
  width: 100%;
}

.lab-chat-box {
  border: 1px solid #c7dce4;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.9);
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
}

.lab-chat-log {
  min-height: 300px;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.48rem;
  background: #f9fcfe;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
  overscroll-behavior: contain;
  word-break: break-word;
}

.lab-chat-msg {
  border-radius: 10px;
  padding: 0.52rem 0.58rem;
  font-size: 0.85rem;
  line-height: 1.4;
  width: auto;
  display: inline-block;
  max-width: 86%;
  min-width: 0;
  box-sizing: border-box;
  height: auto;
}

.lab-chat-msg p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.lab-evidence {
  margin-top: 0.42rem;
  display: grid;
  gap: 0.24rem;
  max-width: 100%;
  min-width: 0;
}

.lab-evidence-label {
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #2f6070;
  font-weight: 700;
}

.lab-evidence-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.lab-evidence-chip {
  border: 1px solid #b9d7e2;
  border-radius: 999px;
  background: #f1f9fc;
  color: #1f4f62;
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.2;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.lab-evidence-chip.primary {
  border-color: #7fb5c7;
  background: #e6f4fa;
  color: #164659;
}

.lab-chat-msg.user {
  align-self: flex-end;
  max-width: 74%;
  border: 1px solid #bddce6;
  background: #e7f4f8;
}

.lab-chat-msg.bot {
  align-self: flex-start;
  max-width: 84%;
  border: 1px solid #d1dfe5;
  background: #f0f5f8;
}

.lab-chat-msg.bot.conflict-fallback {
  border-color: #e2bf9a;
  background: #fff3e8;
  color: #5d2d16;
}

.lab-chat-msg.loading {
  max-width: 150px;
  border: 1px solid #c7dce4;
  background: #eef8fc;
  color: #0f5f7a;
  font-weight: 700;
}

.lab-chat-input {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0.58rem;
  border-top: 1px solid #d4e4ea;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.lab-chat-input input {
  flex: 1 1 220px;
  width: auto;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid #bed5de;
  border-radius: 10px;
  padding: 0.56rem 0.62rem;
  font: inherit;
  font-size: 0.9rem;
}

.lab-chat-input .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.lab-explain {
  padding: 0.78rem 0.85rem;
}

.lab-explain h3 {
  margin: 0;
  font-size: 0.96rem;
}

.lab-explain-summary {
  margin: 0.42rem 0 0.5rem;
  border: 1px solid #c5dce5;
  border-radius: 9px;
  background: #f6fbfd;
  color: #2f5566;
  padding: 0.46rem 0.52rem;
  font-size: 0.78rem;
  line-height: 1.35;
}

.lab-explain-summary.is-empty {
  color: #54707e;
}

.lab-explain-summary.is-loading {
  color: #356274;
}

.lab-explain-toggle {
  margin-top: 0.08rem;
  border: 1px solid #bed5de;
  border-radius: 999px;
  background: #f6fbfd;
  color: #1a5c74;
  font: inherit;
  font-size: 0.76rem;
  line-height: 1.2;
  font-weight: 700;
  padding: 0.3rem 0.56rem;
  cursor: pointer;
}

.lab-explain-toggle:hover,
.lab-explain-toggle:focus-visible {
  border-color: #7ba9bc;
  background: #ffffff;
  outline: none;
}

.lab-explain-details {
  margin-top: 0.34rem;
}

.lab-explain p {
  margin: 0.33rem 0 0;
  font-size: 0.83rem;
  color: #355767;
}

.lab-timeline {
  padding: 0.78rem 0.85rem;
}

.lab-timeline h3 {
  margin: 0;
  font-size: 0.96rem;
}

.lab-timeline-note {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: #4a6776;
}

.lab-timeline-list {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.35rem;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 0.1rem;
}

.lab-timeline-empty {
  margin: 0;
  border: 1px dashed #bfd6e1;
  border-radius: 10px;
  background: rgba(247, 252, 255, 0.95);
  color: #3f6070;
  padding: 0.55rem 0.62rem;
  font-size: 0.8rem;
}

.lab-timeline-item {
  width: 100%;
  border: 1px solid #c6dce5;
  border-radius: 10px;
  background: #f8fcfe;
  padding: 0.45rem 0.52rem;
  display: grid;
  gap: 0.18rem;
  text-align: left;
  cursor: pointer;
}

.lab-timeline-item:hover,
.lab-timeline-item:focus-visible {
  border-color: #86b2c4;
  background: #ffffff;
  outline: none;
}

.lab-timeline-item.active {
  border-color: #0f6e87;
  background: #ecf7fb;
}

.lab-timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.lab-timeline-title {
  margin: 0;
  font-size: 0.78rem;
  color: #17495c;
  font-weight: 700;
}

.lab-timeline-status {
  border: 1px solid #c6dce5;
  border-radius: 999px;
  padding: 0.08rem 0.36rem;
  font-size: 0.68rem;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #2f6070;
  background: #ffffff;
}

.lab-timeline-status.pass {
  border-color: #9fd2b5;
  color: #215b3b;
  background: #ebf8f0;
}

.lab-timeline-status.fail {
  border-color: #e4b2b2;
  color: #7d2929;
  background: #fff0f0;
}

.lab-timeline-status.skip {
  border-color: #d4dbe0;
  color: #5a6770;
  background: #f4f7f9;
}

.lab-timeline-detail {
  margin: 0;
  color: #395c6b;
  font-size: 0.76rem;
  line-height: 1.3;
}

.lab-timeline-meta {
  margin: 0;
  color: #527181;
  font-size: 0.72rem;
  line-height: 1.25;
}

.lab-timeline-live {
  position: absolute;
  left: 0.66rem;
  bottom: 0.62rem;
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 0.34rem;
  max-width: min(92%, 520px);
  pointer-events: auto;
}

.lab-rotation-toggle {
  position: absolute;
  left: 0.66rem;
  top: 0.62rem;
  z-index: 14;
  border: 1px solid rgba(130, 172, 188, 0.75);
  border-radius: 999px;
  background: rgba(240, 250, 255, 0.34);
  color: rgba(23, 79, 100, 0.92);
  font-size: 0.62rem;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.24rem 0.48rem;
  cursor: pointer;
  backdrop-filter: blur(1.6px);
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.lab-rotation-toggle:hover,
.lab-rotation-toggle:focus-visible {
  border-color: rgba(84, 145, 166, 0.92);
  background: rgba(249, 254, 255, 0.7);
  color: #0f5d78;
  transform: translateY(-1px);
  outline: none;
}

.lab-rotation-toggle.is-off {
  background: rgba(240, 247, 251, 0.62);
  border-color: rgba(145, 173, 186, 0.85);
  color: rgba(45, 80, 94, 0.92);
}

.lab-timeline-toggle {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(139, 178, 193, 0.75);
  border-radius: 999px;
  background: rgba(247, 252, 255, 0.68);
  color: #1f5569;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

.lab-timeline-toggle:hover,
.lab-timeline-toggle:focus-visible {
  border-color: rgba(96, 151, 170, 0.95);
  background: rgba(252, 255, 255, 0.88);
  color: #0c4f67;
  transform: scale(1.04);
  outline: none;
}

.lab-timeline-live-text {
  margin: 0;
  font-size: 0.63rem;
  line-height: 1.22;
  letter-spacing: 0.01em;
  color: rgba(23, 73, 92, 0);
  text-shadow: 0 1px 2px rgba(235, 248, 255, 0.22);
  transition: color 220ms ease, text-shadow 220ms ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(86vw, 480px);
}

.lab-timeline-live.is-visible .lab-timeline-live-text {
  color: rgba(24, 76, 96, 0.86);
  text-shadow: 0 1px 2px rgba(235, 248, 255, 0.68);
}

.lab-timeline-overlay {
  position: absolute;
  left: 0.62rem;
  bottom: 1.76rem;
  z-index: 13;
  width: min(300px, calc(100% - 1.24rem));
  max-height: min(48%, 220px);
  border: 1px solid rgba(146, 189, 206, 0.46);
  border-radius: 10px;
  background: rgba(239, 249, 255, 0.24);
  backdrop-filter: blur(1.8px);
  box-shadow: 0 10px 22px rgba(10, 53, 71, 0.12);
  padding: 0.35rem 0.42rem;
  opacity: 0.68;
  transition: opacity 220ms ease, background 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.lab-timeline-overlay:hover,
.lab-timeline-overlay:focus-within {
  opacity: 0.95;
  border-color: rgba(109, 166, 186, 0.84);
  background: rgba(244, 252, 255, 0.72);
  box-shadow: 0 12px 26px rgba(10, 53, 71, 0.19);
}

.lab-timeline-overlay h3 {
  font-size: 0.58rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(31, 79, 97, 0.88);
}

.lab-timeline-overlay .lab-timeline-note {
  display: none;
}

.lab-timeline-overlay .lab-timeline-list {
  margin-top: 0.24rem;
  max-height: 138px;
  gap: 0.2rem;
  padding-right: 0.04rem;
}

.lab-timeline-overlay .lab-timeline-empty {
  border-radius: 8px;
  padding: 0.3rem 0.34rem;
  font-size: 0.58rem;
}

.lab-timeline-overlay .lab-timeline-item {
  border-radius: 8px;
  padding: 0.24rem 0.3rem;
  gap: 0.14rem;
  background: rgba(248, 253, 255, 0.56);
}

.lab-timeline-overlay .lab-timeline-title {
  font-size: 0.58rem;
}

.lab-timeline-overlay .lab-timeline-status {
  font-size: 0.5rem;
  padding: 0.03rem 0.2rem;
}

.lab-timeline-overlay .lab-timeline-detail {
  font-size: 0.56rem;
  line-height: 1.2;
}

.lab-timeline-overlay .lab-timeline-meta {
  font-size: 0.53rem;
  line-height: 1.16;
}

@keyframes lab-wave-pulse {
  0% {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0.55;
  }

  100% {
    transform: translate(-50%, -50%) scale(1.35);
    opacity: 0;
  }
}

@keyframes lab-core-think {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }

  50% {
    transform: translate(-50%, -50%) scale(1.07);
  }
}

@keyframes lab-core-speak {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }

  50% {
    transform: translate(-50%, -50%) scale(1.1);
  }
}

@media (max-width: 1200px) {
  .lab-shell {
    grid-template-columns: 1fr;
  }

  .lab-controls,
  .lab-workbench {
    margin-top: 0;
  }

  .lab-stage {
    min-height: 620px;
  }

  .lab-timeline-overlay {
    position: static;
    width: 100%;
    max-height: none;
    margin-top: 0.5rem;
    opacity: 1;
    border-color: #c6dce5;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: none;
    backdrop-filter: none;
    padding: 0.62rem 0.72rem;
  }

  .lab-timeline-overlay .lab-timeline-note {
    display: block;
  }

  .lab-timeline-overlay .lab-timeline-list {
    max-height: 220px;
    gap: 0.35rem;
    margin-top: 0.45rem;
  }

  .lab-timeline-overlay .lab-timeline-item {
    border-radius: 10px;
    padding: 0.42rem 0.5rem;
  }

  .lab-timeline-overlay .lab-timeline-title {
    font-size: 0.75rem;
  }

  .lab-timeline-overlay .lab-timeline-status {
    font-size: 0.64rem;
    padding: 0.08rem 0.32rem;
  }

  .lab-timeline-overlay .lab-timeline-detail {
    font-size: 0.72rem;
  }

  .lab-timeline-overlay .lab-timeline-meta {
    font-size: 0.68rem;
  }
}

@media (max-width: 1020px) {
  .lab-shell {
    transform: none !important;
  }

  .lab-mobile-dock {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lab-controls,
  .lab-workbench {
    position: fixed;
    top: 0;
    height: 100dvh;
    width: min(92vw, 430px);
    max-width: 430px;
    z-index: 60;
    overflow-y: auto;
    background: transparent;
    backdrop-filter: blur(5px) saturate(1.04);
    -webkit-backdrop-filter: blur(5px) saturate(1.04);
    border-radius: 0;
    border: 1px solid rgba(168, 199, 212, 0.34);
    box-shadow: 0 10px 26px rgba(6, 30, 44, 0.24);
    transition: transform 220ms var(--easing);
    padding-bottom: calc(0.95rem + env(safe-area-inset-bottom, 0px));
    scroll-padding-bottom: calc(0.95rem + env(safe-area-inset-bottom, 0px));
  }

  .lab-controls {
    left: 0;
    transform: translateX(-105%);
  }

  .lab-workbench {
    right: 0;
    transform: translateX(105%);
  }

  .lab-panel-close {
    display: inline-flex;
    align-items: center;
  }

  .lab-chat-box {
    position: relative;
    z-index: 2;
    background: transparent;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .lab-chat-input {
    position: sticky;
    bottom: 0;
    z-index: 6;
    background: rgba(246, 252, 255, 0.82);
    backdrop-filter: blur(3.2px);
    -webkit-backdrop-filter: blur(3.2px);
    border-top: 1px solid rgba(188, 214, 224, 0.92);
  }

  .lab-explain {
    position: relative;
    z-index: 1;
    background: transparent;
  }

  .lab-kb-form,
  .lab-kb-box {
    background: transparent;
  }

  .lab-chat-log {
    position: relative;
    z-index: 1;
    background: rgba(249, 253, 255, 0.52);
    backdrop-filter: blur(1.4px);
    -webkit-backdrop-filter: blur(1.4px);
    padding-bottom: 0.75rem;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .lab-overlay-backdrop {
    background: rgba(8, 21, 33, 0.16);
    backdrop-filter: blur(1.8px);
    -webkit-backdrop-filter: blur(1.8px);
  }

  body[data-open-panel="controls"] .lab-controls {
    transform: translateX(0);
  }

  body[data-open-panel="workbench"] .lab-workbench {
    transform: translateX(0);
  }

  body[data-open-panel] {
    overflow: hidden;
  }

  body[data-open-panel] .lab-overlay-backdrop {
    display: block;
  }
}

@media (max-width: 640px) {
  .lab-presets {
    grid-template-columns: 1fr;
  }

  .lab-config-grid {
    grid-template-columns: 1fr;
  }

  .lab-stage {
    min-height: 510px;
    padding: 0.8rem;
  }

  .lab-brain-canvas {
    min-height: 360px;
    height: clamp(360px, 48vh, 460px);
  }

  .lab-brain-filter {
    font-size: 0.7rem;
    padding: 0.31rem 0.5rem;
  }

  .lab-brain-guide li {
    font-size: 0.73rem;
  }

  .lab-neuron {
    width: 40px;
    height: 40px;
    font-size: 0.93rem;
  }

  .lab-core {
    width: 96px;
    height: 96px;
    font-size: 2rem;
  }

  .lab-chat-input input,
  .lab-chat-input .btn {
    flex-basis: 100%;
    width: 100%;
  }

  .lab-chat-log {
    min-height: 250px;
    max-height: min(44vh, 340px);
  }

  .lab-kb-form textarea {
    min-height: 230px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lab-core,
  .lab-wave {
    animation: none !important;
  }

  .lab-chip,
  .lab-neuron {
    transition: none !important;
  }
}
