/* ===================== Theme Variables ===================== */
:root, [data-theme="light"] {
  --phone-shell: #1a1a2e;
  --screen-bg: #faf8fc;
  --paper: #faf8fc;
  --paper-2: #ffffff;
  --ink: #2a2a3a;
  --ink-2: #5a5a6e;
  --muted: #9a9ab0;
  --line: #e0dce8;
  --soft-line: #ece8f2;
  --tile: #f2eef6;
  --shadow: 0 8px 32px rgba(100, 80, 140, 0.1);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --dock-bg: rgba(255, 255, 255, 0.92);
  --dock-border: #e8e8e8;
  --dock-active: #333;
  --dock-inactive: #aaa;
  --bubble-ai-bg: #fff;
  --bubble-ai-border: #e8e8e8;
  --bubble-ai-text: #4a4a4a;
  --bubble-user-bg: #f0f0f0;
  --bubble-user-border: #d8d8d8;
  --bubble-user-text: #333;
  --accent: #555;
  --accent-light: #f0f0f0;
  --moments-cover: linear-gradient(135deg, #d4b8e8, #a88cc4);
  --diary-line: #e0dce8;
  --app-radius: 22%;
  --wallpaper-default: radial-gradient(circle at 80% 10%, rgba(200,160,255,0.18), transparent 45%),
    radial-gradient(circle at 15% 85%, rgba(255,170,200,0.12), transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(180,220,255,0.08), transparent 60%),
    linear-gradient(170deg, #faf8fc 0%, #f0ecf6 40%, #e8e0f4 100%);
  --wallpaper-sunset: linear-gradient(180deg, #fde8d0, #f5c8a0);
  --wallpaper-ocean: linear-gradient(180deg, #d4eef6, #a8d8e8);
  --wallpaper-night: linear-gradient(180deg, #1a1830, #0d0a1a);
  --wallpaper-sakura: linear-gradient(180deg, #fce4ec, #f8bbd0);
  --wallpaper-forest: linear-gradient(180deg, #d8f0d8, #a8d8a8);
  --wallpaper-latte: linear-gradient(170deg, #f5efe6, #e8d8c4, #f0e6d4);
  --wallpaper-lavender: linear-gradient(170deg, #e8dff5, #d4c8ec, #c8b8e0);
  --wallpaper-ink: linear-gradient(170deg, #f5f5f0, #e8e8e0, #d8d8d0);
}
[data-theme="dark-cute"] {
  --phone-shell: #0d0a14;
  --screen-bg: #16121e;
  --paper: #16121e;
  --paper-2: #1e1a28;
  --ink: #e8dff0;
  --ink-2: #a89ab8;
  --muted: #6a5e7a;
  --line: #3a3248;
  --soft-line: #2a2536;
  --tile: #1e1a28;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --dock-bg: rgba(22, 22, 22, 0.92);
  --dock-border: #2a2a2a;
  --dock-active: #ddd;
  --dock-inactive: #666;
  --bubble-ai-bg: #1e1e1e;
  --bubble-ai-border: #2a2a2a;
  --bubble-ai-text: #bbb;
  --bubble-user-bg: #2a2a2a;
  --bubble-user-border: #3a3a3a;
  --bubble-user-text: #ddd;
  --accent: #bbb;
  --accent-light: #2a2a2a;
  --moments-cover: linear-gradient(135deg, #2a1845, #1a1035);
  --diary-line: #2a2536;
  --app-radius: 22%;
  --wallpaper-default: radial-gradient(circle at 70% 20%, rgba(150,100,200,0.12), transparent 50%),
    linear-gradient(180deg, #1e1830, #120e1a);
  --wallpaper-sunset: linear-gradient(180deg, #2a1a10, #1a0e08);
  --wallpaper-ocean: linear-gradient(180deg, #101828, #0a1018);
  --wallpaper-night: linear-gradient(180deg, #0a0818, #050410);
  --wallpaper-sakura: linear-gradient(180deg, #1a1020, #100818);
  --wallpaper-forest: linear-gradient(180deg, #0a180a, #061006);
  --wallpaper-latte: linear-gradient(180deg, #1a1510, #100c08);
  --wallpaper-lavender: linear-gradient(180deg, #181028, #100820);
  --wallpaper-ink: linear-gradient(180deg, #101010, #080808);
}
[data-theme="dark-cute"] .photo-widget { background: var(--tile); box-shadow: 0 2px 12px rgba(0,0,0,0.2); }
[data-theme="dark-cute"] .info-widget { background: rgba(30, 26, 40, 0.65); border: 1px solid rgba(60, 50, 80, 0.3); }

/* ===================== Reset ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { overflow: hidden; color: var(--ink); font-family: var(--font); background: #e8e4f0; -webkit-font-smoothing: antialiased; transition: background 0.3s, color 0.3s; }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; background: none; }

/* ===================== App Shell ===================== */
.app-shell { height: 100%; display: grid; place-items: center; padding: 12px; }
.phone-frame {
  width: min(420px, 100vw); height: min(860px, 100dvh);
  padding: 10px; border-radius: 36px; background: var(--phone-shell);
  box-shadow: 0 24px 80px rgba(80, 60, 120, 0.3);
  display: flex; flex-direction: column; position: relative;
}
.hardware-notch { height: 24px; display: grid; place-items: center; }
.hardware-notch span { width: 78px; height: 5px; border-radius: 999px; background: #2d2d40; }
.phone-screen {
  flex: 1; min-height: 0; overflow: hidden; border-radius: 26px;
  background-color: var(--screen-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex; flex-direction: column;
  position: relative; transition: background-color 0.3s;
}

/* ===================== Status Bar ===================== */
.status-bar {
  height: 36px; padding: 8px 22px 0; display: flex; align-items: center;
  justify-content: space-between; color: var(--ink); font-size: 13px;
  font-weight: 700; flex: 0 0 auto; letter-spacing: 0.3px;
}
.status-bar strong { font-weight: 800; font-size: 12px; letter-spacing: 1.5px; opacity: 0.5; }
.status-bar .battery { font-weight: 600; opacity: 0.7; }

/* ===================== Page Transitions ===================== */
.page {
  position: absolute; inset: 0; bottom: 64px;
  display: flex; flex-direction: column;
  padding: 0 18px 80px; overflow: hidden;
  transform: translateX(100%); opacity: 0;
  pointer-events: none; will-change: transform, opacity;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s ease;
}
.page.active {
  transform: translateX(0); opacity: 1;
  pointer-events: auto;
}
.page.exit-left {
  transform: translateX(-30%); opacity: 0;
}
.page.exit-right {
  transform: translateX(30%); opacity: 0;
}
.page.enter-left {
  transform: translateX(-100%); opacity: 0;
}
.page.enter-right {
  transform: translateX(100%); opacity: 0;
}
.page.page-home { padding: 0; }
.page:not(.page-chat):not(.page-home):not(.page-moments) { overflow-y: auto; }
.page::-webkit-scrollbar, .chat-log::-webkit-scrollbar, .moments-scroll::-webkit-scrollbar { display: none; }

/* ===================== Desktop ===================== */
.desktop-slider {
  flex: 1; min-height: 0; overflow: hidden; position: relative;
}
.desktop-page { display: none; position: absolute; inset: 0; }
.desktop-page.active { display: flex; flex-direction: column; animation: pageFadeIn 0.25s ease-out; }
@keyframes pageFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}
.desktop-wallpaper {
  position: relative; height: 100%; min-height: 100%; padding: 20px 20px 90px;
  background: transparent;
  overflow-y: auto;
}
/* CSS gradient wallpapers applied on phone-screen */
.wallpaper-default .desktop-wallpaper { background: var(--wallpaper-default); }
.wallpaper-sunset .desktop-wallpaper { background: var(--wallpaper-sunset); }
.wallpaper-ocean .desktop-wallpaper { background: var(--wallpaper-ocean); }
.wallpaper-night .desktop-wallpaper { background: var(--wallpaper-night); }
.wallpaper-sakura .desktop-wallpaper { background: var(--wallpaper-sakura); }
.wallpaper-forest .desktop-wallpaper { background: var(--wallpaper-forest); }
.wallpaper-sunset .desktop-wallpaper { background: var(--wallpaper-sunset) !important; }
.wallpaper-ocean .desktop-wallpaper { background: var(--wallpaper-ocean) !important; }
.wallpaper-night .desktop-wallpaper { background: var(--wallpaper-night) !important; }
.wallpaper-sakura .desktop-wallpaper { background: var(--wallpaper-sakura) !important; }
.wallpaper-forest .desktop-wallpaper { background: var(--wallpaper-forest) !important; }
.wallpaper-latte .desktop-wallpaper { background: var(--wallpaper-latte) !important; }
.wallpaper-lavender .desktop-wallpaper { background: var(--wallpaper-lavender) !important; }
.wallpaper-ink .desktop-wallpaper { background: var(--wallpaper-ink) !important; }
/* Custom image wallpaper on phone-screen level */
.phone-screen.wallpaper-custom { background-color: transparent !important; }
.phone-screen.wallpaper-custom .desktop-wallpaper { background: transparent !important; }

.page-dots {
  position: absolute; bottom: 68px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 10px; z-index: 5;
}
.page-dots .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: 0.35;
  transition: all 0.3s; cursor: pointer;
}
.page-dots .dot.active { opacity: 1; background: var(--accent); transform: scale(1.4); }

/* Home Interleaved Layout */
.home-interleaved { display: flex; flex-direction: column; gap: 20px; padding-top: 8px; }
.home-row { display: flex; gap: 12px; }
.home-widget { flex: 1; aspect-ratio: 1 / 1; border-radius: 18px; overflow: hidden; position: relative; }
.home-app-group { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; aspect-ratio: 1 / 1; }
.home-app-group .home-app { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.home-app-group .home-app strong { font-size: 10px; color: var(--ink-2); font-weight: 700; text-shadow: 0 0 6px var(--screen-bg); max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Photo Widget */
.photo-widget { cursor: pointer; background: var(--tile); box-shadow: 0 2px 12px rgba(0,0,0,0.08); transition: transform 0.15s; }
.photo-widget:active { transform: scale(0.96); }
.photo-widget-inner { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: relative; }
.photo-widget-inner img { width: 100%; height: 100%; object-fit: cover; }
.photo-widget-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); }
.photo-widget-placeholder svg { width: 36px; height: 36px; opacity: 0.4; }
.photo-widget-placeholder span { font-size: 11px; font-weight: 700; opacity: 0.6; }
.photo-widget-date { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.35); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 8px; backdrop-filter: blur(4px); }

/* Info Widget */
.info-widget { background: rgba(255,255,255,0.55); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 2px 12px rgba(0,0,0,0.06); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px; text-align: center; transition: transform 0.15s; }
.info-widget:active { transform: scale(0.96); }
.info-widget-avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; font-weight: 900; background: linear-gradient(135deg, var(--accent), #c8a0e0); color: #fff; box-shadow: 0 4px 14px rgba(139, 106, 174, 0.3); flex-shrink: 0; overflow: hidden; }
.info-widget-avatar img { width: 100%; height: 100%; object-fit: cover; }
.info-widget-body strong { display: block; font-size: 14px; font-weight: 800; color: var(--ink); text-shadow: 0 0 12px var(--screen-bg); }
.info-widget-stage { font-size: 10px; color: var(--muted); font-weight: 700; text-shadow: 0 0 8px var(--screen-bg); }
.info-widget-weather { font-size: 10px; color: var(--muted); font-weight: 700; text-shadow: 0 0 8px var(--screen-bg); margin-top: 2px; }
.info-widget-body em { display: block; font-size: 10px; color: var(--muted); font-style: italic; font-weight: 600; text-shadow: 0 0 8px var(--screen-bg); opacity: 0.8; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Home App (shared) */
.home-grid { display: grid; gap: 22px 8px; justify-items: center; }
.page2-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px 8px; justify-items: center; padding-top: 36px; max-width: 240px; margin: 0 auto; }
.home-app { display: flex; flex-direction: column; align-items: center; gap: 7px; transition: transform 0.15s; }
.home-app:active { transform: scale(0.88); }
.home-app-icon {
  width: 60px; height: 60px; border-radius: var(--app-radius);
  display: grid; place-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  transition: transform 0.18s, box-shadow 0.18s;
  position: relative; overflow: hidden;
}
.home-app:active .home-app-icon {
  transform: scale(0.93);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.home-app-icon svg {
  width: 28px; height: 28px; position: relative; z-index: 1;
}
.home-app-icon.icon-custom { background-size: cover !important; background-position: center !important; }
.home-app-icon.icon-custom svg { display: none; }
.home-app strong {
  font-size: 11px; color: var(--ink-2); font-weight: 700;
  max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-shadow: 0 0 6px var(--screen-bg);
}

/* Icon Edit Mode */
.home-app.wiggle { animation: wiggle 0.25s ease-in-out infinite alternate; }
@keyframes wiggle {
  0% { transform: rotate(-1.5deg) scale(1.02); }
  100% { transform: rotate(1.5deg) scale(0.98); }
}
.home-app.dragging { opacity: 0.3; transition: opacity 0.15s; }
.drag-ghost { position: fixed; z-index: 999; pointer-events: none; transform: scale(1.12); opacity: 0.85; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.25)); }
.edit-done-btn { position: absolute; top: -4px; right: -4px; z-index: 20; height: 28px; padding: 0 14px; border-radius: 14px; border: none; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 800; cursor: pointer; display: none; }
.edit-mode .edit-done-btn { display: block; }
.icon-action-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.4); display: none; justify-content: center; align-items: flex-end; padding-bottom: 40px; }
.icon-action-overlay.active { display: flex; }
.icon-action-sheet { background: var(--paper); border-radius: 16px 16px 0 0; width: 100%; max-width: 380px; padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.icon-action-sheet button { width: 100%; padding: 14px; border: none; border-radius: 10px; background: var(--tile); color: var(--ink); font-size: 15px; font-weight: 700; cursor: pointer; text-align: center; }
.icon-action-sheet button:active { opacity: 0.7; }
.icon-action-sheet button.danger { color: #e55; }
.icon-action-cancel { margin-top: 8px; background: var(--paper-2) !important; font-weight: 800 !important; }

.home-msg-preview {
  position: absolute; bottom: 100px; left: 16px; right: 16px;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 14px;
  background: rgba(255,255,255,0.7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
}
[data-theme="dark-cute"] .home-msg-preview {
  background: rgba(30,26,40,0.75); border-color: rgba(60,50,80,0.5);
}
.home-msg-preview:active { transform: scale(0.97); }
.home-msg-avatar {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 14px; font-weight: 900;
  background: linear-gradient(135deg, var(--accent), #c8a0e0); color: #fff;
}
.home-msg-content { flex: 1; min-width: 0; }
.home-msg-content strong { display: block; font-size: 12px; color: var(--ink); font-weight: 800; }
.home-msg-content span {
  display: block; font-size: 13px; color: var(--ink-2); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.home-msg-time { font-size: 11px; color: var(--muted); font-weight: 700; flex: 0 0 auto; }

/* ===================== Dock Bar ===================== */
.dock {
  position: absolute; bottom: 0; left: 0; right: 0; height: 68px;
  display: flex; align-items: center; justify-content: space-around;
  background: rgba(255,255,255,0.85); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(0,0,0,0.06); z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
[data-theme="dark-cute"] .dock {
  background: rgba(22,18,30,0.85);
  border-top-color: rgba(255,255,255,0.06);
}
.dock-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  position: relative; color: var(--dock-inactive); transition: color 0.2s, transform 0.15s; padding: 4px 12px;
}
.dock-item.active { color: var(--dock-active); }
.dock-item:active { transform: scale(0.88); }
.dock-item.bounce { animation: dockBounce 0.4s ease; }
.dock-icon { font-size: 22px; font-weight: 900; line-height: 1; transition: transform 0.15s; }
.dock-item strong { font-size: 10px; font-weight: 700; }
.dock-badge {
  position: absolute; top: -2px; right: 2px; min-width: 18px; height: 18px;
  border-radius: 9px; background: #FF3B30; color: #fff; font-size: 10px;
  font-weight: 800; display: grid; place-items: center; padding: 0 5px;
  border: 2px solid var(--screen-bg);
  animation: badgePop 0.3s ease;
}

@keyframes dockBounce {
  0% { transform: scale(1); }
  30% { transform: scale(0.88); }
  60% { transform: scale(1.08); }
  80% { transform: scale(0.96); }
  100% { transform: scale(1); }
}
@keyframes badgePop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ===================== Title Bars ===================== */
.app-titlebar {
  height: 66px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center; gap: 10px; flex: 0 0 auto; border-bottom: 2px solid var(--line);
}
.profile-titlebar { height: 86px; border-bottom: 0; }
.profile-titlebar strong { font-size: 26px; }
.app-titlebar strong { display: block; font-size: 21px; }
.app-titlebar span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 1px; }

/* ===================== Shared Buttons ===================== */
.back-button, .small-button, .tool-button, .send-button {
  display: inline-grid; place-items: center; color: var(--ink);
  background: var(--paper-2); border: 2px solid var(--line);
}
.back-button { width: 42px; height: 42px; border-radius: 50%; font-size: 28px; line-height: 1; }
.small-button {
  min-width: 62px; height: 34px; padding: 0 14px; border: 0;
  color: #fff; background: #555; border-radius: 17px; font-weight: 800; font-size: 13px;
}

/* ===================== Page Head ===================== */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 2px 14px; flex: 0 0 auto; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 12px; font-weight: 900; letter-spacing: 1px; }
h1 { margin-bottom: 0; font-size: 22px; }
h2 { margin: 0; font-size: 28px; }
h3 { margin-bottom: 8px; font-size: 15px; }

/* ===================== Chat ===================== */
.texting-header {
  height: 118px; display: grid; grid-template-columns: 52px 46px minmax(0, 1fr) 132px;
  align-items: center; gap: 10px; border-bottom: 2px solid var(--line); flex: 0 0 auto;
}
.menu-button { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--line); background: var(--paper-2); color: var(--ink); font-size: 25px; }
.texting-avatar { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; background: linear-gradient(135deg, var(--accent), #c8a0e0); color: #fff; }
.texting-title { min-width: 0; }
.texting-title strong { display: block; font-size: 20px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.texting-title em { display: inline-flex; align-items: center; gap: 4px; color: #4ade80; font-size: 11px; font-style: normal; font-weight: 800; margin-top: 4px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; display: inline-block; }
.texting-title #chatSubtitle { display: block; color: var(--muted); font-size: 11px; font-weight: 700; margin-top: 2px; letter-spacing: 0.5px; }
.wechat-mode { height: 38px; border-radius: 19px; border: 2px solid var(--line); color: var(--ink); background: var(--paper-2); font-size: 13px; font-weight: 900; padding: 0 16px; }
.header-icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line); background: var(--paper-2); color: var(--ink); font-size: 16px; cursor: pointer; display: grid; place-items: center; transition: background 0.15s; }
.header-icon-btn:active { background: var(--tile); }

/* 搜索面板 */
.search-panel { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: var(--paper); z-index: 30; display: flex; flex-direction: column; transform: translateY(-100%); opacity: 0; pointer-events: none; transition: transform 0.28s cubic-bezier(.4,0,.2,1), opacity 0.22s; }
.search-panel.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.search-bar { display: flex; align-items: center; gap: 8px; padding: 12px 12px; background: var(--paper-2); border-bottom: 2px solid var(--line); flex: 0 0 auto; }
.search-bar-icon { font-size: 14px; opacity: 0.5; flex: 0 0 auto; }
.search-bar input { flex: 1; border: none; background: var(--tile); border-radius: 8px; padding: 10px 12px; font-size: 15px; font-weight: 600; color: var(--ink); outline: none; }
.search-bar input::placeholder { color: var(--muted); font-weight: 500; }
.search-cancel-btn { background: none; border: none; color: var(--ink); font-size: 14px; font-weight: 800; padding: 8px 4px; cursor: pointer; white-space: nowrap; }
.search-body { flex: 1; overflow-y: auto; scrollbar-width: none; }
.search-history { padding: 14px 14px 0; }
.search-history-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.search-history-head span { font-size: 13px; font-weight: 800; color: var(--muted); }
.search-history-head button { background: none; border: none; font-size: 12px; color: var(--muted); cursor: pointer; font-weight: 700; }
.search-history-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.search-history-tags:empty { display: none; }
.search-tag { background: var(--tile); color: var(--ink); font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 14px; border: 1px solid var(--line); cursor: pointer; transition: background 0.15s; }
.search-tag:active { background: var(--paper-2); }
.search-results { padding: 0 14px 20px; }
.search-empty { text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; padding: 40px 0 20px; }
.search-result-item { padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; transition: background 0.1s; }
.search-result-item:active { background: var(--tile); margin: 0 -14px; padding: 12px 14px; border-radius: 8px; }
.search-result-item:last-child { border-bottom: none; }
.search-result-time { font-size: 11px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.search-result-sender { font-size: 12px; font-weight: 800; margin-bottom: 2px; color: var(--ink); }
.search-result-text { font-size: 14px; font-weight: 600; color: var(--ink); opacity: 0.8; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-result-text mark { background: #ffeb3b; color: var(--ink); font-weight: 800; border-radius: 2px; padding: 0 1px; }
.search-count { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; padding: 10px 0 0; }

.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 0 100px; scrollbar-width: none; }
.day-chip { width: fit-content; margin: 6px auto 18px; color: var(--muted); font-size: 11px; font-weight: 800; background: var(--tile); padding: 4px 14px; border-radius: 10px; }
.time-gap { text-align: center; color: var(--muted); font-size: 11px; font-weight: 700; margin: 10px auto 6px; opacity: 0.7; }
.message { display: flex; margin: 0 0 4px; gap: 8px; padding: 0 4px; }
.message.user { flex-direction: row-reverse; }
.msg-avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; font-weight: 900; font-size: 14px; margin-top: 2px; }
.msg-avatar.ai-avatar { background: #555; color: #fff; }
.msg-avatar.user-avatar { background: linear-gradient(135deg, #a0d8b8, #78c09a); color: #fff; }
.msg-body { max-width: 72%; display: flex; flex-direction: column; }
.bubble { padding: 10px 14px; border-radius: 16px; line-height: 1.6; font-size: 15px; font-weight: 600; word-break: break-word; white-space: pre-wrap; }
.message.ai .bubble { background: var(--bubble-ai-bg); border: 1px solid var(--bubble-ai-border); color: var(--bubble-ai-text); border-top-left-radius: 4px; }
.message.user .bubble { background: var(--bubble-user-bg); border: 1px solid var(--bubble-user-border); color: var(--bubble-user-text); border-top-right-radius: 4px; }
.msg-time { font-size: 11px; color: var(--muted); margin-top: 4px; padding: 0 4px; }
.message.user .msg-time { text-align: right; }
.msg-read { font-size: 10px; color: var(--muted); text-align: right; margin-top: 2px; padding: 0 4px; transition: color 0.3s; }
.msg-read.read { color: var(--accent); animation: readPop 0.3s ease; }
@keyframes readPop { 0% { transform: scale(0.8); opacity: 0.5; } 50% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }

.feedback-row { display: flex; gap: 6px; margin-top: 5px; opacity: 0.5; }
.feedback-row button { padding: 3px 8px; border: 1px solid var(--soft-line); background: var(--paper-2); color: var(--muted); font-size: 11px; font-weight: 800; border-radius: 4px; }
.feedback-row button:active { border-color: var(--accent); color: var(--accent); }
.message.meta .bubble { max-width: 88%; margin: 0 auto; color: var(--muted); background: transparent; border: 0; text-align: center; font-size: 12px; }

/* Message appear animation */
.message.anim-in { animation: msgSlideIn 0.3s ease-out both; }
.message.anim-in.anim-left { animation-name: msgSlideLeft; animation-duration: 0.28s; }
.message.anim-in.anim-right { animation-name: msgSlideRight; animation-duration: 0.22s; animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes msgSlideLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes msgSlideRight {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Voice bubble */
.bubble.voice-bubble {
  display: flex; align-items: center; gap: 8px; min-width: 120px; cursor: pointer;
}
.voice-play { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 10px; flex-shrink: 0; }
.voice-wave { display: flex; align-items: center; gap: 2px; height: 18px; }
.voice-wave span { width: 3px; border-radius: 2px; background: var(--muted); }
.voice-wave span:nth-child(1) { height: 6px; }
.voice-wave span:nth-child(2) { height: 12px; }
.voice-wave span:nth-child(3) { height: 18px; }
.voice-wave span:nth-child(4) { height: 10px; }
.voice-wave span:nth-child(5) { height: 14px; }
.voice-wave span:nth-child(6) { height: 8px; }
.voice-dur { font-size: 11px; color: var(--muted); margin-left: auto; }

/* Chat image bubble */
.img-bubble { padding: 4px !important; }
.chat-img { max-width: 180px; max-height: 180px; border-radius: 10px; display: block; object-fit: cover; cursor: pointer; }

/* Chat card bubble */
.card-bubble { padding: 0 !important; overflow: hidden; }
.chat-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; min-width: 160px; }
.card-icon { font-size: 20px; line-height: 1; flex-shrink: 0; }
.card-icon.big { font-size: 28px; }
.card-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-info strong { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-info span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-emoji { font-size: 32px; line-height: 1; flex-shrink: 0; }

.typing { display: flex; align-items: center; gap: 5px; background: var(--bubble-ai-bg); border: 1px solid var(--bubble-ai-border); padding: 14px 18px; border-radius: 16px; border-top-left-radius: 4px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: dotBounce 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat toolbar area */
.chat-toolbar-area {
  position: absolute; left: 0; right: 0; bottom: 44px;
  z-index: 12; background: var(--screen-bg);
  overflow: hidden; transition: max-height 0.25s ease;
  border-top: 1px solid var(--soft-line);
}
.chat-toolbar-area.show-grid { max-height: 220px; }
.chat-toolbar-area:not(.show-grid) { max-height: 40px; }

/* Emoji quick bar */
.emoji-bar {
  display: flex; gap: 6px; overflow-x: auto; padding: 6px 18px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.emoji-bar::-webkit-scrollbar { display: none; }
.emoji-bar button {
  flex-shrink: 0; padding: 6px 12px; border-radius: 16px; font-size: 14px; font-weight: 700;
  background: var(--tile); color: var(--ink); border: 1px solid var(--soft-line);
  transition: transform 0.12s, background 0.12s; white-space: nowrap;
}
.emoji-bar button:active { transform: scale(0.9); background: #e0e0e0; }
.chat-toolbar-area.show-grid .emoji-bar { display: none; }

/* Action grid */
.action-grid {
  display: none; grid-template-columns: repeat(4, 1fr); gap: 10px;
  padding: 14px 18px 10px;
}
.chat-toolbar-area.show-grid .action-grid { display: grid; }
.action-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px; border-radius: 12px; background: var(--tile);
  border: 1px solid var(--soft-line); transition: transform 0.12s;
}
.action-item:active { transform: scale(0.92); }
.action-icon { font-size: 24px; line-height: 1; }
.action-label { font-size: 10px; color: var(--muted); font-weight: 700; }

/* + button in composer */
.plus-btn {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--screen-bg); border: 0;
  font-size: 22px; font-weight: 300; line-height: 1;
  transition: transform 0.25s ease, background 0.2s;
  flex-shrink: 0;
}
.plus-btn.active { transform: rotate(45deg); background: var(--muted); }

/* ===================== API Notice ===================== */
.api-notice {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 8px 14px; margin: 8px 4px 12px;
  background: var(--tile); border-radius: 10px; border: 1px solid var(--soft-line);
  font-size: 12px; color: var(--muted); font-weight: 700;
}
.api-notice button {
  padding: 4px 12px; border-radius: 8px; font-size: 11px; font-weight: 800;
  background: #555; color: #fff; white-space: nowrap;
}

/* Context menu */
.ctx-bubble {
  position: fixed; z-index: 30; display: none; background: #4a4a5a;
  border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  padding: 4px 2px; animation: ctxPop 0.18s ease-out;
}
.ctx-bubble.active { display: block; }
@keyframes ctxPop {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
.ctx-arrow {
  position: absolute; width: 10px; height: 10px; background: #4a4a5a;
  transform: rotate(45deg); bottom: -5px; left: 50%; margin-left: -5px;
}
.ctx-bubble.arrow-up .ctx-arrow { bottom: auto; top: -5px; }
.ctx-actions { display: flex; gap: 0; }
.ctx-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 12px; background: none; border: none; color: #fff;
  font-size: 10px; font-weight: 700; cursor: pointer; min-width: 48px;
  border-radius: 8px; transition: background 0.12s;
}
.ctx-btn:active { background: rgba(255,255,255,0.15); }
.ctx-icon { font-size: 18px; line-height: 1; }
.ctx-btn.ctx-danger { color: #ff6b6b; }
[data-theme="dark-cute"] .ctx-bubble { background: #3a3450; }
[data-theme="dark-cute"] .ctx-arrow { background: #3a3450; }

/* Nudge shake */
.phone-screen.shake { animation: shakeIt 0.4s ease; }
@keyframes shakeIt {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px) rotate(-0.5deg); }
  30% { transform: translateX(5px) rotate(0.5deg); }
  45% { transform: translateX(-4px) rotate(-0.3deg); }
  60% { transform: translateX(3px) rotate(0.3deg); }
  75% { transform: translateX(-2px); }
}

.composer {
  position: absolute; left: 14px; right: 14px; bottom: 2px;
  display: flex; gap: 8px; align-items: center; background: var(--screen-bg); z-index: 12;
  padding: 4px 0;
}
.send-button {
  flex-shrink: 0; width: 56px; height: 36px; border: 0; border-radius: 18px;
  color: #fff; background: var(--ink); font-size: 13px; font-weight: 900;
  transition: transform 0.15s, opacity 0.15s;
}
.send-button:active { transform: scale(0.9); opacity: 0.7; }
.composer input {
  flex: 1; min-width: 0; border: 0; border-bottom: 2px solid var(--line); outline: 0;
  color: var(--ink); background: transparent; padding: 10px 0; font-size: 15px;
}
.composer input::placeholder { color: var(--muted); }

/* ===================== Moments ===================== */
.page-moments { padding: 0 0 80px; }
.moments-scroll { flex: 1; overflow-y: auto; scrollbar-width: none; }
.moments-cover { position: relative; height: 220px; overflow: hidden; }
.moments-cover-bg { position: absolute; inset: 0; background: var(--moments-cover); background-size: cover; background-position: center; }
.moments-cover::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(transparent 40%, rgba(0,0,0,0.45));
  pointer-events: none;
}
.cover-edit {
  position: absolute; bottom: 50px; right: 16px; z-index: 3;
  padding: 6px 14px; border-radius: 14px; font-size: 11px; font-weight: 800;
  background: rgba(0,0,0,0.45); color: #fff; backdrop-filter: blur(8px);
}
.cover-avatar {
  position: absolute; right: 16px; bottom: -24px; width: 64px; height: 64px;
  border-radius: 14px; border: 3px solid var(--paper-2); display: grid; place-items: center;
  font-size: 24px; font-weight: 900; z-index: 2; background: #555; color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.cover-name {
  position: absolute; right: 92px; bottom: 4px; color: #fff; font-size: 16px;
  font-weight: 800; text-shadow: 0 1px 6px rgba(0,0,0,0.5); z-index: 2;
}

.moment-actions-bar { display: flex; justify-content: flex-end; padding: 12px 18px 0; }
.moment-action-btn { padding: 6px 14px; border-radius: 14px; font-size: 12px; font-weight: 800; background: var(--tile); color: var(--accent); border: 1px solid var(--line); }

.moment-list { padding: 16px 18px 20px; }
.moment-item { padding: 16px 0; border-bottom: 1px solid var(--soft-line); }
.moment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.moment-head .avatar { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 15px; font-weight: 900; flex: 0 0 auto; }
.moment-head strong { font-size: 15px; color: var(--accent); }
.moment-head span { margin-left: auto; color: var(--muted); font-size: 11px; }
.moment-text { color: var(--ink-2); font-size: 14px; line-height: 1.65; font-weight: 600; padding-left: 50px; margin-bottom: 6px; }
.moment-actions { display: flex; gap: 14px; padding-left: 50px; }
.moment-actions button { color: var(--muted); font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 4px; transition: color 0.15s, transform 0.15s; }
.moment-actions button:active { transform: scale(0.9); }
.moment-actions button.liked { color: #e53e3e; animation: heartPop 0.35s ease; }
@keyframes heartPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.3); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.moment-comments { background: var(--tile); border-radius: 8px; padding: 8px 10px; margin-top: 8px; margin-left: 50px; }
.moment-likes { font-size: 13px; color: var(--accent); font-weight: 700; padding-bottom: 4px; border-bottom: 1px solid var(--soft-line); margin-bottom: 4px; }
.moment-comment { font-size: 13px; color: var(--ink-2); line-height: 1.5; padding: 2px 0; }
.moment-comment b { color: var(--accent); font-weight: 700; }

/* Moment image grid */
.moment-images { display: grid; gap: 4px; padding-left: 50px; margin-top: 6px; }
.moment-images.grid-1 { grid-template-columns: 1fr; max-width: 200px; }
.moment-images.grid-2 { grid-template-columns: 1fr 1fr; }
.moment-images.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.moment-images img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px;
  background: var(--tile);
}

/* Moment image upload area */
.moment-img-upload { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; align-items: center; }
.moment-img-preview { display: flex; gap: 6px; flex-wrap: wrap; }
.moment-img-preview img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--soft-line); }
.moment-img-add {
  width: 56px; height: 56px; border-radius: 8px; border: 2px dashed var(--soft-line);
  display: grid; place-items: center; color: var(--muted); font-size: 13px; font-weight: 700;
  background: var(--tile); transition: border-color 0.2s;
}
.moment-img-add:active { border-color: var(--accent); }

/* Like heart pop */
.like-btn.pop { animation: heartPop 0.4s ease; }
@keyframes heartPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.4); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* ===================== Diary ===================== */
.diary-timeline { position: relative; padding-left: 32px; }
.diary-timeline::before { content: ''; position: absolute; left: 11px; top: 0; bottom: 0; width: 2px; background: var(--diary-line); border-radius: 1px; }
.diary-item { position: relative; padding: 16px 18px; margin-bottom: 18px; border: 1px solid var(--soft-line); border-radius: 14px; background: var(--paper-2); box-shadow: 0 2px 8px rgba(0,0,0,0.04); animation: fadeInUp 0.25s ease-out both; }
.diary-item::before { content: attr(data-mood-icon); position: absolute; left: -28px; top: 16px; width: 26px; height: 26px; border-radius: 50%; background: var(--paper-2); border: 2px solid var(--diary-line); display: grid; place-items: center; font-size: 13px; z-index: 1; }
.diary-date { font-size: 12px; color: var(--muted); font-weight: 800; margin-bottom: 6px; letter-spacing: 0.5px; }
.diary-text { font-size: 14px; color: var(--ink-2); line-height: 1.7; font-weight: 600; }
.diary-del { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; color: var(--muted); background: var(--tile); border-radius: 50%; display: grid; place-items: center; font-size: 13px; opacity: 0.6; transition: opacity 0.15s; }
.diary-del:active { opacity: 1; }
.mood-selector { display: flex; gap: 10px; }
.mood-btn { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--soft-line); background: var(--paper-2); font-size: 20px; display: grid; place-items: center; transition: border-color 0.2s; }
.mood-btn.active { border-color: #555; background: #e8e8e8; }

/* ===================== Memory ===================== */
.memory-grid { display: grid; gap: 10px; }
.memory-item { padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr) 30px; align-items: center; gap: 8px; border: 1px solid var(--soft-line); border-radius: 10px; background: var(--paper-2); animation: fadeInUp 0.25s ease-out both; }
.memory-item p { margin: 0; color: var(--ink-2); line-height: 1.65; font-size: 14px; font-weight: 600; }
.memory-item button { width: 30px; height: 30px; color: var(--muted); background: var(--tile); border-radius: 50%; }

/* ===================== Share Card ===================== */
.share-card { min-height: 520px; padding: 22px; display: flex; flex-direction: column; border: 1px solid var(--soft-line); border-radius: 12px; background: var(--paper-2); }
.share-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 42px; font-weight: 800; }
.share-card h3 { font-size: 24px; line-height: 1.25; margin-bottom: 26px; }
.share-lines { display: grid; gap: 12px; }
.share-line { padding: 12px; border: 1px solid var(--soft-line); border-radius: 8px; line-height: 1.55; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.share-note { margin: auto 0 0; color: var(--muted); font-size: 12px; }

/* ===================== Settings ===================== */
.settings-panel { display: grid; gap: 14px; padding: 14px; border: 1px solid var(--soft-line); border-radius: 12px; background: var(--paper-2); }
.profile-card { padding: 8px 0 22px; }
.profile-photo { width: 80px; height: 80px; margin: 0 auto 20px; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), #c8a0e0); color: #fff; font-size: 30px; font-weight: 900; box-shadow: 0 4px 16px rgba(139,106,174,0.3); }
.profile-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.profile-card label { color: var(--ink-2); font-size: 12px; letter-spacing: 1px; font-weight: 900; }
.profile-card input { border: 0; border-bottom: 2px solid var(--line); padding: 10px 0 8px; background: transparent; color: var(--ink); font-size: 15px; font-weight: 700; }
.profile-background { margin-top: 16px; }
.profile-background textarea { width: 100%; resize: none; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); padding: 12px; line-height: 1.65; font-size: 14px; font-weight: 600; border-radius: 8px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; text-align: left; font-weight: 800; }
input, select, textarea { width: 100%; border: 1px solid var(--line); color: var(--ink); background: var(--paper-2); outline: none; padding: 11px 12px; border-radius: 10px; transition: border-color 0.2s; }
.settings-actions { display: grid; gap: 10px; margin-top: 12px; }
.settings-actions button, .modal-card > button, .modal-actions button { min-height: 42px; color: #fff; background: #555; font-weight: 900; border-radius: 20px; transition: transform 0.12s, opacity 0.12s; }
.settings-actions button:active, .modal-card > button:active, .modal-actions button:active { transform: scale(0.96); opacity: 0.85; }
.settings-actions .danger, .modal-actions .secondary { color: var(--accent); background: var(--paper-2); border: 1px solid var(--line); }
.theme-selector { display: flex; gap: 10px; }
.theme-btn { flex: 1; padding: 10px; border: 2px solid var(--soft-line); border-radius: 12px; font-size: 13px; font-weight: 800; color: var(--ink); background: var(--paper-2); text-align: center; transition: border-color 0.2s, background 0.2s; }
.theme-btn.active { border-color: #555; background: #e8e8e8; }

/* ===================== Model Row ===================== */
.model-row { display: flex; gap: 8px; }
.model-row select { flex: 1; min-width: 0; }

/* ===================== Slider ===================== */
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row input[type="range"] { flex: 1; border: 0; padding: 0; height: 6px; border-radius: 3px; background: var(--line); -webkit-appearance: none; appearance: none; outline: none; }
.slider-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #555; cursor: pointer; border: 2px solid var(--paper-2); box-shadow: 0 1px 4px rgba(0,0,0,0.2); }
.slider-row span { min-width: 36px; text-align: center; font-size: 14px; font-weight: 800; color: var(--ink); }

/* ===================== Toggle ===================== */
.toggle-row { display: flex; justify-content: space-between; align-items: center; flex-direction: row !important; }
.toggle-row > span { font-size: 14px; font-weight: 700; color: var(--ink); }
.toggle { width: 48px; height: 28px; border-radius: 14px; background: var(--line); position: relative; cursor: pointer; transition: background 0.25s; flex-shrink: 0; }
.toggle[data-on="true"] { background: #555; }
.toggle-knob { width: 22px; height: 22px; border-radius: 50%; background: #fff; position: absolute; top: 3px; left: 3px; transition: transform 0.25s; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.toggle[data-on="true"] .toggle-knob { transform: translateX(20px); }

/* ===================== Backup List ===================== */
.backup-list { max-height: 160px; overflow-y: auto; display: grid; gap: 6px; scrollbar-width: none; }
.backup-list::-webkit-scrollbar { display: none; }
.backup-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 8px; background: var(--tile); border: 1px solid var(--soft-line); font-size: 12px; }
.backup-item span { color: var(--ink-2); font-weight: 600; }
.backup-item button { padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--soft-line); }
.backup-item button:active { background: var(--line); }

/* ===================== Wallpaper Selector ===================== */
.wallpaper-selector { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.wallpaper-option {
  height: 72px; border-radius: 12px; border: 2px solid var(--soft-line);
  cursor: pointer; transition: border-color 0.2s, transform 0.15s; position: relative; overflow: hidden;
}
.wallpaper-option:active { transform: scale(0.94); }
.wallpaper-option.active { border-color: #555; box-shadow: 0 0 0 2px #555; }
.wallpaper-option span {
  position: absolute; bottom: 4px; left: 0; right: 0; text-align: center;
  font-size: 10px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.wp-default { background: radial-gradient(circle at 80% 10%, rgba(200,160,255,0.3), transparent 45%), radial-gradient(circle at 15% 85%, rgba(255,170,200,0.2), transparent 40%), linear-gradient(170deg, #faf8fc, #e8e0f4); }
.wp-sunset { background: linear-gradient(160deg, #fde8d0, #f5c8a0, #f0a878); }
.wp-ocean { background: linear-gradient(160deg, #d4eef6, #8ec8e8, #60b0d8); }
.wp-night { background: linear-gradient(160deg, #1a1830, #0d0a1a, #050410); }
.wp-sakura { background: linear-gradient(160deg, #fce4ec, #f8bbd0, #f48fb1); }
.wp-forest { background: linear-gradient(160deg, #d8f0d8, #8cd8a8, #60c080); }
.wp-latte { background: linear-gradient(160deg, #f5efe6, #e8d0b0, #d4b890); }
.wp-lavender { background: linear-gradient(160deg, #e8dff5, #c8b0e0, #a890d0); }
.wp-ink { background: linear-gradient(160deg, #f0f0ea, #d8d8d0, #b8b8b0); }
.wp-custom { background: linear-gradient(145deg, #e8e0f0, #c8b8d8); }
.wp-custom img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; position: absolute; inset: 0; }

/* ===================== Empty State ===================== */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; text-align: center; gap: 8px;
}
.empty-state-icon { font-size: 36px; margin-bottom: 4px; opacity: 0.6; }
.empty-state-text { color: var(--muted); font-size: 14px; font-weight: 600; line-height: 1.6; }

/* ===================== Music Player ===================== */
.music-player {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px; gap: 20px;
}
.music-disc {
  width: 160px; height: 160px; border-radius: 50%;
  background: conic-gradient(from 0deg, #333, #555, #333, #555, #333);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), inset 0 0 20px rgba(0,0,0,0.3);
  display: grid; place-items: center; transition: transform 0.6s linear;
  position: relative;
}
.music-disc::before {
  content: ''; position: absolute; inset: 8px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
}
.music-disc::after {
  content: ''; position: absolute; inset: 20px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.05);
}
.music-disc.spinning { animation: spin 4s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.music-disc-inner {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--screen-bg); border: 3px solid rgba(255,255,255,0.2);
  z-index: 1;
}
.music-info { text-align: center; }
.music-info strong { display: block; font-size: 20px; color: var(--ink); }
.music-info span { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
.music-lyrics {
  text-align: center; color: var(--ink-2); font-size: 14px; line-height: 2;
  font-weight: 600; max-height: 120px; overflow: hidden;
}
.music-controls { display: flex; align-items: center; gap: 24px; margin-top: 10px; }
.music-btn {
  width: 44px; height: 44px; border-radius: 50%; background: var(--tile);
  color: var(--ink); font-size: 18px; display: grid; place-items: center;
  border: 1px solid var(--line); transition: transform 0.12s, background 0.12s;
}
.music-btn:active { transform: scale(0.9); background: var(--accent-light); }
.music-btn.play-btn {
  width: 56px; height: 56px; font-size: 22px;
  background: #555; color: #fff; border: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* ===================== Gallery ===================== */
.gallery-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 0 2px;
}
.gallery-grid img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px;
  background: var(--tile); cursor: pointer; transition: opacity 0.15s;
}
.gallery-grid img:active { opacity: 0.7; }
.gallery-viewer {
  position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,0.95);
  display: none; place-items: center;
}
.gallery-viewer.active { display: grid; }
.gallery-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.gallery-close {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px;
  border-radius: 50%; background: rgba(255,255,255,0.15); color: #fff;
  font-size: 18px; display: grid; place-items: center; z-index: 2;
}

/* ===================== Import label ===================== */
.import-label {
  min-height: 42px; color: var(--accent); background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 20px; cursor: pointer;
  display: grid; place-items: center; font-weight: 900; font-size: 13px;
  transition: transform 0.12s;
}
.import-label:active { transform: scale(0.96); }

/* ===================== Avatar Upload ===================== */
.avatar-upload-area {
  display: flex; align-items: center; gap: 12px;
}
.avatar-preview {
  width: 56px; height: 56px; border-radius: 16px;
  background: #e8e8e8; display: grid; place-items: center;
  font-size: 20px; font-weight: 900; color: #888;
  overflow: hidden; flex-shrink: 0; border: 2px solid #ddd;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-upload-btn {
  padding: 6px 14px; border-radius: 12px; font-size: 12px; font-weight: 700;
  background: #f0f0f0; color: #555; border: 1px solid #ddd;
}
.avatar-upload-btn:active { background: #e0e0e0; }
.avatar-clear-btn {
  padding: 6px 10px; border-radius: 12px; font-size: 12px; font-weight: 700;
  background: none; color: #999;
}

/* ===================== Modals ===================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 20; display: none; place-items: center; padding: 18px;
  background: rgba(0, 0, 0, 0); transition: background 0.25s;
}
.modal-backdrop.active { display: grid; background: rgba(0, 0, 0, 0.5); }
.modal-backdrop.animating { display: grid; }
.modal-card {
  width: min(360px, 100%); padding: 22px; background: var(--paper-2); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  transform: scale(0.85); opacity: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}
.modal-backdrop.active .modal-card { transform: scale(1); opacity: 1; }
.modal-card h2 { font-size: 20px; margin-bottom: 16px; }
.modal-card p { color: var(--ink-2); line-height: 1.6; font-size: 14px; font-weight: 600; }
.choice-grid { display: grid; gap: 8px; margin: 14px 0; }
.choice { padding: 12px; border: 2px solid var(--soft-line); background: var(--paper-2); color: var(--ink); text-align: left; border-radius: 12px; transition: border-color 0.2s; }
.choice.active { border-color: var(--accent); background: var(--accent-light); }
.choice strong { display: block; font-size: 14px; }
.choice span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }

/* API Guide */
.onboard-desc { font-size: 14px; color: var(--ink-2); line-height: 1.7; font-weight: 600; }
.api-recommend {
  margin: 12px 0; border-radius: 10px; border: 1px solid var(--soft-line); overflow: hidden;
  background: var(--tile);
}
.api-recommend summary {
  padding: 10px 14px; font-size: 13px; font-weight: 700; color: var(--accent);
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px;
}
.api-recommend summary::before { content: '▸'; font-size: 10px; transition: transform 0.2s; }
.api-recommend[open] summary::before { transform: rotate(90deg); }
.api-recommend-body { padding: 0 14px 14px; }
.api-recommend-body p { font-size: 13px; color: var(--ink-2); line-height: 1.6; font-weight: 600; margin-bottom: 8px; }
.api-recommend-tip { font-size: 11px !important; color: var(--muted) !important; margin-top: 6px !important; margin-bottom: 0 !important; }
.api-guide-link {
  display: block; padding: 10px 14px; border-radius: 10px;
  background: #555; color: #fff; font-weight: 800; font-size: 13px;
  text-decoration: none; text-align: center; transition: opacity 0.15s;
}
.api-guide-link:active { opacity: 0.8; }
.onboard-tip {
  font-size: 12px; color: var(--muted); font-weight: 600; line-height: 1.5; margin-top: 4px;
}

/* ===================== Toast ===================== */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 40;
  transform: translateX(-50%) translateY(12px); opacity: 0; pointer-events: none;
  min-width: 180px; max-width: 300px; padding: 10px 18px;
  color: #fff; background: #333; text-align: center;
  font-size: 13px; font-weight: 800; border-radius: 20px;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.active { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================== Shared Animations ===================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===================== Splash Screen ===================== */
.splash {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #1a1a2e 0%, #101114 50%, #0d0a14 100%);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.splash.dismiss {
  opacity: 0; transform: scale(1.05); pointer-events: none;
}
.splash-content {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}
.splash-name {
  display: flex; gap: 0; overflow: hidden;
}
.splash-char {
  display: inline-block;
  font-size: 52px; font-weight: 200; color: #e8e0f0;
  letter-spacing: 2px;
  opacity: 0; transform: translateY(24px);
  animation: charReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes charReveal {
  to { opacity: 1; transform: translateY(0); }
}
.splash-sub {
  font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.25);
  letter-spacing: 12px; margin-left: 12px;
  opacity: 0;
  animation: fadeIn 0.6s 0.6s ease forwards;
}
@keyframes fadeIn {
  to { opacity: 1; }
}
.splash-line {
  width: 0; height: 1px; background: rgba(255,255,255,0.12);
  animation: lineExpand 0.8s 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes lineExpand {
  to { width: 80px; }
}

/* ===================== Lock Screen ===================== */
.lock-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #1a1a2e 0%, #101114 50%, #0d0a14 100%);
  color: #fff; transition: transform 0.5s cubic-bezier(0.4, 0, 0, 1), opacity 0.4s;
  touch-action: none;
}
.lock-screen.dismissed {
  transform: translateY(-100%); opacity: 0; pointer-events: none;
}
.lock-time {
  font-size: 72px; font-weight: 200; letter-spacing: -2px; margin-bottom: 4px;
  text-shadow: 0 2px 20px rgba(200,180,255,0.3);
}
.lock-date { font-size: 16px; font-weight: 600; opacity: 0.6; margin-bottom: 40px; }
.lock-avatar {
  width: 64px; height: 64px; border-radius: 18px;
  display: grid; place-items: center; font-size: 24px; font-weight: 900;
  background: #555; color: #fff;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2); margin-bottom: 12px;
}
.lock-name { font-size: 18px; font-weight: 700; opacity: 0.9; margin-bottom: 60px; }
.lock-hint {
  font-size: 13px; font-weight: 600; opacity: 0.35;
  animation: lockPulse 2s ease-in-out infinite;
}
@keyframes lockPulse {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 0.5; transform: translateY(-4px); }
}

/* ===================== Notification Banner ===================== */
.notif-banner {
  position: fixed; top: -80px; left: 12px; right: 12px; z-index: 90;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 16px;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  transition: top 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}
[data-theme="dark-cute"] .notif-banner {
  background: rgba(30,26,40,0.95);
}
.notif-banner.show { top: 12px; }
.notif-avatar {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 14px; font-weight: 900;
  background: #555; color: #fff;
}
.notif-body { flex: 1; min-width: 0; }
.notif-body strong { display: block; font-size: 13px; color: var(--ink); font-weight: 800; }
.notif-body span {
  display: block; font-size: 13px; color: var(--ink-2); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ===================== Favorites ===================== */
.fav-list { padding: 0 4px; }
.fav-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--soft-line); }
.fav-tag { flex-shrink: 0; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 800; background: var(--tile); color: var(--muted); margin-top: 1px; }
.fav-text { flex: 1; font-size: 13px; color: var(--ink-2); line-height: 1.6; font-weight: 600; }
.fav-del { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--tile); color: var(--muted); display: grid; place-items: center; font-size: 14px; }

/* ===================== Call Overlay ===================== */
.call-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(180deg, #1a1a2e 0%, #0d0d1a 100%);
  display: none; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; gap: 16px;
}
.call-overlay.active { display: flex; }
.call-content { display: flex; flex-direction: column; align-items: center; gap: 12px; animation: callFadeIn 0.5s ease; }
@keyframes callFadeIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
.call-avatar {
  width: 90px; height: 90px; border-radius: 50%;
  display: grid; place-items: center; font-size: 34px; font-weight: 900;
  color: #fff; animation: callPulse 2s infinite;
}
@keyframes callPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.2); }
  50% { box-shadow: 0 0 0 20px rgba(255,255,255,0); }
}
.call-name { font-size: 24px; font-weight: 800; }
.call-status { font-size: 14px; color: rgba(255,255,255,0.6); font-weight: 600; }
.call-timer { font-size: 18px; font-weight: 700; color: rgba(255,255,255,0.8); letter-spacing: 2px; }
.call-actions { display: flex; gap: 60px; margin-top: 60px; }
.call-decline {
  width: 64px; height: 64px; border-radius: 50%; background: #e53e3e; color: #fff;
  font-size: 13px; font-weight: 800; border: 0; display: grid; place-items: center;
}
.call-accept {
  width: 64px; height: 64px; border-radius: 50%; background: #4ade80; color: #fff;
  font-size: 13px; font-weight: 800; border: 0; display: grid; place-items: center;
}
.call-decline:active, .call-accept:active { transform: scale(0.9); }

/* ===================== Install Prompt ===================== */
.install-prompt {
  position: fixed; bottom: -60px; left: 8px; right: 8px; z-index: 85;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 16px;
  background: #333; color: #fff;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.2);
  transition: bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.install-prompt.show { bottom: 8px; }
.install-prompt span { flex: 1; }
.install-prompt #installBtn {
  padding: 6px 16px; border-radius: 14px; background: #fff;
  color: #333; font-weight: 800; font-size: 13px;
}
.install-prompt #installDismiss {
  color: rgba(255,255,255,0.6); font-size: 16px; padding: 4px;
}

/* ===================== Responsive ===================== */
@media (max-width: 520px) {
  .app-shell { padding: 0; }
  .phone-frame { width: 100vw; height: 100dvh; padding: 0; border-radius: 0; background: var(--screen-bg); box-shadow: none; }
  .hardware-notch { display: none; }
  .phone-screen { border-radius: 0; }
  .status-bar { padding-top: max(8px, env(safe-area-inset-top)); height: calc(36px + env(safe-area-inset-top)); }
  .desktop-wallpaper { padding-left: 20px; padding-right: 20px; }
  .composer { bottom: calc(2px + env(safe-area-inset-bottom)); }
  .chat-toolbar-area { bottom: calc(44px + env(safe-area-inset-bottom)); }
  .dock { padding-bottom: env(safe-area-inset-bottom); }
}
