/* ========== Glimmer OS - Complete Styles for index_v2.html ========== */
/* @version 2.12.20 - 修复：iOS PWA 移除 -webkit-fill-available，统一改用 100dvh */

/* iOS安全区域适配 */
html, body {
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    /* 🔧 禁止下拉刷新和橡皮筋效果（CSS优化，减少JS负担） */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    /* background 由各页面自己管理，不设黑色兜底 */
}

/* 🔧 不给body加padding，让各页面容器自己处理安全区 */
body {
    margin: 0;
    padding: 0;
    /* emoji 字体兜底链：让 🤦 😂 🥺 这类字符落到系统原生 emoji 字体上，
       避免某些设备/PWA 下回退失败显示成 ☐ 方框 */
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

/* 顶部导航栏避开灵动岛 - 只针对真正的顶栏，不用通配符避免误伤内部组件 */
.app-header,
.phone-header,
.status-header,
.top-tabs,
.genesis-nav-bar {
    padding-top: calc(env(safe-area-inset-top) + 8px) !important;
}

/* 底部输入框/导航避开底部安全区 */
.chat-input-container,
.dock,
.bottom-nav,
[class*="bottom-bar"],
[class*="tab-bar"] {
    padding-bottom: calc(env(safe-area-inset-bottom) + 4px) !important;
}

/* 修复iOS键盘弹起时的空白间距 */
@supports (-webkit-touch-callout: none) {
    /* iOS设备 */
    html {
        height: 100dvh;
    }

    body {
        min-height: 100dvh;
    }

    #phone-screen {
        min-height: 100dvh;
    }
}

/* 键盘弹起时固定输入框到可视区域底部：只限 iOS PWA，避免误伤安卓 */
body.ios-pwa .chat-input-container {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
}

/* ========== iOS 键盘弹起适配 ========== */
:root {
    --kb-height: 0px;
}

/* 键盘弹起时的全局样式 */
body.keyboard-open {
    overflow: hidden !important;
    width: 100% !important;
}

/* dock 位置完全由 JS positionDocks() 通过内联 style 控制，CSS 只做兜底 */
/* 键盘收起后（无 keyboard-open），清除可能残留的内联 bottom，回到 CSS 默认值 */
body.ios-pwa:not(.keyboard-open) .chat-input-container,
body.ios-pwa:not(.keyboard-open) .echo-dock,
body.ios-pwa:not(.keyboard-open) .chat-input-area {
    bottom: 0 !important;
    transition: none !important;
}

/* 🔧 iOS 键盘弹起时，输入框必须跟随键盘上移（修复间歇性遮挡问题） */
body.ios-pwa.keyboard-open .echo-dock,
body.ios-pwa.keyboard-open .chat-input-area,
body.ios-pwa.keyboard-open .chat-input-container {
    position: fixed !important;
    /* bottom 由 JS 动态设置为键盘高度，这里不能写死 */
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    transition: bottom 0.15s ease-out !important;
}

/* overlay/弹窗打开时隐藏底部输入栏 */
body.keyboard-open .echo-dock {
    z-index: 999 !important;
}
.custom-dialog-overlay ~ .echo-dock {
    display: none !important;
}

/* 键盘弹起时，引用预览条也要跟随（在dock上方60px，仅 iOS PWA） */
body.ios-pwa.keyboard-open #quote-preview-bar {
    position: fixed !important;
    bottom: calc(var(--kb-height, 0px) + 60px) !important;
    z-index: 9998 !important;
    transition: bottom 0.15s ease-out !important;
}

/* 键盘弹起时，聊天消息区域调整高度 */
body.keyboard-open .chat-messages,
body.keyboard-open #app-echo .chat-messages {
    padding-bottom: calc(80px + var(--kb-height, 0px)) !important;
    /* 用 dvh 代替 vh：安卓键盘弹出后 dvh 会随可视区域缩小，vh 不会 */
    max-height: calc(100dvh - var(--kb-height, 0px) - 120px) !important;
}

/* iOS PWA 键盘弹起时的特殊处理 */
body.ios-pwa.keyboard-open {
    /* 不锁定高度，让 visualViewport 自然处理 */
    overflow: hidden !important;
}

body.ios-pwa.keyboard-open .page {
    overflow: hidden !important;
}

/* 防止键盘弹起时页面滚动到奇怪的位置 */
body.ios-pwa.keyboard-open #phone-screen {
    transform: none !important;
    top: 0 !important;
}

/* ========== 🚀 移动端性能优化（保留毛玻璃） ========== */
/* 滚动时优化渲染 */
body.scrolling .chat-messages .message {
    will-change: transform;
}

/* 滚动结束后恢复 */
body:not(.scrolling) .chat-messages .message {
    will-change: auto;
}

/* 毛玻璃元素 GPU 加速 */
.bento-card,
.dock,
.taro-nav-bar,
.echo-dock,
#quote-preview-bar,
.chat-input-container {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* 长列表虚拟化支持 */
.chat-messages {
    contain: strict;
}

.message {
    contain: layout style;
}

/* 减少动画复杂度（低电量/省电模式） */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== 🚫 全局强制隐藏手机外壳侧边按键 ========== */
/* 确保在任何界面（锁屏、主屏、应用内）都不会出现黑色侧边按键 */
body::before,
body::after,
html::before,
html::after {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    content: none !important;
}

/* ========== Custom Fonts ========== */
@font-face {
    font-family: 'Bold';
    src: url('../Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Jason Handwriting';
    src: url('../JasonHandwriting9p.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'QianTu XiaoTu';
    src: url('../千图小兔体.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'ZhangXiLuo FuSheng';
    src: url('../张穸洛浮生楷体.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

/* ========== CSS Variables ========== */
:root {
    /* === 原有变量 === */
    --primary-color: #5a7fff;
    --primary-light: rgba(90, 127, 255, 0.1);
    --primary-medium: rgba(90, 127, 255, 0.5);
    --glass-opacity: 0.7;
    --blur-amount: 20px;
    --border-radius: 16px;
    --bg-image: '';
    --bg-position: center;
    --bg-size: cover;
    --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --spring-easing: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --elastic-easing: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --smooth-easing: cubic-bezier(0.4, 0, 0.2, 1);
    
    /* === 🎨 全局主题变量系统 (Light Mode) === */
    --bg-body: #F2F2F4;
    --bg-screen: #F2F2F4;
    --surface-card: rgba(255, 252, 250, 0.7);
    --border-card: rgba(255, 255, 255, 0.9);
    --shadow-card: 0 10px 30px rgba(189, 175, 175, 0.1);
    --text-main: #6d6466;
    --text-muted: #aeb0b8;
    --text-primary: #6d6466;
    --text-secondary: #aeb0b8;
    --text-tertiary: #c5c7cf;
    --icon-cocoa: #8d6e63;
    --icon-taro: #9575cd;
    --icon-pink: #f48fb1;
    --icon-blue: #90caf9;

    /* === 🌟 日间模式毛玻璃变量（纯白高透）=== */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-text: #6d6466;
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);

    /* === 🎨 Taro 主题：燕麦 & 香芋配色方案 (Macaron True Soft) === */
    --bg-gradient-taro: #F2F2F4;
    --glass-card-taro: rgba(255, 252, 250, 0.7);
    --glass-card-border-taro: rgba(255, 255, 255, 0.9);
    --text-dark-taro: #6d6466;
    --text-med-taro: #aeb0b8;
    --color-cocoa: #d7ccc8;
    --color-cocoa-dark: #8d6e63;
    --color-taro: #e1d5e7;
    --color-taro-dark: #9575cd;
    --accent-pink-taro: #f48fb1;
    --accent-blue-taro: #90caf9;

    /* === 🔒 锁屏壁纸变量 === */
    --lock-bg-img: url('../assets/lock-light.jpg');
    --lock-img-filter: none;
}

/* === 🌙 Dark Mode 全局变量 === */
[data-theme="dark"],
body.dark-mode {
    --bg-body: #1A1A1A;
    --bg-screen: #1A1A1A;
    --surface-card: #1c1c1c;
    --border-card: rgba(255, 255, 255, 0.06);
    --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.2);

    /* 🔒 锁屏夜间壁纸 */
    --lock-bg-img: url('../assets/lock-night.jpg');
    --lock-img-filter: contrast(110%) brightness(0.85);
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-tertiary: #4a5568;
    --icon-cocoa: #e6cbb3;
    --icon-taro: #d1c4e9;
    --icon-pink: #f8bbd0;
    --icon-blue: #b3e5fc;
    
    /* 毛玻璃变量（深邃黑透）*/
    --glass-bg: rgba(30, 40, 55, 0.85);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-text: #e2e8f0;
    --glass-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

/* ========== 全局滚动条隐藏（强制） ========== */
*::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

* {
    -ms-overflow-style: none !important;  /* IE and Edge */
    scrollbar-width: none !important;  /* Firefox */
}

/* 确保所有元素都没有滚动条 */
html, body, div, section, article, aside {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

html::-webkit-scrollbar, 
body::-webkit-scrollbar, 
div::-webkit-scrollbar {
    display: none !important;
}

/* Dark mode variables moved to [data-theme="dark"] section above */

/* ========== Global Reset ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ================= 🍎 iOS PWA 终极适配 ================= */
html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden !important;
    /* position/background 由 ios-pwa-fix.js 在 PWA 模式下管理 */
}

body {
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    filter: none !important;
    margin: 0;
    padding: 0;
    /* 🔧 完美撑满并适配安全区 */
    width: 100%;
    height: 100%;
    /* 🔧 锁死底层滚动，防止拖拽页面导致点击错位 */
    overflow: hidden !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* ✅ 移除安全区padding，实现真正全屏 */
    box-sizing: border-box;
    /* 🔧 iOS 旧版本兼容 */
    min-height: 100vh;
    min-height: -webkit-fill-available;
}
/* ================================================== */

/* 🔧 iOS 全屏模式修复 */
body.is-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    height: 100% !important;
    overflow: hidden !important;
    -webkit-overflow-scrolling: touch !important; /* iOS 滚动优化 */
}

/* ========== Phone Container ========== */
/* ================= 🍎 iOS PWA 主容器适配 ================= */
.phone-container {
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent !important;
    background-color: transparent !important;
    filter: none !important;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* 移动端/PWA：phone-frame 必须撑满容器，不能 flex 居中收缩 */
@media (max-width: 500px), (display-mode: standalone) {
    .phone-container {
        align-items: stretch;
    }
    .phone-frame {
        align-self: stretch;
        min-height: 100%;
    }
}

.phone-frame {
    width: 100%;
    height: 100%;
    position: relative !important;
    overflow: hidden !important;
    transform: translateZ(0) !important;
    z-index: 10;
    background: var(--bg-body);
    isolation: isolate;
    box-sizing: border-box;
    transition: background 0.3s ease;
    border: none;
    border-radius: 0;
    box-shadow: none;
}
/* iOS PWA: 禁用 transform 避免破坏 fixed 子元素 */
body.ios-pwa .phone-frame {
    transform: none !important;
}

/* 🎨 仅PC大屏显示手机外壳效果 */
@media (min-width: 501px) and (display-mode: browser) {
    .phone-frame {
        max-width: 414px;
        height: 812px;
        max-height: 896px;
        border: 6px solid rgba(0, 0, 0, 0.18) !important;
        border-radius: 44px;
        box-shadow: 0 20px 60px rgba(0,0,0,0.15), inset 0 0 0 1px rgba(255,255,255,0.5);
    }
}

/* ========== 页面全屏覆盖（修复状态栏断层） ========== */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: none; /* 默认隐藏 */
    overflow: hidden;
}

.page.active {
    display: flex;
    z-index: 100;
}

/* 焕彩应用背景 - 使用白色主题 */
#screen-settings {
    background: #f7f5f2 !important;
    display: flex;
    flex-direction: column;
    transition: background 0.3s ease;
}

/* 其他应用默认背景（聊天界面除外，聊天界面使用自定义背景） */
.page:not(.taro-home):not(#screen-settings):not(#app-echo):not(.single-chat-page):not(.group-chat-page) {
    background: var(--bg-screen);
    transition: background 0.3s ease;
}

/* ========================================================================
   🤖 安卓专用：Flex 布局架构（彻底放弃"锁死 body"和"JS 强拽"方案）
   核心原理：让安卓原生的 viewport 缩放与 Flex 布局自然配合
   ======================================================================== */

/* 1️⃣ 释放 html/body 的固定定位约束（仅安卓） */
body.android-device {
    position: static !important; /* 🔧 从 fixed 改为 static，允许自然流动 */
    overflow: visible !important; /* 🔧 从 hidden 改为 visible，允许内容自适应 */
    height: auto !important; /* 🔧 从固定高度改为自动，跟随内容 */
    min-height: 100dvh !important; /* 🔧 使用 dvh 单位，键盘弹起时自动缩小 */
}

body.android-device html {
    overflow: visible !important; /* 🔧 同步释放 html 的 overflow 约束 */
}

/* 2️⃣ Echo 应用容器：使用 Flex 布局 + 100dvh 高度 */
body.android-device #app-echo {
    display: flex !important;
    flex-direction: column !important;
    height: 100dvh !important; /* 🔧 关键：使用 dvh 单位，键盘弹起时自动缩小到可视区域 */
    width: 100% !important;
    overflow: hidden !important; /* 🔧 容器本身不滚动，滚动由内部 chat-area 处理 */
    background: var(--bg-screen, #F2F2F4) !important;
    position: relative !important; /* 🔧 从 absolute/fixed 改为 relative */
}

/* 3️⃣ 导航栏：固定高度，不可压缩 */
body.android-device #echo .header {
    flex-shrink: 0 !important; /* 🔧 防止被压缩 */
    position: relative !important; /* 🔧 从 sticky 改为 relative，避免定位问题 */
    z-index: 100 !important;
}

/* 4️⃣ 聊天消息区域：自动填充剩余空间，内部可滚动 */
body.android-device #echo .chat-area {
    flex: 1 !important; /* 🔧 自动填充剩余空间 */
    overflow-y: auto !important; /* 🔧 内部可滚动 */
    -webkit-overflow-scrolling: touch !important; /* 🔧 iOS 平滑滚动 */
    min-height: 0 !important; /* 🔧 允许 flex 子元素缩小 */
}

/* 5️⃣ 底部输入栏：固定高度，不可压缩 */
body.android-device #echo .bottom-bar {
    flex-shrink: 0 !important; /* 🔧 防止被压缩 */
    position: relative !important; /* 🔧 保持 relative 定位 */
    z-index: 100 !important;
}

