/* ── Design tokens ────────────────────────────────────────── */
:root {
  --bg:         #F1F5F9;
  --surface:    #FFFFFF;
  --border:     #E2E8F0;
  --text:       #0F172A;
  --text2:      #475569;
  --text3:      #94A3B8;
  --accent:     #0EA5E9;
  --accent-bg:  #E0F7FE;
  --face-bg:    #080C14;
}

/* ── App shell ────────────────────────────────────────────── */
.app {
  /* Use position:fixed so the shell is always exactly the viewport —
     prevents any body-level scroll from breaking the layout when
     chat messages accumulate */
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ── Header ───────────────────────────────────────────────── */
.hdr {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.hdr h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text);
  margin: 0;
}
.accent { color: var(--accent); }
.subtitle {
  font-size: 0.72rem;
  color: var(--text3);
  letter-spacing: 0.05em;
}
.hdr-nav {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.hdr-link {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  font-size: 0.78rem;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.hdr-link:hover {
  background: var(--bg);
  color: var(--accent);
}
.hdr-home {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 1rem;
  text-decoration: none;
  transition: background 0.15s;
  flex-shrink: 0;
}
.hdr-home:hover { background: var(--bg); }

/* ── Two-column page body ─────────────────────────────────── */
.page-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* ── Left column: face + controls ────────────────────────── */
.left-col {
  flex: 0 0 auto;
  width: 296px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none;          /* Firefox: hide scrollbar chrome */
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 10px 14px 14px;
  gap: 10px;
}
.left-col::-webkit-scrollbar { display: none; } /* Chrome/Safari: hide scrollbar */

/* ── Right column: chat ───────────────────────────────────── */
.right-col {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* ── Screen / bezel ───────────────────────────────────────── */
.screen-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.bezel {
  background: var(--face-bg);
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 4px 28px rgba(0,0,0,0.22), 0 0 0 1px rgba(255,255,255,0.06);
}
.expr-label {
  font-size: 0.85rem;
  color: var(--text2);
  height: 1.4em;
  text-align: center;
}

/* ── Scale toggle ─────────────────────────────────────────── */
.scale-controls {
  display: flex;
  gap: 6px;
}
.scale-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  padding: 3px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}
.scale-btn:hover { border-color: var(--accent); color: var(--accent); }
.scale-btn.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ── Control panel ────────────────────────────────────────── */
.panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.panel-section h3 {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  margin: 0 0 5px;
}
.key-hint { font-weight: 400; opacity: 0.7; }

/* ── Expression button grids ──────────────────────────────── */
.btn-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}
.btn-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.btn-grid-4 .ebtn {
  font-size: 0.62rem;
  padding: 5px 3px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Expression buttons ───────────────────────────────────── */
.ebtn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text2);
  padding: 6px 9px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.ebtn:hover {
  border-color: var(--c);
  color: var(--c);
  background: color-mix(in srgb, var(--c) 6%, var(--surface));
}
.ebtn.active {
  background: color-mix(in srgb, var(--c) 12%, var(--surface));
  border-color: var(--c);
  color: var(--c);
  font-weight: 600;
}

/* ── Auto-rotate toggle ───────────────────────────────────── */
.toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--text2);
  cursor: pointer;
  user-select: none;
}
.toggle input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

/* ── Interval slider ──────────────────────────────────────── */
.switch-interval {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.switch-interval-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text2);
}
.interval-val {
  color: var(--accent);
  font-weight: 700;
}
.switch-interval input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.interval-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text3);
}

/* ── Hint ─────────────────────────────────────────────────── */
.hint {
  font-size: 0.72rem;
  color: var(--text3);
  line-height: 1.7;
}
kbd {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.68rem;
  font-family: inherit;
  color: var(--text2);
}
.hist-inline-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.72rem;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

/* ── Chat panel (fills right-col) ────────────────────────── */
.chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 14px 18px;
  gap: 10px;
  overflow: hidden;
  background: transparent;
}
.chat-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.chat-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
}
.history-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
}
.history-link:hover { text-decoration: underline; }

