/* ==================== 全局 CSS 变量（冷色调神秘风） ==================== */
:root {
  /* 主背景：深蓝黑 */
  --bg:           #0a0e1a;
  --bg-card:      rgba(255,255,255,0.05);
  --bg-card-md:   rgba(255,255,255,0.09);
  --text:         #e8ecf8;
  --muted:        #8b92b0;
  --line:         rgba(255,255,255,0.07);

  /* 主色调：冷紫靛蓝 */
  --pink:         #a78bfa;
  --pink-2:       #818cf8;
  --purple:       #7c6cf0;
  --gold:         #c4b5fd;
  --green:        #6ee7b7;
  --shadow-md:    0 12px 36px rgba(0,0,0,0.32);
  --radius-lg:    22px;
  --radius-md:    16px;
  --radius-sm:    10px;
  --nav-h:        70px;

  /* 冷紫渐变 */
  --accent-start: #a78bfa;
  --accent-end:   #818cf8;
  --accent-glow:  rgba(129,140,248,0.3);

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

/* ==================== 基础重置 ==================== */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html {
  touch-action: manipulation;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top right,  rgba(129,140,248,.12), transparent 30%),
    radial-gradient(circle at top left,   rgba(167,139,250,.10), transparent 28%),
    radial-gradient(circle at 50% 80%,    rgba(99,102,241,.06), transparent 35%),
    linear-gradient(180deg, #0d1120 0%, #0a0e1a 100%);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
}

/* ==================== 全局动画 ==================== */
@keyframes page-in {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes page-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-10px); }
}
@keyframes home-fadein {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes glow-drift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(20px, -15px) scale(1.15); }
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1;  transform: translateY(0) scale(1); }
}
@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .55; }
  40%           { transform: translateY(-5px); opacity: 1; }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: .45; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spinBtn { to { transform: rotate(360deg); } }
@keyframes affection-glow {
  from { box-shadow: 0 0 4px rgba(167,139,250,.4); }
  to   { box-shadow: 0 0 12px rgba(167,139,250,.9), 0 0 4px rgba(129,140,248,.7); }
}

/* ==================== 可访问性 ==================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==================== 响应式：小屏手机 ==================== */
@media (max-width: 375px) {
  :root {
    --radius-lg: 18px;
    --radius-md: 14px;
  }
  .home-logo-text { font-size: 38px; letter-spacing: 8px; }
  .home-tagline { font-size: 15px; }
  .home-actions { width: 200px; }
}

/* ==================== 响应式：大屏手机 ==================== */
@media (min-width: 414px) {
  .char-cover { height: 170px; }
  .msg-bubble { font-size: 15px; }
}

/* ==================== 响应式：平板 768px+ ==================== */
@media (min-width: 768px) {
  :root {
    --radius-lg: 24px;
    --radius-md: 18px;
    --nav-h: 64px;
  }
  .phone-shell { max-width: 520px; }
  .page { padding: 20px 20px calc(var(--nav-h) + var(--safe-bottom) + 20px); }
  .page-topbar { padding: 16px 20px 14px; }
  .page-topbar h1 { font-size: 20px; }
  .home-logo-text { font-size: 56px; letter-spacing: 14px; }
  .home-tagline { font-size: 17px; }
  .char-cover { height: 180px; }
  .msg-bubble { max-width: 75%; font-size: 15px; }
  .chat-messages { padding: 18px 20px 10px; }
  .chat-composer { padding: 8px 16px calc(var(--nav-h) + var(--safe-bottom) + 8px); }
  .bottom-nav { max-width: 520px; }
  .modal-sheet { max-width: 520px; }
  .accordion-cards-grid { grid-template-columns: repeat(3, 1fr); }
  .featured-banner-card { height: 220px; }
  .char-detail-cover { height: 360px; }
}

/* ==================== 响应式：桌面 1024px+ ==================== */
@media (min-width: 1024px) {
  :root {
    --radius-lg: 28px;
    --radius-md: 20px;
    --nav-h: 60px;
  }
  .phone-shell { max-width: 660px; }
  .page { padding: 24px 28px calc(var(--nav-h) + var(--safe-bottom) + 24px); }
  .page-topbar { padding: 18px 24px 16px; }
  .page-topbar h1 { font-size: 22px; }
  .home-logo-text { font-size: 64px; letter-spacing: 16px; }
  .home-tagline { font-size: 18px; }
  .home-actions { width: 280px; }
  .home-btn { padding: 16px 0; font-size: 16px; }
  .char-cover { height: 200px; }
  .msg-bubble { max-width: 65%; font-size: 15px; }
  .chat-messages { padding: 20px 24px 12px; }
  .chat-composer { padding: 10px 20px calc(var(--nav-h) + var(--safe-bottom) + 12px); }
  .composer-input { font-size: 16px; }
  .bottom-nav { max-width: 660px; height: calc(var(--nav-h) + var(--safe-bottom)); }
  .modal-sheet {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 28px;
  }
  .accordion-cards-grid { grid-template-columns: repeat(3, 1fr); }
  .featured-banner-card { height: 260px; }
  .char-detail-cover { height: 400px; }
  .profile-header { padding: 22px; }
  .setting-row { padding: 16px 20px; }
}

/* ==================== 响应式：横屏 ==================== */
@media (max-height: 500px) and (orientation: landscape) {
  .phone-shell { max-width: 100%; }
  .page-topbar { padding-top: calc(8px + var(--safe-top)); }
  .bottom-nav { height: calc(60px + var(--safe-bottom)); }
  .chat-messages { padding: 10px; }
}
