/* ═══════════════════════════════════════════════════
   AI Vision Talk — 深空靛蓝 · Glassmorphism 设计系统
   布局: 主舞台(双画面) + 右侧滑出聊天栏
   UX 准则: Antigravity Kit (150-300ms 微交互,
   44px 触控区域, prefers-reduced-motion, smooth scroll)
   ═══════════════════════════════════════════════════ */

/* ─── Design Tokens ────────────────────────── */
:root {
  --bg: #080c17; --bg-alt: #0a0f1d;
  --surface: rgba(15,20,40,0.72); --surface-2: rgba(22,28,52,0.78);
  --surface-3: rgba(40,48,72,0.65); --surface-solid: #101630;
  --accent: #818cf8; --accent-2: #34d399; --danger: #f87171; --warning: #fbbf24;
  --text: #e2e8f0; --text-2: #94a3b8; --text-3: #64748b;
  --radius: 10px; --radius-lg: 16px; --radius-xl: 22px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3); --shadow: 0 4px 24px rgba(0,0,0,.45);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.55);
  --spring: cubic-bezier(0.34,1.56,0.64,1);
  --glass-border: 1px solid rgba(255,255,255,.06);
  --glass-bg: rgba(15,20,40,.55);
  --backdrop: blur(16px) saturate(140%);
  --sidebar-w: 42vw; --sidebar-min: 320px; --sidebar-max: 480px;
}
[data-theme="light"] {
  --bg: #f1f5f9; --bg-alt: #e2e8f0;
  --surface: rgba(255,255,255,.78); --surface-2: rgba(248,250,252,.82);
  --surface-3: rgba(226,232,240,.7); --surface-solid: #fff;
  --accent: #6366f1; --accent-2: #10b981; --danger: #ef4444; --warning: #d97706;
  --text: #1e293b; --text-2: #475569; --text-3: #94a3b8;
  --shadow: 0 4px 24px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.12);
  --glass-bg: rgba(255,255,255,.55);
  --glass-border: 1px solid rgba(0,0,0,.06);
}

* { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif;
  background: var(--bg); color: var(--text);
  height: 100dvh; overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background .4s ease, color .4s ease;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(ellipse 80% 60% at 30% 20%, rgba(99,102,241,.06) 0%, transparent 60%),
              radial-gradient(ellipse 60% 80% at 70% 70%, rgba(52,211,153,.04) 0%, transparent 60%);
  pointer-events: none;
}
#app { display:flex; flex-direction:column; height:100dvh; }

/* ─── Icons ────────────────────────────────── */
.icon { width:1em; height:1em; vertical-align:-.125em; fill:none; stroke:currentColor; stroke-width:1.8; }
svg.icon { overflow:visible; }

/* ══════════════════════════════════════════════
   Topbar (Glass)
   ══════════════════════════════════════════════ */