/* 6️⃣ 背景色全链路覆盖（防止黑屏） */
body.android-device,
body.android-device #phone-screen,
body.android-device .phone-container,
body.android-device .phone-frame,
body.android-device .screen-content,
body.android-device #app-echo,
body.android-device .single-chat-page {
    background: var(--bg-screen, #F2F2F4) !important;
}

/* 7️⃣ 夜间模式适配 */
body.dark-mode.android-device,
body.dark-mode.android-device #phone-screen,
body.dark-mode.android-device .phone-container,
body.dark-mode.android-device .phone-frame,
body.dark-mode.android-device .screen-content,
body.dark-mode.android-device #app-echo,
body.dark-mode.android-device .single-chat-page {
    background: var(--bg-screen, #1A1A1A) !important;
}

.page.active {
    display: flex;
    flex-direction: column;
}

/* 主屏幕在最底层 */

/* === 屏幕内容容器 === */
.screen-content {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--bg-screen);
    transition: background 0.3s ease;
}

/* iPhone 15 Pro 灵动岛 - 完全隐藏避免黑条 */
body:not(.dark-mode) .phone-frame::before,
body:not(.dark-mode) .phone-frame::after {
    display: none !important;
    content: none !important;
}


/* 电源键 - 右侧 */
body::before {
    /* 🚫 强制隐藏侧边按键（永久） */
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    /* 以下样式已失效，但保留注释供参考 */
    /*
    content: '';
    position: fixed;
    right: calc(50% - 207px - 3px);
    top: calc(50vh - 300px);
    width: 3px;
    height: 80px;
    background: linear-gradient(90deg, #5a5a5a 0%, #3a3a3a 50%, #4a4a4a 100%);
    border-radius: 0 2px 2px 0;
    z-index: 11;
    box-shadow: 
        inset 0 1px 1px rgba(0, 0, 0, 0.3),
        inset 0 -1px 1px rgba(255, 255, 255, 0.2);
    */
}

/* ========== 壁纸 ========== */
.wallpaper {
    /* 🔧 iOS 全屏适配：壁纸覆盖整个屏幕 */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    background: var(--bg-screen);
    background-size: cover;
    background-position: center;
    z-index: 0;
    pointer-events: none !important;
    transition: background 0.3s ease;
}

/* ========== 锁屏样式 - 极简白冰设计 ========== */

/* 锁屏容器 */
.lock-screen, #lock-screen {
    /* 🔧 iOS 全屏适配：使用 fixed + top/left/right/bottom 代替 width/height */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 99999999 !important; /* 🔧 必须高于 vConsole (9999999) */
    background: var(--bg-milky);
    display: flex;
    flex-direction: column;
    cursor: grab;
    user-select: none;
    pointer-events: auto;
    touch-action: none;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s ease;
}

.lock-screen:active {
    cursor: grabbing;
}

#lock-screen[style*="display: none"],
#lock-screen.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

/* 锁屏壁纸层 */
.lock-screen-wallpaper {
    /* 🔧 iOS 全屏适配：壁纸必须覆盖整个屏幕包括安全区 */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background-image: var(--lock-bg-img) !important;
    background-size: cover;
    background-position: center bottom;
    filter: var(--lock-img-filter) !important;
    pointer-events: none !important;
    transition: background-image 0.5s, filter 0.5s;
}

/* 顶部压白/压暗遮罩 */
.lock-top-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0.4) 40%, transparent 100%);
    z-index: 2;
    pointer-events: none;
    transition: background 0.5s;
}

body.dark-mode .lock-top-mask {
    background: linear-gradient(to bottom, rgba(5,5,5,0.85) 0%, rgba(5,5,5,0.4) 40%, transparent 100%);
}

/* 动态效果容器 */
.chill-effects {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

/* 日间雾气效果 */
.fog-blob {
    position: absolute;
    width: 150%;
    height: 100%;
    left: -25%;
    bottom: -10%;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.5) 0%, transparent 50%);
    filter: blur(20px);
    animation: slowFog 8s infinite alternate ease-in-out;
    transition: opacity 0.5s;
}

.fog-blob:nth-child(2) {
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.3) 0%, transparent 40%);
    animation: slowFog 12s infinite alternate-reverse ease-in-out;
    animation-delay: -3s;
}

@keyframes slowFog {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-40px) scale(1.15); }
}

body.dark-mode .fog-blob {
    opacity: 0;
}

/* 日间冰晶粒子 */
.ice-particle {
    position: absolute;
    bottom: -10px;
    width: 4px;
    height: 4px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 8px 2px rgba(255,255,255,0.9);
    animation: riseParticle linear infinite;
}

@keyframes riseParticle {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    10% { opacity: 1; }
    70% { opacity: 0.6; }
    100% { transform: translateY(-350px) scale(1.5); opacity: 0; }
}

body.dark-mode .ice-particle {
    display: none;
}

/* 夜间星尘效果 */
.star-dust {
    position: absolute;
    width: 2.5px;
    height: 2.5px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px rgba(255,255,255,0.9);
    animation: fastDust linear infinite;
    z-index: 4;
    display: none;
}

@keyframes fastDust {
    0% { transform: translate(0, 0) scale(0.2); opacity: 0; }
    20% { opacity: 1; }
    60% { opacity: 0.8; transform: translate(-40px, -100px) scale(1.5); }
    100% { transform: translate(-70px, -200px) scale(0.5); opacity: 0; }
}

body.dark-mode .star-dust {
    display: block;
}

/* 夜间海面波光 */
.water-caustics {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    mix-blend-mode: overlay;
    opacity: 0;
    background-image:
        radial-gradient(ellipse at 40% 70%, rgba(255,255,255,0.3) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 90%, rgba(255,255,255,0.2) 0%, transparent 50%);
    background-size: 200% 200%;
    animation: causticFlow 6s infinite alternate ease-in-out;
    transition: opacity 0.5s;
}

body.dark-mode .water-caustics {
    opacity: 0.8;
}

@keyframes causticFlow {
    0% { background-position: 0% 100%; transform: scale(1); }
    100% { background-position: 100% 0%; transform: scale(1.05); }
}

/* 时间排版区域 */
.lock-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    /* 🔧 iOS 安全区适配：顶部避开灵动岛 */
    padding: calc(env(safe-area-inset-top) + 50px) 36px 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    z-index: 10;
    pointer-events: none;
}

.lock-date {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-sub);
    letter-spacing: 2px;
    text-transform: uppercase;
    border-bottom: 1.5px solid var(--text-main);
    padding-bottom: 6px;
    transition: color 0.5s, border-color 0.5s, text-shadow 0.5s;
}

body.dark-mode .lock-date {
    text-shadow: 0 2px 12px rgba(0,0,0,0.9);
}

.lock-time {
    font-size: 105px !important;
    font-weight: 300 !important;
    letter-spacing: -3px;
    line-height: 0.9;
    color: var(--text-main);
    margin-left: -5px;
    margin-top: 12px;
    font-family: 'Inter', sans-serif !important;
    transition: color 0.5s, text-shadow 0.5s;
}

body.dark-mode .lock-time {
    text-shadow: 0 2px 12px rgba(0,0,0,0.9);
}

/* 兼容旧的.lock-hours类名 */
.lock-hours {
    font-size: 105px !important;
    font-weight: 300 !important;
    letter-spacing: -3px;
    line-height: 0.9;
    color: var(--text-main);
    margin-left: -5px;
    margin-top: 12px;
    font-family: 'Inter', sans-serif !important;
    transition: color 0.5s, text-shadow 0.5s;
}

body.dark-mode .lock-hours {
    text-shadow: 0 2px 12px rgba(0,0,0,0.9);
}

/* 标签区域 */
.lock-tag {
    position: absolute;
    bottom: 120px;
    /* 🔧 iOS 安全区适配：底部避开安全区 */
    bottom: calc(120px + env(safe-area-inset-bottom));
    left: 36px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-left: 1.5px solid var(--text-main);
    padding-left: 10px;
    z-index: 10;
    transition: border-color 0.5s;
}

body.dark-mode .lock-tag {
    text-shadow: 0 2px 12px rgba(0,0,0,0.9);
}

.lock-tag-title {
    font-family: var(--font-serif);
    font-size: 13px;
    font-style: italic;
    color: var(--text-main);
    transition: color 0.5s;
}

.lock-tag-sub {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-sub);
    transition: color 0.5s;
}

/* 底部解锁提示 */
.lock-bottom {
    position: absolute;
    bottom: 40px;
    /* 🔧 iOS 安全区适配：底部避开安全区 */
    bottom: calc(40px + env(safe-area-inset-bottom));
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 0 36px;
    z-index: 20;
}

.swipe-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.85);
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.5s;
}

body.dark-mode .swipe-hint {
    background: rgba(20, 20, 20, 0.6);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
}

.swipe-hint i {
    font-size: 18px;
    animation: swipeBounce 2s infinite;
}

@keyframes swipeBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* 兼容旧的.lock-hint类名 */
.lock-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.85);
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.5s;
}

body.dark-mode .lock-hint {
    background: rgba(20, 20, 20, 0.6);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
}





/* ========== 主屏幕 ========== */
.screen-content, #screen-content {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1 !important;
    display: flex;
    flex-direction: column;
}

/* ========== 页面系统 (强制重写) ========== */
/* 1. 屏幕容器：占满全屏，默认隐藏 */
.page {
    display: none !important; /* 默认都不显示 */
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.4) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    z-index: 10;
    overflow: hidden !important;
    flex-direction: column;
}

/* 2. 激活状态：显示并置顶 */
.page.active {
    display: flex !important; /* 激活时显示 */
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
    z-index: 100 !important; /* 保证在最上层 */
    pointer-events: auto !important;
}

/* 3. 主页特殊处理：由 taro-home-styles.css 控制 */
/* #home 样式已移至 taro-home-styles.css，避免冲突 */

/* ========== APP Header ========== */
.app-header {
    display: flex;
    align-items: center;
    /* 🔧 顶部避开iOS状态栏安全区 */
    padding: calc(env(safe-area-inset-top) + 20px) 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.3);
    position: relative; /* 🔧 确保正确定位 */
    z-index: 100; /* 🔧 确保在最上层 */
}

/* 🌙 夜间模式 - App Header */
body.dark-mode .app-header {
    background: #1A1A1A !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

/* ✨ 万象页面 - 固定导航栏(不影响子页面overlay) */
#genesis > .app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

/* 万象页面内容区域添加上边距,避免被固定导航栏遮挡 */
#genesis > .app-content {
    padding-top: calc(env(safe-area-inset-top) + 64px); /* header高度 + 安全区域 */
}

/* 确保overlay子页面不受影响 - overlay有自己独立的导航栏 */
.overlay-page.genesis-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000; /* 比主页面的header层级更高 */
}


.app-header h1 {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    transition: color 0.3s ease;
}

/* 🌙 夜间模式 - 标题文字 */
body.dark-mode .app-header h1 {
    color: var(--dark-text-primary, #f0f0f0) !important;
}

.back-btn, .add-btn, .menu-btn, .chat-menu-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    color: #333;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative; /* 🔧 确保可点击 */
    z-index: 10; /* 🔧 确保在最上层 */
}

