/* ===== 魔法宠物星球 - 极简科技质感风格 ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

:root {
  /* 中性灰底色系 */
  --bg: #f5f5f7;
  --bg2: #ffffff;
  --bg-hover: #fafafa;
  
  /* 低饱和单强调色 - 靛蓝 */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --primary-subtle: rgba(99, 102, 241, 0.08);
  
  /* 辅助色 */
  --accent: #f59e0b;
  --green: #10b981;
  --blue: #6366f1;
  
  /* 中性色 */
  --card: #ffffff;
  --card-border: #e5e5e7;
  --card-border-hover: #d4d4d8;
  --text: #18181b;
  --text-secondary: #71717a;
  --text-muted: #a1a1aa;
  --text-light: #fafafa;
  
  /* 阴影系统 - 轻量精致 */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.08);
  
  /* 圆角 - 柔和统一 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* 毛玻璃效果 */
  --glass: rgba(255, 255, 255, 0.85);
  --glass-subtle: rgba(255, 255, 255, 0.6);
  
  /* 动画时长 */
  --transition-fast: 150ms;
  --transition-normal: 250ms;
  --transition-slow: 350ms;
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
  letter-spacing: 0.01em;
  /* 防止移动端双击缩放 */
  touch-action: manipulation;
  -ms-touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 极简背景 - 去除花哨渐变 */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(99, 102, 241, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(99, 102, 241, 0.03) 0%, transparent 45%);
  pointer-events: none;
}

/* 极简装饰点 */
.stars { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.star {
  position: absolute;
  border-radius: 50%;
  animation: twinkle var(--dur) var(--ease-smooth) infinite alternate;
}
@keyframes twinkle { 0%{opacity:0.12;transform:scale(1)} 100%{opacity:0.3;transform:scale(1.2)} }

/* ===== 导航栏 ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: var(--glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
  box-shadow: var(--shadow-xs);
}
.nav-logo {
  font-size: 1.25rem; color: var(--text);
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.nav-logo .logo-icon { font-size: 1.4rem; }

.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-coins {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-hover); border: 1px solid var(--card-border);
  border-radius: 20px; padding: 6px 12px; font-size: 0.82rem; color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-normal) var(--ease-smooth);
}
.nav-coins:hover {
  border-color: var(--card-border-hover);
  background: var(--bg2);
}
.nav-gems {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-hover); border: 1px solid var(--card-border);
  border-radius: 20px; padding: 6px 12px; font-size: 0.82rem; color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-normal) var(--ease-smooth);
}
.nav-gems:hover {
  border-color: var(--card-border-hover);
  background: var(--bg2);
}
.nav-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--card-border); cursor: pointer;
  object-fit: cover;
  background: var(--bg-hover);
  transition: all var(--transition-normal) var(--ease-smooth);
}
.nav-avatar:hover {
  border-color: var(--primary);
}
.nav-btn {
  background: var(--primary); color: white; border: none; border-radius: var(--radius-md);
  padding: 8px 20px; font-size: 0.88rem; cursor: pointer;
  font-family: inherit; transition: all var(--transition-normal) var(--ease-smooth);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.nav-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* ===== 主内容区 ===== */
.main-layout {
  position: relative; z-index: 1;
  padding-top: 60px;
  min-height: 100vh;
  display: flex;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: 70px; flex-shrink: 0;
  position: fixed; left: 0; top: 60px; bottom: 0;
  background: var(--bg2);
  border-right: 1px solid var(--card-border);
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 0; gap: 8px; z-index: 100;
  transition: all var(--transition-normal) var(--ease-smooth);
  box-shadow: var(--shadow-xs);
}
.sidebar-item {
  width: 50px; height: 50px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition-normal) var(--ease-smooth);
  border: 1px solid transparent; text-decoration: none; color: var(--text-muted);
}
.sidebar-icon {
  font-size: 1.5rem;
  transition: transform var(--transition-normal) var(--ease-smooth);
}
.sidebar-item span.label { font-size: 0.55rem; display: none; }
.sidebar-item:hover, .sidebar-item.active {
  background: var(--primary-subtle);
  border-color: var(--primary-light);
  color: var(--primary);
}
.sidebar-item:hover .sidebar-icon,
.sidebar-item.active .sidebar-icon {
  transform: scale(1.08);
}
.sidebar-item.active {
  background: var(--primary-subtle);
  border-color: var(--primary);
}