#topbar {
  display:flex; align-items:center; gap:12px; padding:6px 16px;
  background: var(--glass-bg); backdrop-filter: var(--backdrop);
  -webkit-backdrop-filter: var(--backdrop);
  border-bottom: var(--glass-border); flex-shrink:0; min-height:50px; z-index:20;
}
.logo {
  font-weight:800; font-size:16px; display:flex; align-items:center; gap:8px;
  background: linear-gradient(135deg, var(--accent), #c084fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo .icon { color: var(--accent); -webkit-text-fill-color: var(--accent); }
.topbar-status { display:flex; gap:10px; font-size:13px; color:var(--text-2); }
.status-item { display:flex; align-items:center; gap:5px; font-weight:500; }
.dot { width:9px; height:9px; border-radius:50%; display:inline-block; transition: all .3s ease; }
.dot.on { background:var(--accent-2); box-shadow:0 0 8px var(--accent-2); }
.dot.off { background:var(--text-3); }
.topbar-center { display:flex; align-items:center; gap:5px; margin-left:auto; }
.badge {
  font-size:12px; padding:3px 10px; border-radius:10px;
  background: rgba(255,255,255,.04); color:var(--text-2);
  white-space:nowrap; border: var(--glass-border); font-weight:500;
}
.badge.hidden { display:none; }
.topbar-cost {
  font-family:'SF Mono','Cascadia Code','Fira Code',monospace; font-size:12px;
  color:var(--accent-2); cursor:default; padding:2px 10px; border-radius:10px;
  background: rgba(52,211,153,.08); border:1px solid rgba(52,211,153,.15);
  font-weight:600;
}
.icon-btn {
  background:none; border:none; color:var(--text-2); cursor:pointer;
  padding:6px; border-radius:8px; transition: all .2s ease; font-size:18px;
  display:inline-flex; align-items:center; justify-content:center;
}
.icon-btn:hover { background:rgba(255,255,255,.06); color:var(--text); }
.icon-btn:focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:6px; }

/* ══════════════════════════════════════════════
   Main Area: Stage + Sidebar
   ══════════════════════════════════════════════ */
#mainArea {
  display:flex; flex:1; overflow:hidden; position:relative;
}

/* ─── Avatar Stage (左侧舞台) ──────────────── */
#avatarStage {
  flex:1; display:flex; flex-direction:column; position:relative;
  min-width:0; overflow:hidden;
}

/* ─── Live2D 主画布 ───────────────────────── */
#live2dStage {
  flex:1; position:relative; overflow:hidden;
  display:flex; align-items:center; justify-content:center;
  background: radial-gradient(ellipse at center, rgba(99,102,241,.06) 0%, transparent 70%);
}
#live2dStage #live2dCanvas {
  position:absolute; inset:0; width:100%; height:100%; display:none;
}
#live2dStage #live2dCanvas.active { display:block; z-index:2; }
#live2dStage .live2d-status {
  position:absolute; bottom:16px; left:50%; transform:translateX(-50%);
  font-size:12px; color:var(--text-3); z-index:3;
  background:rgba(0,0,0,.45); padding:3px 14px; border-radius:12px;
}
#live2dStage .live2d-status.success { color:var(--accent-2); }
#live2dStage .live2d-status.error { color:var(--danger); }

/* ─── Waifu Tips Bubble ───────────────────── */
.waifu-bubble {
  position:absolute; z-index:10; max-width:260px; padding:10px 16px;
  border-radius:18px; font-size:13px; line-height:1.5; color:var(--text);
  background: var(--glass-bg); backdrop-filter: var(--backdrop);
  -webkit-backdrop-filter: var(--backdrop);
  border: var(--glass-border); box-shadow: var(--shadow);
  pointer-events:none; opacity:0; transform:translateY(8px) scale(.95);
  transition: width .35s; touch-action: manipulation; var(--spring);
}
.waifu-bubble.show { opacity:1; transform:translateY(0) scale(1); }
.waifu-bubble.hidden { display:none; }
.waifu-bubble::after {
  content:''; position:absolute; bottom:-8px; left:50%; transform:translateX(-50%);
  width:0; height:0; border-left:8px solid transparent; border-right:8px solid transparent;
  border-top:8px solid var(--surface-solid);
}

