/* 硅灵降世 - 深色主题样式 */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a25;
  --accent-cyan: #00d4ff;
  --accent-cyan-dim: #00a8cc;
  --accent-purple: #a855f7;
  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border-color: #2a2a3a;
  --user-bubble: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  --ai-bubble: #1a1a25;
  --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.15);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

/* 主容器 */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 768px;
  margin: 0 auto;
}

/* 顶部栏 */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.app-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-glow);
}

.app-title {
  font-size: 18px;
  font-weight: 600;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-tertiary);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

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

/* 聊天区域 */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scroll-behavior: smooth;
}

.chat-area::-webkit-scrollbar {
  width: 6px;
}

.chat-area::-webkit-scrollbar-track {
  background: transparent;
}

.chat-area::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

/* 欢迎消息 */
.welcome-card {
  text-align: center;
  padding: 40px 20px;
  margin-bottom: 20px;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  box-shadow: 0 0 40px rgba(0, 212, 255, 0.3);
  animation: pulse 2s infinite;
}

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

.welcome-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

/* 快捷提示 */
.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.quick-prompt {
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-prompt:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: translateY(-2px);
}

/* 消息气泡 */
.message {
  display: flex;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}

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

.message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message.ai .message-avatar {
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
  font-size: 16px;
}

.message.user .message-avatar {
  background: var(--bg-tertiary);
  font-size: 14px;
}

.message-content {
  max-width: 80%;
  margin: 0 10px;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.6;
  font-size: 15px;
  word-break: break-word;
}

.message.ai .message-bubble {
  background: var(--ai-bubble);
  border: 1px solid var(--border-color);
  border-radius: 4px 16px 16px 16px;
}

.message.user .message-bubble {
  background: var(--user-bubble);
  border-radius: 16px 4px 16px 16px;
  color: white;
}

.message-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

.message.ai .message-time {
  text-align: left;
}

/* 打字指示器 */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 16px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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

/* 底部输入区 */
.input-area {
  padding: 12px 16px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--bg-tertiary);
  border-radius: 24px;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--border-color);
  transition: border-color 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.input-field {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 24px;
  line-height: 24px;
}

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

.send-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

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

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

/* 安装提示条 */
.install-banner {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary);
  border: 1px solid var(--accent-cyan);
  border-radius: 12px;
  padding: 12px 20px;
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.install-banner.show {
  display: flex;
}

.install-banner button {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.install-btn-yes {
  background: var(--accent-cyan);
  color: white;
}

.install-btn-no {
  background: transparent;
  color: var(--text-secondary);
}

/* 更新提示 */
#update-banner {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-purple);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  z-index: 1000;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { top: -50px; }
  to { top: 60px; }
}

/* 加载动画 */
.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: loadingDot 1.4s infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingDot {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* 移动端适配 */
@media (max-width: 480px) {
  .message-content {
    max-width: 85%;
  }
  
  .welcome-card {
    padding: 30px 16px;
  }
  
  .welcome-icon {
    width: 60px;
    height: 60px;
    font-size: 30px;
  }
}

/* 深色模式增强 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0a0a0f;
  }
}

/* 安装指引弹窗 */
.guide-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.guide-content {
  background: #1a1a2e;
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid #2a2a4e;
}
.guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #2a2a4e;
}
.guide-header h2 {
  color: #00d4ff;
  font-size: 18px;
  margin: 0;
}
.guide-close {
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
}
.guide-body {
  padding: 20px;
}
.guide-section {
  margin-bottom: 20px;
}
.guide-section h3 {
  color: #00d4ff;
  font-size: 15px;
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid #2a2a4e;
}
.guide-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  color: #ccc;
  font-size: 14px;
}
.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}
.guide-note {
  background: rgba(255,152,0,0.1);
  border: 1px solid rgba(255,152,0,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  color: #ffb74d;
  font-size: 13px;
  margin-top: 10px;
}

/* 常驻快捷栏 */
.quick-bar {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  overflow-x: auto;
  background: #0d0d14;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}
.quick-bar::-webkit-scrollbar { display: none; }
.quick-bar .quick-prompt {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid rgba(100,126,234,0.3);
  background: rgba(100,126,234,0.08);
  color: #a0b4ff;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.quick-bar .quick-prompt:hover,
.quick-bar .quick-prompt:active {
  background: rgba(100,126,234,0.2);
  border-color: rgba(100,126,234,0.5);
  color: #fff;
}

.app-icon img, .welcome-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* === 音樂播放器 === */
.music-modal {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(10,10,15,0.97);
  border-top: 1px solid rgba(0,255,200,0.2);
  border-radius: 16px 16px 0 0;
  max-height: 70vh;
  overflow: hidden;
  flex-direction: column;
}
.music-modal.active { display: flex; }
.music-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.music-header h3 { margin:0; font-size:15px; color:#e0e0e0; }
.music-close {
  background:none; border:none; color:#888; font-size:20px; cursor:pointer; padding:4px 8px;
}
.music-list {
  overflow-y: auto; flex:1; padding:8px 0;
}
.music-item {
  display: flex; align-items: center; gap:10px;
  padding: 10px 16px; cursor: pointer;
  transition: background 0.2s;
}
.music-item:hover { background: rgba(0,255,200,0.06); }
.music-item.playing { background: rgba(0,255,200,0.1); }
.music-item .play-icon {
  width:32px; height:32px; border-radius:50%;
  background: rgba(0,255,200,0.15);
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0; font-size:12px; color:#00ffc8;
}
.music-item.playing .play-icon { background: rgba(0,255,200,0.3); }
.music-item .track-info { flex:1; min-width:0; }
.music-item .track-title { font-size:14px; color:#e0e0e0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.music-item .track-type { font-size:11px; color:#666; }
.music-bar {
  display: flex; align-items: center; gap:8px;
  padding: 8px 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.music-bar audio { flex:1; height:32px; border-radius:8px; }
