/* ============================================================
   CamTalk — Web 端应用样式
   双栏布局：左侧视频面板 + 右侧聊天面板

   设计方向：深色科技极简，Ethereal Glass 美学
   字体：Inter 优先，系统字体栈兜底
   颜色：冷灰体系，单一蓝色强调色
   ============================================================ */

:root {
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-bg: #0a0a0f;
  --color-surface: #111118;
  --color-surface-2: #1a1a24;
  --color-surface-3: #22222e;
  --color-text: #d4d4dc;
  --color-text-muted: #5a5a6e;
  --color-border: #1f1f2a;
  --color-success: #34d399;
  --color-warning: #fbbf24;
  --color-error: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --transition-fast: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-bg: #f4f4f8;
  --color-surface: #ffffff;
  --color-surface-2: #f0f0f5;
  --color-surface-3: #e8e8ee;
  --color-text: #111118;
  --color-text-muted: #6b6b80;
  --color-border: #dddde5;
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-error: #dc2626;
}

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

html, body, #root {
  height: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- App Shell ---- */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ---- Header ---- */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 8px rgba(10, 10, 15, 0.3);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.header__left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.header__title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.header__subtitle {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--color-text-muted);
  letter-spacing: 0.01em;
}

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

.header__stats {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  padding: 4px 12px;
  background: var(--color-surface-2);
  border-radius: 20px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.badge {
  font-size: 0.72rem;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all var(--transition-fast);
}

.badge--connected {
  color: var(--color-success);
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.badge--connecting {
  color: var(--color-warning);
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.badge--disconnected {
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.btn-icon:active {
  transform: scale(0.92);
}

.lang-group {
  display: flex;
  gap: 2px;
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-btn:hover {
  color: var(--color-text);
}

.lang-btn--active {
  background: var(--color-primary);
  color: white;
}

/* ---- Workspace (双栏，侧边栏为 overlay 不在 flex 流中) ---- */

.workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ---- 会话历史侧边栏（Overlay 抽屉式） ---- */

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 10, 15, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  z-index: 51;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow: hidden;
  animation: slideInLeft 0.3s var(--transition-smooth);
  box-shadow: 8px 0 40px rgba(10, 10, 15, 0.4);
}

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

.sidebar--collapsed {
  display: none;
}

.sidebar__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.sidebar__toggle {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.sidebar__toggle:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.sidebar__new-btn {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  flex: 1;
  text-align: left;
}

.sidebar__new-btn:hover {
  background: var(--color-surface-2);
}

.sidebar__new-btn--full {
  flex: 1;
  text-align: left;
}

/* Sidebar Search */
.sidebar__search {
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.sidebar__search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: 0.78rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

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

.sidebar__search-input:focus {
  border-color: var(--color-primary);
}

/* Sidebar List */
.sidebar__list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
}

.sidebar__empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

/* Time group header */
.sidebar__group {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: 12px 12px 6px;
  opacity: 0.7;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}

.sidebar__item:hover {
  background: var(--color-surface-2);
}

.sidebar__item:hover .sidebar__item-actions {
  opacity: 1;
}

.sidebar__item--active {
  background: var(--color-surface-2);
  border-left: 3px solid var(--color-primary);
}

.sidebar__item-icon {
  font-size: 0.72rem;
  color: var(--color-primary);
  opacity: 0.7;
  flex-shrink: 0;
}

.sidebar__item-content {
  flex: 1;
  min-width: 0;
}

.sidebar__item-title {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text);
}

.sidebar__item-meta {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 2px;
  display: flex;
  gap: 8px;
}

.sidebar__item-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.sidebar__action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar__action-btn:hover {
  background: var(--color-surface-3);
  color: var(--color-text);
}

.sidebar__action-btn--danger:hover {
  color: #e74c3c;
}

.sidebar__edit {
  display: flex;
  gap: 4px;
  width: 100%;
}

.sidebar__edit-input {
  flex: 1;
  font-size: 0.82rem;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
  outline: none;
}

.sidebar__edit-input:focus {
  border-color: var(--color-primary);
}

.sidebar__edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
}

.sidebar__edit-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

/* Sidebar footer */
.sidebar__footer {
  padding: 10px 16px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.sidebar__clear-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  width: 100%;
  text-align: center;
}

.sidebar__clear-btn:hover {
  background: rgba(248, 113, 113, 0.08);
  color: var(--color-error);
}

/* ---- 左侧视频面板 ---- */

.video-panel {
  width: 420px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  gap: 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.video-container {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--color-surface-2);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  transition: border-color var(--transition-fast);
}

.video-container:hover {
  border-color: var(--color-surface-3);
}

.video-container .video-preview {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.video-container .video-preview__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #12121a;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 400;
}

.video-placeholder__icon {
  font-size: 2.2rem;
  opacity: 0.15;
  margin-bottom: 4px;
}

.video-placeholder__hint {
  font-size: 0.72rem;
  opacity: 0.6;
}

.video-indicator {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--color-success);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  animation: pulse 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

.live-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: white;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.live-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulse 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

.video-indicator--audio { left: auto; right: 16px; color: var(--color-primary); }
.video-indicator--error { color: var(--color-error); animation: none; }

.detail-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(59, 130, 246, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: white;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.observation-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(52, 211, 153, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: white;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  animation: pulse 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

/* AI Vision Indicator (eye icon in top-right of video) */
.ai-vision-indicator {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(10, 10, 15, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--color-text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all var(--transition-fast);
}

/* ---- 视频控制栏 ---- */

.video-controls {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 0 4px;
}

.video-controls__row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn--ctrl {
  padding: 7px 14px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn--ctrl:hover {
  background: var(--color-surface-3);
  color: var(--color-text);
  border-color: var(--color-surface-3);
}

.btn--ctrl:active {
  transform: translateY(1px);
}

.btn--ctrl-on {
  background: rgba(52, 211, 153, 0.1);
  color: var(--color-success);
  border-color: rgba(52, 211, 153, 0.25);
}

.btn--ctrl-on:hover {
  background: rgba(52, 211, 153, 0.18);
}

.btn--ctrl-off {
  background: rgba(248, 113, 113, 0.08);
  color: var(--color-error);
  border-color: rgba(248, 113, 113, 0.18);
}

.btn--ctrl-off:hover {
  background: rgba(248, 113, 113, 0.15);
}

.btn--speaking {
  animation: micPulse 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.4);
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(52, 211, 153, 0.3); transform: scale(1); }
  50% { box-shadow: 0 0 18px rgba(52, 211, 153, 0.7); transform: scale(1.04); }
}

/* ---- 右侧聊天面板 ---- */

.chat-panel-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  min-width: 0;
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  font-weight: 600;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  color: var(--color-text-muted);
  letter-spacing: -0.01em;
}

.chat-panel-header__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- Scenario Quick Selector (chat header) ---- */
.scenario-selector {
  appearance: none;
  -webkit-appearance: none;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 4px 26px 4px 10px;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
  letter-spacing: 0.01em;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.scenario-selector:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
  background-color: var(--color-surface-3);
}

.scenario-selector:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.chat-panel-header__stats {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--color-text-muted);
  padding: 3px 10px;
  background: var(--color-surface-2);
  border-radius: 12px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.chat-panel-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---- Chat Panel (覆盖子组件样式) ---- */

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

.chat-panel__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-panel__welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 12px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  padding: 40px 0;
}

.chat-panel__welcome-icon {
  font-size: 2.4rem;
  opacity: 0.12;
  margin-bottom: 4px;
}

.chat-panel__welcome-hint {
  font-size: 0.75rem;
  opacity: 0.6;
  max-width: 240px;
  text-align: center;
  line-height: 1.5;
}

.chat-panel--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 12px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.chat-panel--empty-icon {
  font-size: 2.4rem;
  opacity: 0.12;
  margin-bottom: 4px;
}

.chat-panel--empty-hint {
  font-size: 0.75rem;
  opacity: 0.6;
  max-width: 240px;
  text-align: center;
  line-height: 1.5;
}

.chat-message {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  max-width: min(92%, 65ch);
  transition: background var(--transition-fast);
}

.chat-message:hover {
  background: var(--color-surface-3);
}

.chat-message--user {
  border-left: 2px solid var(--color-primary);
  align-self: flex-end;
  background: rgba(59, 130, 246, 0.06);
}

.chat-message--user:hover {
  background: rgba(59, 130, 246, 0.1);
}

.chat-message--assistant {
  border-left: 2px solid var(--color-success);
}

.chat-message--streaming {
  opacity: 0.85;
}

/* ---- System message (scenario switch, etc.) ---- */
.chat-message--system {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 0;
  background: transparent;
}

.chat-message--system::before,
.chat-message--system::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.chat-message--system__text {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.chat-message__role {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.chat-message__content {
  font-size: 0.82rem;
  line-height: 1.65;
  white-space: pre-wrap;
  max-width: 65ch;
}

.chat-message__meta {
  margin-top: 8px;
  font-size: 0.62rem;
  color: var(--color-text-muted);
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* ---- Chat Input ---- */

.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.chat-input__field {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: 0.82rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

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

.chat-input__field:focus {
  border-color: var(--color-primary);
}

.chat-input__send {
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.chat-input__send:hover:not(:disabled) {
  opacity: 0.9;
}

.chat-input__send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---- Streaming Cursor ---- */

.cursor {
  display: inline;
  animation: blink 0.8s step-end infinite;
  color: var(--color-success);
  font-weight: 300;
}

/* ---- System Message ---- */

.system-message {
  text-align: center;
  padding: 10px 16px;
  margin: 0 24px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
}

.system-message--warning {
  background: rgba(251, 191, 36, 0.08);
  color: var(--color-warning);
  border: 1px solid rgba(251, 191, 36, 0.15);
}

.system-message--info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(59, 130, 246, 0.06);
  color: var(--color-text-muted);
  border: 1px solid rgba(59, 130, 246, 0.12);
}

/* ---- Typing Indicator（跳动点） ---- */

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
}

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

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

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

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

/* ---- Drawer (Config Panel) ---- */

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.25s var(--transition-smooth);
}

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.35s var(--transition-smooth);
  box-shadow: -8px 0 40px rgba(10, 10, 15, 0.5);
}

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.drawer__title {
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: -0.01em;
}

.drawer__close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.drawer__close:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.drawer__close:active {
  transform: scale(0.92);
}

.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ---- Config Group ---- */

.config-group {
  margin-bottom: 24px;
}

.config-group__title {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px;
  margin: 0 -8px;
  font-size: 0.82rem;
  color: var(--color-text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.config-row:hover {
  background: var(--color-surface-2);
}

.config-row__info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.config-row__label {
  font-weight: 500;
  color: var(--color-text);
}

.config-row__desc {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.config-row select,
.config-row input[type="checkbox"] {
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.config-row select:hover,
.config-row input[type="checkbox"]:hover {
  border-color: var(--color-surface-3);
}

.config-row select:focus,
.config-row input[type="checkbox"]:focus {
  outline: 2px solid rgba(59, 130, 246, 0.4);
  outline-offset: 1px;
}

.config-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

/* ---- Toast ---- */

.toast-container {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  animation: slideIn 0.35s var(--transition-smooth);
  max-width: 320px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(10, 10, 15, 0.4);
}

.toast--error {
  background: rgba(248, 113, 113, 0.92);
  color: white;
}

.toast--warning {
  background: rgba(251, 191, 36, 0.92);
  color: #111;
}

.toast--info {
  background: rgba(59, 130, 246, 0.92);
  color: white;
}

/* ---- Buttons ---- */

.btn {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.01em;
}

.btn:active {
  transform: translateY(1px);
}

.btn--lg {
  padding: 12px 32px;
  font-size: 0.92rem;
  border-radius: var(--radius);
}

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

.btn--primary:hover {
  background: var(--color-primary-hover);
}

.btn--secondary {
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn--secondary:hover {
  background: var(--color-surface-3);
  border-color: var(--color-surface-3);
}

.btn--warning {
  background: var(--color-warning);
  color: #111;
}

.btn--warning:hover {
  opacity: 0.9;
}

.btn--danger {
  background: rgba(248, 113, 113, 0.1);
  color: var(--color-error);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.btn--danger:hover {
  background: rgba(248, 113, 113, 0.18);
}

.btn--active {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
  animation: pulseBtn 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

/* ---- Animations ---- */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@keyframes pulseBtn {
  0%, 100% { box-shadow: 0 0 12px rgba(59, 130, 246, 0.35); }
  50% { box-shadow: 0 0 22px rgba(59, 130, 246, 0.6); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* ---- Scrollbar ---- */

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ---- Enhanced Video Controls (3-layer) ---- */

.video-controls__toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

/* ---- Round Control Buttons (Camera / Mic) ---- */

.btn-ctrl-round {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  position: relative;
}

.btn-ctrl-round:hover {
  background: var(--color-surface-3);
  border-color: var(--color-surface-3);
  color: var(--color-text);
  transform: scale(1.06);
}

.btn-ctrl-round:active {
  transform: scale(0.95);
}

.btn-ctrl-round--on {
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.3);
  color: var(--color-success);
}

.btn-ctrl-round--on:hover {
  background: rgba(52, 211, 153, 0.18);
  border-color: rgba(52, 211, 153, 0.45);
}

.btn-ctrl-round--off {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.2);
  color: var(--color-error);
}

.btn-ctrl-round--off:hover {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.35);
}

.btn-ctrl-round--speaking {
  animation: micPulse 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.45);
}

/* ---- Pill Control Buttons (Recognize / Interrupt / Stop) ---- */

.btn-ctrl-pill {
  padding: 8px 16px;
  border-radius: 22px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.btn-ctrl-pill:hover:not(:disabled) {
  background: var(--color-surface-3);
  color: var(--color-text);
  border-color: var(--color-surface-3);
}

.btn-ctrl-pill:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-ctrl-pill:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ctrl-pill--recognize {
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-primary);
  border-color: rgba(59, 130, 246, 0.25);
}

.btn-ctrl-pill--recognize:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
}

.btn-ctrl-pill--interrupt {
  background: rgba(251, 191, 36, 0.1);
  color: var(--color-warning);
  border-color: rgba(251, 191, 36, 0.25);
}

.btn-ctrl-pill--interrupt:hover:not(:disabled) {
  background: rgba(251, 191, 36, 0.2);
  border-color: rgba(251, 191, 36, 0.4);
}

.btn-ctrl-pill--stop {
  background: rgba(248, 113, 113, 0.1);
  color: var(--color-error);
  border-color: rgba(248, 113, 113, 0.2);
}

.btn-ctrl-pill--stop:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.35);
}

/* ---- Scenario Chip Strip (horizontal scroll, video panel) ---- */

.scenario-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.scenario-strip__label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  opacity: 0.7;
  padding: 0 2px;
}

.scenario-strip__scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  /* Thin scrollbar - visible but unobtrusive */
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.scenario-strip__scroll::-webkit-scrollbar {
  height: 3px;
}

.scenario-strip__scroll::-webkit-scrollbar-track {
  background: transparent;
}

.scenario-strip__scroll::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

.scenario-strip__scroll:hover::-webkit-scrollbar-thumb {
  background: var(--color-text-muted);
}

/* Individual scenario chip */
.scenario-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1;
}

.scenario-chip:hover {
  background: var(--color-surface-3);
  border-color: var(--color-surface-3);
  color: var(--color-text);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(10, 10, 15, 0.12);
}

.scenario-chip:active {
  transform: translateY(0);
}

/* Active chip */
.scenario-chip--active {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.35);
  color: var(--color-primary);
}

.scenario-chip--active:hover {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.45);
  color: var(--color-primary);
}

/* "+" create new scenario chip */
.scenario-chip--add {
  border-style: dashed;
  opacity: 0.7;
}

.scenario-chip--add:hover {
  opacity: 1;
  border-style: solid;
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(59, 130, 246, 0.06);
}

.scenario-chip--add .scenario-chip__icon {
  display: inline-flex;
  align-items: center;
}

.scenario-chip__icon {
  font-size: 0.9rem;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.scenario-chip__name {
  letter-spacing: 0.01em;
}

/* ---- Legacy button styles kept for backward compat ---- */

.btn--recognize {
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-primary);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 7px 14px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-weight: 500;
  white-space: nowrap;
}

.btn--recognize:hover {
  background: rgba(59, 130, 246, 0.2);
}

.btn--recognize:active {
  transform: translateY(1px);
}

/* Device selectors */
.video-controls__devices {
  display: flex;
  gap: 8px;
  justify-content: center;
  width: 100%;
}

.device-select-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.device-select-label {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.device-select {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  font-size: 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-overflow: ellipsis;
}

.device-select:hover {
  border-color: var(--color-surface-3);
  color: var(--color-text);
}

.device-select:focus {
  outline: 2px solid rgba(59, 130, 246, 0.3);
  outline-offset: 1px;
}

/* ---- Text-only mode (video ended, chat preserved) ---- */

.video-controls__text-only {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.video-ended-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
}

.video-ended-hint__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.video-ended-hint__sub {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  opacity: 0.7;
}

.btn--outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.btn--outline:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-color: var(--color-surface-3);
}

/* ---- Scene Cards (empty state) ---- */

.scene-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 24px;
  max-width: 380px;
  width: 100%;
}

.scene-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.scene-card:hover {
  background: var(--color-surface-3);
  border-color: var(--color-surface-3);
  transform: translateY(-1px);
}

.scene-card:active {
  transform: translateY(0);
}

.scene-card__icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.scene-card__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.scene-card__title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text);
}

