/* === AI Phone - 主题变量 === */
:root {
  /* 日间模式 */
  --phone-bg: #f5f5f7;
  --phone-frame: #1a1a1a;
  --statusbar-bg: rgba(255,255,255,0.72);
  --statusbar-text: #000;
  --dock-bg: rgba(255,255,255,0.5);
  --dock-blur: blur(30px);
  --desktop-bg: #ffffff;
  --icon-label: #000;
  --app-bg: #ffffff;
  --app-text: #000;
  --app-subtext: #888;
  --bubble-self: #000;
  --bubble-self-text: #fff;
  --bubble-other: #e9e9eb;
  --bubble-other-text: #000;
  --bubble-read: #888;
  --input-bg: #f5f5f7;
  --input-text: #000;
  --divider: #e5e5ea;
  --wechat-nav-bg: rgba(247,247,247,0.85);
  --wechat-nav-text: #000;
  --card-bg: #fff;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.08);
  --overlay-bg: rgba(0,0,0,0.4);
  --setting-bg: #f5f5f7;
  --setting-cell-bg: #fff;
  --danger: #ff3b30;
  --accent: #07C160;
  --link: #007aff;
  --frost: rgba(255,255,255,0.72);
  --frost-blur: blur(20px);
  --frost-strong: rgba(255,255,255,0.82);
  --frost-strong-blur: blur(30px);
  --widget-bg: rgba(255,255,255,0.65);
  --glass-highlight: rgba(255,255,255,0.6);
  --glass-border: rgba(255,255,255,0.25);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.1);
  --home-indicator-bg: rgba(0,0,0,0.15);
}

[data-theme="dark"] {
  --phone-bg: #000;
  --phone-frame: #000;
  --statusbar-bg: rgba(0,0,0,0.72);
  --statusbar-text: #fff;
  --dock-bg: rgba(28,28,30,0.65);
  --desktop-bg: #000;
  --icon-label: #fff;
  --app-bg: #000;
  --app-text: #fff;
  --app-subtext: #8e8e93;
  --bubble-self: #fff;
  --bubble-self-text: #000;
  --bubble-other: #2c2c2e;
  --bubble-other-text: #fff;
  --bubble-read: #666;
  --input-bg: #1c1c1e;
  --input-text: #fff;
  --divider: #38383a;
  --wechat-nav-bg: rgba(0,0,0,0.85);
  --wechat-nav-text: #fff;
  --card-bg: #1c1c1e;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
  --overlay-bg: rgba(0,0,0,0.6);
  --setting-bg: #000;
  --setting-cell-bg: #1c1c1e;
  --frost: rgba(28,28,30,0.72);
  --frost-strong: rgba(28,28,30,0.85);
  --frost-strong-blur: blur(30px);
  --widget-bg: rgba(28,28,30,0.65);
  --glass-highlight: rgba(255,255,255,0.08);
  --glass-border: rgba(255,255,255,0.1);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.3);
  --home-indicator-bg: rgba(255,255,255,0.25);
}

/* === 基础重置 === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 安全区 */
.safe-top { padding-top: env(safe-area-inset-top); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }

/* 滚动条隐藏 */
::-webkit-scrollbar { width: 0; height: 0; }
.scroll-hide { -ms-overflow-style: none; scrollbar-width: none; }
.scroll-hide::-webkit-scrollbar { display: none; }

/* 通用动画 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes slideDown {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
.fade-in { animation: fadeIn 0.3s ease forwards; }
.slide-up { animation: slideUp 0.35s ease forwards; }
.scale-in { animation: scaleIn 0.25s ease forwards; }
.pop-in { animation: popIn 0.3s ease forwards; }

/* 磨砂效果 */
.frost {
  backdrop-filter: var(--frost-blur);
  -webkit-backdrop-filter: var(--frost-blur);
  background: var(--frost);
}

/* 点击反馈 */
.tap-active:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}

/* 通用过渡 */
.smooth {
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1.2);
}

