/* =============================================
   Echo - Minimal, Warm, Mobile-First Design
   "去标签化" 极简美学
============================================= */

:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #252540;
  --bg-card: #1e1e35;
  --text-primary: #e8e8f0;
  --text-secondary: #9898b0;
  --text-muted: #6a6a8a;
  --accent: #7c6cf0;
  --accent-glow: rgba(124, 108, 240, 0.25);
  --accent-soft: #b8a8ff;
  --warm: #f0a87c;
  --warm-glow: rgba(240, 168, 124, 0.2);
  --border: #2a2a45;
  --success: #6cdb8a;
  --danger: #f06c7c;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 4px 30px rgba(0,0,0,0.3);
  --font: 'Inter', 'Noto Sans SC', -apple-system, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: auto;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =================== Screens =================== */

#app {
  height: 100%;
  position: relative;
}

.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* =================== Loading =================== */

#loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--bg-primary);
}

.loading-logo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.echo-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  position: absolute;
  animation: pulse-ring 2s ease-in-out infinite;
}

.echo-ring::before, .echo-ring::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0.3;
}
.echo-ring::before { inset: -8px; animation: pulse-ring 2s ease-in-out 0.5s infinite; }
.echo-ring::after { inset: 4px; animation: pulse-ring 2s ease-in-out 1s infinite; }

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.echo-mark {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--text-primary);
  z-index: 1;
}

.loading-text {
  color: var(--text-muted);
  font-size: 14px;
  animation: fade-in-out 2s ease-in-out infinite;
}

@keyframes fade-in-out {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* =================== Auth =================== */

#auth-screen {
  justify-content: center;
  padding: 40px 24px;
}

.auth-container {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
}

.auth-brand {
  text-align: center;
  margin-bottom: 40px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 8px;
}

/* Web: single line with mixed sizes */
.logo-line {
  display: inline-block;
  font-weight: 700;
  letter-spacing: 4px;
  line-height: 1.2 !important;
  background: linear-gradient(135deg, var(--accent), #1a1a2e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-echo {
  font-size: 40px;
}

.logo-the {
  font-size: 36px;
}

.logo-voice {
  font-size: 36px;
}

/* App (Capacitor): three stacked lines */
.cap .auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0px;
}

.cap .logo-line {
  display: block;
  letter-spacing: 6px;
  text-align: center;
}

.cap .logo-echo {
  font-size: 40px;
}

.cap .logo-the {
  font-size: 36px;
}

.cap .logo-voice {
  font-size: 36px;
}

.auth-subtitle-spaced {
  margin-top: 24px;
}

.auth-tagline {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 2px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-family: var(--font);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.3s;
}

.auth-tab.active {
  background: var(--accent);
  color: white;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-group {
  position: relative;
}

.input-group input {
  width: 100%;
  padding: 10px 12px;
  padding: 14px 16px 14px 42px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.3s;
}

.input-group input:focus {
  border-color: var(--accent);
}

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

/* 语言选择器 */

.input-hint {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 16px 0 16px;
  line-height: 1.5;
  letter-spacing: 0.3px;
  opacity: 0.7;
}


/* ContentEditable placeholder for nickname */
.nickname-editable {
  text-align: left !important;
}

.nickname-editable:empty:before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

.nickname-editable:focus:empty:before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  opacity: 0.6;
}

.lang-select {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.5;
}

.auth-btn {
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #6a5acd);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 16px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity 0.3s, transform 0.2s;
  letter-spacing: 1px;
}

.auth-btn:hover { opacity: 0.9; }
.auth-btn:active { transform: scale(0.98); }

.auth-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
}

/* =================== Chat Header =================== */

#chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-echo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
}

.header-mode-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 6px;
}

.header-right {
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: background 0.2s, color 0.2s;
}

.icon-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* =================== Chat Messages =================== */

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  padding-bottom: 8px;
  scroll-behavior: smooth;
}

#chat-messages::-webkit-scrollbar {
  width: 3px;
}

#chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.welcome-card {
  text-align: center;
  padding: 40px 20px;
  margin-top: 20px;
}