/* Voice status badges */
.voice-status {
  flex: 0 0 auto;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: 8px;
  width: fit-content;
}
.voice-status-listening {
  color: #0369A1;
  background: #E0F2FE;
  animation: pulse 0.9s ease-in-out infinite;
}
.voice-status-thinking {
  color: #92400E;
  background: #FEF3C7;
  animation: pulse 1.2s ease-in-out infinite;
}
.voice-status-tts {
  color: #1D4ED8;
  background: #DBEAFE;
  animation: pulse 1s ease-in-out infinite;
}
.voice-status-speaking {
  color: #065F46;
  background: #D1FAE5;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* Messages scroll area */
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.chat-empty {
  font-size: 0.82rem;
  color: var(--text3);
  text-align: center;
  padding: 40px 0;
  margin: auto;
}

/* ── Chat bubbles ─────────────────────────────────────────── */
.bubble {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 82%;
}
.bubble-user { align-self: flex-end; align-items: flex-end; }
.bubble-bot  { align-self: flex-start; align-items: flex-start; }
.bubble-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
}
.bubble-text {
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 0.9rem;
  line-height: 1.55;
}
.bubble-markdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bubble-paragraph {
  margin: 0;
}
.bubble-heading {
  margin: 0;
  font-weight: 700;
  line-height: 1.3;
}
.bubble-heading-1 { font-size: 1.05rem; }
.bubble-heading-2 { font-size: 0.98rem; }
.bubble-heading-3 { font-size: 0.94rem; }
.bubble-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bubble-list li {
  margin: 0;
}
.bubble-code {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.06);
  overflow-x: auto;
  white-space: pre-wrap;
  font-size: 0.84rem;
}
.bubble-markdown code {
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.06);
  font-size: 0.86em;
}
.bubble-markdown a {
  color: var(--accent);
  word-break: break-word;
}
.bubble-user .bubble-text {
  background: #DBEAFE;
  color: #1E3A8A;
  border-bottom-right-radius: 3px;
}
.bubble-bot .bubble-text {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 3px;
}
.audio-btn {
  width: 100%;
  max-width: 220px;
  height: 28px;
  margin-top: 3px;
  border-radius: 6px;
  opacity: 0.8;
}
.audio-btn:hover { opacity: 1; }

/* ── Tool calls widget (Hermes Agent mode) ──────────────────── */
.tool-calls {
  width: 100%;
  margin-bottom: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.75rem;
}
.tool-calls-summary {
  padding: 5px 10px;
  cursor: pointer;
  color: var(--text2);
  user-select: none;
  list-style: none;
}
.tool-calls-summary::-webkit-details-marker { display: none; }
.tool-calls-summary::marker { display: none; }
.tool-calls-summary:hover { color: var(--text); }
.tool-calls-list {
  margin: 0;
  padding: 4px 10px 6px 10px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-top: 1px solid var(--border);
}
.tool-calls-item {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--text2);
}
.tool-calls-icon { font-size: 0.7rem; }
.tool-calls-name {
  font-weight: 600;
  color: var(--accent);
  min-width: 80px;
}
.tool-calls-preview {
  font-size: 0.68rem;
  color: var(--text3);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}