.scene-card__desc {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* ---- Scenario Selection Cards ---- */

.scenario-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 24px;
  max-width: 380px;
  width: 100%;
  margin-bottom: 8px;
}

.scenario-cards__title {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding: 0 4px 4px;
}

.scenario-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.scenario-card:hover {
  background: var(--color-surface-3);
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
}

.scenario-card:active {
  transform: translateY(0);
}

.scenario-card__icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.scenario-card__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.scenario-card__title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text);
}

.scenario-card__desc {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* ---- Scenario Hint Card (非空状态顶部提示) ---- */

.chat-panel__scenario-hint {
  display: flex;
  justify-content: center;
  padding: 12px 24px 0;
}

.scenario-hint-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  max-width: 520px;
  width: 100%;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.06);
}

.scenario-hint-card__icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.scenario-hint-card__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.scenario-hint-card__text strong {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 0.01em;
}

.scenario-hint-card__text p {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0;
}

/* ---- Voice Input Button ---- */

.chat-input__voice {
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-input__voice:hover {
  background: var(--color-surface-3);
  color: var(--color-text);
}

.chat-input__voice--active {
  background: rgba(52, 211, 153, 0.12);
  color: var(--color-success);
  border-color: rgba(52, 211, 153, 0.3);
  animation: micPulse 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

/* ---- Header sidebar toggle ---- */

.header__menu-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
}

.header__menu-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.header__menu-btn:active {
  transform: scale(0.92);
}

/* ---- Auth Page ---- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 16px 64px rgba(10, 10, 15, 0.4);
}

.auth-card__header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-card__logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.auth-card__subtitle {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

/* Auth form tabs */
.auth-form__tabs {
  display: flex;
  gap: 2px;
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab:hover {
  color: var(--color-text);
}

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

/* Auth form fields */
.auth-form__fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field__label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.auth-field__input {
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.auth-field__input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

.auth-field__input:focus {
  border-color: var(--color-primary);
}

/* Error message */
.auth-form__error {
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: rgba(248, 113, 113, 0.1);
  color: var(--color-error);
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid rgba(248, 113, 113, 0.2);
}

/* Submit button */
.auth-form__submit {
  width: 100%;
  padding: 11px 0;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: white;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  letter-spacing: 0.01em;
}

.auth-form__submit:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.auth-form__submit:active:not(:disabled) {
  transform: translateY(1px);
}

.auth-form__submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Footer link */
.auth-card__footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.auth-card__link {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 4px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-card__link:hover {
  color: var(--color-primary-hover);
}

/* ---- Logout button in config panel ---- */

.config-logout-btn {
  width: 100%;
  margin-top: 12px;
  padding: 9px 0;
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(248, 113, 113, 0.08);
  color: var(--color-error);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.config-logout-btn:hover {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
}

/* ============================================================
   Custom Scenarios Styles
   ============================================================ */

/* Scenario list */
.scenario-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.scenario-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.scenario-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.scenario-item input[type="radio"] {
  cursor: pointer;
}

.scenario-item__icon {
  font-size: 20px;
  line-height: 1;
}

.scenario-item__name {
  flex: 1;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
}

.scenario-item__desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

/* Custom scenario with edit/delete buttons */
.scenario-item--custom {
  padding: 8px 10px;
}

.scenario-item__radio {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  cursor: pointer;
}

.scenario-item__info {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
}

.scenario-item__actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.scenario-action-btn {
  padding: 4px 8px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.scenario-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.scenario-action-btn--confirm {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.3);
}

.scenario-empty {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

/* Create scenario button */
.config-create-btn {
  margin-left: auto;
  padding: 4px 12px;
  font-size: 12px;
  background: rgba(196, 97, 47, 0.15);
  border: 1px solid rgba(196, 97, 47, 0.3);
  border-radius: 999px;
  color: #C4612F;
  cursor: pointer;
  transition: all 0.2s;
}

.config-create-btn:hover {
  background: rgba(196, 97, 47, 0.25);
  border-color: rgba(196, 97, 47, 0.5);
}

.config-group__title {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s;
}

.modal {
  background: #1F2421;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s;
}

.modal--large {
  max-width: 700px;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal__title {
  font-size: 18px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
}

.modal__close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}

.modal__body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal__footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 8px;
}

/* Form elements */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 8px;
}

.form-required {
  color: #C4612F;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: rgba(196, 97, 47, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  line-height: 1.6;
}

.form-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

.form-error {
  padding: 12px;
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 6px;
  color: #f87171;
  font-size: 13px;
  margin-top: 12px;
}

/* Icon picker */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.icon-picker__item {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-picker__item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.icon-picker__item--active {
  background: rgba(196, 97, 47, 0.2);
  border-color: rgba(196, 97, 47, 0.5);
}

/* Prompt guide */
.form-guide-btn {
  background: transparent;
  border: none;
  color: #C4612F;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  margin-left: auto;
  transition: all 0.2s;
}

.form-guide-btn:hover {
  background: rgba(196, 97, 47, 0.1);
}

.form-guide {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.6;
}

.form-guide strong {
  color: rgba(255, 255, 255, 0.9);
}

.form-guide ul {
  margin: 8px 0;
  padding-left: 20px;
  color: rgba(255, 255, 255, 0.7);
}

.form-guide__code {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 12px;
  margin-top: 8px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: #C4612F;
  color: white;
  border-color: #C4612F;
}

.btn--primary:hover:not(:disabled) {
  background: #A94E22;
  border-color: #A94E22;
}

.btn--secondary {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn--secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.9);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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