/* AI Buddy · 儿童友好样式 v0.2.0 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #E8F4FD;
  overflow: hidden;
  height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh;         /* fallback for older browsers */
  max-width: 480px;
  margin: 0 auto;
  background: #E8F4FD;
  position: relative;
  overflow: hidden;
}

/* ===== Header ===== */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  z-index: 10;
}
.logo { font-size: 20px; font-weight: 700; color: #1A1A2E; }
.logo span { color: #4FC3F7; }
.header-right { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  height: 30px; width: auto; border-radius: 6px;
  vertical-align: middle; transition: transform .18s; cursor: default;
}
.brand-logo:hover { transform: scale(1.04); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border: none; background: transparent;
  border-radius: 50%; cursor: pointer; color: #455A64;
  transition: background .18s, color .18s, transform .12s;
}
.icon-btn svg { width: 22px; height: 22px; display: block; }
.icon-btn:hover { background: rgba(79,195,247,.12); color: #4FC3F7; }
.icon-btn:active { transform: scale(.94); }
.icon-btn.active { background: rgba(79,195,247,.18); color: #4FC3F7; }
.icon-btn:focus-visible { outline: 2px solid #4FC3F7; outline-offset: 2px; }

/* ===== Pet Area ===== */
/* v2.0 H5: 透明背景 + 缩小 + 自由浮动 */
.pet-area {
  position: fixed;
  top: 56px;
  right: 12px;
  z-index: 20;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: transparent;
  overflow: visible;
  cursor: pointer;
  /* 平滑漂移动画由 JS 驱动，此处仅保留基本过渡 */
  transition: none;
}
.pet-area:active {
  transform: scale(0.95);
}
#petCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  touch-action: manipulation;
  border-radius: 50%;
}

/* ===== Chat Area ===== */
.chat-area {
  flex: 1;
  min-height: 0;          /* 防止 flex 子元素坍缩 */
  overflow-y: auto;
  padding: 8px 16px;
  background: rgba(255,255,255,0.6);
  -webkit-overflow-scrolling: touch;
}
.chat-hint {
  text-align: center; color: #90A4AE; font-size: 15px; padding: 12px;
}
.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  margin: 6px 0;
  border-radius: 16px;
  font-size: 16px;                    /* ↑ from 14px (更符合儿童规范) */
  line-height: 1.6;
  animation: fadeIn 0.3s ease;
  word-break: break-word;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-bubble.user {
  background: #4FC3F7; color: white;
  margin-left: auto;
  border-bottom-right-radius: 6px;
}
.chat-bubble.buddy {
  background: white; color: #1A1A2E;
  margin-right: auto;
  border-bottom-left-radius: 6px;
  border: 1px solid rgba(79,195,247,0.2);
}
.bubble-label { font-size: 13px; opacity: 0.6; margin-bottom: 3px; }
.bubble-score {
  display: inline-block; font-size: 13px; padding: 2px 8px;
  border-radius: 10px; background: #4FC3F7; color: white;
  margin-left: 6px;
}
.correction {
  font-size: 14px; color: #1D9E75; margin-top: 4px; padding: 2px 0;
}
.correction-tip {
  font-size: 13px; color: #7F77DD; margin-top: 2px; padding: 1px 0;
}
.loading-bubble { opacity: 0.7; }

/* ===== Bottom Bar ===== */
.bottom-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  padding: 8px 16px 14px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(0,0,0,0.06);
}
.voice-selector {
  display: flex; gap: 12px;           /* ↑ from 6px (防误触) */
  margin-bottom: 8px;
  justify-content: center;
}
.voice-btn {
  padding: 6px 14px;
  border: 1px solid #E0E0E0; border-radius: 16px;
  background: white; font-size: 14px; cursor: pointer;
  transition: all 0.2s;
  min-height: 36px;
}
.voice-btn.active { background: #4FC3F7; color: white; border-color: #4FC3F7; }
.voice-btn.locked { color: #BDBDBD; }
.main-controls {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.mic-btn {
  width: 72px; height: 72px;          /* ↑ from 64px (幼儿更友好) */
  border-radius: 50%;
  border: none; background: #4FC3F7; color: white;
  font-size: 32px; cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 4px 16px rgba(79,195,247,0.3);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.mic-btn:active, .mic-btn.active {
  transform: scale(1.12);
  background: #29B6F6;
  box-shadow: 0 6px 24px rgba(79,195,247,0.5);
}
.mic-btn.recording {
  background: #FF5252;
  box-shadow: 0 4px 20px rgba(255,82,82,0.5);
  animation: micPulse 0.8s ease-in-out infinite;
}
.mic-btn.processing {
  background: #FFB74D;
  box-shadow: 0 4px 20px rgba(255,183,77,0.5);
  pointer-events: none;
  animation: micSpin 1s linear infinite;
}
@keyframes micPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
@keyframes micSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.mic-label { font-size: 14px; color: #78909C; }
.text-input-row {
  display: flex; gap: 8px; width: 100%; max-width: 360px; margin-top: 4px;
}
.text-input {
  flex: 1; padding: 10px 14px;
  border: 1px solid #E0E0E0; border-radius: 20px;
  font-size: 15px; outline: none; background: #FAFAFA;
  transition: border-color 0.2s;
}
.text-input:focus { border-color: #4FC3F7; background: white; }
.text-input.pulse {
  animation: inputPulse 0.6s ease-in-out 3;
  border-color: #FF5252;
  box-shadow: 0 0 12px rgba(255,82,82,0.3);
}
@keyframes inputPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255,82,82,0); }
  50% { box-shadow: 0 0 18px rgba(255,82,82,0.5); }
}
.send-btn {
  padding: 10px 20px;
  border: none; border-radius: 20px;
  background: #4FC3F7; color: white;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.send-btn:active { background: #29B6F6; }
.status-bar {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-size: 13px; color: #90A4AE; padding: 0 8px;
}

/* ===== Overlay ===== */
.overlay {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  justify-content: center; align-items: center;
}
.overlay.show { display: flex; }
.settings-panel, .vip-panel {
  background: white; border-radius: 24px; padding: 28px;
  width: 90%; max-width: 380px; max-height: 80vh; overflow-y: auto;
}
.settings-panel h3, .vip-panel h3 {
  font-size: 20px; margin-bottom: 20px; text-align: center; color: #1A1A2E;
}
.setting-item { margin-bottom: 16px; }
.setting-item label {
  display: block; font-size: 15px; color: #78909C; margin-bottom: 6px;
}
.setting-item input, .setting-item select {
  width: 100%; padding: 10px 14px;
  border: 1px solid #E0E0E0; border-radius: 12px;
  font-size: 16px; outline: none; background: #FAFAFA;
  transition: border-color 0.2s;
}
.setting-item input:focus, .setting-item select:focus {
  border-color: #4FC3F7; background: white;
}
.btn-close {
  width: 100%; padding: 14px; margin-top: 16px;
  background: #F5F5F5; border: none; border-radius: 14px;
  font-size: 16px; cursor: pointer; color: #78909C;
}

/* ===== VIP Panel ===== */
.vip-icon { font-size: 56px; text-align: center; margin-bottom: 10px; }
.vip-panel p { text-align: center; color: #78909C; font-size: 15px; margin-bottom: 20px; }
.vip-plans { display: flex; gap: 14px; }
.plan {
  flex: 1; padding: 20px; border-radius: 16px;
  background: #F8F9FA; text-align: center;
}
.plan.featured {
  background: linear-gradient(135deg, #E8F4FD, #E1F5EE);
  border: 2px solid #4FC3F7;
  position: relative;
}
.plan-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: #FF8A65; color: white; padding: 3px 14px;
  border-radius: 12px; font-size: 12px; font-weight: 600;
}
.plan-name { font-size: 16px; font-weight: 600; color: #1A1A2E; }
.plan-price { font-size: 28px; font-weight: 700; color: #4FC3F7; margin: 6px 0; }
.plan-desc { font-size: 12px; color: #90A4AE; margin-bottom: 10px; }
.btn-buy {
  padding: 8px 24px; border-radius: 16px;
  border: 1px solid #4FC3F7; background: white;
  color: #4FC3F7; cursor: pointer; font-size: 14px; font-weight: 600;
}
.btn-buy.primary { background: #4FC3F7; color: white; }

/* ===== Vocabulary Panel (P1-14) ===== */
.vocab-panel {
  background: white; border-radius: 24px; padding: 20px;
  width: 90%; max-width: 400px; max-height: 80vh; overflow-y: auto;
}
.vocab-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.vocab-header h3 { font-size: 20px; color: #1A1A2E; margin: 0; }
.vocab-tabs {
  display: flex; gap: 6px; margin-bottom: 16px;
}
.vocab-tab {
  flex: 1; padding: 8px 4px; border-radius: 12px; border: none;
  background: #F0F4F8; color: #78909C; font-size: 13px; cursor: pointer;
  transition: all 0.2s;
}
.vocab-tab.active { background: #4FC3F7; color: white; font-weight: 600; }
.vocab-list { display: flex; flex-direction: column; gap: 8px; }
.vocab-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: #F8FAFB; border-radius: 12px;
  animation: fadeIn 0.2s ease;
}
.vocab-word { font-size: 17px; font-weight: 700; color: #1A1A2E; min-width: 80px; }
.vocab-meaning { flex: 1; font-size: 14px; color: #607D8B; }
.vocab-badge { font-size: 12px; padding: 2px 8px; border-radius: 8px; white-space: nowrap; }
.vocab-badge.mastered { background: #E8F5E9; color: #4CAF50; }
.vocab-badge.weak { background: #FFF3E0; color: #FF9800; }
.vocab-badge.learning { background: #E3F2FD; color: #2196F3; }
.vocab-empty { text-align: center; padding: 32px 0; color: #90A4AE; font-size: 15px; }
.vocab-loading { text-align: center; padding: 24px; color: #90A4AE; }

/* 夜间模式词汇本 */
body[data-theme="dark"] .vocab-panel { background: #1E1E2E; }
body[data-theme="dark"] .vocab-header h3 { color: #E0E0E0; }
body[data-theme="dark"] .vocab-tab { background: #2A2A3E; color: #A0A0B0; }
body[data-theme="dark"] .vocab-tab.active { background: #4FC3F7; color: white; }
body[data-theme="dark"] .vocab-item { background: #2A2A3E; }
body[data-theme="dark"] .vocab-word { color: #E0E0E0; }
body[data-theme="dark"] .vocab-meaning { color: #9090A0; }

/* ===== Payment QR Area (P1) ===== */
.payment-qr-area {
  text-align: center;
  padding: 16px 0;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.qr-title {
  font-size: 16px; font-weight: 600; color: #1A1A2E; margin-bottom: 12px;
}
.qr-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.qr-code-bg {
  width: 140px; height: 140px;
  background: #F5F5F5;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed #BDBDBD;
}
.qr-icon { font-size: 48px; }
.qr-amount {
  font-size: 24px; font-weight: 700; color: #FF5722;
}
.qr-info {
  font-size: 13px; color: #90A4AE; margin-bottom: 8px;
}
.qr-info code {
  background: #F5F5F5; padding: 2px 6px; border-radius: 4px; font-size: 12px;
}
.countdown {
  font-size: 14px; color: #FF8A65; font-weight: 600; margin-top: 4px;
}
.qr-status {
  font-size: 14px; color: #78909C; margin-bottom: 12px;
}
.btn-cancel {
  padding: 8px 20px; border-radius: 14px;
  border: 1px solid #E0E0E0; background: white;
  color: #90A4AE; cursor: pointer; font-size: 14px;
}

/* Payment Status */
.payment-status {
  text-align: center;
  padding: 20px 0;
}
.payment-status .status-icon {
  font-size: 48px; margin-bottom: 10px;
}
.payment-status h3 {
  font-size: 18px; color: #1A1A2E; margin-bottom: 8px;
}
.payment-status p {
  font-size: 14px; color: #78909C;
}

/* Plan Original Price */
.plan-original {
  font-size: 13px; color: #BDBDBD; text-decoration: line-through;
}

/* ===== Scrollbar ===== */
.chat-area::-webkit-scrollbar { width: 3px; }
.chat-area::-webkit-scrollbar-thumb { background: #B0BEC5; border-radius: 3px; }

/* ═════════════════════════════════════════════════════════
   v7.0 语音气泡 + 模式切换器样式 ★Phase 1 新增★
   ═════════════════════════════════════════════════════════ */

/* ── 语音气泡 ──────────────────────────────────────────── */
.voice-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 16px;
  max-width: 280px;
  min-width: 120px;
  font-size: 13px;
  position: relative;
  transition: all 0.2s ease;
}
.voice-bubble--left {
  background: #fff;
  border: 1.5px solid #E0E0E0;
  align-self: flex-start;
  margin-right: auto;
}
.voice-bubble--right {
  background: linear-gradient(135deg, #4A90D9 0%, #7B68EE 100%);
  color: #fff;
  align-self: flex-end;
  margin-left: auto;
}

/* ── 播放按钮 ──────────────────────────────────────────── */
.voice-bubble__play {
  width: 32px; height: 32px;
  min-width: 32px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.voice-bubble--left .voice-bubble__play {
  background: #4A90D9;
  color: #fff;
}
.voice-bubble--right .voice-bubble__play {
  background: rgba(255,255,255,0.3);
  color: #fff;
}
.voice-bubble__play:hover {
  transform: scale(1.1);
}
.voice-bubble__play:active {
  transform: scale(0.95);
}

/* ── 音波 Canvas ───────────────────────────────────────── */
.voice-bubble__wave {
  flex: 1;
  border-radius: 6px;
  min-width: 80px;
}

/* ── 时长标签 ──────────────────────────────────────────── */
.voice-bubble__duration {
  font-size: 11px;
  opacity: 0.6;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── 进度条 ────────────────────────────────────────────── */
.voice-bubble__progress {
  position: absolute;
  bottom: 0; left: 16px; right: 16px;
  height: 3px;
  background: rgba(0,0,0,0.06);
  border-radius: 0 0 2px 2px;
  overflow: hidden;
}
.voice-bubble--right .voice-bubble__progress {
  background: rgba(255,255,255,0.2);
}
.voice-bubble__progress-bar {
  height: 100%;
  background: #4A90D9;
  border-radius: 2px;
  transition: width 0.1s linear;
  width: 0;
}
.voice-bubble--right .voice-bubble__progress-bar {
  background: rgba(255,255,255,0.7);
}

/* ── 三模式切换器 ──────────────────────────────────────── */
.voice-mode-switcher {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255,255,255,0.8);
  border-radius: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.voice-mode-switcher__btn {
  padding: 6px 12px;
  border: none;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  background: transparent;
  color: #666;
  transition: all 0.2s;
  white-space: nowrap;
}
.voice-mode-switcher__btn:hover {
  background: rgba(74,144,217,0.08);
  color: #4A90D9;
}
.voice-mode-switcher__btn--active {
  background: #4A90D9;
  color: #fff;
  box-shadow: 0 2px 6px rgba(74,144,217,0.3);
}
.voice-mode-switcher__btn--active:hover {
  background: #3A7BC8;
  color: #fff;
}

/* ── 录音指示器 ────────────────────────────────────────── */
.recording-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #FF5252;
  color: #fff;
  border-radius: 20px;
  font-size: 12px;
  animation: pulse-rec 1.5s ease-in-out infinite;
}
@keyframes pulse-rec {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}
.recording-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #fff;
  animation: blink-dot 0.8s ease-in-out infinite;
}
@keyframes blink-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ═════════════════════════════════════════════════════════
   v0.7.0 小蓝生活智伴 — 角色切换 + 蓝色主题 ★新增★
   ═════════════════════════════════════════════════════════ */

/* ── 角色切换器 ──────────────────────────────────────────── */
.role-switcher {
  display: flex;
  gap: 6px;
  align-items: center;
}
.role-btn {
  padding: 5px 12px;
  border: 1.5px solid #E0E0E0;
  border-radius: 16px;
  background: white;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  color: #78909C;
}
.role-btn:hover {
  border-color: #4FC3F7;
  color: #4FC3F7;
}
.role-btn.active {
  background: #4FC3F7;
  color: white;
  border-color: #4FC3F7;
  font-weight: 600;
}
/* 小蓝激活时蓝色渐变 */
body[data-role="little_blue"] .role-btn.active {
  background: linear-gradient(135deg, #4FC3F7, #0288D1);
  border-color: #0288D1;
}

/* ── 小蓝气泡 ────────────────────────────────────────────── */
.chat-bubble.little-blue {
  background: linear-gradient(135deg, #E1F5FE, #B3E5FC);
  color: #01579B;
  margin-right: auto;
  border-bottom-left-radius: 6px;
  border-left: 3px solid #0288D1;
}
.chat-bubble.little-blue .bubble-label {
  color: #0288D1;
}

/* ── 小蓝主题下整体配色 ────────────────────────────────── */
body[data-role="little_blue"] .app {
  background: linear-gradient(180deg, #E1F5FE 0%, #B3E5FC 100%);
}
body[data-role="little_blue"] header {
  background: rgba(227, 242, 253, 0.95);
}
body[data-role="little_blue"] .brand-logo {
  opacity: .96;
}
body[data-role="little_blue"] .chat-area {
  background: rgba(227, 242, 253, 0.6);
}
body[data-role="little_blue"] .bottom-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}
body[data-role="little_blue"] .mic-btn {
  background: linear-gradient(135deg, #4FC3F7, #0288D1);
  box-shadow: 0 4px 16px rgba(2, 136, 209, 0.3);
}
body[data-role="little_blue"] .send-btn {
  background: linear-gradient(135deg, #4FC3F7, #0288D1);
}
body[data-role="little_blue"] .voice-btn.active {
  background: linear-gradient(135deg, #4FC3F7, #0288D1);
  border-color: #0288D1;
}

/* ── 小蓝引导提示 ────────────────────────────────────────── */
.guide-bubble {
  border: 2px dashed #4FC3F7 !important;
  animation: guidePulse 2s ease-in-out infinite;
}
@keyframes guidePulse {
  0%, 100% { box-shadow: 0 0 0 rgba(79, 195, 247, 0); }
  50% { box-shadow: 0 0 12px rgba(79, 195, 247, 0.3); }
}
.guide-switch-btn {
  display: block;
  margin-top: 10px;
  padding: 8px 20px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #4FC3F7, #0288D1);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.guide-switch-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(2, 136, 209, 0.4);
}

/* ── 小蓝模式宠物区域收起 ───────────────────────────────── */
/* 小蓝模式下宠物区域直接隐藏（position:fixed 不影响布局） */

/* ═════════════════════════════════════════════════════════
   Phase 1.5 PWA 样式 ★新增★
   ═════════════════════════════════════════════════════════ */

/* ── 离线模式指示 ───────────────────────────────────────── */
body.offline-mode::before {
  content: '🐳 网络不给力~';
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: #FF8A65;
  color: white;
  padding: 6px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: 0 2px 12px rgba(255, 138, 101, 0.4);
  animation: fadeIn 0.3s ease;
}

/* ── PWA 更新提示条 ────────────────────────────────────── */
#sw-update-banner {
  display: none;
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #4FC3F7;
  color: white;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  cursor: pointer;
  z-index: 9998;
  box-shadow: 0 4px 16px rgba(79, 195, 247, 0.4);
  white-space: nowrap;
}
#sw-update-banner.show { display: block; }

/* ── iOS 启动屏背景色（与 manifest 同步）───────────────── */
/* 防止 Safari 加载时闪白 */
html {
  background-color: #E8F4FD;
}

/* ═════════════════════════════════════════════════════════
   Phase 2 夜间模式 / 护眼模式 ★新增★
   配色来源：M3规范 §4.5（#FFF8E1 暖黄 + #5D4037 深棕）
   激活方式：body[data-theme="dark"] 或 js 动态切换
   ═════════════════════════════════════════════════════════ */
body[data-theme="dark"],
html[data-theme="dark"] {
  /* 暖黄色背景 — 减少蓝光，护眼 */
  background: #FFF8E1 !important;
  color: #5D4037;
}
body[data-theme="dark"] .app {
  background: #FFF8E1 !important;
}
body[data-theme="dark"] header {
  background: rgba(255, 248, 225, 0.92) !important;
}
body[data-theme="dark"] .logo {
  color: #5D4037 !important;
}
body[data-theme="dark"] .brand-logo {
  filter: brightness(.92);
}
body[data-theme="dark"] .chat-area {
  background: rgba(255, 253, 231, 0.85) !important;
}
body[data-theme="dark"] .chat-bubble {
  color: #4E342E;
}
body[data-theme="dark"] .chat-bubble.buddy {
  background: #FFF8E1 !important;
  border-color: rgba(93, 64, 55, 0.15) !important;
  color: #5D4037 !important;
}
body[data-theme="dark"] .chat-bubble.user {
  background: #FFAB91 !important;
  color: white !important;
}
body[data-theme="dark"] .chat-hint {
  color: #A1887F;
}
body[data-theme="dark"] .bottom-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: rgba(255, 248, 225, 0.96) !important;
  border-top-color: rgba(93, 64, 55, 0.1) !important;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}
body[data-theme="dark"] .mic-btn {
  background: #FFAB91 !important;
  box-shadow: 0 4px 16px rgba(255, 171, 145, 0.4) !important;
}
body[data-theme="dark"] .mic-btn:active,
body[data-theme="dark"] .mic-btn.active {
  background: #FF8A65 !important;
}
body[data-theme="dark"] .send-btn {
  background: #FFAB91 !important;
}
body[data-theme="dark"] .send-btn:active {
  background: #FF8A65 !important;
}
body[data-theme="dark"] .voice-btn.active {
  background: #FFAB91 !important;
  border-color: #FFAB91 !important;
  color: white !important;
}
body[data-theme="dark"] .text-input {
  background: #FFF8E1 !important;
  border-color: #BCAAA4 !important;
  color: #5D4037 !important;
}
body[data-theme="dark"] .text-input:focus {
  border-color: #FFAB91 !important;
}
body[data-theme="dark"] .overlay {
  background: rgba(93, 64, 55, 0.4) !important;
}
body[data-theme="dark"] .settings-panel,
body[data-theme="dark"] .vip-panel {
  background: #FFF8E1 !important;
  color: #5D4037;
}
body[data-theme="dark"] .settings-panel h3,
body[data-theme="dark"] .vip-panel h3 {
  color: #5D4037 !important;
}
body[data-theme="dark"] .voice-bubble--left {
  background: #FFF8E1 !important;
  border-color: #D7CCC8 !important;
  color: #5D4037 !important;
}
body[data-theme="dark"] .voice-bubble--right {
  background: #FFAB91 !important;
  color: white !important;
}
body[data-theme="dark"] .recording-indicator {
  background: #E64A19 !important;
}
body[data-theme="dark"] .voice-mode-switcher {
  background: rgba(255, 248, 225, 0.9) !important;
}
body[data-theme="dark"] .voice-mode-switcher__btn {
  color: #8D6E63;
}
body[data-theme="dark"] .voice-mode-switcher__btn--active {
  background: #FFAB91 !important;
  color: white !important;
}
body[data-theme="dark"] .status-bar {
  color: #A1887F;
}
body[data-theme="dark"] .mic-label {
  color: #A1887F !important;
}
body[data-theme="dark"] #sw-update-banner {
  background: #FFAB91 !important;
}
body[data-theme="dark"] .plan {
  background: rgba(255, 248, 225, 0.5) !important;
}
body[data-theme="dark"] .plan.featured {
  background: rgba(255, 171, 145, 0.15) !important;
  border-color: #FFAB91 !important;
}
body[data-theme="dark"] .plan-name,
body[data-theme="dark"] .plan-price {
  color: #5D4037 !important;
}
body[data-theme="dark"] .plan-price {
  color: #FFAB91 !important;
}
body[data-theme="dark"] .plan-desc,
body[data-theme="dark"] .qr-info {
  color: #A1887F !important;
}
body[data-theme="dark"] .btn-buy {
  border-color: #FFAB91 !important;
  color: #FFAB91 !important;
}
body[data-theme="dark"] .btn-buy.primary {
  background: #FFAB91 !important;
  color: white !important;
}
body[data-theme="dark"] .role-btn {
  background: #FFF8E1 !important;
  border-color: #D7CCC8 !important;
  color: #8D6E63 !important;
}
body[data-theme="dark"] .role-btn.active {
  background: #FFAB91 !important;
  border-color: #FFAB91 !important;
  color: white !important;
}

/* ═════════════════════════════════════════════════════════
   Phase 2 平板横屏布局 ★新增★
   策略：min-width: 768px + orientation: landscape
   采用左右分栏：左侧宠物+对话（70%），右侧工具面板（30%）
   ═════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (orientation: landscape) {
  .app {
    flex-direction: row;
    max-width: 100%;
    height: 100dvh;
    overflow: hidden;
  }

  /* ── 左侧：宠物 + 对话（主区）─────────────────────────── */
  .app-left {
    flex: 0 0 70%;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-right: 1px solid rgba(79, 195, 247, 0.15);
  }

  /* ── 右侧：工具面板（辅区）────────────────────────────── */
  .app-right {
    flex: 0 0 30%;
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.4);
    min-width: 240px;
  }

  /* 宠物区域扩大 */
  .app-left .pet-area {
    flex: 1;
    min-height: 200px;
  }

  /* 对话区域扩大 */
  .app-left .chat-area {
    flex: 1;
    max-height: none;
  }

  /* 底部控制栏只在左侧 */
  .app-left .bottom-bar {
    padding: 8px 16px 12px;
  }

  /* 右侧面板样式 */
  .app-right .side-section {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 12px;
  }
  .app-right .side-section h4 {
    font-size: 14px;
    color: #4FC3F7;
    margin-bottom: 10px;
    font-weight: 600;
  }
  .app-right .side-section p {
    font-size: 13px;
    color: #78909C;
    line-height: 1.5;
  }

  /* 平板端隐藏 header 中的设置按钮（右侧有） */
  header .icon-btn:last-child {
    display: none;
  }
}

/* 平板竖屏（适配已有 max-width: 480px）*/
@media (min-width: 768px) and (orientation: portrait) {
  .app {
    max-width: 540px;
  }
}

/* ═════════════════════════════════════════════════════════
   Phase 1.5 移动端性能优化 ★新增★
   策略：will-change 预通知GPU合成层 + contain 隔离重排
   ═════════════════════════════════════════════════════════ */

/* 高频动画元素预提升为合成层，避免主线程 repaint */
.mic-btn,
.role-btn,
.voice-mode-switcher__btn,
.chat-bubble {
  will-change: transform;
}

/* 宠物Canvas区域 — 独立合成层，避免影响其他区域 */
#petCanvas {
  will-change: transform;
  contain: layout style;
}

/* 聊天区域 — 已移除 contain: paint 以修复 WebView 滚动失效 */

/* 低端设备降级（不支持 will-change 或内存受限时回退） */
@media (max-width: 360px), (max-height: 640px) {
  .mic-btn,
  .role-btn,
  .voice-mode-switcher__btn,
  .chat-bubble,
  #petCanvas {
    will-change: auto;
  }
  .pet-area {
    width: 75px;
    height: 75px;
    top: 48px;
    right: 8px;
  }
}