/* 🌙 夜间模式 - 按钮 */
body.dark-mode .back-btn,
body.dark-mode .add-btn,
body.dark-mode .menu-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--dark-text-primary, #f0f0f0) !important;
}

.back-btn:hover, .add-btn:hover, .menu-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.05); /* 🔧 添加交互反馈 */
}

body.dark-mode .back-btn:hover,
body.dark-mode .add-btn:hover,
body.dark-mode .menu-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    position: relative;
    min-height: 0;
    background: transparent;
}

/* ========== 按钮样式 ========== */
.btn-glass {
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 24px;
    background: var(--surface-card);
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: rgba(100, 150, 255, 0.3) !important;
    border-color: rgba(100, 150, 255, 0.4) !important;
    color: var(--text-main) !important;
}

/* ========== 输入框 ========== */
.glass-input {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.25);
    font-size: 14px;
    color: var(--text-main);
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
}

.glass-input:focus {
    outline: none;
    border-color: rgba(100, 150, 255, 0.4);
    background: rgba(255, 255, 255, 0.8);
}

.setting-textarea {
    min-height: 100px;
    resize: vertical;
}

/* ========== 桌面 ========== */
.home-screen {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    z-index: 1;
    /* 🔧 iOS 底部延伸：确保背景色延伸到底部 */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
}

.home-pages-container {
    width: 100%;
    height: 100%;
    display: flex;
    overflow-x: scroll; /* 🔧 允许横向滚动 */
    overflow-y: hidden; /* 🔧 禁止纵向滚动 */
    position: relative;
    touch-action: pan-x !important; /* 🔧 允许横向滑动 */
    -webkit-overflow-scrolling: touch !important; /* iOS 平滑滚动 */
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory; /* 🔧 页面吸附 */
    scroll-behavior: smooth;
}

.home-pages-container::-webkit-scrollbar {
    display: none;
}

.home-page {
    width: 100%;
    min-width: 100%;
    flex-shrink: 0;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-align: start; /* 🔧 页面吸附对齐 */
    box-sizing: border-box;
}

/* ========== 精简时钟 ========== */
.compact-clock {
    position: absolute;
    top: 10px;
    left: 24px;
    z-index: 5;
    pointer-events: none;
}

.compact-time {
    font-size: 48px;
    font-weight: 300;
    color: var(--text-main);
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.3);
    letter-spacing: -2px;
    transition: color 0.3s ease;
    display: flex;
    align-items: baseline;
}

.compact-date {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    margin-top: 4px;
    transition: color 0.3s ease;
}

/* ========== Bento 磁贴区 ========== */
.bento-section {
    display: flex !important;
    gap: 12px;
    padding: 0 20px;
    height: auto !important;
    min-height: 200px;
    overflow: visible !important;
    margin-top: 80px;
    margin-bottom: 20px;
}

.bento-card {
    background: rgba(255, 245, 250, 0.7);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bento-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.identity-card {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.identity-card:active {
    transform: scale(0.98);
}

.identity-avatar-large {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #ffd6e7 0%, #e6d6ff 100%);
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex !important;
    flex-shrink: 0;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(255, 182, 193, 0.25);
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease;
}

.identity-avatar-large:hover {
    transform: scale(1.05);
}

.identity-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

.avatar-placeholder {
    font-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.identity-status {
    text-align: center;
    width: 100%;
}

.identity-name, .identity-persona {
    display: block !important;
    color: var(--text-main) !important;
    text-align: center;
    min-height: 18px;
    transition: color 0.3s ease;
    cursor: pointer;
    transition: opacity 0.2s ease;
    padding: 4px 8px;
    border-radius: 8px;
}

.identity-name:hover, .identity-persona:hover {
    opacity: 0.7;
    background: rgba(0, 0, 0, 0.03);
}

.identity-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 3px;
    color: #2d2d2d !important;
}

.identity-persona {
    font-size: 11px;
    color: var(--text-tertiary) !important;
    font-weight: 400;
    transition: color 0.3s ease;
}

.bento-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.memory-card {
    flex: 1;
    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
    padding: 0;
    padding-bottom: 20px !important;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.2s ease;
    height: auto !important;
    min-height: 100px !important;
    background-size: cover !important;
    overflow: visible !important;
}

.memory-card:active {
    transform: scale(0.98);
}

.genesis-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    gap: 8px;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(255, 240, 245, 0.8) 0%, rgba(240, 230, 255, 0.8) 100%);
    transition: transform 0.2s ease;
}

.genesis-card:active {
    transform: scale(0.98);
}

.memory-image {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.memory-placeholder {
    font-size: 26px;
}

.memory-count {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
}

.genesis-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    transition: color 0.3s ease;
}

/* ========== 应用图标区 ========== */
.apps-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 24px 24px;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 0;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.app-icon:active {
    transform: scale(0.9);
}

.icon-wrapper {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    transition: all 0.2s ease;
}

.app-icon:hover .icon-wrapper {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.icon-label {
    font-size: 12px;
    color: var(--text-main);
    text-align: center;
    max-width: 64px;
    transition: color 0.3s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

/* ========== Dock 栏 ========== */
.dock {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    z-index: 100;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 1000;
}

.dock .app-icon {
    gap: 6px;
}

.dock .icon-wrapper {
    width: 52px;
    height: 52px;
}

/* ========== 页面指示器 ========== */
.page-indicators {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 999;
}

.indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    cursor: pointer;
}

.indicator.active {
    width: 20px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.9);
}

/* ========== API 设置界面（万象 App）========== */
.setting-group {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.setting-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

.setting-buttons {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.setting-buttons .btn-glass {
    flex: 1;
}

#genesis .app-content {
    padding: 20px;
}

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ========== iOS PWA 全屏修复 ========== */
/* 详细布局由 ios-pwa-fix.js 统一管理，这里只做基础重置 */
@media (display-mode: standalone) {
    body, #phone-screen, .screen-content {
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        border: none !important;
    }
    .phone-frame {
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }
    .phone-container {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        border: none !important;
    }
    .dock-glass {
        bottom: calc(25px + env(safe-area-inset-bottom, 0px)) !important;
    }
    body:not(.dark-mode) .phone-frame::before,
    body:not(.dark-mode) .phone-frame::after {
        display: none !important;
    }
}

/* 🍎 PWA 模式类标记（JavaScript 检测添加）*/
body.pwa-mode {
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    position: fixed !important;
    inset: 0 !important;
}

body.pwa-mode .phone-container {
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    position: fixed !important;
    inset: 0 !important;
    /* height 不设，靠 inset:0 撑满，避免 iOS dvh 截断 */
}

body.pwa-mode .phone-frame {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
}

/* ========== 响应式调整 ========== */
@media (max-width: 414px) {
    /* 🔧 移动端强制全屏：phone-container 靠 fixed+inset 撑满，不设 height */
    .phone-container {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .phone-frame {
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        max-width: none !important;
        max-height: none !important;
        margin: 0 !important;
    }
    
    .screen-content {
        width: 100% !important;
        height: 100% !important;
    }
    
    .compact-time {
        font-size: 40px;
    }
    
    .bento-section {
        padding: 0 16px;
    }
    
    .apps-section {
        padding: 0 20px 20px;
    }
}

/* ========== 新桌面设计 (Dual Screen) ========== */

/* Dual Screen 专用变量 */
.dual-screen-home {
    --glass-bg-dual: rgba(255, 255, 255, 0.25);
    --glass-border-dual: 1px solid rgba(255, 255, 255, 0.35);
    --glass-shadow-dual: 0 10px 30px rgba(0, 0, 0, 0.05);
    --icon-bg-dual: linear-gradient(135deg, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.2) 100%);
    --icon-shadow-dual: 
        inset 1px 1px 2px rgba(255,255,255,0.8), 
        inset -1px -1px 2px rgba(0,0,0,0.1),
        0 5px 15px rgba(0,0,0,0.1);
    --page-padding-dual: 24px;
}

/* 滑动容器 (Snap Scroll) */
.scroll-container {
    flex: 1;
    display: flex;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x proximity;  /* mandatory → proximity 让滑动更流畅 */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
    cursor: grab;
    user-select: none;
    /* 添加滚动平滑过渡 */
    scroll-padding: 0;
}

.scroll-container:active {
    cursor: grabbing;
}

.scroll-container::-webkit-scrollbar { 
    display: none;
}

/* 确保应用图标在拖拽时仍可点击 */
.scroll-container .app-item,
.scroll-container .widget {
    pointer-events: auto;
    user-select: none;
}

/* 单页布局 */
.dual-page {
    min-width: 100%;
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    scroll-snap-align: start;
    padding: 10px var(--page-padding-dual, 24px) 140px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(6, 1fr);
    grid-gap: 15px 15px;
    align-content: start;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 组件 (Widgets) */
.widget {
    background: var(--glass-bg-dual, rgba(255, 255, 255, 0.25));
    border: var(--glass-border-dual, 1px solid rgba(255, 255, 255, 0.35));
    border-radius: 28px;
    box-shadow: var(--glass-shadow-dual, 0 10px 30px rgba(0, 0, 0, 0.05));
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 大组件 (4x2) */
.widget-lg {
    grid-column: span 4;
    grid-row: span 2;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* 中组件 (2x2) */
.widget-md {
    grid-column: span 2;
    grid-row: span 2;
    padding: 16px;
    box-sizing: border-box;
    justify-content: space-between;
}

/* 组件内部元素 */
.avatar-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.music-disc {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    background: rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* App 图标 */
.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.app-item:active {
    transform: scale(0.95);
}

.icon-box {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: var(--icon-bg-dual, linear-gradient(135deg, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.2) 100%));
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow: var(--icon-shadow-dual);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
}

.icon-box:active {
    transform: scale(0.95);
    background: rgba(255,255,255,0.5);
}

.icon-box i {
    font-size: 28px;
    background: linear-gradient(180deg, #FFFFFF 0%, #D6D6D6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.15));
}

.app-name {
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* 🎨 主题系统会通过 theme.js 动态覆盖 .taro-home .app-name 的颜色 */

/* 分页指示器 (Dual Screen) */
.dots {
    position: absolute;
    bottom: 120px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 200;
    pointer-events: none;
}

.dot {
    width: 6px;
    height: 6px;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
    transition: all 0.3s ease;
    cursor: pointer;
    pointer-events: auto;
    padding: 4px;
}

.dot.active {
    background: #fff;
    transform: scale(1.2);
}

.dot:hover {
    background: rgba(255,255,255,0.7);
}

/* Dock (Dual Screen) */
.dock-glass {
    position: absolute;
    bottom: 25px;
    left: 20px;
    right: 20px;
    height: 85px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 35px;
    border: 1px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
    z-index: 100;
}

.dock-glass .app-name {
    display: none;
}

.dock-glass .app-item {
    margin-top: 0;
}

/* 角标 */
.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: rgba(255,255,255,0.95);
    color: #000;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ========== Echo App - 马卡龙聊天风格 ========== */

/* Echo 页面专用变量 */
#echo {
    --macaron-bg: linear-gradient(180deg, #ffffff 0%, #dfe9f3 100%);
    --candy-pink: #FFB7B2;
    --candy-mint: #B5EAD7;
    --candy-blue: #C7CEEA;
    --candy-yellow: #FFFFD8;
    --candy-purple: #E2F0CB;
    --text-main: #6c5ce7;
    --text-light: #a29bfe;
    --glass-panel: rgba(255, 255, 255, 0.65);
    --glass-border: 1px solid rgba(255, 255, 255, 0.7);
    --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.1);
    --radius-box: 24px;
    --radius-btn: 16px;
    
    background: var(--macaron-bg);
    background-attachment: fixed;
    /* 🔧 确保背景铺满全屏包括安全区 */
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-size: 200% 200%;
    animation: gradientMove 15s ease infinite;
    font-family: 'Inter', -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 侧边栏遮罩 */
.sidebar-mask {
    position: fixed;
    inset: 0;
    background: rgba(108, 92, 231, 0.25);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}

.sidebar-mask.active {
    opacity: 1;
    pointer-events: auto;
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    top: 0;
    right: -85%;
    width: 85%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    box-shadow: -10px 0 30px rgba(0,0,0,0.05);
    z-index: 200;
    padding: 20px;
    box-sizing: border-box;
    transition: right 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar.open {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
    font-weight: 700;
    color: #6c5ce7;
    margin-bottom: 10px;
}

/* 设置卡片 */
.setting-card {
    background: #fff;
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-label {
    font-size: 12px;
    color: #b2bec3;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* 头像上传区 */
.avatar-uploader-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fdfdfd;
    border: 1px dashed #dfe6e9;
    border-radius: 12px;
    padding: 10px;
}

.user-tag {
    font-size: 13px;
    font-weight: 600;
    color: #636e72;
}

.mini-avatar-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* 马卡龙下拉框 */
.macaron-select {
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    border: none;
    background: var(--candy-blue);
    color: #fff;
    font-weight: 600;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    text-align-last: center;
}

/* 开关 */
.row-switch {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.switch-btn {
    width: 44px;
    height: 24px;
    background: #dfe6e9;
    border-radius: 12px;
    position: relative;
    transition: 0.3s;
    cursor: pointer;
}

.switch-btn::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.switch-btn.on {
    background: var(--candy-mint);
}

.switch-btn.on::after {
    transform: translateX(20px);
}

/* Echo Header */
#echo .header {
    /* 🔧 高度需包含安全区 */
    min-height: 65px;
    /* 🔧 顶部避开iOS状态栏安全区 */
    padding: env(safe-area-inset-top) 12px 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.4);
    z-index: 100;
    border-bottom: var(--glass-border);
    /* 🔧 移动端输入时保持导航栏可见 */
    position: sticky;
    top: 0;
}

#echo .header-back-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
    cursor: pointer;
    transition: 0.2s;
    flex-shrink: 0;
}

#echo .header-back-btn:active {
    transform: scale(0.9);
    background: rgba(108, 92, 231, 0.1);
}

#echo .header-back-btn i {
    font-size: 20px;
    color: #6c5ce7;
}

#echo .header-center {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    margin: 0 8px;
}

#echo .header-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
    align-items: flex-start; /* 防止子元素拉伸 */
}

#echo .header-name {
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.3s;
}