.hist-page {
  min-height: 100vh;
  background: var(--bg);
}
.hist-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 10;
}
.hist-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.hist-back {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  padding: 5px 12px;
  font-size: 0.78rem;
  cursor: pointer;
}
.hist-back:hover { border-color: var(--accent); color: var(--accent); }
.hist-clear {
  background: none;
  border: 1px solid #FECACA;
  border-radius: 6px;
  color: #DC2626;
  padding: 5px 12px;
  font-size: 0.78rem;
  cursor: pointer;
}
.hist-clear:hover:not(:disabled) { border-color: #DC2626; }
.hist-clear:disabled { opacity: 0.3; cursor: default; }

.hist-empty {
  text-align: center;
  color: var(--text3);
  padding: 64px 32px;
  font-size: 0.9rem;
}
.hist-list {
  display: flex;
  flex-direction: column;
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 24px;
}
.hist-entry {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--surface);
}
.hist-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.hist-time {
  font-size: 0.68rem;
  color: var(--text3);
}
.hist-del {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0 4px;
}
.hist-del:hover { color: #DC2626; }
.hist-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.hist-role {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
  min-width: 36px;
  padding-top: 2px;
}
.hist-row-user .hist-role { color: #2563EB; }
.hist-row-bot  .hist-role { color: #059669; }
.hist-body { flex: 1; }
.hist-text {
  font-size: 0.86rem;
  color: var(--text);
  line-height: 1.5;
  margin: 0 0 6px;
}
.hist-audio {
  width: 100%;
  max-width: 260px;
  height: 26px;
  opacity: 0.75;
  border-radius: 6px;
}
.hist-audio:hover { opacity: 1; }

/* ── Mobile responsive ────────────────────────────────────── */
@media (max-width: 700px) {
  .app {
    height: 100dvh;
    height: -webkit-fill-available;
  }

  /* Compact header */
  .hdr { padding: 8px 14px; }
  .hdr h1 { font-size: 1.2rem; }
  .subtitle { display: none; }

  /* Stack columns vertically */
  .page-body { flex-direction: column; }

  /* Left col: face + controls takes top portion, scrollable if needed */
  .left-col {
    width: 100%;
    flex: 0 0 auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
    gap: 8px;
    /* On mobile: face + minimal controls in a horizontal row */
    flex-direction: row;
    align-items: flex-start;
    overflow-x: hidden;
    overflow-y: visible;
  }

  /* Face sits on the left side on mobile */
  .screen-wrap {
    flex: 0 0 auto;
  }

  /* Bezel smaller padding on mobile */
  .bezel { padding: 8px; }

  /* Controls sit on the right side of face on mobile */
  .panel {
    flex: 1;
    min-width: 0;
    gap: 8px;
    overflow-y: auto;
    max-height: 272px; /* matches face height: 240 + 2*8 padding + 8 */
  }

  /* Compact button grids on mobile */
  .btn-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }
  .btn-grid-4 {
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
  }
  .ebtn { font-size: 0.7rem; padding: 5px 6px; }
  .btn-grid-4 .ebtn { font-size: 0.58rem; padding: 4px 2px; }

  /* Hide scale toggle on mobile (always 1x) */
  .scale-controls { display: none; }

  /* Right col: chat fills remaining height */
  .right-col {
    flex: 1;
    min-height: 0;
  }

  /* Chat padding tighter on mobile */
  .chat-panel { padding: 10px 12px; }
}


/* ── Memory panel ─────────────────────────────────────────── */
.memory-panel {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.hermes-mode-badge {
  flex: 0 0 auto;
  padding: 6px 14px;
  font-size: 0.72rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.memory-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: var(--bg);
  border: none;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text2);
  text-align: left;
}
.memory-toggle:hover { background: #E8EEF6; }
.memory-badge {
  margin-left: auto;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}
.memory-arrow { font-size: 0.6rem; color: var(--text3); }
.memory-body {
  padding: 8px 10px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.memory-empty {
  font-size: 0.72rem;
  color: var(--text3);
  text-align: center;
  padding: 6px 0;
  margin: 0;
}
.memory-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0 0 8px;
  padding: 0;
  max-height: 160px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.memory-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text2);
  line-height: 1.4;
}
.memory-text { flex: 1; }
.memory-del {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0 2px;
}
.memory-del:hover { color: #DC2626; }
.memory-clear {
  width: 100%;
  background: none;
  border: 1px solid #FECACA;
  border-radius: 5px;
  color: #DC2626;
  font-size: 0.72rem;
  padding: 4px 0;
  cursor: pointer;
}
.memory-clear:hover { background: #FEF2F2; }

/* ── Voice hint ───────────────────────────────────────────── */
.voice-hint {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* ── Settings page ────────────────────────────────────────── */
.settings-page {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
}
.settings-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.settings-back {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  font-size: 0.85rem;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.settings-back:hover { background: var(--bg); color: var(--accent); }
.settings-heading {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
}
.settings-save {
  background: var(--accent);
  border: none;
  border-radius: 7px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 16px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.settings-save:hover { opacity: 0.85; }

.settings-body {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 18px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text2);
  margin: 0 0 4px;
  letter-spacing: 0.02em;
}
.settings-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text2);
}
.settings-label-mt { margin-top: 6px; }
.settings-hint {
  font-size: 0.73rem;
  font-weight: 400;
  color: var(--text3);
  margin-left: 4px;
}
.settings-hint-block {
  font-size: 0.75rem;
  color: var(--text3);
  margin: 0;
}
.settings-hint-block a { color: var(--accent); }
.settings-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.settings-input:focus { border-color: var(--accent); }
.settings-textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  resize: vertical;
  min-height: 60px;
  transition: border-color 0.15s;
  font-family: inherit;
  line-height: 1.5;
}
.settings-textarea:focus { border-color: var(--accent); }
.settings-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text2);
  cursor: pointer;
}
.settings-radio-label input { accent-color: var(--accent); }

/* Voice card grid */
.settings-voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.settings-voice-btn {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 10px 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.settings-voice-btn:hover { border-color: var(--accent); background: var(--accent-bg); }
.settings-voice-btn.active {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.voice-btn-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}
.voice-btn-meta {
  font-size: 0.68rem;
  color: var(--text3);
  line-height: 1.3;
}

/* Danger zone */
.settings-section-danger {
  border-color: #FECACA;
}
.settings-reset-btn {
  background: none;
  border: 1px solid #FECACA;
  border-radius: 6px;
  color: #DC2626;
  font-size: 0.82rem;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.settings-reset-btn:hover { background: #FEF2F2; }

/* ── Settings: secret input row ── */
.settings-secret-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.settings-secret-row .settings-input {
  flex: 1;
}
.settings-show-btn {
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  color: #475569;
}
.settings-show-btn:hover {
  background: #cbd5e1;
}

/* ── Hold-to-talk voice button ────────────────────────────── */
.vbtn-wrap {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  padding: 8px 16px 14px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.vbtn {
  position: relative;
  width: 100%;
  max-width: 380px;
  height: 52px;
  border: none;
  border-radius: 26px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;          /* block scroll while held */
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(14,165,233,0.35);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.vbtn:active:not(:disabled) {
  transform: scale(0.96);
}

/* Acquiring (mic opening) — amber pulse */
.vbtn--acquiring {
  background: #F59E0B;
  box-shadow: 0 0 0 0 rgba(245,158,11,0.5);
  animation: vbtn-pulse-amber 0.7s ease-out infinite;
}
@keyframes vbtn-pulse-amber {
  0%  { box-shadow: 0 0 0 0   rgba(245,158,11,0.55); }
  70% { box-shadow: 0 0 0 16px rgba(245,158,11,0);   }
  100%{ box-shadow: 0 0 0 0   rgba(245,158,11,0);    }
}

/* Recording — red pulse */
.vbtn--recording {
  background: #EF4444;
  box-shadow: 0 0 0 0 rgba(239,68,68,0.5);
  animation: vbtn-pulse-red 0.9s ease-out infinite;
}
@keyframes vbtn-pulse-red {
  0%  { box-shadow: 0 0 0 0   rgba(239,68,68,0.55); }
  70% { box-shadow: 0 0 0 20px rgba(239,68,68,0);   }
  100%{ box-shadow: 0 0 0 0   rgba(239,68,68,0);    }
}

/* Busy (thinking / speaking) — muted */
.vbtn--busy {
  background: #94A3B8;
  box-shadow: none;
  cursor: not-allowed;
}

/* Cancel button — appears next to the main button when busy */
.vbtn-cancel {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  margin-left: 10px;
  border: none;
  border-radius: 50%;
  background: #EF4444;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(239,68,68,0.45);
  transition: transform 0.1s, box-shadow 0.1s;
  touch-action: manipulation;
}
.vbtn-cancel:active { transform: scale(0.93); box-shadow: none; }
/* ── Mobile overrides ─────────────────────────────────────── */
@media (max-width: 700px) {
  /* Fixed bar at bottom so it's always reachable */
  .vbtn-wrap {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    /* respect iPhone notch */
    padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    z-index: 100;
  }
  .vbtn {
    height: 60px;
    font-size: 1.08rem;
  }
  /* Push chat content up so fixed button doesn't cover messages */
  .right-col {
    padding-bottom: 100px;
  }
}

/* ── Settings slider row ──────────────────────────────────── */
.settings-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.settings-slider {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}
.settings-slider-val {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 36px;
  text-align: right;
}
