/* ============================================
   iOS 18 Liquid Glass AI Chat - Styles
   液态毛玻璃 · 深色系统色调 · Apple 设计语言
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-primary: #07080b;

  /* 玻璃材质基础 */
  --glass-blur: 40px;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-bg-hover: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-soft: rgba(255, 255, 255, 0.07);
  --glass-border-strong: rgba(255, 255, 255, 0.22);
  --glass-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.10);

  /* 文字 */
  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.58);
  --text-tertiary: rgba(255, 255, 255, 0.34);

  /* 中性强调（系统蓝，克制使用） */
  --accent: #79a7ff;
  --accent-soft: rgba(120, 160, 255, 0.16);
  --user-glass: linear-gradient(155deg, rgba(90, 100, 125, 0.50), rgba(45, 50, 66, 0.55));
  --ai-glass: linear-gradient(155deg, rgba(70, 78, 98, 0.42), rgba(32, 36, 48, 0.48));

  /* 圆角（贴近 iOS iMessage 气泡） */
  --radius-bubble: 21px;
  --radius-pill: 26px;
  --radius-sm: 12px;
  --radius-md: 18px;

  /* iOS 标准缓动 */
  --ease-ios: cubic-bezier(0.2, 0, 0.2, 1);

  /* 安全区域 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, 'SF Pro Text', 'SF Pro Display', 'PingFang SC', 'Helvetica Neue', system-ui, sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

/* ============================================
   背景：多层径向色斑 + 呼吸动画
   ============================================ */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 10% 0%, #0d1117 0%, transparent 55%),
    radial-gradient(100% 80% at 90% 90%, #0a0f16 0%, transparent 60%),
    linear-gradient(175deg, #0b0d12 0%, #07080b 100%);
}

/* 极淡的灰蓝光带，提供玻璃折射的层次，不带彩色 */
.bg-layer::before {
  content: '';
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(40% 30% at 25% 20%, rgba(140, 150, 170, 0.10), transparent 70%),
    radial-gradient(35% 30% at 75% 35%, rgba(120, 140, 170, 0.08), transparent 70%),
    radial-gradient(45% 30% at 55% 75%, rgba(100, 120, 150, 0.07), transparent 70%);
  filter: blur(40px);
  animation: aurora 26s ease-in-out infinite;
}

@keyframes aurora {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.9; }
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  will-change: transform, opacity;
}

.orb-1 {
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(130, 145, 172, 0.40), transparent 70%);
  top: -90px;
  left: -70px;
  animation: float1 18s ease-in-out infinite, breathe1 9s ease-in-out infinite;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(168, 175, 190, 0.30), transparent 70%);
  top: 26%;
  right: -80px;
  animation: float2 22s ease-in-out infinite, breathe2 11s ease-in-out infinite;
}

.orb-3 {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(95, 115, 145, 0.35), transparent 70%);
  bottom: 6%;
  left: 16%;
  animation: float3 20s ease-in-out infinite, breathe3 10s ease-in-out infinite;
}

.orb-4 {
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(105, 130, 165, 0.35), transparent 70%);
  top: 50%;
  left: 60%;
  animation: float4 25s ease-in-out infinite, breathe1 12s ease-in-out infinite;
}

.orb-5 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(150, 158, 175, 0.30), transparent 70%);
  top: 10%;
  left: 42%;
  animation: float5 16s ease-in-out infinite, breathe2 8s ease-in-out infinite;
}

/* 呼吸：透明度缓慢起伏 */
@keyframes breathe1 { 0%, 100% { opacity: 0.55; } 50% { opacity: 0.95; } }
@keyframes breathe2 { 0%, 100% { opacity: 0.50; } 50% { opacity: 0.90; } }
@keyframes breathe3 { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.85; } }

@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(60px, 80px) scale(1.1); }
  66% { transform: translate(-30px, 40px) scale(0.95); }
}
@keyframes float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-80px, 60px) scale(1.05); }
  66% { transform: translate(-40px, -50px) scale(0.9); }
}
@keyframes float3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(50px, -70px) scale(1.1); }
  66% { transform: translate(-60px, -30px) scale(0.95); }
}
@keyframes float4 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-60px, -40px); }
}
@keyframes float5 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(40px, 50px); }
}

/* ============================================
   布局
   ============================================ */
.chat-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding-top: var(--safe-top);
}

/* ============================================
   顶部导航：透明无框，居中标题 + 左侧圆形设置钮
   ============================================ */
.nav-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 24px 16px 8px;
  flex-shrink: 0;
  background: transparent;
  border-bottom: none;
}

.nav-title-text {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.1px;
  color: var(--text-secondary);
  pointer-events: none;
  z-index: 0;
}

/* 通用深色毛玻璃卡片 */
.glass-card {
  position: relative;
  background: rgba(26, 26, 30, 0.62);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.11), 0 12px 40px rgba(0, 0, 0, 0.30);
}