#echo .header-name.typing-status {
    color: #6c5ce7;
    font-weight: 600;
    font-size: 14px;
    animation: typingPulse 1.5s ease-in-out infinite;
}

@keyframes typingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

#echo .header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

/* 顶部交互按钮 (按照macaron.style) */
.top-interaction-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 6px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(108, 92, 231, 0.1);
    transition: 0.2s;
    /* 强制限制尺寸，防止拉伸成长白条 */
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    flex-shrink: 0 !important;
}

.top-interaction-btn:active {
    transform: scale(0.95);
    background: var(--candy-pink);
}

.top-interaction-btn img {
    display: block;
    width: 18px;
    height: 18px;
}

.top-interaction-icon {
    color: #fd79a8;
    font-size: 16px;
}

.top-interaction-text {
    font-size: 13px;
    font-weight: 700;
    color: #2d3436;
}

#echo .more-btn {
    font-size: 24px;
    color: #6c5ce7;
    cursor: pointer;
}

/* 聊天区域 */
#echo .chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 !important; /* 移除所有padding，让Tab栏紧贴底部 */
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: opacity 0.2s ease; /* 添加平滑过渡效果 */
}

#echo .msg-row {
    display: flex;
    flex-direction: row; /* 显式指定为水平排列 */
    align-items: flex-start; /* 🔧 顶部对齐：头像在左上角/右上角 */
    gap: 8px;
    margin-bottom: 4px;
}

/* 防止头像挤压气泡 */
#echo .msg-row .chat-avatar,
#echo .msg-row img[class*="avatar"] {
    flex-shrink: 0 !important;
}

#echo .msg-row.user {
    justify-content: flex-end;
    flex-direction: row; /* 用户：气泡在左，头像在右 */
}

#echo .msg-row.ai {
    justify-content: flex-start;
    flex-direction: row; /* AI：头像在左，气泡在右 */
}

#echo .chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #fff;
    flex-shrink: 0;
}

/* 1. 基础气泡重置（宽度由 text-break-fix.css 统一控制）*/
#echo .speech-bubble,
#echo .msg-bubble {
    box-sizing: border-box;
}

/* msg-content 宽度由 text-break-fix.css 统一控制 */
#echo .msg-content {
    padding: 0 !important;
}

/* 2. 对方气泡 */
#echo .msg-row.other .speech-bubble {
    align-self: flex-start;
}

/* 3. 我的气泡 */
#echo .msg-row.me .msg-bubble {
    align-self: flex-end;
}

/* 气泡尺寸由 text-break-fix.css 统一控制 */
#echo .bubble {
    padding: 12px 18px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    white-space: pre-wrap;
    word-break: break-word;
    width: max-content;
    max-width: var(--bubble-max-width);
}

#echo .bubble.ai {
    background: rgba(255,255,255,0.85);
    color: #636e72;
    border-bottom-left-radius: 4px;
}

#echo .bubble.user {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* 2. 剧情卡片专属隔离样式（🌟 修复：补全了正确的类名前缀）*/
#echo .speech-bubble:has(.scenario-card),
#echo .msg-bubble:has(.scenario-card),
#echo .speech-bubble:has(.hb-bubble),
#echo .msg-bubble:has(.hb-bubble),
#echo .speech-bubble:has(.gold-card),
#echo .msg-bubble:has(.gold-card) {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: hidden !important;
    max-width: 100% !important;
}

/* 剧情卡片本身的核心样式：零内边距 + 溢出隐藏（🌟 新皮肤 .sk-card 自带 padding，排除掉避免被 !important 压平贴边）*/
.scenario-card:not(.sk-card) {
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 12px;
    box-sizing: border-box;
}

/* ========== 标签化消息样式 ========== */
#echo .msg-action {
    background: rgba(255, 243, 224, 0.9);
    color: #856404;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    margin: 4px 0;
    border-left: 3px solid #ffc107;
    max-width: 70%;
    font-style: italic;
}

#echo .msg-thought {
    background: rgba(232, 234, 246, 0.9);
    color: #4a5568;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    margin: 4px 0;
    border-left: 3px solid #6c5ce7;
    max-width: 70%;
    font-style: italic;
}

#echo .msg-speech {
    background: rgba(255, 255, 255, 0.85);
    color: #636e72;
    padding: 12px 18px;
    border-radius: 20px;
    border-bottom-left-radius: 4px;
    font-size: 15px;
    line-height: 1.5;
    margin: 4px 0;
    max-width: 70%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

/* 底部栏 */
#echo .bottom-bar {
    /* ❌ 旧版使用 absolute，新版改为 relative */
    position: relative;
    background: rgba(255,255,255,0.6);
    padding: 12px 12px 20px; /* 降低 padding */
    z-index: 100;
    border-top: 1px solid rgba(255,255,255,0.5);
    flex-shrink: 0; /* 防止被压缩 */
}

#echo .input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

/* NPC 切换键 */
#echo .npc-key {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: #fff;
    color: #6c5ce7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: 0.2s;
}

#echo .npc-key:active {
    transform: scale(0.9);
    background: var(--candy-blue);
    color: #fff;
}

#echo .input-box {
    flex: 1;
    height: 44px;
    background: #fff;
    border-radius: 14px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

#echo .input-box input {
    border: none;
    outline: none;
    flex: 1;
    font-family: inherit;
    font-size: 15px;
    background: transparent;
    color: #2d3436;
}

/* 加号按钮 */
#echo .plus-key {
    width: 36px;
    height: 36px;
    font-size: 28px;
    color: #b2bec3;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
}

#echo .plus-key.active {
    transform: rotate(45deg);
    color: #6c5ce7;
}

/* 发送按钮 */
#echo .send-key {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
    cursor: pointer;
    transition: 0.2s;
}

#echo .send-key:active {
    transform: scale(0.9);
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.4);
}

/* [已删除旧的 panel-drawer 和 macaron-grid 样式，使用新的 clean-drawer 架构] */

#echo .grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

#echo .grid-icon-box {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: 0.2s;
}

#echo .grid-item:active .grid-icon-box {
    transform: scale(0.9);
    filter: brightness(0.9);
}

#echo .grid-label {
    font-size: 11px;
    color: #636e72;
    font-weight: 600;
}

/* 颜色类 */
.bg-pink { background: #FFB7B2; }
.bg-mint { background: #B5EAD7; }
.bg-blue { background: #C7CEEA; }
.bg-purple { background: #a29bfe; }
.bg-yellow { background: #ffeaa7; }
.bg-red { background: #ff7675; }

/* 双击消息菜单的旧样式已移除（类名迁移到 .glm-bmenu 命名空间，
   样式见 apps-styles.css，由 echo.js 的 showMessageMenu/showNarratorMenu 使用）。
   popIn 关键帧保留：它是公用动画，watch-mode / pay-gift 等仍在引用。 */

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 侧边栏设置样式 */
.setting-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
}

.setting-section:last-child {
    border-bottom: none;
}

.setting-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(108, 92, 231, 0.2), transparent);
    margin: 24px 0;
}

.setting-section.danger-zone {
    border: 2px solid #e74c3c;
    border-radius: 12px;
    padding: 15px;
    background: rgba(231, 76, 60, 0.05);
    margin-top: 20px;
}

.setting-title {
    font-size: 15px;
    font-weight: 700;
    color: #6c5ce7;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-btn {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    border: 2px solid #f1f2f6;
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    color: #2d3436;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.setting-btn:hover {
    border-color: #6c5ce7;
    background: rgba(108, 92, 231, 0.05);
    transform: translateY(-1px);
}

.setting-btn-sm {
    padding: 6px 12px;
    border: 1px solid #dfe6e9;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    font-weight: 600;
    color: #636e72;
}

.setting-btn-sm:hover {
    border-color: #6c5ce7;
    color: #6c5ce7;
}

.danger-btn {
    border-color: #e74c3c !important;
    color: #e74c3c !important;
}

.danger-btn:hover {
    background: #e74c3c !important;
    color: #fff !important;
}

.setting-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #636e72;
    margin: 12px 0 6px;
}

/* ========== 📖 单选按钮组样式 ========== */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(108, 92, 231, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option:hover {
    background: rgba(108, 92, 231, 0.05);
    border-color: rgba(108, 92, 231, 0.4);
}

.radio-option.active {
    background: rgba(108, 92, 231, 0.1);
    border-color: #6c5ce7;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.2);
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-circle {
    width: 20px;
    height: 20px;
    border: 2px solid #b2bec3;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.radio-option.active .radio-circle {
    border-color: #6c5ce7;
    background: #6c5ce7;
}

.radio-option.active .radio-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.radio-text {
    flex: 1;
}

.radio-title {
    font-size: 14px;
    font-weight: 600;
    color: #2d3436;
    margin-bottom: 2px;
}

.radio-option.active .radio-title {
    color: #6c5ce7;
}

.radio-desc {
    font-size: 12px;
    color: #95a5a6;
    font-style: italic;
}

.setting-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #f1f2f6;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: 0.2s;
    box-sizing: border-box;
}

.setting-input:focus {
    border-color: #6c5ce7;
    background: rgba(108, 92, 231, 0.02);
}

.setting-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 2px solid #f1f2f6;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: 0.2s;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}

.setting-textarea:focus {
    border-color: #6c5ce7;
    background: rgba(108, 92, 231, 0.02);
}

.avatar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
}

.avatar-label {
    font-size: 13px;
    font-weight: 600;
    color: #636e72;
}

.avatar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mini-avatar-preview {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.setting-switch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
}

.setting-switch-row span {
    font-size: 14px;
    font-weight: 600;
    color: #2d3436;
}

.setting-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 10px;
    cursor: pointer;
}

.setting-switch input[type="checkbox"] {
    width: 40px;
    height: 20px;
    position: relative;
    appearance: none;
    background: #dfe6e9;
    border-radius: 10px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s;
}

.setting-switch input[type="checkbox"]:checked {
    background: #6c5ce7;
}

.setting-switch input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.setting-switch input[type="checkbox"]:checked::before {
    left: 22px;
}

.setting-switch span {
    font-size: 14px;
    font-weight: 600;
    color: #2d3436;
}

.setting-select {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    border: 2px solid #f1f2f6;
    background: #fff;
    border-radius: 10px;
    font-weight: 600;
    color: #2d3436;
    cursor: pointer;
    transition: all 0.2s;
}

.setting-select:hover {
    border-color: #6c5ce7;
}

.setting-select:focus {
    outline: none;
    border-color: #6c5ce7;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

/* 挂载系统展开样式 */
.mount-expandable {
    margin-bottom: 12px;
}

.mount-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: linear-gradient(135deg, rgba(162, 155, 254, 0.1), rgba(108, 92, 231, 0.1));
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.mount-header:hover {
    background: linear-gradient(135deg, rgba(162, 155, 254, 0.2), rgba(108, 92, 231, 0.2));
}

.mount-header span {
    font-size: 14px;
    font-weight: 600;
    color: #6c5ce7;
}

.mount-header i {
    font-size: 20px;
    color: #6c5ce7;
    transition: transform 0.3s;
}

.mount-content {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 0 0 10px 10px;
    margin-top: -10px;
    padding-top: 15px;
}

.mount-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 8px;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.mount-checkbox-item:hover {
    background: rgba(108, 92, 231, 0.05);
}

.mount-checkbox-item input[type="checkbox"],
.mount-checkbox-item input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.mount-checkbox-item span {
    font-size: 14px;
    color: #2d3436;
}

.mount-empty {
    text-align: center;
    padding: 20px;
    color: #b2bec3;
    font-size: 13px;
}

/* 头像源选择菜单 */
.avatar-source-menu {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.avatar-menu-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.avatar-menu-content {
    position: relative;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    width: 100%;
    max-width: 500px;
    animation: slideUp 0.3s;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.avatar-menu-title {
    font-size: 16px;
    font-weight: 700;
    color: #2d3436;
    margin-bottom: 16px;
    text-align: center;
}

.avatar-menu-btn {
    width: 100%;
    padding: 14px;
    margin-bottom: 10px;
    border: 2px solid #f1f2f6;
    background: #fff;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 15px;
    color: #2d3436;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.avatar-menu-btn:active {
    transform: scale(0.98);
    background: rgba(108, 92, 231, 0.05);
    border-color: #6c5ce7;
}

.avatar-menu-btn i {
    font-size: 20px;
    color: #6c5ce7;
}

.avatar-menu-btn.cancel {
    border-color: #dfe6e9;
    color: #636e72;
    margin-top: 8px;
}

.avatar-menu-btn.cancel:active {
    background: #f8f9fa;
    border-color: #dfe6e9;
}

/* ========== 小剧场卡片系统 ========== */
.card-container {
    display: flex;
    justify-content: center;
    margin: 15px 0;
}

/* 小票卡片 */
.card-receipt {
    width: 100%;
    max-width: 300px;
}

.receipt-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-family: 'Courier New', monospace;
    position: relative;
}

.receipt-card::before,
.receipt-card::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(
        45deg,
        transparent 33.33%,
        #fff 33.33%,
        #fff 66.66%,
        transparent 66.66%
    ),
    linear-gradient(
        -45deg,
        transparent 33.33%,
        #fff 33.33%,
        #fff 66.66%,
        transparent 66.66%
    );
    background-size: 8px 16px;
    background-position: 0 -4px, 4px -4px;
}

.receipt-card::before {
    top: -4px;
}

.receipt-card::after {
    bottom: -4px;
}

.receipt-header {
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: #000;
    margin-bottom: 10px;
}

.receipt-title {
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    margin: 10px 0;
}

.receipt-item {
    font-size: 13px;
    margin: 8px 0;
    color: #333;
}

.receipt-price {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    margin: 15px 0;
    color: #000;
}

.receipt-footer {
    text-align: center;
    font-size: 16px;
    color: #000;
    margin: 10px 0;
}

.receipt-time {
    text-align: center;
    font-size: 11px;
    color: #999;
    margin-top: 10px;
}

/* 评论卡片 */
.card-comment {
    width: 100%;
    max-width: 350px;
}

.comment-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 12px;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
}

.comment-user {
    font-size: 14px;
    font-weight: 700;
    color: #2d3436;
    margin-bottom: 6px;
}

.comment-text {
    font-size: 14px;
    color: #636e72;
    line-height: 1.5;
    margin-bottom: 8px;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #b2bec3;
}

.comment-actions i {
    cursor: pointer;
    transition: color 0.2s;
}

.comment-actions i:hover {
    color: #ff7675;
}

/* 酒店预订卡片 */
.card-hotel {
    width: 100%;
    max-width: 350px;
}

.hotel-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    color: #fff;
    display: flex;
    gap: 15px;
    align-items: center;
}