/* ─── Camera PiP (画中画 左下角) ────────── */
#cameraPiP {
  position:absolute; bottom:12px; left:12px;
  width:280px; height:210px; z-index:8;
  border-radius:var(--radius); overflow:hidden;
  border: var(--glass-border);
  box-shadow: var(--shadow-lg);
  background:#000; display:flex; flex-direction:column;
}
#cameraPiP #cameraViewport {
  flex:1; position:relative; overflow:hidden;
  display:flex; align-items:center; justify-content:center;
  background:#000;
}
#cameraPiP #video { width:100%; height:100%; object-fit:contain; display:none; }
#cameraPiP #canvasOverlay {
  position:absolute; top:0; left:0; width:100%; height:100%;
  pointer-events:none; display:none; z-index:2;
}
#cameraPiP #videoPlaceholder {
  display:flex; flex-direction:column; align-items:center;
  justify-content:center; height:100%; color:var(--text-3); gap:4px; padding:8px;
}
#cameraPiP .placeholder-icon { opacity:.25; }
#cameraPiP .placeholder-hint { font-size:10px; color:var(--text-3); }
#cameraPiP #motionIndicator {
  position:absolute; bottom:4px; left:4px; z-index:4;
  background:rgba(0,0,0,.6); padding:2px 8px; border-radius:8px; font-size:10px; color:var(--text-2);
}
#cameraPiP #motionIndicator.hidden { display:none; }
#cameraPiP #memoryStrip {
  display:flex; gap:3px; padding:3px 6px; background:rgba(0,0,0,.3);
  overflow-x:auto; flex-shrink:0; min-height:28px; align-items:center;
}
#cameraPiP #memoryStrip::-webkit-scrollbar { height:1px; }
.memory-hint { font-size:9px; color:var(--text-3); margin:0 auto; }
.memory-thumb {
  width:22px; height:22px; border-radius:4px; object-fit:cover;
  border:1px solid var(--surface-3); flex-shrink:0; cursor:pointer;
}
.memory-thumb:hover { border-color:var(--accent); }
#cameraPiP #detectionCanvas {
  position:absolute; top:0; left:0; width:100%; height:100%;
  pointer-events:none; z-index:3; display:none;
}
/* ─── PiP drag handle ────────────────── */
.pip-handle {
  display:flex; align-items:center; gap:6px; padding:4px 10px;
  background:rgba(0,0,0,.6); cursor:grab; flex-shrink:0;
  font-size:13px; color:var(--text-2); user-select:none;
}
.pip-handle:active { cursor:grabbing; }
.pip-handle .icon { flex-shrink:0; stroke:var(--accent-2); }
/* ─── PiP resize corner ──────────────── */
.pip-resize {
  position:absolute; bottom:0; right:0; width:18px; height:18px;
  cursor:nwse-resize; color:rgba(255,255,255,.3); font-size:14px;
  line-height:18px; text-align:center; z-index:9;
  user-select:none;
}
.pip-resize:hover { color:var(--accent); }

/* ══════════════════════════════════════════════
   Chat Sidebar (右侧滑出)
   ══════════════════════════════════════════════ */
#chatSidebar {
  position:absolute; top:0; right:0; bottom:0; width:0; overflow:hidden;
  background: var(--glass-bg); backdrop-filter: var(--backdrop);
  -webkit-backdrop-filter: var(--backdrop);
  border-left: var(--glass-border);
  transition: width .35s; touch-action: manipulation; cubic-bezier(0.4,0,0.2,1);
  z-index:15; display:flex; flex-direction:column;
}
#chatSidebar.open { width:38%; min-width:300px; max-width:480px; }
#chatPanel {
  display:flex; flex-direction:column; height:100%; min-width:300px;
}
#chatMessages {
  flex:1; overflow-y:auto; padding:16px;
  display:flex; flex-direction:column; gap:8px;
  scroll-behavior:smooth;
}
#chatMessages::-webkit-scrollbar { width:3px; }
#chatMessages::-webkit-scrollbar-thumb { background:var(--surface-3); border-radius:2px; }