/* ===== 内容区 ===== */
.content {
  flex: 1;
  margin-left: 70px;
  padding: 24px;
  min-height: calc(100vh - 60px);
}

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal) var(--ease-smooth);
}
.card:hover {
  box-shadow: var(--shadow-md);
}

/* ===== 宠物舞台 ===== */
.pet-stage {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 380px;
  background: linear-gradient(145deg, var(--bg-hover) 0%, #fafafa 50%, #f5f5f5 100%);
  border-radius: var(--radius-xl); overflow: hidden;
  border: 1px solid var(--card-border);
}
.pet-ground {
  position: absolute; bottom: 0; left: 0; right: 0; height: 80px;
  background: linear-gradient(to top, rgba(99, 102, 241, 0.06), transparent);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}
.pet-video-wrap {
  position: relative; width: 260px; height: 260px;
  display: flex; align-items: center; justify-content: center;
}
.pet-video {
  width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
  animation: petFloat 4s var(--ease-smooth) infinite;
}
@keyframes petFloat { 0%,100%{transform:translateY(0) scale(1)} 50%{transform:translateY(-8px) scale(1.01)} }

/* 宠物占位动画（无视频时） */
.pet-placeholder {
  width: 200px; height: 200px;
  display: flex; align-items: center; justify-content: center;
  font-size: 7rem;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
  animation: petFloat 4s var(--ease-smooth) infinite;
}

.pet-name-badge {
  position: absolute; bottom: 20px;
  background: rgba(255,255,255,0.9); border: 1px solid var(--card-border);
  border-radius: 20px; padding: 6px 16px;
  font-size: 1rem; color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

/* ===== 状态条 ===== */
.status-bars { display: flex; flex-direction: column; gap: 10px; }
.status-bar { display: flex; align-items: center; gap: 10px; }
.status-label { font-size: 0.82rem; width: 60px; color: var(--text-muted); font-weight: 500; }
.bar-track {
  flex: 1; height: 10px; background: var(--bg-hover);
  border-radius: 6px; overflow: hidden;
  border: 1px solid var(--card-border);
}
.bar-fill {
  height: 100%; border-radius: 6px;
  transition: width var(--transition-normal) var(--ease-smooth);
}
.bar-hunger .bar-fill { background: linear-gradient(to right, #f97316, #fbbf24); }
.bar-happy  .bar-fill { background: linear-gradient(to right, #ec4899, #f472b6); }
.bar-health .bar-fill { background: linear-gradient(to right, #10b981, #34d399); }
.status-val { font-size: 0.78rem; width: 35px; text-align: right; color: var(--text-muted); font-weight: 500; }

/* ===== 互动按钮 ===== */
.action-btns {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px; border-radius: var(--radius-md); cursor: pointer;
  border: 1px solid var(--card-border); background: var(--bg-hover);
  font-family: inherit; font-size: 0.8rem; color: var(--text);
  transition: all var(--transition-normal) var(--ease-smooth); user-select: none;
}
.action-btn .btn-icon { font-size: 1.7rem; }
.action-btn:hover { transform: translateY(-2px); border-color: var(--primary); background: var(--primary-subtle); box-shadow: var(--shadow-sm); }
.action-btn:active { transform: scale(0.97); }
.action-btn.feed:hover   { border-color: #fbbf24; background: rgba(251, 191, 36, 0.08); }
.action-btn.play:hover   { border-color: #ec4899; background: rgba(236, 72, 153, 0.08); }
.action-btn.sleep:hover  { border-color: #6366f1; background: rgba(99, 102, 241, 0.08); }
.action-btn.talk:hover   { border-color: #10b981; background: rgba(16, 185, 129, 0.08); }

/* ===== 对话框 ===== */
.chat-panel {
  display: flex; flex-direction: column;
  height: 420px; border-radius: var(--radius-lg);
  overflow: hidden;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin; scrollbar-color: var(--card-border-hover) transparent;
  background: var(--bg-hover);
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--card-border-hover); border-radius: 2px; }

.chat-bubble {
  max-width: 78%; padding: 10px 16px; border-radius: 16px;
  font-size: 0.92rem; line-height: 1.6; word-break: break-word;
  animation: bubbleIn var(--transition-normal) var(--ease-smooth);
}
@keyframes bubbleIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.chat-bubble.user {
  align-self: flex-end;
  background: var(--primary);
  color: white; border-bottom-right-radius: 4px;
  box-shadow: var(--shadow-sm);
}
.chat-bubble.pet {
  align-self: flex-start;
  background: var(--bg2); border: 1px solid var(--card-border);
  color: var(--text); border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-xs);
}
.chat-bubble.pet .pet-avatar-mini {
  font-size: 1.2rem; margin-right: 4px;
}
.typing-dot {
  display: inline-block; width: 6px; height: 6px;
  background: var(--primary-light); border-radius: 50%; margin: 0 2px;
  animation: typingDot 1.2s var(--ease-smooth) infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-4px)} }

/* 流式输出样式 */
.typing-indicator {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--text-muted);
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* 打字光标效果 */
.chat-bubble.pet::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: var(--primary);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 0.8s step-end infinite;
}

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

/* 流式输出时隐藏光标 */
.chat-bubble.pet.finished::after {
  display: none;
}

/* 宠物特效动画 */
@keyframes float {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-10px); }
}

@keyframes popIn {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes popOut {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  40% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
}

.chat-input-row {
  display: flex; gap: 10px; padding: 12px 16px;
  background: var(--bg2); border-top: 1px solid var(--card-border);
}
.chat-input {
  flex: 1; background: var(--bg-hover); border: 1px solid var(--card-border);
  border-radius: 24px; padding: 10px 16px; color: var(--text);
  font-family: inherit; font-size: 0.92rem; outline: none;
  transition: all var(--transition-normal) var(--ease-smooth);
}
.chat-input:focus { border-color: var(--primary); background: var(--bg2); box-shadow: 0 0 0 2px var(--primary-subtle); }
.chat-input::placeholder { color: var(--text-muted); }
.chat-send-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary);
  border: none; color: white; font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-normal) var(--ease-smooth); flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.chat-send-btn:hover { transform: scale(1.05); background: var(--primary-dark); }

/* ===== 宠物图鉴/商店 ===== */
.pet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.pet-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-lg); padding: 20px; text-align: center;
  cursor: pointer; transition: all var(--transition-normal) var(--ease-smooth); position: relative;
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.pet-card:hover { transform: translateY(-4px); border-color: var(--primary-light); box-shadow: var(--shadow-md); }
.pet-emoji { font-size: 3.8rem; margin-bottom: 10px; display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.06));
}
.pet-card-name { font-size: 1.05rem; color: var(--text); margin-bottom: 4px; font-weight: 500; }
.pet-card-desc { font-size: 0.73rem; color: var(--text-muted); line-height: 1.5; }

.rarity-badge {
  position: absolute; top: 10px; right: 10px;
  padding: 3px 8px; border-radius: 8px; font-size: 0.68rem; font-weight: 500;
}
.rarity-1 { background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--card-border); }
.rarity-2 { background: rgba(16, 185, 129, 0.08); color: #059669; border: 1px solid rgba(16, 185, 129, 0.2); }
.rarity-3 { background: rgba(99, 102, 241, 0.08); color: var(--primary); border: 1px solid rgba(99, 102, 241, 0.2); }
.rarity-4 { background: rgba(245, 158, 11, 0.08); color: #d97706; border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ===== 等级经验 ===== */
.level-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-hover); border: 1px solid var(--card-border);
  border-radius: 10px; padding: 3px 10px; font-size: 0.82rem; color: var(--text);
  font-weight: 500;
}
.exp-bar {
  height: 6px; background: var(--bg-hover); border-radius: 3px; overflow: hidden;
  margin-top: 6px; border: 1px solid var(--card-border);
}
.exp-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px; transition: width var(--transition-normal) var(--ease-smooth);
}

