#sb-panel {
  --sb-bg:     #050508;
  --sb-panel:  #0d0d18;
  --sb-border: #1a1a2e;
  --sb-cyan:   #00c8ff;
  --sb-purple: #b06aff;
  --sb-white:  #e8e8f0;
  --sb-dim:    #5a5a7a;
  --sb-accent: #00c8ff;

  font-family: 'Share Tech Mono', monospace;
  margin: 48px 0 0;
  width: 100%;
  color: var(--sb-white);
}

#sb-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: var(--sb-panel);
  border: 1px solid var(--sb-border);
  border-left: 3px solid var(--sb-accent);
  cursor: pointer;
  clip-path: polygon(12px 0%, 100% 0%, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0% 100%, 0% 12px);
  transition: background 0.2s;
  user-select: none;
}

#sb-trigger:hover { background: rgba(255,255,255,0.02); }

.sb-trigger-left { display: flex; align-items: center; gap: 14px; }

.sb-trigger-icon { width: 34px; height: 34px; flex-shrink: 0; position: relative; }
.sb-trigger-icon svg { width: 100%; height: 100%; }

.sb-pulse {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid var(--sb-accent);
  animation: sb-pulse 2.4s ease-out infinite;
  opacity: 0;
}
@keyframes sb-pulse {
  0%   { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1.35); opacity: 0; }
}

.sb-trigger-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sb-accent);
}

.sb-trigger-sub {
  font-size: 0.68rem;
  color: var(--sb-dim);
  letter-spacing: 0.08em;
  margin-top: 3px;
}

.sb-trigger-sub em { font-style: normal; color: var(--sb-white); opacity: 0.7; }

.sb-chevron {
  color: var(--sb-dim);
  font-size: 0.75rem;
  font-family: 'Orbitron', sans-serif;
  transition: transform 0.3s, color 0.2s;
}

#sb-panel.sb-open .sb-chevron { transform: rotate(180deg); color: var(--sb-accent); }

#sb-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4,0,0.2,1);
  border: 1px solid transparent;
  border-top: none;
}

#sb-panel.sb-open #sb-body {
  max-height: 620px;
  border-color: var(--sb-border);
  border-left: 3px solid var(--sb-accent);
  border-top: none;
  clip-path: polygon(0% 0%, 100% 0%, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0% 100%);
}

#sb-messages {
  height: 320px;
  overflow-y: auto;
  padding: 20px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--sb-bg);
  scrollbar-width: thin;
  scrollbar-color: var(--sb-border) transparent;
}
#sb-messages::-webkit-scrollbar { width: 3px; }
#sb-messages::-webkit-scrollbar-thumb { background: var(--sb-border); border-radius: 2px; }

.sb-msg { display: flex; gap: 12px; animation: sb-in 0.3s ease both; }
@keyframes sb-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

.sb-msg.sb-user { flex-direction: row-reverse; }

.sb-msg-icon {
  width: 28px; height: 28px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.58rem;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.04em;
  color: var(--sb-dim);
  border: 1px solid var(--sb-border);
  clip-path: polygon(6px 0%, 100% 0%, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0% 100%, 0% 6px);
  background: var(--sb-panel);
  margin-top: 2px;
}

.sb-bubble {
  max-width: 76%;
  padding: 12px 16px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.92rem;
  line-height: 1.75;
  letter-spacing: 0.02em;
  clip-path: polygon(8px 0%, 100% 0%, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0% 100%, 0% 8px);
}

.sb-msg.sb-bot .sb-bubble {
  background: var(--sb-panel);
  border: 1px solid rgba(0,0,0,0.3);
  border-left: 2px solid var(--sb-accent);
  color: var(--sb-white);
}

.sb-msg.sb-user .sb-bubble {
  background: rgba(176,106,255,0.06);
  border: 1px solid rgba(176,106,255,0.2);
  border-right: 2px solid var(--sb-purple);
  color: var(--sb-white);
  text-align: right;
}

#sb-typing { display: none; gap: 12px; align-items: flex-start; }
#sb-typing.sb-visible { display: flex; }

.sb-dots {
  display: flex; gap: 4px;
  padding: 14px 18px;
  background: var(--sb-panel);
  border: 1px solid rgba(0,0,0,0.3);
  border-left: 2px solid var(--sb-accent);
  clip-path: polygon(8px 0%, 100% 0%, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0% 100%, 0% 8px);
}
.sb-dots span { width: 5px; height: 5px; background: var(--sb-accent); display: block; animation: sb-dot 1.2s ease-in-out infinite; }
.sb-dots span:nth-child(2) { animation-delay: 0.2s; }
.sb-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes sb-dot { 0%,80%,100%{transform:scaleY(0.4);opacity:0.3} 40%{transform:scaleY(1);opacity:1} }

/* ── Input row ── */

#sb-input-row {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 12px 16px;
  background: var(--sb-panel);
  border-top: 1px solid var(--sb-border);
}

#sb-image-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px; height: 28px;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.2s;
  margin-bottom: 4px;
}
#sb-image-btn:hover { opacity: 1; }
#sb-image-btn svg { display: block; }

#sb-input {
  flex: 1;
  background: transparent; border: none; outline: none;
  color: var(--sb-white);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.84rem;
  line-height: 1.5;
  resize: none; max-height: 80px;
  scrollbar-width: none;
}
#sb-input::placeholder { color: var(--sb-dim); }
#sb-input::-webkit-scrollbar { display: none; }