/* Welcome */
.welcome-center {
  display:flex; flex-direction:column; align-items:center;
  justify-content:center; flex:1; padding:24px 16px; text-align:center; gap:6px;
}
.welcome-center .welcome-icon {
  width:56px; height:56px; border-radius:50%;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  display:flex; align-items:center; justify-content:center;
  box-shadow: 0 0 32px rgba(129,140,248,.2);
}
.welcome-center .welcome-icon svg { width:28px; height:28px; stroke:#fff; }
.welcome-center h2 { font-size:17px; font-weight:700; color:var(--text); }
.welcome-center p { font-size:12px; color:var(--text-2); max-width:260px; line-height:1.5; }
.prompt-chips { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; justify-content:center; max-width:340px; }
.prompt-chip {
  padding:6px 12px; border-radius:16px; font-size:12px; cursor:pointer;
  border: var(--glass-border); background: var(--glass-bg);
  color: var(--text-2); transition: all .2s ease;
  backdrop-filter: blur(8px); white-space:nowrap; user-select:none;
}
.prompt-chip:hover {
  border-color: var(--accent); color: var(--accent);
  background: rgba(129,140,248,.08); transform: translateY(-1px);
}

/* Messages */
.msg { display:flex; gap:8px; margin-bottom:2px; }
.msg.user { justify-content:flex-end; }
.msg.ai { justify-content:flex-start; }
.msg { animation: msgSpringIn .4s var(--spring); }
@keyframes msgSpringIn {
  from { opacity:0; transform:translateY(14px) scale(.96); }
  to { opacity:1; transform:translateY(0) scale(1); }
}
.msg-avatar {
  width:28px; height:28px; border-radius:50%;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  display:flex; align-items:center; justify-content:center;
  font-size:13px; flex-shrink:0; margin-top:2px;
}
.msg.user .msg-avatar { display:none; }
.msg-content {
  max-width:80%; padding:10px 14px; border-radius: var(--radius);
  font-size:13px; line-height:1.6; word-break:break-word;
}
.msg.user .msg-content {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff; border-bottom-right-radius: 4px;
}
.msg.ai .msg-content {
  background: var(--glass-bg); color: var(--text);
  border-bottom-left-radius: 4px; border: var(--glass-border);
  backdrop-filter: blur(8px);
}
.msg.cost-info .msg-content {
  background:transparent; color:var(--text-3); font-size:10px;
  text-align:center; padding:3px 6px; max-width:100%; width:100%;
  border:none; backdrop-filter:none;
}
.msg .msg-tips { margin-top:6px; font-size:11px; color:var(--text-3); }
.msg .msg-tips kbd {
  padding:1px 5px; border-radius:3px; background:rgba(255,255,255,.05);
  font-family:inherit; font-size:10px; border: var(--glass-border);
}

/* Thinking */
#thinkingIndicator {
  display:flex; align-items:center; gap:8px; padding:8px 16px;
  background: var(--surface-2); border-top: var(--glass-border);
  font-size:12px; color:var(--text-3); flex-shrink:0;
}
#thinkingIndicator.hidden { display:none; }
.thinking-dots { display:flex; gap:3px; }
.thinking-dots span {
  width:6px; height:6px; border-radius:50%; background:var(--accent);
}
.thinking-dots span:nth-child(1) { animation:dotBounce 1.4s ease infinite 0s; }
.thinking-dots span:nth-child(2) { animation:dotBounce 1.4s ease infinite .2s; }
.thinking-dots span:nth-child(3) { animation:dotBounce 1.4s ease infinite .4s; }
@keyframes dotBounce {
  0%,80%,100% { transform:scale(.5); opacity:.3; }
  40% { transform:scale(1); opacity:1; }
}
.thinking-cancel {
  margin-left:auto; background:none; border:none; color:var(--text-3);
  cursor:pointer; padding:2px 6px; border-radius:4px; font-size:12px;
}
.thinking-cancel:hover { background:rgba(255,255,255,.06); color:var(--text); }

#emotionBar {
  padding:4px 16px; background:var(--surface-2); display:flex;
  align-items:center; gap:6px; font-size:13px; color:var(--text-2);
  border-top: var(--glass-border); flex-shrink:0;
}
#emotionBar.hidden { display:none; }