.welcome-wave {
  font-size: 56px;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.welcome-title {
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent), #1a1a2e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-text {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.8;
  font-weight: 300;
}

/* Message Bubbles */
.message {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  animation: msg-in 0.3s ease-out;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  align-items: flex-end;
}

.message.echo {
  align-items: flex-start;
}

.message-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  padding: 0 4px;
}

.message-bubble {
  max-width: 85%;
  padding: 10px 16px;
  border-radius: var(--radius);
  line-height: 1.7;
  font-size: 17.5px;
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
}

.message.user .message-bubble {
  background: linear-gradient(135deg, var(--accent), #6a5acd);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.message.echo .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}

.message-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
  align-items: center;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* =================== Input Area =================== */

#input-area {
  flex-shrink: 0;
  padding: 8px 12px;
  padding-bottom: max(8px, var(--safe-bottom));
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 4px;
}

#chat-input {
  flex: 1;
  padding: 3px 10px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font);
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.5;
  min-height: 0;
  height: auto;
  min-height: 24px;
  box-sizing: border-box;
}

#chat-input::placeholder { color: var(--text-muted); }

#send-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  flex-shrink: 0;
}

#send-btn:active { transform: scale(0.9); }
#send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* =================== Sidebar =================== */

#sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 50;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 80vw;
  background: var(--bg-secondary);
  z-index: 60;
  display: flex;
  flex-direction: column;
  animation: slide-in 0.25s ease;
  border-right: 1px solid var(--border);
}

#sidebar.hidden {
  display: flex;
  transform: translateX(-100%);
  animation: none;
}

@keyframes slide-in {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
}

.sidebar-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.sidebar-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.sidebar-name {
  font-size: 15px;
  font-weight: 500;
}

.sidebar-tier {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-family: var(--font);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-item.danger:hover {
  background: rgba(240, 108, 124, 0.1);
  color: var(--danger);
}

.nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
}

/* =================== Modal =================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fade-in 0.2s ease;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow);
  animation: modal-in 0.3s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 18px;
  font-weight: 500;
}

.modal-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.modal-body {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.modal-body p {
  margin-bottom: 8px;
}

.onb-btn {
  padding: 8px 14px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  flex: 1 1 auto;
  min-width: 0;
}

.onb-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.onb-btn.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.modal-btn {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-xs);
  border: none;
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity 0.2s;
}

.modal-btn.primary {
  background: var(--accent);
  color: white;
}

.modal-btn.secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.modal-btn.danger {
  background: var(--danger);
  color: white;
}

/* =================== Memory Cards =================== */

.memory-section {
  margin-bottom: 40px;
}

.memory-section-title {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.memory-item {
  background: var(--bg-card);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.memory-item .importance {
  font-size: 11px;
  color: var(--text-muted);
}

.memory-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 40px 20px;
  font-size: 14px;
  line-height: 2;
}

/* =================== Plan Cards =================== */

.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
}

.plan-card.featured {
  border-color: var(--accent);
  position: relative;
}

.plan-card.featured::before {
  content: '推荐';
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
}

.plan-name {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}

.plan-price {
  font-size: 28px;
  font-weight: 700;
  margin: 8px 0;
}

.plan-price span {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

.plan-features {
  list-style: none;
  margin: 12px 0;
}

.plan-features li {
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.plan-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity 0.2s;
}

.plan-btn.primary { background: var(--accent); color: white; }
.plan-btn.secondary { background: var(--bg-tertiary); color: var(--text-secondary); }

/* =================== Responsive =================== */

@media (min-width: 768px) {
  #input-area {
    padding: 6px 16px;
  }

  #chat-messages {
    padding: 12px 16px 8px;
  }

  .message-bubble {
    max-width: 70%;
  }
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: #f5f5f8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eeeeff;
    --bg-card: #f8f8ff;
    --text-primary: #1a1a2e;
    --text-secondary: #5a5a7a;
    --text-muted: #9a9ab0;
    --border: #e0e0f0;
    accent: #7c6cf0;
  }

  .message.echo .message-bubble {
    background: white;
    border-color: var(--border);
  }
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 200;
  animation: toast-in 0.3s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toast-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}