.hotel-icon {
    font-size: 48px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.hotel-info {
    flex: 1;
}

.hotel-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}

.hotel-details {
    font-size: 13px;
    opacity: 0.9;
    line-height: 1.5;
}

/* NPC 头像 */
/* NPC 头像样式 (按照macaron.style) */
#echo .npc-avatar-box {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 2px;
    border: 2px dashed #ccc;
    transition: 0.3s;
    overflow: hidden;
}

#echo .npc-avatar-box.active {
    border-color: #0d47a1;
    border-style: solid;
    box-shadow: 0 0 12px rgba(13, 71, 161, 0.3);
}

#echo .npc-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* 用户头像框 (按照macaron.style) */
#echo .user-avatar-box {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    cursor: pointer;
    overflow: hidden;
}

#echo .user-avatar-box.active {
    border: 3px solid #0d47a1;
    border-style: solid;
    box-shadow: 0 0 12px rgba(13, 71, 161, 0.4);
    transform: scale(1.05);
}

#echo .user-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* ========== 马卡龙风格弹窗 ========== */
.macaron-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.macaron-alert.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.macaron-alert-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-radius: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.macaron-alert-emoji {
    font-size: 24px;
    line-height: 1;
}

.macaron-alert-text {
    font-size: 15px;
    font-weight: 600;
    color: #2d3436;
    font-family: 'Inter', sans-serif;
}


/* ============================================ */
/* ǿ��ҳ�������߼� - �������г�ͻ���� */
/* ============================================ */

/* 1. Ĭ����������ҳ�� */
/* ========== 页面容器（修复全屏覆盖） ========== */
.page {
    display: none !important;
    position: absolute !important;
    top: 0; /* 🎨 从顶部开始，完全覆盖 */
    left: 0;
    width: 100%;
    height: 100%; /* 🎨 完整高度，无需减去状态栏 */
    background-color: #f2f2f7 !important; /* 纯色背景，盖住底层壁纸 */
    z-index: 10;
    overflow: hidden !important;
}

/* 2. 只有带 active 的才显示 */
.page.active {
    display: flex !important;
    flex-direction: column !important;
    z-index: 100 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* 焕彩应用使用白色主题背景 */
#screen-settings {
    background: #f7f5f2 !important;
}

/* 4. �༭ҳ��ǿ��ȫ������ */
.full-screen-edit-page {
    display: none !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: #f5f5f7 !important;
    z-index: 200 !important;
}

.full-screen-edit-page.active {
    display: flex !important;
    flex-direction: column !important;
}

/* 5. ��ֹ��ҳ�������ʾ */
.phone-frame > .screen-content > .page:not(.active) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ========== Echo Tab 栏修复 - 移除多余空白 ========== */
/* 强制主容器无padding，让Tab栏紧贴底部 */
#echo {
    padding: 0 !important;
}

#echo .chat-area {
    padding: 0 !important;
}

.echo-tabs {
    margin: 0 !important;
}

/* ========== 聊天列表新样式 (来自 AI-Social-App) ========== */

/* 头像区域 */
.avatar-box {
    width: 50px;
    height: 50px;
    position: relative;
    flex-shrink: 0;
}

/* 单人头像 */
.single-avatar {
    width: 100%;
    height: 100%;
    border-radius: 18px;
    object-fit: cover;
}

/* 群聊堆叠头像 */
.group-stack {
    position: relative;
    width: 100%;
    height: 100%;
}

.stack-img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid #fff;
    position: absolute;
    object-fit: cover;
}

.stack-img.s-1 {
    bottom: 0;
    left: 0;
    z-index: 2;
}

.stack-img.s-2 {
    top: 0;
    right: 0;
    z-index: 1;
    opacity: 0.8;
}

/* 文字内容 */
.chat-info {
    flex: 1;
    overflow: hidden;
}

.chat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-main, #2d3436);
}