/* ===== 通知/Toast ===== */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px; border-radius: var(--radius-md); font-size: 0.88rem;
  animation: toastIn var(--transition-normal) var(--ease-smooth);
  max-width: 300px; box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  font-weight: 500;
}
@keyframes toastIn { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }
.toast.success { background: rgba(16, 185, 129, 0.08); color: #065f46; border: 1px solid rgba(16, 185, 129, 0.2); border-left: 3px solid #10b981; }
.toast.error   { background: rgba(244, 63, 94, 0.08); color: #9f1239; border: 1px solid rgba(244, 63, 94, 0.2); border-left: 3px solid #f43f5e; }
.toast.info    { background: rgba(99, 102, 241, 0.08); color: #1e40af; border: 1px solid rgba(99, 102, 241, 0.2); border-left: 3px solid #6366f1; }
.toast.warning { background: rgba(245, 158, 11, 0.08); color: #92400e; border: 1px solid rgba(245, 158, 11, 0.2); border-left: 3px solid #f59e0b; }

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn var(--transition-fast) var(--ease-smooth);
}
/* 聊天模态框不遮罩背景，透明 */
.chat-modal-overlay {
  background: transparent;
  backdrop-filter: none;
}
.chat-modal-overlay .modal {
  animation: slideInRight var(--transition-normal) var(--ease-smooth);
}
@keyframes slideInRight { from{transform:translateX(100%);opacity:0} to{transform:translateX(0);opacity:1} }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal {
  background: var(--bg2); border: 1px solid var(--card-border);
  border-radius: var(--radius-xl); padding: 30px; width: 100%; max-width: 440px;
  animation: slideUp var(--transition-normal) var(--ease-smooth); box-shadow: var(--shadow-lg);
}
@keyframes slideUp { from{transform:translateY(16px);opacity:0} to{transform:translateY(0);opacity:1} }
.modal-title { font-size: 1.3rem; color: var(--text); margin-bottom: 20px; text-align: center; font-weight: 600; }
.modal-close {
  float: right; margin-top: -10px; margin-right: -10px;
  background: var(--bg-hover); border: 1px solid var(--card-border); color: var(--text-secondary);
  font-size: 1.1rem; cursor: pointer; padding: 6px 10px; border-radius: var(--radius-sm);
  transition: all var(--transition-normal) var(--ease-smooth);
}
.modal-close:hover { background: var(--card-border-hover); color: var(--text); }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.form-input {
  width: 100%; background: var(--bg-hover); border: 1px solid var(--card-border);
  border-radius: var(--radius-md); padding: 12px 16px; color: var(--text);
  font-family: inherit; font-size: 0.92rem; outline: none; transition: all var(--transition-normal) var(--ease-smooth);
}
.form-input:focus { border-color: var(--primary); background: var(--bg2); box-shadow: 0 0 0 2px var(--primary-subtle); }
.form-input::placeholder { color: var(--text-muted); }

.btn-primary {
  width: 100%; background: var(--primary);
  color: white; border: none; border-radius: var(--radius-md); padding: 14px;
  font-size: 0.95rem; font-family: inherit; cursor: pointer; transition: all var(--transition-normal) var(--ease-smooth);
  font-weight: 500; letter-spacing: 0.02em; box-shadow: var(--shadow-sm);
}
.btn-primary:hover { transform: translateY(-1px); background: var(--primary-dark); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--bg-hover); color: var(--text-secondary);
  border: 1px solid var(--card-border); border-radius: var(--radius-md); padding: 12px 20px;
  font-family: inherit; font-size: 0.88rem; cursor: pointer; transition: all var(--transition-normal) var(--ease-smooth);
}
.btn-secondary:hover { background: var(--card-border-hover); color: var(--text); }

/* ===== 页面切换 ===== */
.page { display: none; }
.page.active { display: block; }

/* ===== 加载动画 ===== */
.loading-spinner {
  width: 40px; height: 40px; border: 3px solid #ede9fe;
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 20px auto;
}
@keyframes spin { to{transform:rotate(360deg)} }

/* ===== 商店 ===== */
.shop-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px;
}
.shop-item {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-md); padding: 16px; text-align: center; transition: all var(--transition-normal) var(--ease-smooth);
  box-shadow: var(--shadow-sm);
}
.shop-item:hover { border-color: var(--card-border-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.shop-icon { font-size: 2.3rem; margin-bottom: 8px; }
.shop-name { font-size: 0.88rem; margin-bottom: 6px; color: var(--text); font-weight: 500; }
.shop-desc { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 10px; line-height: 1.4; }
.shop-price {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 0.82rem; color: var(--text-secondary);
}
.btn-buy {
  width: 100%; margin-top: 8px; background: var(--primary);
  color: white; border: none; border-radius: var(--radius-sm); padding: 8px;
  font-family: inherit; font-size: 0.82rem; cursor: pointer; font-weight: 500; transition: all var(--transition-normal) var(--ease-smooth);
  box-shadow: var(--shadow-xs);
}
.btn-buy:hover { transform: translateY(-1px); background: var(--primary-dark); }

/* ===== 签到 ===== */
/* 签到页面优化 */
.checkin-days {
  display: grid;
  grid-template-columns: repeat(7,1fr);
  gap: 8px;
}
.checkin-day {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.73rem;
  gap: 2px;
  border: 1px solid var(--card-border);
  background: var(--bg-hover);
  color: var(--text-muted);
  padding: 8px 4px;
  min-height: 70px;
  transition: all var(--transition-normal) var(--ease-smooth);
}
.checkin-icon { font-size: 1.1rem; margin-bottom: 2px; }
.checkin-label { font-size: 0.73rem; font-weight: 500; }
.checkin-reward { font-size: 0.65rem; color: var(--accent); margin-top: 2px; }
.checkin-day.done {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
  color: #065f46;
}
.checkin-day.today {
  background: var(--primary-subtle);
  border-color: var(--primary);
  color: var(--primary);
}
.checkin-day:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xs);
}