/* Chat Input Bar */
#chatInputBar {
  display:flex; gap:6px; padding:10px 12px; align-items:center;
  border-top: var(--glass-border);
}
#chatInputBar .action-btn {
  width:42px; height:42px; border-radius:50%; border: var(--glass-border);
  background: rgba(255,255,255,.04); color: var(--text-2);
  cursor:pointer; flex-shrink:0; display:flex; align-items:center; justify-content:center;
  transition: all .2s var(--spring); touch-action: manipulation;
}
#chatInputBar .action-btn:hover { background:rgba(255,255,255,.08); color:var(--text); }
#chatInputBar .action-btn.recording { background:var(--danger); color:#fff; animation:micPulse 1s ease infinite; }
@keyframes micPulse {
  0%,100% { box-shadow:0 0 0 0 rgba(248,113,113,.5); }
  50% { box-shadow:0 0 0 10px rgba(248,113,113,0); }
}
#chatInputBar .input-wrap {
  flex:1; display:flex; align-items:center; background: rgba(255,255,255,.04);
  border: var(--glass-border); border-radius: 18px; padding:0 2px 0 12px;
  transition: all .25s ease;
}
#chatInputBar .input-wrap:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(129,140,248,.1);
}
#chatInputBar #textInput {
  flex:1; background:none; border:none; padding:8px 0; color:var(--text);
  font-size:13px; outline:none;
}
#chatInputBar #textInput::placeholder { color:var(--text-3); }
.send-btn {
  width:30px; height:30px; border-radius:50%; border:none;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  color:#fff; cursor:pointer; transition: all .2s var(--spring);
  display:flex; align-items:center; justify-content:center;
  box-shadow: 0 2px 10px rgba(129,140,248,.25);
}
.send-btn:hover { transform:scale(1.08); box-shadow: 0 3px 16px rgba(129,140,248,.35); }

/* ══════════════════════════════════════════════
   Bottom Bar
   ══════════════════════════════════════════════ */
#bottombar {
  display:flex; align-items:center; justify-content:space-between;
  padding:6px 14px; background: var(--glass-bg);
  backdrop-filter: var(--backdrop); -webkit-backdrop-filter: var(--backdrop);
  border-top: var(--glass-border); flex-shrink:0; z-index:20;
}
.bottombar-left, .bottombar-right, .bottombar-center { display:flex; gap:6px; align-items:center; }
#bottombar .action-btn {
  width:44px; height:44px; border-radius:50%; border: var(--glass-border);
  background: rgba(255,255,255,.04); color: var(--text-2);
  cursor:pointer; flex-shrink:0; display:flex; align-items:center; justify-content:center;
  transition: all .2s var(--spring); touch-action: manipulation;
}
#bottombar .action-btn:hover { background:rgba(255,255,255,.08); color:var(--text); transform:scale(1.05); }
#bottombar .action-btn.accent { border-color: var(--accent); color: var(--accent); }
#bottombar .action-btn.accent:hover { background: rgba(129,140,248,.1); }

/* ══════════════════════════════════════════════
   Character Strip (on avatar stage)
   ══════════════════════════════════════════════ */
