:root {
  color-scheme: dark;
  --bg: #141414;
  --bg-soft: #1c1c1c;
  --bg-elevated: #252525;
  --bg-dock: rgba(20, 20, 20, 0.92);
  --text: #f0f0f0;
  --muted: #a3a3a3;
  --accent: #e07a5f;
  --accent-hover: #cf6a50;
  --accent-glow: rgba(224, 122, 95, 0.25);
  --user-bg: #2e2e2e;
  --user-border: #3d3d3d;
  --accent-2: #81c995;
  --accent-2-glow: rgba(129, 201, 149, 0.2);
  --thinking: #9bbcff;
  --speaking: #f0c75e;
  --danger: #f07178;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --content-width: 42rem;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
  background: var(--bg);
  color: var(--text);
}

body {
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(224, 122, 95, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(129, 201, 149, 0.06), transparent),
    var(--bg);
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: none;
  margin: 0;
}

.app-body {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: row;
  position: relative;
  overflow: hidden;
}

.sidebar {
  width: 16.75rem;
  min-width: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: rgba(18, 18, 18, 0.92);
  backdrop-filter: blur(12px);
  transition:
    width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    min-width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar > * {
  min-width: 16.75rem;
}

.sidebar-top {
  padding: 0.9rem 0.85rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-new {
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 600;
  padding: 0.7rem 0.9rem;
}

.sidebar-new:not(:disabled):hover {
  background: #2a2a2a;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.55rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.chat-list-item {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.45rem 0.55rem 0.7rem;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.35;
}

.chat-list-main {
  flex: 1;
  min-width: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

.chat-list-item:hover,
.chat-list-item.active {
  background: var(--bg-elevated);
}

.chat-list-item.active {
  border-color: var(--border);
}

.chat-list-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.15rem;
  opacity: 0;
}

.chat-list-item:hover .chat-list-actions,
.chat-list-item.active .chat-list-actions,
.chat-list-item:focus-within .chat-list-actions {
  opacity: 1;
}

@media (hover: none) {
  .chat-list-actions {
    opacity: 1;
  }
}

.chat-action {
  min-width: 1.7rem;
  padding: 0.2rem 0.35rem;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1;
}

.chat-action:not(:disabled):hover {
  color: var(--text);
  background: #2a2a2a;
}

.chat-action.danger:not(:disabled):hover {
  color: var(--danger);
}

.chat-rename-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  padding: 0.2rem 0.4rem;
  font-size: 0.84rem;
}

.chat-list-title {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list-meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 400;
}

.chat-list-empty {
  color: var(--muted);
  font-size: 0.84rem;
  padding: 0.85rem 0.7rem;
}

.sidebar-user {
  flex-shrink: 0;
  padding: 0.85rem 0.9rem;
  border-top: 1px solid var(--border);
}

.sidebar-user[hidden] {
  display: none;
}

.user-name,
.user-email {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}

.user-email {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.sidebar-toggle {
  display: inline-flex;
}

.sidebar-backdrop {
  display: none;
}

@media (min-width: 841px) {
  body:not(.sidebar-open) .sidebar {
    width: 0;
    min-width: 0;
    border-right-color: transparent;
    pointer-events: none;
  }
}

/* ── Header ── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: max(1.1rem, env(safe-area-inset-top, 0px)) 1.5rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.tagline {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.3;
}

.topbar-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.settings-wrap {
  display: flex;
  align-items: center;
  position: relative;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--bg-elevated);
  white-space: nowrap;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
}

.status-pill.idle { color: var(--muted); }
.status-pill.listening {
  color: var(--accent-2);
  border-color: rgba(129, 201, 149, 0.35);
  background: rgba(129, 201, 149, 0.1);
}
.status-pill.transcribing,
.status-pill.thinking {
  color: var(--thinking);
  border-color: rgba(155, 188, 255, 0.35);
  background: rgba(155, 188, 255, 0.1);
}
.status-pill.tooling {
  color: var(--thinking);
  border-color: rgba(155, 188, 255, 0.5);
  background: rgba(155, 188, 255, 0.16);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.74rem;
}
.status-pill.speaking {
  color: var(--speaking);
  border-color: rgba(240, 199, 94, 0.35);
  background: rgba(240, 199, 94, 0.1);
}
.status-pill.error {
  color: var(--danger);
  border-color: rgba(240, 113, 120, 0.35);
  background: rgba(240, 113, 120, 0.1);
}

body.voice-on .status-pill {
  display: none;
}

.icon-btn {
  background: var(--bg-elevated);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
  font-size: 0.84rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.icon-btn.icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  flex-shrink: 0;
}

.icon-btn.icon-only svg {
  display: block;
}

.icon-btn:not(:disabled):hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.16);
  background: #2a2a2a;
}

/* ── Chat area ── */

.chat-area {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  padding: 2rem 1.5rem 2.5rem;
}

.chat-inner {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: min(52vh, 420px);
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.chat-empty.hidden {
  display: none;
}

.empty-orb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 5rem;
  height: 5rem;
  margin-bottom: 1.75rem;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.empty-orb span {
  display: block;
  width: 5px;
  height: 1.25rem;
  border-radius: 3px;
  background: var(--muted);
  opacity: 0.5;
  animation: wave 1.2s ease-in-out infinite;
}

.empty-orb span:nth-child(2) { animation-delay: 0.15s; height: 2rem; opacity: 0.7; }
.empty-orb span:nth-child(3) { animation-delay: 0.3s; }

.chat-empty h2 {
  margin: 0 0 0.65rem;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.chat-empty p {
  margin: 0;
  max-width: 22rem;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--muted);
}

.chat-empty strong {
  color: var(--accent);
  font-weight: 600;
}

/* ── Messages ── */

.message {
  display: flex;
  margin-bottom: 1.75rem;
  animation: fadeIn 0.25s ease;
}

.message.user {
  justify-content: flex-end;
}

.message.assistant {
  justify-content: flex-start;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
}

.message-bubble {
  max-width: 100%;
  line-height: 1.65;
  font-size: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.user .message-bubble {
  background: var(--user-bg);
  border: 1px solid var(--user-border);
  border-radius: 1.25rem 1.25rem 0.4rem 1.25rem;
  padding: 0.95rem 1.2rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.message.user.draft .message-bubble {
  background: rgba(46, 46, 46, 0.42);
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.message.user.draft.placeholder-draft .message-bubble {
  color: var(--muted);
  font-style: italic;
  opacity: 0.7;
}

.caption-stable {
  opacity: 0.92;
  transition: opacity 0.25s ease;
}

.caption-pending {
  opacity: 0.38;
  animation: captionReveal 0.55s ease;
}

.live-text .caption-stable {
  opacity: 0.9;
}

.live-text .caption-pending {
  opacity: 0.4;
}

.message.assistant .message-bubble {
  padding: 0.25rem 0;
  color: var(--text);
  font-size: 1.02rem;
}

.tool-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-width: 100%;
}

.tool-bar.hidden {
  display: none;
}

.tool-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(155, 188, 255, 0.28);
  background: rgba(155, 188, 255, 0.1);
  color: var(--thinking);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-chip.active {
  border-color: rgba(155, 188, 255, 0.55);
  background: rgba(155, 188, 255, 0.2);
  box-shadow: 0 0 10px rgba(155, 188, 255, 0.18);
}

.message.assistant.streaming .caption-stable {
  opacity: 0.92;
}

.message.assistant.streaming .caption-pending {
  opacity: 0.38;
  animation: captionReveal 0.55s ease;
}

.message.assistant.streaming .message-bubble::after {
  content: "▋";
  display: inline;
  animation: blink 1s step-end infinite;
  color: var(--accent);
  margin-left: 2px;
}

.thinking-copy {
  color: inherit;
}

.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.thinking-dots span {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: thinkingBounce 0.7s ease-in-out infinite both;
}

.thinking-dots span:nth-child(1) { animation-delay: 0s; }
.thinking-dots span:nth-child(2) { animation-delay: -0.23s; }
.thinking-dots span:nth-child(3) { animation-delay: -0.46s; }

/* ── Bottom dock ── */

.voice-dock {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-dock);
  backdrop-filter: blur(16px);
  padding: 1.25rem 1.5rem calc(1.25rem + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
}

.dock-inner {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
}

.live-strip {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  min-height: 3.5rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.75rem 0.65rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.live-strip.voice-on {
  align-items: center;
  padding: 1rem 1.15rem;
}

.live-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
  margin-bottom: 0.85rem;
}

.live-strip.voice-on .live-indicator {
  margin-bottom: 0;
}

.live-indicator.listening {
  background: var(--accent-2);
  box-shadow: 0 0 12px var(--accent-2-glow);
  animation: pulse 1.4s ease infinite;
}

.live-indicator.recording {
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  animation: pulse 0.9s ease infinite;
}

.live-indicator.thinking {
  background: var(--thinking);
  animation: pulse 1.1s ease infinite;
}

.live-indicator.speaking {
  background: var(--speaking);
  animation: pulse 1.2s ease infinite;
}

.live-indicator.error {
  background: var(--danger);
}

.live-status {
  margin: 0;
  flex: 1;
  line-height: 1.55;
  font-size: 1rem;
  color: var(--text);
}

.live-status.placeholder {
  color: var(--muted);
}

.live-status.hidden,
.compose-form.hidden {
  display: none !important;
}

.live-status .thinking-copy,
.live-status .thinking-dots {
  vertical-align: middle;
}

.live-status:has(.thinking-dots) {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--thinking);
}

.live-text {
  margin: 0;
  flex: 1;
  width: 100%;
  min-height: 1.55rem;
  max-height: 7.5rem;
  padding: 0.45rem 0.15rem;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.55;
  resize: none;
  overflow-y: auto;
}

.live-text::placeholder {
  color: var(--muted);
}

.live-text:focus {
  outline: none;
}

.live-text:disabled {
  opacity: 0.55;
}

.compose-form {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
}

.send-btn {
  flex-shrink: 0;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 600;
}

.send-btn:not(:disabled):hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: #2a2a2a;
}

.dock-controls {
  display: flex;
  gap: 0.75rem;
}

button {
  border: none;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.35rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
}

button:not(:disabled):active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.talk {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--accent), #c9684f);
  color: #fff;
  font-weight: 650;
  font-size: 1rem;
  padding: 0.95rem 1.5rem;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.talk:not(:disabled):hover {
  background: linear-gradient(135deg, var(--accent-hover), #b85a42);
}

.talk.active {
  background: linear-gradient(135deg, #81c995, #5fa878);
  box-shadow: 0 4px 20px var(--accent-2-glow);
}

.talk.active .btn-icon {
  animation: pulse-dot 1.2s ease infinite;
}

.talk.ending {
  background: linear-gradient(135deg, #d26666, #b34b4b);
  box-shadow: 0 4px 20px rgba(240, 113, 120, 0.28);
}

.talk.ending:not(:disabled):hover {
  background: linear-gradient(135deg, #e07474, #c25757);
}

.talk.skipping {
  background: linear-gradient(135deg, #e0b84a, #c9a23a);
  box-shadow: 0 4px 20px rgba(240, 199, 94, 0.28);
}

.talk.skipping:not(:disabled):hover {
  background: linear-gradient(135deg, #ebc65c, #d4ad48);
}

.btn-icon {
  font-size: 0.65rem;
  line-height: 1;
}

.mute {
  background: var(--bg-elevated);
  color: var(--accent-2);
  border: 1px solid rgba(129, 201, 149, 0.3);
  font-weight: 600;
  min-width: 6.5rem;
  padding: 0.95rem 1.25rem;
}

.mute:not(:disabled):hover {
  background: #2a2a2a;
  border-color: rgba(129, 201, 149, 0.45);
}

.mute.muted {
  color: var(--danger);
  border-color: rgba(240, 113, 120, 0.35);
}

/* ── Animations ── */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes captionReveal {
  from { opacity: 0.08; filter: blur(3px); }
  to { opacity: 0.38; filter: blur(0); }
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes thinkingBounce {
  0%, 100% { transform: translateY(-3px); opacity: 1; }
  50% { transform: translateY(0); opacity: 0.3; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes wave {
  0%, 100% { transform: scaleY(0.5); opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-backdrop {
    transition: none;
  }
}

/* ── Responsive ── */

@media (max-width: 840px) {
  .status-pill:not(.error) {
    display: none;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(12, 12, 12, 0.62);
    backdrop-filter: blur(6px);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
      visibility 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .sidebar-backdrop:not(:disabled):active {
    transform: none;
  }

  .sidebar {
    position: fixed;
    z-index: 30;
    top: 0;
    left: 0;
    bottom: 0;
    height: auto;
    padding-top: env(safe-area-inset-top, 0px);
    transform: translateX(-105%);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-user {
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: max(1rem, env(safe-area-inset-top, 0px)) 1.15rem 1rem;
    gap: 1rem;
  }

  .tagline {
    display: none;
  }

  .topbar-actions {
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
  }

  .status-pill {
    font-size: 0.72rem;
    min-height: 2.25rem;
    padding: 0 0.65rem;
  }

  .chat-log {
    padding: 1.5rem 1.15rem 2rem;
  }

  .voice-dock {
    padding: 1rem 1.15rem calc(1rem + env(safe-area-inset-bottom, 0));
  }

  .live-strip {
    min-height: 3.25rem;
    padding: 0.9rem 1rem;
  }

  .message {
    margin-bottom: 1.35rem;
  }

  .message-bubble {
    font-size: 0.95rem;
  }
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1.5rem, env(safe-area-inset-top, 0px)) 1.5rem max(1.5rem, env(safe-area-inset-bottom, 0px));
  background: rgba(12, 12, 12, 0.82);
  backdrop-filter: blur(16px);
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  width: min(24rem, 100%);
  max-height: calc(100svh - 2.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.6rem 1.5rem 1.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 650;
}

.login-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.login-card input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  padding: 0.75rem 0.85rem;
  font-size: 1rem;
}

.login-card button[type="submit"] {
  margin-top: 0.35rem;
  background: linear-gradient(135deg, var(--accent), #c9684f);
  color: #fff;
  font-weight: 650;
}

.login-error {
  color: var(--danger);
  font-size: 0.88rem;
}

.login-error.hidden {
  display: none;
}

.settings-wrap {
  display: flex;
  align-items: center;
  position: relative;
}

.settings-popover {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top, 0px)) 1rem max(1.25rem, env(safe-area-inset-bottom, 0px));
  background: rgba(12, 12, 12, 0.82);
  backdrop-filter: blur(16px);
}

.settings-popover.hidden {
  display: none;
}

.settings-card {
  width: min(28rem, 100%);
  max-height: calc(100svh - 2.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.15rem 1.15rem 1.05rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.settings-card h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 650;
}

.settings-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.settings-card label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.settings-card input[type="text"],
.settings-card select,
.settings-card textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  padding: 0.75rem 0.85rem;
  font-size: 1rem;
  font-family: inherit;
}

.settings-card textarea {
  resize: vertical;
  min-height: 8rem;
  line-height: 1.45;
}

.voice-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.voice-row select {
  flex: 1;
  min-width: 0;
}

.voice-row .icon-btn {
  flex-shrink: 0;
}

#preloadSttBtn.hidden {
  display: none;
}

.check-row {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 0.65rem !important;
  color: var(--text) !important;
  font-size: 0.9rem !important;
}

.check-row input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.settings-card button[type="submit"] {
  background: linear-gradient(135deg, var(--accent), #c9684f);
  color: #fff;
  font-weight: 650;
  padding: 0.7rem 1.15rem;
}

.vad-hud {
  position: fixed;
  left: 0.75rem;
  bottom: 6.5rem;
  z-index: 40;
  margin: 0;
  max-width: min(42rem, calc(100vw - 1.5rem));
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #141414;
  color: #c8c8c8;
  font: 11px/1.45 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  pointer-events: none;
}

.vad-hud.hidden {
  display: none;
}