/* 设置面板底部抽屉 */
.glass-sheet {
  position: relative;
  background: rgba(26, 26, 30, 0.62);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.11), 0 -12px 60px rgba(0, 0, 0, 0.4);
}

/* 圆形设置按钮（深色液态玻璃） */
.gear-btn {
  position: relative;
  z-index: 1;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(26, 26, 30, 0.62);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.11), 0 4px 16px rgba(0, 0, 0, 0.35);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.25s var(--ease-ios), background 0.25s var(--ease-ios), border-color 0.25s var(--ease-ios);
}

.gear-btn:active {
  transform: scale(0.9);
}

/* 关闭按钮（设置面板内） */
.glass-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(26, 26, 30, 0.62);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.11), 0 4px 16px rgba(0, 0, 0, 0.35);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.25s var(--ease-ios), background 0.25s var(--ease-ios), border-color 0.25s var(--ease-ios);
}

.glass-btn:hover {
  background: rgba(40, 40, 46, 0.68);
  border-color: rgba(255, 255, 255, 0.24);
}

.glass-btn:active {
  transform: scale(0.9);
}

.nav-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* 主按钮：深色玻璃 */
.glass-primary {
  background: linear-gradient(135deg, rgba(150, 160, 180, 0.55), rgba(90, 100, 125, 0.65)) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.30), var(--glass-sheen) !important;
  transition: transform 0.25s var(--ease-ios), box-shadow 0.25s var(--ease-ios) !important;
}

.glass-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38), var(--glass-sheen) !important;
}

/* ============================================
   消息列表
   关键：必须 display:flex 才能让气泡贴边
   ============================================ */
.message-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 12px;
  padding-bottom: calc(88px + constant(safe-area-inset-bottom, 0px));
  padding-bottom: calc(88px + var(--safe-bottom));
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.message-list::-webkit-scrollbar {
  width: 4px;
}

.message-list::-webkit-scrollbar-track {
  background: transparent;
}

.message-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
}

/* --- 欢迎卡片 --- */
.welcome-card {
  max-width: 300px;
  margin: auto;
  margin-top: 8vh;
  margin-bottom: 24px;
  padding: 36px 26px;
  text-align: center;
  animation: fadeUp 0.6s var(--ease-ios) both;
}

.welcome-icon {
  font-size: 36px;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 16px;
  animation: breathing 3s ease-in-out infinite;
}

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

.welcome-card h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.welcome-card p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
}

/* ============================================
   消息气泡（液态玻璃）
   ============================================ */
.message {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  margin-bottom: 14px;
  animation: msgIn 0.4s var(--ease-ios) both;
}

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

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

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

.message.assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.bubble {
  position: relative;
  overflow: hidden;
  padding: 11px 16px;
  line-height: 1.6;
  font-size: 15px;
  word-wrap: break-word;
  white-space: pre-wrap;
  border-radius: 20px;
}

/* 玻璃高光层：顶部反光 + 角落折射亮斑 */
.bubble::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.22), transparent 52%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.015) 42%);
  pointer-events: none;
  opacity: 0.6;
}

.bubble::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 18px;
  width: 11px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  filter: blur(0.5px);
  pointer-events: none;
  opacity: 0.5;
}

/* 用户气泡：右侧，轻微色调但保留真实毛玻璃，贴右边缘 */
.message.user .bubble {
  border-bottom-right-radius: 5px;
  background: rgba(70, 74, 92, 0.62);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    0 6px 24px rgba(0, 0, 0, 0.22);
  color: #fff;
}

/* AI 气泡：左侧，中性深玻璃，保留玻璃光学质感，贴左边缘 */
.message.assistant .bubble {
  border-bottom-left-radius: 5px;
  background: rgba(26, 26, 30, 0.62);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    0 6px 24px rgba(0, 0, 0, 0.20);
}

.bubble p { margin: 0; }
.bubble p + p { margin-top: 8px; }

.bubble code {
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'SF Mono', 'Menlo', monospace;
}

.bubble pre {
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 8px 0;
}

.bubble pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
}

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: rgba(255, 255, 255, 0.85);
  margin-left: 2px;
  border-radius: 2px;
  vertical-align: text-bottom;
  animation: blink 1s ease-in-out infinite;
}

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

/* ============================================
   输入区域（毛玻璃胶囊 · 固定抽屉，咬死屏幕底部）
   抽屉条 position:fixed; bottom:0 始终贴屏底，
   页面正文/标题栏完全静止。
   键盘弹出时 dvh 收缩，抽屉本身不动，
   视觉上盒子跟着键盘被顶上来。
   ============================================ */
.input-area {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 10px 14px;
  padding-bottom: calc(10px + constant(safe-area-inset-bottom, 0px));
  padding-bottom: calc(10px + var(--safe-bottom));
  will-change: transform;
  transition: transform 0.3s var(--ease-ios);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border-radius: 20px;
  padding: 8px 10px 8px 20px;
  background: rgba(26, 26, 30, 0.62);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.11), 0 10px 36px rgba(0, 0, 0, 0.28);
  transition: border-color 0.25s var(--ease-ios), box-shadow 0.25s var(--ease-ios);
}