#characterStrip {
  display:flex; align-items:center; gap:8px;
  padding:6px 12px; background:rgba(0,0,0,.08);
  border-bottom: var(--glass-border); flex-shrink:0; overflow:hidden; z-index:5;
}
#characterStrip .char-label { font-size:12px; color:var(--text-3); flex-shrink:0; font-weight:600; }
#characterStrip .character-list { display:flex; gap:5px; overflow-x:auto; flex:1; scrollbar-width:none; }
#characterStrip .character-list::-webkit-scrollbar { height:0; }
#characterStrip .character-card {
  flex-direction:row; padding:4px 8px; gap:6px; font-size:11px;
  white-space:nowrap; flex-shrink:0; border-radius: var(--radius);
  background: var(--glass-bg); border: var(--glass-border);
  cursor:pointer; transition: all .2s ease;
}
#characterStrip .character-card:hover { border-color:var(--accent); }
#characterStrip .character-card.active { border-color:var(--accent); background:var(--accent); color:#fff; }
#characterStrip .character-card .char-avatar { width:22px; height:22px; font-size:11px; border-radius:50%; }
#characterStrip .character-card .char-name { font-size:11px; font-weight:600; }
#characterStrip .character-card .char-voice { font-size:9px; color:var(--text-3); }
#characterStrip .character-card.active .char-voice { color:rgba(255,255,255,.7); }
#characterStrip .character-card .char-delete {
  position:absolute; top:-4px; right:-4px; width:16px; height:16px;
  border-radius:50%; background:var(--danger); color:#fff; border:none;
  font-size:9px; line-height:16px; text-align:center; cursor:pointer;
  padding:0; opacity:0; transition:opacity .15s;
}
#characterStrip .character-card:hover .char-delete { opacity:1; }
#characterStrip .character-card.custom-card { position:relative; }
.char-add-btn {
  width:26px; height:26px; border-radius:50%; border:1px dashed var(--surface-3);
  background:transparent; color:var(--text-2); font-size:18px; cursor:pointer;
  padding:0; line-height:24px; text-align:center; flex-shrink:0; transition:all .2s;
}
.char-add-btn:hover { border-color:var(--accent); color:var(--accent); }

/* Skill form */
.skill-form {
  background:rgba(0,0,0,.12); border-bottom: var(--glass-border);
  padding:10px 12px; flex-shrink:0;
}
.skill-form.hidden { display:none; }
.skill-form-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.skill-form-header span { font-size:12px; font-weight:700; color:var(--text); }
.skill-form-body { display:flex; flex-direction:column; gap:6px; }
.skill-form-body input, .skill-form-body textarea, .skill-form-body select {
  padding:6px 10px; background:rgba(255,255,255,.03); border: var(--glass-border);
  border-radius:6px; color:var(--text); font-size:12px; outline:none; font-family:inherit;
}
.skill-form-body input:focus, .skill-form-body textarea:focus, .skill-form-body select:focus { border-color:var(--accent); }
.skill-form-row { display:flex; gap:6px; }
.skill-form-row > div { flex:1; }
.skill-form-footer { display:flex; align-items:center; justify-content:space-between; margin-top:8px; }
.skill-form-hint { font-size:10px; color:var(--danger); }
.skill-form-footer .btn { padding:6px 12px; font-size:12px; }

/* ══════════════════════════════════════════════
   Modal & Utilities
   ══════════════════════════════════════════════ */