.chat-time {
    font-size: 11px;
    color: var(--text-sub, #b2bec3);
    font-weight: 600;
}

.chat-msg {
    font-size: 13px;
    color: #636e72;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sender-highlight {
    color: var(--accent, #6c5ce7);
    font-weight: 600;
    margin-right: 4px;
}

/* 未读红点 */
.badge {
    background: var(--pink, #fd79a8);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(253, 121, 168, 0.3);
}

/* ========== 朋友圈样式 (来自 AI-Social-App) ========== */
/* 动态卡片 */
.feed-card {
    background: #fff;
    margin: 0 20px 25px;
    padding: 20px;
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.feed-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.feed-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    object-fit: cover;
}

.feed-meta {
    flex: 1;
}

.feed-meta h4 {
    margin: 0;
    font-size: 15px;
    color: var(--text-main, #2d3436);
}

.feed-meta span {
    font-size: 11px;
    color: var(--text-sub, #b2bec3);
}

.feed-text {
    font-size: 14px;
    line-height: 1.6;
    color: #2d3436;
    margin-bottom: 12px;
}

.feed-imgs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.feed-imgs img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

.feed-imgs img:hover {
    transform: scale(1.05);
}

/* 底部按钮栏 */
.feed-actions {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid #f5f6fa;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #636e72;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}

.action-btn i {
    font-size: 18px;
}

.action-btn.active {
    color: var(--pink, #fd79a8);
}

.action-btn:hover {
    color: var(--accent, #6c5ce7);
}

.comment-item {
    font-size: 13px;
    margin-bottom: 8px;
    line-height: 1.4;
}

.c-name {
    color: var(--accent, #6c5ce7);
    font-weight: 700;
    margin-right: 4px;
}

.c-text {
    color: #636e72;
}

.c-input {
    flex: 1;
    border: none;
    background: #fff;
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
}

.c-send {
    background: var(--accent, #6c5ce7);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 0 15px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.c-send:hover {
    background: var(--text-light, #a29bfe);
}

.c-send:active {
    transform: scale(0.95);
}

/* ========== AI������ť�������� ========== */
@keyframes shake {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(10deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-10deg); }
    100% { transform: rotate(0deg); }
}

.interact-key {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffd6e8 0%, #e6d9ff 100%);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s var(--spring-easing);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.interact-key:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.interact-key:active {
    transform: scale(0.95);
}

.interact-key.shaking {
    animation: shake 0.5s infinite;
}

/* ========== Ⱥ�Ĳ������ʽ ========== */
.group-members-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-height: 200px;
    overflow-y: auto;
    padding: 12px;
    background: rgba(108, 92, 231, 0.05);
    border-radius: 12px;
}

.member-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    background: #fff;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.member-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.member-card.selected {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: #fff;
}

.member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
}

.member-card.selected .member-avatar {
    border-color: #fff;
}

.member-name {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    word-break: break-word;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    box-orient: vertical;
}

/* ========== 🎨 焕彩应用强制修复 ========== */

/* 1. App 全屏覆盖（修复状态栏断层） */
.page {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 10 !important;
    background-color: #f2f2f7 !important; /* 盖住底层壁纸 */
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.page:not(.active) {
    display: none !important;
}

/* 主屏幕在最底层 */

/* 焕彩应用使用白色主题背景 */
#screen-settings {
    background: #f7f5f2 !important;
}

/* 2. 主屏时间透明且穿透点击 */
.taro-status-header {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 414px !important;
    margin: 0 auto !important;
    background: transparent !important;
    border: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
    outline: none !important;
    z-index: 1000 !important;
    pointer-events: none !important; /* 穿透点击 */
    /* 修复：添加flex布局确保时间在右、问候语在左 */
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-top: calc(env(safe-area-inset-top, 0px) + 25px) !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
}

/* 确保问候语在左边 */
div#taro-greeting,
#taro-greeting {
    order: 1 !important;
    flex-shrink: 0 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    letter-spacing: 1.5px !important;
    color: #5A5555 !important;
    opacity: 0.65 !important;
    font-family: sans-serif !important;
    pointer-events: none !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
}

/* 确保时间在右边 */
div#taro-clock,
#taro-clock {
    order: 3 !important;
    flex-shrink: 0 !important;
    font-weight: 900 !important;
    font-size: 24px !important;
    letter-spacing: 1px !important;
    display: flex !important;
    align-items: center !important;
    height: 44px !important;
}

.taro-status-header > * {
    pointer-events: auto !important; /* 恢复子元素点击 */
}

/* 3. 主屏时间文字颜色 */
.taro-status-header.text-dark {
    color: #333 !important;
}

.taro-status-header.text-light {
    color: var(--text-dark-taro, #6d6466) !important;
}

/* ========================================================================== */
/* 夜间模式全局样式 - 最高优先级 */
/* [Dark mode rules moved to dark-mode.css] */

/* =========================================
   🔧 UniversalUploader - 通用上传器样式
   液态玻璃拟态设计
   ========================================= */

/* 遮罩层 - 在手机屏幕内显示（Tinted Paper Editorial）*/
.uploader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(40, 38, 36, 0.38);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 30px;
    animation: uploaderFadeIn 0.3s ease;
}

.uploader-overlay.uploader-show {
    display: flex;
}

@keyframes uploaderFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 弹窗主体 - 象牙白底 */
.uploader-modal {
    width: 100%;
    max-width: 340px;
    max-height: 85%;
    background: #FCFAF8;
    border: 1px solid transparent;
    border-radius: 48px;
    box-shadow:
        0 30px 60px -10px rgba(44, 42, 40, 0.18),
        0 10px 24px -8px rgba(44, 42, 40, 0.08);
    overflow: hidden;
    position: relative;
    animation: uploaderSlideIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes uploaderSlideIn {
    from {
        transform: scale(0.96) translateY(8px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* 内容容器 */
.uploader-content {
    max-height: 90vh;
    overflow-y: auto;
}

/* 滚动条样式 */
.uploader-content::-webkit-scrollbar {
    width: 4px;
}

.uploader-content::-webkit-scrollbar-track {
    background: transparent;
}

.uploader-content::-webkit-scrollbar-thumb {
    background: rgba(44, 42, 40, 0.15);
    border-radius: 2px;
}

.uploader-content::-webkit-scrollbar-thumb:hover {
    background: rgba(44, 42, 40, 0.25);
}

/* 头部 - 象牙白主底 + 燕麦色细线分隔 */
.uploader-header {
    padding: 36px 28px 24px;
    text-align: center;
    position: relative;
    background: transparent;
    border-bottom: 1px solid #E5E0D6;
}

.uploader-icon {
    font-size: 40px;
    margin-bottom: 12px;
    color: #2C2A28 !important;
    opacity: 0.85;
    animation: none;
}

@keyframes uploaderIconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.uploader-title {
    font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
    font-size: 30px;
    font-style: italic;
    font-weight: 600;
    color: #2C2A28;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.uploader-subtitle {
    font-family: 'Noto Serif SC', 'PingFang SC', '苹方', serif;
    font-size: 13px;
    color: #8A8782;
    letter-spacing: 0.05em;
    margin-top: 6px;
}

.uploader-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #EBE7E0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    font-size: 18px;
    color: #2C2A28;
}

.uploader-close:hover {
    background: #E5E0D6;
    transform: rotate(90deg);
}

/* 主体内容 */
.uploader-body {
    padding: 24px 28px 12px;
}

/* 区域标题 */
.uploader-section {
    margin-bottom: 20px;
}

.uploader-section-title {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #8A8782;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.uploader-section-title i {
    font-size: 14px;
}

/* 输入框组 */
.uploader-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.uploader-input {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid transparent;
    border-radius: 100px;
    background: #EBE7E0;
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 14px;
    color: #2C2A28;
    outline: none;
    transition: 0.25s;
}

.uploader-input:focus {
    border-color: #2C2A28;
    background: #FCFAF8;
    box-shadow: 0 0 0 3px rgba(44, 42, 40, 0.04);
}

.uploader-input::placeholder {
    color: #8A8782;
    font-style: italic;
}

/* 按钮 */
.uploader-btn {
    padding: 14px 22px;
    border: none;
    border-radius: 100px;
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.25s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.uploader-btn-primary {
    background: #2C2A28;
    color: #FCFAF8;
    box-shadow: none;
    justify-content: center;
    width: 100%;
}

.uploader-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    background: #2C2A28;
}

.uploader-btn-primary:active {
    transform: scale(0.97);
}

.uploader-btn-secondary {
    background: #EBE7E0;
    color: #2C2A28;
    border: none;
    justify-content: center;
}

.uploader-btn-secondary:hover {
    background: #E5E0D6;
}

/* 分隔线 */
.uploader-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: #8A8782;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 13px;
}

.uploader-divider::before,
.uploader-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #E5E0D6;
}

.uploader-divider span {
    padding: 0 15px;
}

/* 拖拽区域 */
.uploader-drop-zone {
    border: 1.5px dashed #C9C2B5;
    border-radius: 24px;
    padding: 36px 20px;
    text-align: center;
    background: rgba(235, 231, 224, 0.4);
    transition: 0.3s;
    cursor: pointer;
}

.uploader-drop-zone:hover {
    border-color: #2C2A28;
    background: rgba(235, 231, 224, 0.7);
}

.uploader-drop-zone.uploader-drag-over {
    border-color: #2C2A28;
    background: #EBE7E0;
    transform: scale(1.02);
}

.uploader-drop-zone > i {
    font-size: 36px;
    color: #8A8782;
    margin-bottom: 12px;
    display: block;
}

.uploader-drop-text {
    font-family: 'Noto Serif SC', serif;
    font-size: 14px;
    color: #2C2A28;
    margin-bottom: 4px;
}

.uploader-drop-hint {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 13px;
    color: #8A8782;
    margin-bottom: 16px;
}

/* 底部 */
.uploader-footer {
    padding: 12px 28px 24px;
    background: transparent;
}

.uploader-tip {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Noto Serif SC', serif;
    font-size: 12px;
    color: #8A8782;
    line-height: 1.6;
}

.uploader-tip i {
    font-size: 14px;
    color: #2C2A28;
    opacity: 0.5;
}

/* 加载状态 */
.uploader-loading {
    text-align: center;
    padding: 56px 20px;
}

.uploader-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 18px;
    border: 3px solid #EBE7E0;
    border-top-color: #2C2A28;
    border-radius: 50%;
    animation: uploaderSpin 1s linear infinite;
}

@keyframes uploaderSpin {
    to { transform: rotate(360deg); }
}

.uploader-loading-text {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 16px;
    color: #2C2A28;
}

/* 错误提示（水洗玫瑰底） */
.uploader-error {
    padding: 14px 18px;
    background: #FDF5F4;
    border: 1px solid transparent;
    border-radius: 16px;
    color: #9B4A46;
    font-family: 'Noto Serif SC', serif;
    font-size: 13px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: uploaderShake 0.5s ease;
}

@keyframes uploaderShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.uploader-error i {
    font-size: 18px;
}

/* ============ 夜间模式：深色艺术展风 ============ */
body.dark-mode .uploader-overlay,
body.night .uploader-overlay {
    background: rgba(0, 0, 0, 0.55);
}

body.dark-mode .uploader-modal,
body.night .uploader-modal {
    background: #262524;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow:
        0 30px 60px -10px rgba(0, 0, 0, 0.6),
        0 10px 24px -8px rgba(0, 0, 0, 0.4);
}

body.dark-mode .uploader-header,
body.night .uploader-header {
    background: transparent;
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .uploader-icon,
body.night .uploader-icon {
    color: #F0EBE1 !important;
}

body.dark-mode .uploader-title,
body.night .uploader-title {
    color: #F0EBE1;
}

body.dark-mode .uploader-subtitle,
body.night .uploader-subtitle {
    color: #A39E98;
}

body.dark-mode .uploader-close,
body.night .uploader-close {
    background: #33312E;
    color: #F0EBE1;
}

body.dark-mode .uploader-close:hover,
body.night .uploader-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .uploader-section-title,
body.night .uploader-section-title {
    color: #A39E98;
}

body.dark-mode .uploader-input,
body.night .uploader-input {
    background: #33312E;
    border-color: transparent;
    color: #F0EBE1;
}

body.dark-mode .uploader-input:focus,
body.night .uploader-input:focus {
    background: #262524;
    border-color: #F0EBE1;
    box-shadow: 0 0 0 3px rgba(240, 235, 225, 0.04);
}

body.dark-mode .uploader-input::placeholder,
body.night .uploader-input::placeholder {
    color: #A39E98;
}

body.dark-mode .uploader-btn-primary,
body.night .uploader-btn-primary {
    background: #F0EBE1;
    color: #262524;
}

body.dark-mode .uploader-btn-primary:hover,
body.night .uploader-btn-primary:hover {
    background: #FFFFFF;
}

body.dark-mode .uploader-btn-secondary,
body.night .uploader-btn-secondary {
    background: #33312E;
    color: #F0EBE1;
}

body.dark-mode .uploader-btn-secondary:hover,
body.night .uploader-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .uploader-divider,
body.night .uploader-divider {
    color: #A39E98;
}

body.dark-mode .uploader-divider::before,
body.dark-mode .uploader-divider::after,
body.night .uploader-divider::before,
body.night .uploader-divider::after {
    background: rgba(255, 255, 255, 0.06);
}

body.dark-mode .uploader-drop-zone,
body.night .uploader-drop-zone {
    background: rgba(51, 49, 46, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark-mode .uploader-drop-zone:hover,
body.night .uploader-drop-zone:hover {
    background: rgba(51, 49, 46, 0.7);
    border-color: #F0EBE1;
}

body.dark-mode .uploader-drop-zone.uploader-drag-over,
body.night .uploader-drop-zone.uploader-drag-over {
    background: #33312E;
    border-color: #F0EBE1;
}

body.dark-mode .uploader-drop-zone > i,
body.night .uploader-drop-zone > i {
    color: #A39E98;
}

body.dark-mode .uploader-drop-text,
body.night .uploader-drop-text {
    color: #F0EBE1;
}

body.dark-mode .uploader-drop-hint,
body.night .uploader-drop-hint {
    color: #A39E98;
}

body.dark-mode .uploader-footer,
body.night .uploader-footer {
    background: transparent;
}

body.dark-mode .uploader-tip,
body.night .uploader-tip {
    color: #A39E98;
}

body.dark-mode .uploader-tip i,
body.night .uploader-tip i {
    color: #F0EBE1;
}

body.dark-mode .uploader-spinner,
body.night .uploader-spinner {
    border-color: #33312E;
    border-top-color: #F0EBE1;
}

body.dark-mode .uploader-loading-text,
body.night .uploader-loading-text {
    color: #F0EBE1;
}

body.dark-mode .uploader-error,
body.night .uploader-error {
    background: #3A2A29;
    color: #E68A88;
}

/* ========== 星汇弹窗位置修正 ========== */
/* 确保所有弹窗在手机内部 */
#starhub .modal-mask {
    position: absolute !important; /* 相对于#starhub定位 */
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: auto !important; /* 确保可点击 */
}

#starhub .modal-mask.active {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ========== 星汇横向滚动优化 ========== */
/* 隐藏横向滚动条但保持可滚动 */
#starhub-chips-container::-webkit-scrollbar {
    height: 0px !important;
    display: none !important;
}

#starhub-chips-container {
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    scroll-snap-type: x proximity;
}

/* 确保chip不会被压缩 */
#starhub-chips-container .chip {
    flex-shrink: 0 !important;
    min-width: fit-content !important;
    padding: 8px 16px !important;
}

/* 内容纵向滚动优化 */
.scroll-content,
#starhub-content-area {
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
    overflow-y: scroll !important;
}

#starhub-content-area::-webkit-scrollbar,
.scroll-content::-webkit-scrollbar {
    width: 0px !important;
    display: none !important;
}

/* 确保标签容器可以完整滚动 */
#starhub-chips-container {
    scroll-padding-right: 20px !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: scroll !important;
}

/* 强制标签栏可滑动 */
#starhub .cat-scroll,
#starhub [style*="overflow-x"] {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* 确保chip不会被压缩 */
#starhub .chip {
    flex-shrink: 0 !important;
}

/* Chip样式优化 */
.chip {
    transition: all 0.3s ease !important;
}

.chip:active {
    transform: scale(0.95) !important;
}

/* 身份选择器hover效果 */
.identity-option:hover {
    background: rgba(255,255,255,0.2) !important;
    transform: translateX(3px);
}

.identity-option input:checked + div {
    opacity: 1;
}

/* 确认按钮hover效果 */
#confirm-identity-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* ========== 通知中心样式 ========== */
/* 通知项hover效果 - 亮白风格 */
.notif-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3) !important;
    background: rgba(255, 255, 255, 1) !important;
}

/* 毛玻璃输入框样式 */
.glass-input {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: white !important;
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    outline: none;
}

.glass-input::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

.glass-input option {
    background: #667eea;
    color: white;
}

/* 通知列表滚动条优化 */
#notif-list-starhub::-webkit-scrollbar {
    width: 4px;
}

#notif-list-starhub::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

#notif-list-starhub::-webkit-scrollbar-thumb {
    background: rgba(161, 140, 209, 0.3);
    border-radius: 2px;
}

#notif-list-starhub::-webkit-scrollbar-thumb:hover {
    background: rgba(161, 140, 209, 0.5);
}

/* 红点脉动动画 */
#notif-badge {
    animation: notif-pulse 2s infinite;
}

@keyframes notif-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Toast提示动画 */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

/* ========== 星汇登录页样式修正 ========== */
/* 确保登录页铺满手机屏幕但不溢出 */
#view-login-starhub {
    position: absolute !important; /* 限制在父容器(.page)内 */
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(45deg, #ff9a9e, #fad0c4, #fad0c4, #a18cd1, #fbc2eb) !important;
    background-size: 400% 400% !important;
    animation: gradientBG 15s ease infinite !important;
    z-index: 100 !important;
    /* 移除 display: flex !important; 让 JS 可以控制显示/隐藏 */
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 40px 20px !important;
    overflow-y: auto !important; /* 允许垂直滚动防止内容溢出 */
}

/* 星汇登录页 夜间模式 */
body.dark-mode #view-login-starhub {
    background: #1A1A1A !important;
    background-image: none !important;
    animation: none !important;
}

/* 渐变动画 */
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ========================================
   🌟 强制修复所有弹窗的毛玻璃质感
   ======================================== */

/* 所有模态框容器 */
.modal,
.modal-mask,
.sidebar-mask,
.avatar-menu-overlay,
.avatar-source-menu .avatar-menu-overlay,
.all-characters-modal-overlay,
.group-chat-selector-overlay,
.list-menu-overlay {
}