/* 胶囊顶部高光 */
.input-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.18), transparent 45%);
  pointer-events: none;
}

.input-wrapper:focus-within {
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.11), 0 10px 36px rgba(0, 0, 0, 0.28), 0 0 0 4px var(--accent-soft);
}

.input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  letter-spacing: -0.01em;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  padding: 6px 0;
}

.input-wrapper textarea::placeholder {
  color: var(--text-tertiary);
}

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, rgba(140, 150, 175, 0.75), rgba(80, 90, 115, 0.85));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease-ios), box-shadow 0.25s var(--ease-ios), opacity 0.25s var(--ease-ios);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.send-btn:not(:disabled):hover {
  transform: scale(1.07);
}

.send-btn:not(:disabled):active {
  transform: scale(0.92);
}

/* ============================================
   设置面板（毛玻璃弹窗）
   ============================================ */
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 1;
  transition: opacity 0.4s var(--ease-ios);
}

.settings-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.settings-sheet {
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 0;
  transform: scale(1);
  opacity: 1;
  transition: transform 0.4s var(--ease-ios), opacity 0.4s var(--ease-ios);
  padding-bottom: var(--safe-bottom);
}

.settings-overlay.hidden .settings-sheet {
  transform: scale(0.96);
  opacity: 0;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  position: sticky;
  top: 0;
  background: rgba(26, 26, 30, 0.62);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 1;
}

.settings-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.settings-body {
  padding: 20px 24px 40px;
}

.field-group {
  margin-bottom: 20px;
}

.field-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.1px;
}

.field-group input,
.field-group textarea {
  width: 100%;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02) 50%, rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  letter-spacing: -0.01em;
  outline: none;
  transition: border-color 0.25s var(--ease-ios), box-shadow 0.25s var(--ease-ios);
}

.field-group input:focus,
.field-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-group textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

.field-group input::placeholder,
.field-group textarea::placeholder {
  color: var(--text-tertiary);
}

.key-input-wrap { position: relative; }
.key-input-wrap input { padding-right: 48px; }

.key-vis-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.key-vis-btn .hidden { display: none; }

.primary-btn, .danger-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.25s var(--ease-ios), background 0.25s var(--ease-ios), box-shadow 0.25s var(--ease-ios);
  margin-bottom: 12px;
}

.primary-btn { color: #fff; }
.primary-btn:active { transform: scale(0.97); }

/* 危险按钮：深色毛玻璃 */
.danger-btn {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03) 60%, rgba(255, 255, 255, 0.05));
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72);
  box-shadow: var(--glass-sheen);
}

.danger-btn:hover {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
}

.danger-btn:active { transform: scale(0.97); }

/* ============================================
   错误提示（深色毛玻璃胶囊，复用玻璃质感）
   ============================================ */
.toast {
  position: fixed;
  top: calc(16px + constant(safe-area-inset-top, 0px));
  top: calc(16px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%) translateY(-24px);
  z-index: 200;
  max-width: calc(100% - 40px);
  padding: 11px 22px;
  border-radius: 999px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #fff;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.12), rgba(30, 33, 42, 0.55) 50%, rgba(20, 22, 30, 0.6));
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--glass-sheen), 0 12px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-ios), transform 0.4s var(--ease-ios);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   AI 内容排版
   ============================================ */
.message.assistant .bubble h1,
.message.assistant .bubble h2,
.message.assistant .bubble h3 {
  margin: 12px 0 6px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.message.assistant .bubble h1 { font-size: 18px; }
.message.assistant .bubble h2 { font-size: 16px; }
.message.assistant .bubble h3 { font-size: 15px; }

.message.assistant .bubble ul,
.message.assistant .bubble ol {
  padding-left: 20px;
  margin: 6px 0;
}

.message.assistant .bubble li { margin: 3px 0; }

.message.assistant .bubble blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin: 8px 0;
  color: var(--text-secondary);
}

.message.assistant .bubble a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.message.assistant .bubble a:hover { border-bottom-color: var(--accent); }

.message.assistant .bubble hr {
  border: none;
  height: 1px;
  background: var(--glass-border-soft);
  margin: 12px 0;
}

.message.assistant .bubble strong {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.96);
}

.message.assistant .bubble em { color: rgba(255, 255, 255, 0.78); }

/* ============================================
   桌面端适配
   ============================================ */
@media (min-width: 768px) {
  .message { max-width: 62%; }
  .message-list { padding: 16px 24px 8px; }

  .welcome-card {
    max-width: 360px;
    padding: 44px 32px;
  }

  .settings-sheet {
    border-radius: 20px;
  }
}

/* ============================================
   iOS 触摸回弹抑制
   ============================================ */
@supports (-webkit-touch-callout: none) {
  .message-list { overscroll-behavior-y: contain; }
}