.modal { position:fixed; inset:0; z-index:100; display:flex; align-items:center; justify-content:center; }
.modal.hidden { display:none; }
.modal-backdrop {
  position:absolute; inset:0; background:rgba(0,0,0,.55);
  backdrop-filter: blur(4px); animation:fadeIn .2s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal-content {
  position:relative; background:var(--surface-solid); border-radius:var(--radius-lg);
  width:440px; max-width:94vw; max-height:85vh; overflow-y:auto;
  box-shadow:var(--shadow-lg); animation:modalIn .3s var(--spring);
  border: var(--glass-border);
}
@keyframes modalIn { from { opacity:0; transform:scale(.95) translateY(16px); } to { opacity:1; transform:scale(1) translateY(0); } }
.modal-header { display:flex; align-items:center; justify-content:space-between; padding:18px 22px 0; position:sticky; top:0; background:var(--surface-solid); z-index:1; }
.modal-header h2 { font-size:16px; color:var(--text); display:flex; align-items:center; gap:6px; font-weight:700; }
.modal-close { background:none; border:none; color:var(--text-2); cursor:pointer; padding:4px; border-radius:4px; }
.modal-close:hover { background:rgba(255,255,255,.06); color:var(--text); }
.modal-body { padding:16px 22px; }
.setting-group { margin-bottom:14px; }
.setting-label { display:block; font-size:12px; color:var(--text-2); margin-bottom:5px; font-weight:600; }
.provider-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:6px; }
.provider-card { display:flex; flex-direction:column; align-items:center; gap:4px; padding:10px 6px; border-radius:var(--radius); cursor:pointer; background:rgba(255,255,255,.03); border: var(--glass-border); transition: all .2s ease; text-align:center; }
.provider-card:hover { border-color:var(--accent); background:rgba(129,140,248,.06); }
.provider-card.active { border-color:var(--accent); background:var(--accent); color:#fff; }
.provider-card .prov-icon { font-size:20px; font-weight:700; }
.provider-card .prov-name { font-size:11px; font-weight:600; }
.provider-card .prov-models { font-size:9px; opacity:.7; }
#modelSelect { width:100%; padding:8px 12px; background:rgba(255,255,255,.03); border: var(--glass-border); border-radius:var(--radius); color:var(--text); font-size:13px; outline:none; cursor:pointer; }
#modelSelect:focus { border-color:var(--accent); }
.setting-note { margin-top:5px; font-size:11px; color:var(--warning); padding:6px 10px; background:rgba(251,191,36,.08); border-radius:var(--radius); border:1px solid rgba(251,191,36,.15); }
.setting-note.hidden { display:none; }
.input-with-btn { display:flex; gap:6px; }
.input-with-btn input { flex:1; padding:8px 12px; background:rgba(255,255,255,.03); border: var(--glass-border); border-radius:var(--radius); color:var(--text); font-size:13px; outline:none; }
.input-with-btn input:focus { border-color:var(--accent); }
.btn-sm { padding:10px 16px; font-size:13px; cursor:pointer; font-weight:600; }
.btn-sm.primary { background:var(--accent); color:#fff; }
.btn-sm.secondary { background:rgba(255,255,255,.03); color:var(--text-2); border: var(--glass-border); }
.validation-status { margin-top:6px; font-size:11px; display:flex; align-items:center; gap:4px; }
.validation-status.hidden { display:none; }
.validation-status.success { color:var(--accent-2); }
.validation-status.error { color:var(--danger); }
.segmented-control { display:flex; gap:0; background:rgba(255,255,255,.03); border-radius:var(--radius); overflow:hidden; border: var(--glass-border); }
.segmented-control button { flex:1; padding:6px 8px; border:none; background:transparent; color:var(--text-2); font-size:12px; cursor:pointer; transition: all .2s; border-right:1px solid var(--surface-3); }
.segmented-control button:last-child { border-right:none; }
.segmented-control button.active { background:var(--accent); color:#fff; }
.budget-input-group { display:flex; align-items:center; background:rgba(255,255,255,.03); border: var(--glass-border); border-radius:var(--radius); overflow:hidden; }
.dollar-sign { padding:0 6px 0 12px; color:var(--text-3); font-size:13px; }
.budget-input-group input { flex:1; padding:8px 0; background:none; border:none; color:var(--text); font-size:13px; outline:none; }
.budget-suffix { padding:0 12px 0 4px; color:var(--text-3); font-size:12px; }
.toggle-row { display:flex; gap:14px; flex-wrap:wrap; }
.toggle-row label { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--text-2); cursor:pointer; }
.modal-footer { display:flex; align-items:center; justify-content:space-between; padding:12px 22px; border-top: var(--glass-border); position:sticky; bottom:0; background:var(--surface-solid); }
.modal-stats { display:flex; gap:12px; font-size:10px; color:var(--text-3); }
.modal-actions { display:flex; gap:6px; }
.btn { padding:10px 18px; font-size:13px; cursor:pointer; transition: all .2s; display:inline-flex; align-items:center; gap:4px; font-weight:600; }
.btn.primary { background:linear-gradient(135deg,var(--accent),#a78bfa); color:#fff; }
.btn.primary:hover { filter:brightness(1.1); }
.btn.secondary { background:rgba(255,255,255,.03); color:var(--text-2); border: var(--glass-border); }
/* ─── Auth Overlay ─────────────────────── */
.auth-overlay {
  position:fixed; inset:0; z-index:300;
  display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,.65); backdrop-filter:blur(8px);
  transition:opacity .3s;
}
.auth-overlay.hidden { display:none; }
.auth-card {
  background:var(--surface-solid); border-radius:var(--radius-lg);
  width:430px; max-width:94vw; padding:40px 36px;
  box-shadow:var(--shadow-lg); border:var(--glass-border);
  animation:modalIn .3s var(--spring);
}
.auth-header { text-align:center; margin-bottom:28px; }
.auth-logo {
  width:64px; height:64px; border-radius:50%;
  background:linear-gradient(135deg,var(--accent),#a78bfa);
  display:flex; align-items:center; justify-content:center;
  margin:0 auto 14px;
  box-shadow:0 0 36px rgba(129,140,248,.2);
}
.auth-logo .icon { stroke:#fff; width:30px; height:30px; }
.auth-header h2 { font-size:22px; font-weight:700; color:var(--text); margin-bottom:6px; }
.auth-header p { font-size:14px; color:var(--text-2); }
.auth-field { margin-bottom:18px; }
.auth-field label { display:block; font-size:13px; color:var(--text-2); margin-bottom:6px; font-weight:600; text-align:center; }
.auth-field input {
  width:100%; padding:12px 16px; background:rgba(255,255,255,.03);
  border:var(--glass-border); border-radius:var(--radius); color:var(--text);
  font-size:15px; outline:none; font-family:inherit; text-align:center !important;
}
.auth-field input:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(129,140,248,.1); }
.auth-field input::placeholder { text-align:center; }
.auth-error { font-size:13px; color:var(--danger); margin-bottom:14px; text-align:center; }
.auth-error.hidden { display:none; }
.auth-submit {
  width:100%; padding:14px; border:none; border-radius:var(--radius);
  background:linear-gradient(135deg,var(--accent),#a78bfa); color:#fff;
  font-size:16px; font-weight:700; cursor:pointer; margin-top:6px;
  transition:all .2s; display:block !important; text-align:center;
}
.auth-submit:hover { filter:brightness(1.1); transform:translateY(-1px); }
.auth-switch { text-align:center; margin-top:20px; font-size:15px; color:var(--text-2); }
.auth-link { background:none; border:none; color:var(--accent); cursor:pointer; font-size:15px; font-weight:600; }
.auth-link:hover { text-decoration:underline; }
.auth-skip { text-align:center; margin-top:12px; }
.auth-skip .auth-link { color:var(--text-3); font-size:14px; }

.btn.secondary:hover { background:rgba(255,255,255,.06); color:var(--text); }
#toastContainer { position:fixed; bottom:80px; left:50%; transform:translateX(-50%); z-index:200; display:flex; flex-direction:column; gap:4px; pointer-events:none; }
.toast { background:var(--surface-solid); color:var(--text); padding:8px 18px; border-radius:20px; font-size:12px; box-shadow:var(--shadow-lg); animation:toastIn .35s var(--spring); border: var(--glass-border); pointer-events:auto; text-align:center; }
.toast-error { border-color:var(--danger); color:var(--danger); }
.toast-success { border-color:var(--accent-2); color:var(--accent-2); }
@keyframes toastIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

/* ─── Responsive ──────────────────────────── */
@media (max-width:768px) {
  #avatarStage { flex:1; min-width:0; }
  #cameraPiP { width:200px; height:150px; bottom:8px; left:8px; }
  #chatSidebar.open { width:100%; min-width:0; max-width:none; }
  .modal-content { width:96vw; }
  .provider-grid { grid-template-columns:repeat(2,1fr); }
}
@media (max-width:480px) {
  #cameraPiP { width:150px; height:112px; }
  .topbar-cost { font-size:10px; }
}