/* 🍎 iOS 灵动岛补偿 - 全屏覆盖层顶部安全区 */
/* 注意：只给真正全屏且内容从顶部开始的界面加补偿，底部弹出的半屏面板不需要 */
.all-characters-modal-overlay,
.group-chat-selector-overlay,
.list-menu-overlay {
    padding-top: max(20px, env(safe-area-inset-top)) !important;
}

/* ========================================
   🎨 统一头像选择器样式
   ======================================== */

.avatar-setter-group {
    position: relative;
}

.avatar-setter-group .avatar-preview {
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.avatar-setter-group .avatar-preview:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15) !important;
}

.avatar-setter-group .avatar-actions {
    display: flex;
    gap: 10px;
}

.avatar-setter-group .btn-icon {
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.avatar-setter-group .btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    background: #fff !important;
}

.avatar-setter-group .btn-icon:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1) !important;
}

.avatar-setter-group .btn-icon i {
    transition: transform 0.2s ease;
}

.avatar-setter-group .btn-icon:hover i {
    transform: scale(1.1);
}

/* 摇骰子特效 */
@keyframes dice-roll {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    75% { transform: rotate(15deg); }
}

.avatar-setter-group .btn-icon:hover .ri-dice-line {
    animation: dice-roll 0.5s ease-in-out;
}

/* 其他星汇视图容器样式（背景由 css/apps/starhub-new.css 统一管理，不再强制渐变） */
#view-home-starhub,
#view-detail-starhub,
#view-editor-starhub {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: transparent !important;
    z-index: 50 !important; /* 确保在登录页下方 */
}

/* ========================================================================
   🚨 强制红包系统沙盒约束（紧急修复补丁）
   ======================================================================== */

/* 强制手机壳作为绝对定位参照系（已在 .phone-frame 中设置） */
/* .phone-container 必须保持 position:fixed，不可改为 relative，否则 iOS 白边回来 */
/* 红包弹窗请用 .phone-frame 作为参照系，不要依赖 .phone-container */

/* 强制所有红包相关的弹窗、遮罩、详情页被锁死在手机壳内 */
.modal-overlay, 
#modal-rp-open,
#modal-send-rp,
#rp-details-view,
.red-packet-detail-modal, 
.red-packet-modal,
[class*="modal-mask"],
.player-modal,
.reader-overlay {
    position: absolute !important; /* 严禁使用 fixed */
    top: 0 !important; 
    left: 0 !important; 
    right: 0 !important; 
    bottom: 0 !important;
    width: 100% !important; 
    height: 100% !important;
    margin: 0 !important;
    z-index: 9999;
}

/* 定位面板单独处理，确保未打开时不阻挡点击且不可见 */
.loc-panel {
    position: absolute !important;
    top: 0 !important; 
    left: 0 !important; 
    right: 0 !important; 
    bottom: 0 !important;
    width: 100% !important; 
    height: 100% !important;
    margin: 0 !important;
    z-index: 9999;
    pointer-events: none !important;
    display: none !important; /* 🔧 默认隐藏 */
    flex-direction: column;
}

.loc-panel.open {
    display: flex !important; /* 🔧 打开时显示 */
    pointer-events: auto !important;
}

/* 确保 iphone-frame 也被约束（如果项目使用） */
.iphone-frame {
    position: relative !important;
    overflow: hidden !important;
}

/* 强制所有全屏遮罩层使用 absolute */
[class*="overlay"]:not(.avatar-menu-overlay):not(.all-characters-modal-overlay) {
    position: absolute !important;
}

/* ========== 全局 Toast 样式（设计稿同款 · 黑底白字胶囊）========== */
.glass-toast {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 50px);
    left: 50%;
    transform: translate(-50%, -12px) scale(0.96);
    opacity: 0;
    background: #000000 !important;
    color: #FFFFFF !important;
    border: none !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18) !important;
    border-radius: 100px !important;
    padding: 13px 26px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: max-content !important;
    max-width: 80vw !important;
    z-index: 9999 !important;
    font-family: 'Inter', -apple-system, sans-serif !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: 1.2px !important;
    text-transform: uppercase !important;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.glass-toast.show {
    transform: translate(-50%, 0) scale(1) !important;
    opacity: 1 !important;
}

.glass-toast i {
    font-size: 16px !important;
    flex-shrink: 0 !important;
    color: #FFFFFF !important;
}

.glass-toast .toast-text {
    color: #FFFFFF !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: 1.2px !important;
    line-height: 1.4 !important;
    word-break: break-word !important;
    text-transform: uppercase !important;
}

/* 类型仅染图标，胶囊保持纯黑 */
.glass-toast.success i { color: #4ade80 !important; }
.glass-toast.error i   { color: #ef5350 !important; }
.glass-toast.warning i { color: #fbbf24 !important; }
.glass-toast.info i    { color: #64b5f6 !important; }

/* 隐藏状态 */
.glass-toast.toast-hiding {
    transform: translate(-50%, -12px) scale(0.96) !important;
    opacity: 0 !important;
}

/* 夜间模式：反转为白底黑字 */
body.dark-mode .glass-toast,
body.night .glass-toast,
body[data-theme="dark"] .glass-toast {
    background: #FFFFFF !important;
    color: #000000 !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.45) !important;
}
body.dark-mode .glass-toast i,
body.night .glass-toast i,
body[data-theme="dark"] .glass-toast i,
body.dark-mode .glass-toast .toast-text,
body.night .glass-toast .toast-text,
body[data-theme="dark"] .glass-toast .toast-text {
    color: #000000 !important;
}
body.dark-mode .glass-toast.success i,
body.night .glass-toast.success i { color: #16a34a !important; }
body.dark-mode .glass-toast.error i,
body.night .glass-toast.error i { color: #d32f2f !important; }
body.dark-mode .glass-toast.warning i,
body.night .glass-toast.warning i { color: #d97706 !important; }
body.dark-mode .glass-toast.info i,
body.night .glass-toast.info i { color: #1976d2 !important; }

/* ==========================================
   手机端外壳切换 - 双状态控制
   ========================================== */
@media screen and (max-width: 768px) {
    /* 基础：防止页面滚动 */
    body {
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }
    
    /* 过渡动画 */
    .phone-frame {
        transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
    }

    /* =========================================
       状态 A：带壳模式（默认，body 没有 .is-fullscreen）
       完整显示手机外壳，等比缩小居中
       ========================================= */
    body:not(.is-fullscreen) .phone-container {
        width: 100% !important;
        /* 不设 height，靠 position:fixed; inset:0 撑满，避免 iOS 47px 白边 */
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }
    
    body:not(.is-fullscreen) .phone-frame {
        width: 375px !important;
        height: 812px !important;
        border-radius: 55px !important;
        border: 6px solid #fff !important;
        box-shadow: 0 0 0 12px rgba(255,255,255,0.3), 0 30px 60px rgba(0,0,0,0.3) !important;
        position: relative !important;
        transform: scale(calc(min(85vw / 390, 85vh / 860))) !important; /* iOS fallback */
        transform: scale(calc(min(85vw / 390, 85dvh / 860))) !important;
        transform-origin: center center !important;
        overflow: hidden !important;
    }

    /* =========================================
       状态 B：沉浸全屏模式（body.is-fullscreen）
       扒掉所有外壳，铺满真机屏幕（iOS PWA 完美适配）
       ========================================= */
    body.is-fullscreen .phone-container {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        /* 不设 height，靠 position:fixed; inset:0 撑满 */
    }
    
    body.is-fullscreen .phone-frame {
        width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important; /* 这一行是唯一的神，100dvh 天然贴合底部边缘 */
        border-radius: 0 !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        transform: none !important;
    }
    
    body.is-fullscreen #phone-screen {
        width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 全屏模式安全距离（防刘海遮挡） */
    body.is-fullscreen .status-header {
        padding-top: max(20px, env(safe-area-inset-top)) !important;
    }
    body.is-fullscreen .dock-container {
        padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
    }
}

/* ========================================
   🖥️ 桌面端高度修复（防止底栏下沉出手机壳）
   ======================================== */
/* 
   问题：页面设了 min-height: 100vh，但桌面端 100vh > .phone-frame 内部高度
   导致 absolute 定位的底栏下沉到手机壳外
   解决：当页面在 .phone-frame 内时，强制高度 = 100%（跟随父容器）
*/
/* 桌面端：页面在 phone-frame 内时，高度跟随父容器不超出手机壳 */
.phone-frame .taro-home,
.phone-frame #echo,
.phone-frame #contact,
.phone-frame .persons-page,
.phone-frame .beings-page,
.phone-frame .whisper-root,
.phone-frame #worldbook,
.phone-frame #treasure {
    min-height: unset !important;
    height: 100% !important;
    overflow: hidden;
}

/* ========== vConsole 美化样式 ========== */
/* 🔧 确保 VConsole 可交互和拖拽 */
#__vconsole {
    pointer-events: auto !important;
    z-index: 999999 !important;
}
#__vconsole * {
    pointer-events: auto !important;
}

/* 🔧 vConsole 遮罩层（点击关闭面板） */
#__vconsole .vc-mask {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 999998 !important;
}

/* 悬浮按钮 - 磨砂玻璃风格，与 Glimmer OS 界面协调 */
#__vconsole .vc-switch {
    background: rgba(255, 255, 255, 0.25) !important;
    color: #fff !important;
    border-radius: 24px !important;
    right: 16px !important;
    bottom: 120px !important;
    font-size: 11px !important;
    padding: 10px 18px !important;
    width: auto !important;
    height: auto !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-weight: 500 !important;
    letter-spacing: 0.5px !important;
    transition: all 0.3s ease !important;
    cursor: move !important;
    touch-action: none !important;
}

#__vconsole .vc-switch:active {
    transform: scale(0.95) !important;
    background: rgba(255, 255, 255, 0.35) !important;
}

/* vConsole 面板美化 - 占据屏幕70%高度 */
#__vconsole .vc-panel {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-height: 70vh !important;
    height: 70vh !important;
    background: rgba(245, 245, 245, 0.98) !important;
    border-radius: 16px 16px 0 0 !important;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.3) !important;
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* vConsole 标签栏 */
#__vconsole .vc-tabbar {
    flex-shrink: 0 !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    padding: 8px 0 !important;
}

#__vconsole .vc-tab {
    color: #666 !important;
    padding: 8px 16px !important;
}

#__vconsole .vc-tab.vc-actived {
    color: #007aff !important;
    border-bottom-color: #007aff !important;
}

/* vConsole 内容区域 - 可滚动 */
#__vconsole .vc-content {
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    background: rgba(255, 255, 255, 0.95) !important;
    color: #333 !important;
    padding: 8px !important;
}

/* vConsole 日志列表 */
#__vconsole .vc-logbox {
    height: 100% !important;
    overflow-y: auto !important;
}

/* vConsole 日志文字 */
#__vconsole .vc-item {
    color: #333 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    padding: 8px 12px !important;
    word-break: break-word !important;
}

#__vconsole .vc-item-log {
    color: #333 !important;
}

#__vconsole .vc-item-info {
    color: #007aff !important;
}

#__vconsole .vc-item-warn {
    color: #ff9500 !important;
    background: rgba(255, 149, 0, 0.05) !important;
}

#__vconsole .vc-item-error {
    color: #ff3b30 !important;
    background: rgba(255, 59, 48, 0.05) !important;
}

/* vConsole 输入框 */
#__vconsole .vc-cmd {
    flex-shrink: 0 !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
}

#__vconsole .vc-cmd-input {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #333 !important;
    padding: 12px !important;
    font-size: 14px !important;
}

/* vConsole 工具栏按钮 */
#__vconsole .vc-toolbar {
    flex-shrink: 0 !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    padding: 8px !important;
}

#__vconsole .vc-toolbox-item {
    color: #007aff !important;
    padding: 6px 12px !important;
    margin: 0 4px !important;
}

/* 🔧 iOS PWA 适配：确保面板不被底部安全区截断 */
@supports (-webkit-touch-callout: none) {
    #__vconsole .vc-panel {
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
        max-height: calc(70vh - env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* ===== vConsole 样式修复（大面板 + 高可读性） ===== */
#__vconsole {
    z-index: 999999 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
}

#__vconsole .vc-switch {
    z-index: 999999 !important;
    position: fixed !important;
    right: 10px !important;
    bottom: 80px !important;
    pointer-events: auto !important;
}

#__vconsole .vc-mask {
    z-index: 999998 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.75) !important;
    pointer-events: auto !important;
}

#__vconsole .vc-panel {
    z-index: 999999 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: 10% !important;
    height: auto !important;
    max-height: 90vh !important;
    background: #1c1c1e !important;
    border-top: 3px solid #4fc3f7 !important;
    display: flex !important;
    flex-direction: column !important;
    pointer-events: auto !important;
    opacity: 1 !important;
}