.checkin-btn {
  width: 100%;
  max-width: 200px;
  padding: 12px 40px;
  margin-top: 16px;
}

/* ===== VIP徽章 ===== */
.vip-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: rgba(245, 158, 11, 0.1);
  color: #d97706; border: 1px solid rgba(245, 158, 11, 0.2); border-radius: 8px; padding: 2px 8px; font-size: 0.72rem; font-weight: 600;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  /* 聊天模态框移动端全屏显示 */
  .chat-modal-overlay {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
  }
  .chat-modal-overlay .modal {
    position: fixed !important;
    bottom: auto !important;
    right: auto !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    max-width: 95vw !important;
    max-height: 85vh !important;
    animation: slideUp var(--transition-normal) var(--ease-smooth) !important;
  }
  .content { margin-left: 0; padding: 16px; padding-bottom: 80px; }
  .sidebar {
    width: 100%; height: 60px; flex-direction: row;
    top: auto; bottom: 0; left: 0; right: 0;
    border-right: none; border-top: 1px solid var(--card-border);
    padding: 0; justify-content: space-around;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
  }
  .sidebar-item {
    width: auto; min-width: 50px; height: 60px;
    border-radius: 0; border: none;
    flex-direction: column; gap: 2px;
  }
  .sidebar-item:hover, .sidebar-item.active {
    background: var(--primary-subtle);
    border: none;
  }
  .sidebar-icon {
    font-size: 1.3rem;
    margin-bottom: 0;
  }
  .sidebar-item:hover .sidebar-icon,
  .sidebar-item.active .sidebar-icon {
    transform: none;
    filter: none;
  }
  .sidebar-item span.label {
    display: block;
    font-size: 0.62rem;
    line-height: 1;
    margin-top: -2px;
  }

  /* 防止移动端点击缩放 */
  button, .btn-primary, .btn-secondary, .btn-buy, .action-btn, .checkin-btn, .tab-btn, .theme-btn, .choice-btn, .shop-item {
    touch-action: manipulation;
    -ms-touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  /* 防止移动端双击缩放 */
  a, .modal-overlay, .modal {
    touch-action: manipulation;
    -ms-touch-action: manipulation;
  }

  /* 签到页面移动端优化 */
  .checkin-days {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .checkin-day {
    min-height: 60px;
    padding: 6px 2px;
  }
  .checkin-icon { font-size: 0.95rem; }
  .checkin-label { font-size: 0.68rem; }
  .checkin-reward { font-size: 0.6rem; }
  .checkin-btn {
    width: 100%;
    padding: 10px 20px;
    font-size: 0.88rem;
  }

  /* 个人中心页面移动端优化 */
  #page-profile .card {
    padding: 12px;
  }
  #page-profile .card[style*="display:grid"] {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  #page-profile h4 {
    font-size: 0.95rem;
    margin-bottom: 12px;
  }
  #page-profile h2 {
    font-size: 1.25rem;
    margin-bottom: 12px;
  }
  #page-profile p {
    font-size: 0.78rem;
  }

  /* 探索页面移动端优化 */
  #page-explore .tabs {
    flex-wrap: wrap;
    gap: 6px;
  }
  #page-explore .tab-btn {
    flex: 1 0 0 0;
    min-width: calc(33.333% - 4px);
    font-size: 0.78rem;
    padding: 8px 12px;
  }
  #page-explore h2 {
    font-size: 1.25rem;
    margin-bottom: 12px;
  }
  #page-explore p {
    font-size: 0.78rem;
  }
  #page-explore .feature-card {
    padding: 12px;
  }

  /* 其他页面移动端优化 */
  .action-btns { grid-template-columns: repeat(2, 1fr); }
  .pet-grid { grid-template-columns: repeat(2, 1fr); }
  .shop-grid { grid-template-columns: repeat(2, 1fr); }
  .pet-video-wrap, .pet-placeholder { width: 200px; height: 200px; }
  .nav-coins, .nav-gems { padding: 4px 8px; font-size: 0.78rem; }
}