/* === Lnyy UI v2：核心 Token 与旧变量兼容层 === */
:root {
  color-scheme: light;

  --lnyy-bg: #f4f4f6;
  --lnyy-surface: #ffffff;
  --lnyy-text: #111113;
  --lnyy-text-secondary: #73737a;
  --lnyy-divider: rgba(60, 60, 67, 0.16);
  --lnyy-accent: #d98fa0;
  --lnyy-pearl-pink: #f3b7ca;
  --lnyy-pearl-violet: #c9b8ff;
  --lnyy-pearl-blue: #dbeaff;
  --lnyy-glass-cold: rgba(248, 250, 255, 0.46);
  --lnyy-glass-border: rgba(255, 255, 255, 0.66);
  --lnyy-glass-highlight: inset 0 1px 0 rgba(255,255,255,.78), inset 0 -1px 0 rgba(201,184,255,.18);
  --lnyy-iridescent-sheen: linear-gradient(118deg, rgba(255,255,255,.72) 0%, rgba(243,183,202,.34) 28%, rgba(201,184,255,.28) 48%, rgba(219,234,255,.36) 66%, rgba(255,255,255,.16) 100%);
  --lnyy-iridescent-glow: radial-gradient(circle at 16% 8%, rgba(255,255,255,.84), transparent 26%), radial-gradient(circle at 82% 18%, rgba(243,183,202,.38), transparent 28%), radial-gradient(circle at 72% 86%, rgba(201,184,255,.32), transparent 34%);
  --lnyy-glass-shadow: 0 18px 44px rgba(52,45,68,.18), 0 4px 14px rgba(255,255,255,.18) inset;
  --lnyy-status-text: #141418;
  --lnyy-link: #007aff;
  --lnyy-danger: #ff3b30;
  --lnyy-success: #34c759;

  --glass-soft-bg: linear-gradient(145deg, rgba(255,255,255,.34), rgba(248,250,255,.16)), var(--lnyy-glass-cold);
  --glass-soft-blur: blur(14px) saturate(1.2);
  --glass-medium-bg: linear-gradient(145deg, rgba(255,255,255,.44), rgba(243,183,202,.16) 42%, rgba(201,184,255,.14)), rgba(248,250,255,.34);
  --glass-medium-blur: blur(20px) saturate(1.24);
  --glass-strong-bg: linear-gradient(145deg, rgba(255,255,255,.62), rgba(243,183,202,.2) 38%, rgba(201,184,255,.18)), rgba(248,250,255,.54);
  --glass-strong-blur: blur(26px) saturate(1.28);
  --shadow-soft: 0 10px 26px rgba(52,45,68,.12), var(--lnyy-glass-highlight);
  --shadow-float: 0 22px 56px rgba(38,34,52,.22), var(--lnyy-glass-highlight);

  --wechat-self: #111111;
  --wechat-self-text: #ffffff;
  --wechat-other: #ffffff;
  --imessage-self: #0a84ff;

  /* 旧页面继续使用这些名称，后续按 App 小步迁移。 */
  --phone-bg: var(--lnyy-bg);
  --desktop-bg: var(--lnyy-bg);
  --app-bg: var(--lnyy-surface);
  --app-text: var(--lnyy-text);
  --app-subtext: var(--lnyy-text-secondary);
  --divider: var(--lnyy-divider);
  --danger: var(--lnyy-danger);
  --link: var(--lnyy-link);
  --bubble-self: var(--wechat-self);
  --bubble-self-text: var(--wechat-self-text);
  --bubble-other: var(--wechat-other);
  --input-bg: var(--lnyy-bg);
  --input-text: var(--lnyy-text);
  --dock-bg: var(--glass-medium-bg);
  --dock-blur: var(--glass-medium-blur);
  --frost: var(--glass-strong-bg);
  --frost-blur: var(--glass-medium-blur);
  --frost-strong: var(--glass-strong-bg);
  --frost-strong-blur: var(--glass-strong-blur);
  --widget-bg: var(--glass-medium-bg);
}

[data-theme="dark"] {
  color-scheme: dark;

  --lnyy-bg: #09090a;
  --lnyy-surface: #1c1c1e;
  --lnyy-text: #f7f7f8;
  --lnyy-text-secondary: #a1a1a8;
  --lnyy-divider: rgba(235, 235, 245, 0.18);
  --lnyy-accent: #e4a3b2;
  --lnyy-pearl-pink: #f0aeca;
  --lnyy-pearl-violet: #bbaaff;
  --lnyy-pearl-blue: #9fc6ff;
  --lnyy-glass-cold: rgba(38, 38, 46, 0.58);
  --lnyy-glass-border: rgba(255, 255, 255, 0.22);
  --lnyy-glass-highlight: inset 0 1px 0 rgba(255,255,255,.24), inset 0 -1px 0 rgba(240,174,202,.12);
  --lnyy-iridescent-sheen: linear-gradient(118deg, rgba(255,255,255,.2) 0%, rgba(240,174,202,.22) 30%, rgba(187,170,255,.2) 52%, rgba(159,198,255,.18) 72%, rgba(255,255,255,.08) 100%);
  --lnyy-iridescent-glow: radial-gradient(circle at 18% 10%, rgba(255,255,255,.2), transparent 28%), radial-gradient(circle at 82% 18%, rgba(240,174,202,.18), transparent 30%), radial-gradient(circle at 72% 88%, rgba(187,170,255,.18), transparent 34%);
  --lnyy-glass-shadow: 0 20px 54px rgba(0,0,0,.42), 0 1px 0 rgba(255,255,255,.16) inset;
  --lnyy-status-text: #f7f7f8;
  --lnyy-link: #5aa7ff;
  --lnyy-danger: #ff453a;
  --lnyy-success: #30d158;

  --glass-soft-bg: linear-gradient(145deg, rgba(255,255,255,.12), rgba(240,174,202,.08)), rgba(28, 28, 34, 0.46);
  --glass-medium-bg: linear-gradient(145deg, rgba(255,255,255,.14), rgba(240,174,202,.1) 42%, rgba(187,170,255,.1)), rgba(28, 28, 34, 0.62);
  --glass-strong-bg: linear-gradient(145deg, rgba(255,255,255,.16), rgba(240,174,202,.12) 38%, rgba(187,170,255,.12)), rgba(24, 24, 30, 0.82);
  --shadow-soft: 0 10px 28px rgba(0,0,0,.34), var(--lnyy-glass-highlight);
  --shadow-float: 0 24px 64px rgba(0,0,0,.52), var(--lnyy-glass-highlight);

  --wechat-self: #f3f3f3;
  --wechat-self-text: #111111;
  --wechat-other: #2c2c2e;
  --imessage-self: #0a84ff;
}

@keyframes lnyyPearlSheen {
  0% { background-position: 0% 50%; opacity: .58; }
  50% { background-position: 100% 50%; opacity: .9; }
  100% { background-position: 0% 50%; opacity: .58; }
}