#__vconsole .vc-tabbar {
    background: #2d2d2d !important;
    flex-shrink: 0 !important;
    padding: 12px 0 !important;
    border-bottom: 1px solid #444 !important;
}

#__vconsole .vc-content {
    flex: 1 !important;
    overflow-y: auto !important;
    background: #1c1c1e !important;
    min-height: 400px !important;
    padding: 12px !important;
}

#__vconsole .vc-logbox {
    height: 100% !important;
    background: #1c1c1e !important;
}

#__vconsole .vc-log-entry,
#__vconsole .vc-item,
#__vconsole .vc-log {
    color: #e0e0e0 !important;
    font-size: 14px !important;
    line-height: 1.8 !important;
    padding: 10px 12px !important;
    border-bottom: 1px solid #333 !important;
    background: transparent !important;
}

#__vconsole .vc-log-info,
#__vconsole .vc-log-info .vc-log-content {
    color: #9cdcfe !important;
    background: transparent !important;
}

#__vconsole .vc-log-warn,
#__vconsole .vc-log-warn .vc-log-content {
    color: #ffcc00 !important;
    background: rgba(255, 204, 0, 0.08) !important;
}

#__vconsole .vc-log-error,
#__vconsole .vc-log-error .vc-log-content {
    color: #ff6b6b !important;
    background: rgba(255, 107, 107, 0.08) !important;
}

#__vconsole .vc-tool {
    background: #2d2d2d !important;
    flex-shrink: 0 !important;
    border-top: 1px solid #444 !important;
    padding: 10px !important;
}

#__vconsole .vc-cmd-input {
    background: #1c1c1e !important;
    color: #e0e0e0 !important;
    border: 1px solid #555 !important;
    padding: 8px !important;
    font-size: 14px !important;
}

#__vconsole .vc-subtab {
    background: #252525 !important;
    padding: 8px 0 !important;
}

#__vconsole .vc-subtab .vc-subtab-btn {
    color: #ccc !important;
    font-size: 13px !important;
    padding: 6px 12px !important;
}

#__vconsole .vc-subtab .vc-subtab-btn.vc-actived {
    color: #fff !important;
    border-bottom: 2px solid #4fc3f7 !important;
}

#__vconsole .vc-tabbar .vc-tab,
#__vconsole .vc-tabbar .vc-tab-btn {
    color: #999 !important;
    font-size: 15px !important;
    padding: 10px 16px !important;
}

#__vconsole .vc-tabbar .vc-tab.vc-actived,
#__vconsole .vc-tabbar .vc-tab-btn.vc-actived {
    color: #4fc3f7 !important;
    background: rgba(79, 195, 247, 0.1) !important;
}

#__vconsole .vc-tool .vc-tool-btn {
    color: #ccc !important;
    font-size: 13px !important;
}

/* 确保所有内容区域都不透明 */
#__vconsole * {
    box-sizing: border-box !important;
    pointer-events: auto !important;
}

#__vconsole .vc-log-content {
    opacity: 1 !important;
}

#__vconsole .vc-system,
#__vconsole .vc-network,
#__vconsole .vc-element,
#__vconsole .vc-storage {
    background: #1c1c1e !important;
    color: #e0e0e0 !important;
}
/* ===== vConsole 样式修复结束 ===== */

/* =========================================================
   🔧 修正：vConsole 调试面板层级（解决遮挡底层点击的问题）
   ========================================================= */
#__vconsole {
    z-index: 9999999 !important; /* 依然保持最顶层 */
    pointer-events: none !important; /* 🌟 关键：让外层隐形容器的点击【穿透】下去，不挡系统按钮 */
}

/* 只让绿按钮、暗色遮罩和面板本身拦截点击 */
#__vconsole .vc-switch,
#__vconsole .vc-mask,
#__vconsole .vc-panel {
    pointer-events: auto !important; 
}

/* 恢复内部元素的滚动和点击 */
#__vconsole .vc-panel * {
    pointer-events: auto !important; 
    touch-action: auto !important; 
}

#__vconsole .vc-panel {
    background-color: #fbf9fe !important; 
    color: #333 !important;
}
#__vconsole .vc-content {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* iOS PWA 底部黑边修复：双层覆盖确保从后台切回时无黑边 */
body.ios-pwa::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: -100px;
    background: var(--wallpaper-bg, #1C1520);
    z-index: -1;
    pointer-events: none;
}

/* html 层背景色兜底（iOS 有时 body 底部缩回留出 html 背景色） */
html:has(body.ios-pwa) {
    background: var(--wallpaper-bg, #1C1520) !important;
}


/* �T�T�T�T�T�T ������ɴ���� �T�T�T�T�T�T */
.lock-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.08);
    pointer-events: none;
    z-index: 1;
}
.lock-screen-overlay {
    z-index: 2;
}

/* �T�T�T�T�T�T ������̬Ч�� �T�T�T�T�T�T */

/* ��ֽ����΢�ƣ��Ʋ�Ʈ���У� */
.lock-screen-wallpaper {
    animation: lockDrift 20s ease-in-out infinite;
    transform-origin: center;
}
@keyframes lockDrift {
    0%, 100% { transform: scale(1.05) translateX(0) translateY(0); }
    25% { transform: scale(1.05) translateX(-8px) translateY(-4px); }
    50% { transform: scale(1.08) translateX(5px) translateY(-6px); }
    75% { transform: scale(1.05) translateX(-3px) translateY(3px); }
}

/* �������� */
.lock-particles {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

/* ? ������˸ */
.lock-star {
    position: absolute;
    width: 3px; height: 3px;
    border-radius: 50%;
    background: #fff;
    opacity: 0;
    animation: starTwinkle 3s ease-in-out infinite;
}
.lock-star.s1 { top: 12%; left: 15%; animation-delay: 0s; animation-duration: 2.5s; }
.lock-star.s2 { top: 25%; left: 78%; animation-delay: 0.8s; animation-duration: 3.2s; }
.lock-star.s3 { top: 45%; left: 25%; animation-delay: 1.5s; animation-duration: 2.8s; width: 2px; height: 2px; }
.lock-star.s4 { top: 60%; left: 85%; animation-delay: 2.1s; animation-duration: 3.5s; }
.lock-star.s5 { top: 35%; left: 55%; animation-delay: 0.4s; animation-duration: 4s; width: 2px; height: 2px; }
.lock-star.s6 { top: 75%; left: 40%; animation-delay: 1.8s; animation-duration: 2.2s; }

@keyframes starTwinkle {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 0.8; transform: scale(1.2); }
}

/* ?? ������Ʈ�� */
.lock-star::after {
    content: '';
    position: absolute;
    width: 1px; height: 1px;
    background: rgba(255,255,255,0.6);
    border-radius: 50%;
    animation: particleFall 8s linear infinite;
    top: 0; left: 20px;
}
.lock-star.s1::after { animation-delay: 1s; left: 30px; animation-duration: 10s; }
.lock-star.s3::after { animation-delay: 3s; left: -15px; animation-duration: 7s; }
.lock-star.s5::after { animation-delay: 5s; left: 10px; animation-duration: 12s; }

@keyframes particleFall {
    0% { opacity: 0; transform: translateY(-20px) translateX(0); }
    10% { opacity: 0.5; }
    90% { opacity: 0.3; }
    100% { opacity: 0; transform: translateY(200px) translateX(15px); }
}

/* ?? ��߸��� */
.lock-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(30px);
    opacity: 0;
    animation: orbFloat 10s ease-in-out infinite;
}
.lock-orb.o1 {
    width: 80px; height: 80px;
    background: rgba(255,200,255,0.12);
    bottom: 20%; left: 10%;
    animation-delay: 0s;
    animation-duration: 12s;
}
.lock-orb.o2 {
    width: 60px; height: 60px;
    background: rgba(200,180,255,0.10);
    bottom: 40%; right: 15%;
    animation-delay: 3s;
    animation-duration: 15s;
}
.lock-orb.o3 {
    width: 50px; height: 50px;
    background: rgba(255,255,230,0.08);
    bottom: 60%; left: 50%;
    animation-delay: 6s;
    animation-duration: 10s;
}

@keyframes orbFloat {
    0%, 100% { opacity: 0; transform: translateY(0) scale(0.8); }
    30% { opacity: 1; }
    50% { opacity: 0.8; transform: translateY(-40px) scale(1.1); }
    70% { opacity: 1; }
}

/* ?? �¹������������⣩ */
.lock-screen-wallpaper::after {
    content: '';
    position: absolute;
    top: 15%; left: 50%;
    transform: translateX(-50%);
    width: 200px; height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
    animation: moonBreathe 6s ease-in-out infinite;
    pointer-events: none;
}
@keyframes moonBreathe {
    0%, 100% { opacity: 0.3; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.8; transform: translateX(-50%) scale(1.3); }
}

/* ?? �ռ�ģʽ��ůɫ��� */
.lock-orb.o1 { background: rgba(255,200,180,0.12); }
.lock-orb.o2 { background: rgba(255,180,220,0.10); }
.lock-orb.o3 { background: rgba(255,230,200,0.08); }

/* ?? ҹ��ģʽ����ɫ + �������� */
body.dark-mode .lock-star,
body.night .lock-star {
    box-shadow: 0 0 4px rgba(255,255,255,0.5);
}
body.dark-mode .lock-orb.o1,
body.night .lock-orb.o1 {
    background: rgba(180,140,255,0.15);
}
body.dark-mode .lock-orb.o2,
body.night .lock-orb.o2 {
    background: rgba(140,120,255,0.12);
}
body.dark-mode .lock-orb.o3,
body.night .lock-orb.o3 {
    background: rgba(200,180,255,0.10);
}
body.dark-mode .lock-screen-wallpaper::after,
body.night .lock-screen-wallpaper::after {
    background: radial-gradient(circle, rgba(180,140,255,0.08) 0%, transparent 70%);
}

/* 时间戳样式 */
.msg-timestamp {
    font-size: 10px;
    color: #b2bec3;
    text-align: center;
    margin: 2px 0 0 0;
    padding: 0;
    line-height: 1.2;
    width: 100%;
}
#echo .msg-row {
    margin-bottom: 4px;
}

/* 侧边栏打开时隐藏底部输入栏 */
#echo-sidebar.active ~ .bottom-bar,
#echo-sidebar.active ~ #echo-bottom-bar,
.sidebar-open .bottom-bar,
.sidebar-open #echo-bottom-bar {
    display: none !important;
}

/* ========================================
   🔧 侧边栏防键盘弹起（防止黑屏）- 已移除阻塞规则
   ======================================== */
/* 注释：原有的 pointer-events: none 规则会阻止所有输入框交互，已移除 */

/* ========================================
   🔧 安卓全屏防黑屏/防闪烁终极补丁
   ======================================== */
html, body {
    background-color: var(--bg-screen, #F2F2F4) !important;
}

body.dark-mode,
body.dark-mode html {
    background-color: var(--bg-screen, #1A1A1A) !important;
}

.phone-container,
.phone-frame,
#phone-screen,
.screen-content,
#app-echo,
.taro-home {
    /* 🔧 已删除 transform: translateZ(0) + will-change: transform。
            这两条本意是 GPU 合成层优化，但副作用是创建 containing block，
            导致所有页面的 position: fixed 子元素被劫持（千面/众生 save-bar 卡中段 bug 根因）。
            现代浏览器会自动决定合成策略，这条手动优化既无收益又制造 bug。 */
    background-color: var(--bg-screen, #F2F2F4) !important;
}

/* 🎬 [流式 thinking 阶段样式] AI 思考过程的灰色斜体显示，闭合后切回正常正文样式 */
.streaming-thinking {
    color: var(--text-sub, #888) !important;
    font-style: italic !important;
    opacity: 0.65 !important;
    font-size: 13px !important;
}

/* 🎬 [流式占位等待动画] 流式请求发出后到第一个 chunk 到达前，气泡显示"思考中..."动画 */
.stream-placeholder .stream-loading-dots {
    color: var(--text-sub, #888);
    font-size: 13px;
    font-style: italic;
    opacity: 0.7;
}
.stream-placeholder .stream-loading-dots::after {
    content: '';
    display: inline-block;
    width: 1.2em;
    text-align: left;
    animation: stream-loading-dots 1.4s steps(4, end) infinite;
}
@keyframes stream-loading-dots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
    100% { content: ''; }
}

body.dark-mode .phone-container,
body.dark-mode .phone-frame,
body.dark-mode #phone-screen,
body.dark-mode .screen-content,
body.dark-mode #app-echo,
body.dark-mode .taro-home {
    background-color: var(--bg-screen, #1A1A1A) !important;
}

body.is-fullscreen,
body.is-fullscreen html {
    background-color: var(--bg-screen, #F2F2F4) !important;
    transform: translateZ(0);
}

body.is-fullscreen.dark-mode,
body.is-fullscreen.dark-mode html {
    background-color: var(--bg-screen, #1A1A1A) !important;
}