/* 小屏幕手机优化（iPhone SE 等） */
@media (max-width: 375px) {
  #page-profile .card {
    padding: 10px;
  }
  #page-profile h2 {
    font-size: 1.2rem;
  }
  #page-profile h4 {
    font-size: 0.95rem;
  }
  #page-explore h2 {
    font-size: 1.2rem;
  }
  #page-explore .tab-btn {
    min-width: calc(25% - 3px);
    font-size: 0.75rem;
    padding: 6px 8px;
  }
  .checkin-days {
    gap: 4px;
  }
  .checkin-day {
    min-height: 55px;
    padding: 4px 2px;
  }
}

/* 大屏平板优化 */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar { width: 70px; }
  .content { margin-left: 70px; }
  .pet-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar { width: 70px; }
  .content { margin-left: 70px; }
  .pet-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1025px) {
  .content { max-width: 1200px; margin-left: auto; margin-right: auto; padding-left: calc(70px + 24px); }
}

/* ===== 粒子效果 ===== */
.particle {
  position: fixed; pointer-events: none; z-index: 9998;
  font-size: 1.2rem; animation: particleFly 1.2s ease-out forwards;
}
@keyframes particleFly {
  0% { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0.4); }
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--card-border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== 宠物状态特效 ===== */
.pet-effect {
  position: absolute; font-size: 1.8rem;
  animation: effectRise 1.8s ease-out forwards; pointer-events: none; z-index: 10;
}
@keyframes effectRise {
  0%  { opacity: 1; transform: translateY(0) scale(1); }
  100%{ opacity: 0; transform: translateY(-60px) scale(1.3); }
}