/* =================== Privacy / Ephemeral Toggle =================== */
.privacy-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-bottom: 1px;
}
.privacy-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}
.privacy-btn.active {
  border-color: #e74c3c;
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
}
.privacy-btn.active:hover {
  background: rgba(231, 76, 60, 0.15);
}
.privacy-indicator {
  font-size: 12px;
  color: #e74c3c;
  text-align: center;
  padding: 4px 0 0 0;
  animation: fade-in 0.2s ease;
}

/* Allow text selection in messages */
.msg-text { display: block; }

#chat-messages, .message, .message-bubble, .msg-text, .message * {
  -webkit-user-select: text !important;
  user-select: text !important;
}

/* =================== UI Polish =================== */

/* Smoother page transitions */
.screen {
  animation: screen-fade-in 0.3s ease;
}
@keyframes screen-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Better chat bubble shadows */
.message.echo .message-bubble {
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  border: 1px solid var(--border);
  transition: box-shadow 0.2s;
}
.message.echo .message-bubble:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.message.user .message-bubble {
  background: linear-gradient(135deg, var(--accent), #6a5acd);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Better button hover */
.icon-btn {
  transition: all 0.2s;
}
.icon-btn:hover {
  background: var(--accent-glow);
  color: var(--accent-soft);
  transform: scale(1.05);
}

/* Auth card polish */
.auth-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  max-height: 90dvh;
  overflow-y: auto;
}

/* Modal enhancements */
.modal {
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
  border: 1px solid var(--border);
}

/* Sidebar smooth */
.nav-item {
  border-radius: var(--radius-xs);
  transition: all 0.2s;
}
.nav-item:hover {
  background: var(--accent-glow);
  color: var(--text-primary);
  transform: translateX(2px);
}

/* Input polish */
.input-group input:focus, .input-group textarea:focus {
  box-shadow: 0 0 0 2px var(--accent-glow);
  border-color: var(--accent) !important;
}

/* Privacy indicator animation */
.privacy-indicator:not(.hidden) {
  animation: slide-up 0.3s ease;
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Copy button messages smoother */
.copy-btn {
  font-size: 13px; line-height: 1; color: var(--text-muted);
  z-index: 5; pointer-events: none;
}
.message-bubble:hover .copy-btn {
  opacity: 0.6; pointer-events: auto;
}

/* Copy button on messages */
.message-bubble .copy-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1;
  color: var(--text-muted);
  z-index: 5;
  pointer-events: none;
}

.message-bubble:hover .copy-btn {
  opacity: 0.6;
  pointer-events: auto;
}

.copy-btn:hover {
  opacity: 1 !important;
  background: rgba(255,255,255,0.08);
}

.copy-btn.copied {
  opacity: 1 !important;
  color: var(--success);
}

/* ==================== Language Toggle ==================== */
.lang-toggle:hover {
  opacity: 0.8;
  background: var(--bg-tertiary);

/* Turnstile - reduce visual footprint */
.cf-turnstile {
  transform: scale(0.85);
  transform-origin: center;
  margin-bottom: 4px !important;
}
}



/* ============ Voice Input ============ */
.mic-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  padding: 10px;
  font-size: 18px;
  line-height: 1;
  transition: all 0.15s;
  flex-shrink: 0;
}
.mic-btn:hover { background: var(--bg-tertiary); }
.mic-btn.recording {
  background: var(--danger);
  border-color: var(--danger);
  animation: micPulse 0.8s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240,108,124,0.5); }
  50% { box-shadow: 0 0 0 8px rgba(240,108,124,0); }
}

.voice-bubble {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
  cursor: pointer;
  width: auto;
  max-width: 200px;
}

/* Compact voice message inner container */
.voice-msg {
  width: 120px;
  box-sizing: border-box;
}
.voice-play-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: none;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.voice-play-btn:hover { background: var(--accent); color: #fff; }
.voice-duration { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.voice-text-toggle {
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: none;
  padding: 1px 3px;
  border-radius: 3px;
  white-space: nowrap;
  font-size: 10px;
}
.voice-text-toggle:hover { background: var(--accent-glow); }
.voice-transcribed {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 12px 8px;
  display: none;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.voice-transcribed.show { display: block; }