#sb-send {
  background: none;
  border: 1px solid rgba(0,200,255,0.35);
  color: var(--sb-accent);
  cursor: pointer;
  padding: 7px 14px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  clip-path: polygon(5px 0%, 100% 0%, calc(100% - 5px) 100%, 0% 100%);
  transition: background 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}
#sb-send:hover:not(:disabled) { background: rgba(0,200,255,0.08); box-shadow: 0 0 10px rgba(0,200,255,0.2); }
#sb-send:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Image preview row ── */

#sb-image-preview-row {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--sb-bg);
  border-top: 1px solid var(--sb-border);
}

#sb-image-preview-wrap {
  position: relative;
  display: inline-flex;
}

#sb-image-preview {
  max-width: 80px;
  max-height: 56px;
  border-radius: 3px;
  opacity: 0.8;
  display: block;
  border: 1px solid var(--sb-border);
}

#sb-image-clear {
  position: absolute;
  top: -6px; right: -6px;
  width: 16px; height: 16px;
  background: var(--sb-panel);
  border: 1px solid var(--sb-border);
  border-radius: 50%;
  color: var(--sb-dim);
  font-size: 0.55rem;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: color 0.15s, border-color 0.15s;
}
#sb-image-clear:hover { color: var(--sb-white); border-color: var(--sb-accent); }

/* ── Hint bar ── */

.sb-hint {
  font-size: 0.6rem; color: var(--sb-dim);
  letter-spacing: 0.07em; text-align: center;
  padding: 6px 16px 10px;
  background: var(--sb-bg);
  border-top: 1px solid var(--sb-border);
}

/* ── SENTIENT BEING v4 Voice UI additions ───────────────────── */

/* Voice bar row */
#sb-voice-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem 0;
}

/* Mic button */
#sb-mic-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 1px solid var(--sb-accent, #00ffe0);
  color: var(--sb-accent, #00ffe0);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  padding: 0.35rem 0.75rem;
  cursor: crosshair;
  clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px));
  transition: background 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

#sb-mic-btn:hover {
  background: color-mix(in srgb, var(--sb-accent, #00ffe0) 12%, transparent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--sb-accent, #00ffe0) 40%, transparent);
}

#sb-mic-btn.sb-listening {
  background: color-mix(in srgb, var(--sb-accent, #00ffe0) 20%, transparent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--sb-accent, #00ffe0) 60%, transparent);
  animation: sb-mic-pulse 1s ease-in-out infinite;
}

@keyframes sb-mic-pulse {
  0%, 100% { box-shadow: 0 0 8px color-mix(in srgb, var(--sb-accent, #00ffe0) 40%, transparent); }
  50%       { box-shadow: 0 0 24px color-mix(in srgb, var(--sb-accent, #00ffe0) 80%, transparent); }
}

/* Speaking indicator — waveform bars */
#sb-speaking-indicator {
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

#sb-speaking-indicator.sb-active {
  opacity: 1;
}

#sb-speaking-indicator span {
  display: block;
  width: 3px;
  height: 12px;
  background: var(--sb-accent, #00ffe0);
  border-radius: 2px;
  animation: sb-wave 0.8s ease-in-out infinite;
}

#sb-speaking-indicator span:nth-child(1) { animation-delay: 0.0s; height: 6px;  }
#sb-speaking-indicator span:nth-child(2) { animation-delay: 0.1s; height: 14px; }
#sb-speaking-indicator span:nth-child(3) { animation-delay: 0.2s; height: 10px; }
#sb-speaking-indicator span:nth-child(4) { animation-delay: 0.1s; height: 14px; }
#sb-speaking-indicator span:nth-child(5) { animation-delay: 0.0s; height: 6px;  }

#sb-speaking-indicator label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.5rem;
  letter-spacing: 0.2em;
  color: var(--sb-accent, #00ffe0);
  opacity: 0.7;
  margin-left: 0.4rem;
}

@keyframes sb-wave {
  0%, 100% { transform: scaleY(0.4); }
  50%       { transform: scaleY(1.0); }
}

/* Stop button */
#sb-stop-btn {
  display: none;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 1px solid rgba(255, 74, 74, 0.5);
  color: #ff4a4a;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  padding: 0.35rem 0.65rem;
  cursor: crosshair;
  clip-path: polygon(0 0, calc(100% - 4px) 0, 100% 4px, 100% 100%, 4px 100%, 0 calc(100% - 4px));
  transition: background 0.2s;
  flex-shrink: 0;
}

#sb-stop-btn.sb-active {
  display: flex;
}

#sb-stop-btn:hover {
  background: rgba(255, 74, 74, 0.12);
}

/* Stirring pulse on the panel before SB opens */
#sb-panel.sb-stirring .sb-pulse {
  animation: sb-stir 1.4s ease-in-out infinite !important;
  opacity: 1 !important;
}

@keyframes sb-stir {
  0%, 100% { transform: scale(1);   opacity: 0.4; }
  50%       { transform: scale(2.2); opacity: 1;   }
}

/* Status text in trigger bar */
#sb-status-text {
  opacity: 0.7;
  font-style: italic;
}