/* 宠物心情气泡 */
.mood-bubble {
  position: absolute; top: 10px; right: 10px;
  background: var(--bg2); border-radius: 14px 14px 14px 4px;
  padding: 8px 12px; font-size: 0.78rem; color: var(--text);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
  animation: bubbleIn var(--transition-normal) var(--ease-smooth), fadeOut 0.3s ease 3s forwards;
  max-width: 160px; line-height: 1.4;
}
@keyframes fadeOut { to{opacity:0;transform:scale(0.9)} }

/* tab切换 */
.tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
  padding: 8px 20px; border-radius: 20px; border: 1px solid var(--card-border);
  background: var(--bg-hover); color: var(--text-muted); cursor: pointer;
  font-family: inherit; font-size: 0.88rem; transition: all var(--transition-normal) var(--ease-smooth);
}
.tab-btn.active, .tab-btn:hover {
  background: var(--primary-subtle); border-color: var(--primary); color: var(--primary);
}

/* 空状态 */
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 12px; opacity: 0.4; }

/* ===== 故事/游戏/日记新功能 ===== */
.feature-card {
  background: var(--bg-hover);
  border: 1px solid var(--card-border); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.story-placeholder {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
/* 冒险故事容器 */
.adventure-container {
  background: var(--bg-hover);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-height: 300px;
}
.adventure-scene {
  animation: fadeInUp var(--transition-normal) var(--ease-smooth);
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.adventure-scene .story-text {
  background: var(--bg2);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 20px;
}
.story-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.choice-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg2);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-normal) var(--ease-smooth);
  text-align: left;
}
.choice-btn:hover {
  background: var(--primary-subtle);
  border-color: var(--primary);
  transform: translateX(6px);
  box-shadow: var(--shadow-sm);
}
.choice-btn:active {
  transform: translateX(3px);
}
.choice-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
}
.choice-text {
  flex: 1;
  line-height: 1.5;
}
.story-ending {
  text-align: center;
  padding: 30px;
  background: var(--bg2);
  border-radius: var(--radius-lg);
  margin-top: 20px;
  animation: fadeInUp var(--transition-normal) var(--ease-smooth);
}
.story-ending.good-ending {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.story-ending.bad-ending {
  background: rgba(244, 63, 94, 0.06);
  border: 1px solid rgba(244, 63, 94, 0.2);
}
.story-ending h3 {
  font-size: 1.4rem;
  margin-bottom: 8px;
  font-weight: 600;
}
.story-ending.good-ending h3 {
  color: #065f46;
}
.story-ending.bad-ending h3 {
  color: #991b1b;
}
/* 主题按钮 */
.theme-btn {
  padding: 10px 18px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  background: var(--bg-hover);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.86rem;
  transition: all var(--transition-normal) var(--ease-smooth);
  color: var(--text);
}
.theme-btn:hover {
  background: var(--primary-subtle);
  border-color: var(--primary);
  color: var(--primary);
}
.story-text {
  background: var(--bg-hover); border: 1px solid var(--card-border);
  border-radius: var(--radius-md); padding: 18px; font-size: 0.92rem;
  line-height: 1.8; color: var(--text); min-height: 120px;
  white-space: pre-wrap; word-break: break-word;
}
.riddle-option {
  width: 100%; text-align: left; padding: 14px 18px;
  background: var(--bg-hover); border: 1px solid var(--card-border); border-radius: var(--radius-md);
  font-family: inherit; font-size: 0.92rem; color: var(--text);
  cursor: pointer; transition: all var(--transition-normal) var(--ease-smooth); margin-bottom: 10px; display: block;
}
.riddle-option:hover { background: var(--primary-subtle); border-color: var(--primary); color: var(--primary); transform: translateX(4px); }
.riddle-option.correct { background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.2); color: #065f46; }
.riddle-option.wrong   { background: rgba(244, 63, 94, 0.08); border-color: rgba(244, 63, 94, 0.2); color: #9f1239; }
.diary-entry {
  background: var(--bg-hover); border: 1px solid var(--card-border);
  border-radius: var(--radius-md); padding: 16px; margin-bottom: 12px;
}
.diary-date { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 6px; }
.diary-content { font-size: 0.88rem; color: var(--text); line-height: 1.7; }
.diary-role-user { color: var(--primary); font-weight: 600; }
.diary-role-pet  { color: var(--green); font-weight: 600; }

/* 宠物PK战斗按钮 */
.battle-move-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.battle-move-btn:active { transform: translateY(0); }
.battle-move-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
