/* --- 组件 1：顶部音乐播放器 --- */
.music-player {
    width: 90%;
    height: 22%;
    background: #f0f2f5;
    border-radius: 20px;
    margin-top: 3%;
    display: flex;
    align-items: center;
    padding: 15px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
    position: relative;
}

/* 左侧唱片 */
.music-cover {
    height: 75%;
    aspect-ratio: 1/1; /* 保持圆形 */
    border-radius: 50%;
    background: #ddd;
    margin-right: 15px;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    cursor: pointer;
}
.music-cover img { width: 100%; height: 100%; object-fit: cover; }

/* 右侧信息 */
.music-info {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between；
   }
    
    .music-title {
        font-size: 18px;
        font-weight: 700;
        color: #000;
        cursor: pointer;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .music-sub {
        font-size: 12px;
        color: #888;
        margin-top: -2px;
    }

    .music-lyrics {
        font-size: 12px; /* 稍微调小一点以适应空间 */
        color: #999;
        line-height: 1.2;
        margin: 5px 0;
        font-style: italic;
    }
    
    .music-lyrics p { margin: 0; }

    .music-controls {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        color: #333;
    }

    .control-btn {
        font-size: 16px;
        cursor: pointer;
        opacity: 0.7;
        transition: opacity 0.2s;
    }
    .control-btn:hover { opacity: 1; }
    .control-btn.small { font-size: 14px; }

    .play-btn {
        width: 30px;
        height: 30px;
        background: #333;
        color: #fff;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 12px;
        cursor: pointer;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }

/* --- 组件 2 & 3: 通用混合区域容器 (修改版) --- */

/* 中间区域：图片容器 + APP */
.middle-complex-area {
    width: 90%;
    /* 核心修改 1：把高度改成 auto，让它包裹住内容，不要撑太高 */
    height: auto; 
    /* 核心修改 2：增加顶部间距，让它离上面的播放器远一点 */
    margin-top: 30px; 
    /* 核心修改 3：增加底部间距，控制和下方拍立得的距离 */
    margin-bottom: 20px; 
    
    display: flex;
    justify-content: space-between; /* 左右分开 */
    align-items: flex-start;
    flex-shrink: 0; /* 防止被压缩 */
}

/* 底部区域：拍立得等 (修改版) */
.bottom-complex-area {
    width: 90%;
    /* 核心修改 4：去掉 flex: 1，或者改变对齐方式，让它不要死死抵在屏幕最底部 */
    flex: 1; 
    display: flex;
    justify-content: space-between;
    /* 核心修改 5：改为 flex-start (顶部对齐)，让它往上跑，靠近中间区域 */
    align-items: flex-start; 
    padding-bottom: 20px;
    /* 👇 核心修改在这里：加大这个数值，就会往下移动 */
    margin-top: 40px; 
}


/* --- 左侧：纯图片容器 --- */
.id-card-widget {
    width: 42%; /* 保持宽度，与右侧平衡 */
    height: 140px; /* 保持高度，与右侧 App 网格对齐 */
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 12px; /* 圆角与 APP 保持一致 */
    
    /* 布局设置 */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden; /* 确保图片不溢出圆角 */
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    transition: all 0.2s ease;
}

/* 鼠标悬停效果 */
.id-card-widget:hover {
    box-shadow: 0 6px 15px rgba(0,0,0,0.08);
    transform: translateY(-2px); /* 微微上浮 */
}

/* 图片样式：占满整个容器 */
.id-card-widget img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 裁剪模式，保证填满不拉伸 */
    display: block;
}

/* 提示文字样式 */
#id-hint {
    font-size: 12px;
    color: #999;
    pointer-events: none; /* 让点击穿透到父容器 */
}

/* --- 小号 APP 网格 --- */
.mini-app-grid {
    width: 55%; /* 占右侧 */
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
}

/* 小号 App 样式覆写 */
.app-item.small {
    gap: 3px;
}
.app-icon-box.small-icon {
    width: 42px; /* 更小一点 */
    height: 42px;
    font-size: 18px;
    border-radius: 10px;
}

/* --- 右下角：拍立得 (Polaroid) --- */
.polaroid-widget {
    width: 40%;
    height: 130px;
    background: #fff;
    padding: 8px 8px 25px 8px; /* 底部留白大 */
    box-shadow: 2px 5px 15px rgba(0,0,0,0.1);
    transform: rotate(-3deg); /* 微微倾斜更有感觉 */
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.polaroid-widget:hover { transform: rotate(0deg) scale(1.02); }

.polaroid-pic {
    width: 100%;
    height: 100%; /* 占满剩余空间 */
    background: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
.polaroid-pic img { width: 100%; height: 100%; object-fit: cover; }

.polaroid-text {
    position: absolute;
    bottom: 5px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 10px;
    color: #555;
}
/* --- 外观 App 全屏容器 --- */
.app-fullscreen {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%; /* 占满屏幕 */
    background: #f2f2f7; /* iOS 设置页背景灰 */
    z-index: 150; /* 保证盖住主页，但小于 API 弹窗 */
    display: flex;
    flex-direction: column;
    transform: translateY(100%); /* 默认藏在屏幕下面 */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 32px; /* 跟随屏幕圆角 */
    overflow: hidden;
}

/* 激活状态：滑上来 */
.app-fullscreen.active {
    transform: translateY(0);
}

/* App 顶部导航 */
.app-header {
    height: 50px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.back-btn {
    color: #007aff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 滚动内容区 */
.app-content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* 设置卡片块 */
.setting-card {
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.setting-card h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.appearance-page {
    padding: 20px 20px 50px 20px;
}

.appearance-nav-card {
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.appearance-nav-card:active {
    transform: scale(0.99);
    background: #f7f7f7;
}

.appearance-sub-back {
    margin: 0 0 14px 0;
    border: none;
    background: transparent;
    color: #007aff;
    font-size: 15px;
    padding: 4px 0;
    cursor: pointer;
}

.global-chat-wallpaper-preview {
    height: 150px;
    border-radius: 8px;
    border: 1px dashed #d1d1d6;
    background-color: #f4f4f6;
    background-size: cover;
    background-position: center;
    color: #999;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    overflow: hidden;
}

.global-chat-wallpaper-preview.has-image {
    border-style: solid;
}

.appearance-text-danger {
    margin-top: 10px;
    border: none;
    background: transparent;
    color: #ff3b30;
    font-size: 13px;
    padding: 0;
    cursor: pointer;
}

.font-url-input {
    width: 100%;
    box-sizing: border-box;
}

.font-field-title {
    margin-top: 16px !important;
}

.font-action-row {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.font-action-row .mini-btn,
.font-action-row .mini-btn-ok {
    flex: 1;
    min-width: 92px;
}

.font-preview-box {
    min-height: 120px;
    border: 1px solid #e5e5ea;
    border-radius: 8px;
    background: #f9f9fb;
    padding: 16px;
    color: #222;
    font-size: 16px;
    line-height: 1.7;
    user-select: text;
}

.font-preview-status {
    margin-top: 8px;
    color: #888;
    font-size: 12px;
}

.font-preview-status[data-type="ok"] {
    color: #178f45;
}

.font-preview-status[data-type="error"] {
    color: #ff3b30;
}

.font-preview-status[data-type="loading"] {
    color: #007aff;
}

.font-preset-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.font-preset-row:last-child {
    border-bottom: none;
}

.font-preset-row.active .font-preset-name {
    color: #007aff;
}

.font-preset-main {
    min-width: 0;
    flex: 1;
}

.font-preset-name {
    font-size: 14px;
    font-weight: 600;
    color: #222;
}

.font-preset-url {
    margin-top: 4px;
    color: #999;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.appearance-empty-note {
    color: #999;
    font-size: 13px;
    padding: 8px 0;
}

.icon-settings-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.icon-settings-item {
    padding-bottom: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.icon-settings-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.mini-btn.danger {
    color: #ff3b30;
}

.setting-desc {
    font-size: 12px;
    color: #888;
    margin-bottom: 15px;
}

/* 按钮和输入框行 */
.setting-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}
.setting-row:last-child { margin-bottom: 0; }

.url-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    background: #f9f9f9;
}

.url-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.setting-row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mini-btn,
.mini-btn-ok {
    border: none;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.mini-btn {
    background: #f2f2f7;
    color: #222;
}

.mini-btn-ok {
    background: #111;
    color: #fff;
}

/* 按钮样式 */
.btn-primary, .btn-secondary {
    border: none;
    border-radius: 8px;
    padding: 8px 15px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
}

.btn-primary {
    background: #007aff;
    color: white;
    width: 100%; /* 占满一行 */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-secondary {
    background: #e5e5ea;
    color: #333;
    white-space: nowrap; /* 防止文字换行 */
}

.btn-secondary:active { background: #d1d1d6; }
/* =========================================
   UI 2.0 第一排：照片贴纸 + 聊天卡片
   ========================================= */

/* 1. 统一的大灰盒子底座 */
.top-unified-container {
    width: 100%;
    height: 100%;
    background: #e3e3e8; /* 参考图的浅灰色 */
    border-radius: 28px;
    padding: 12px;
    display: flex;
    gap: 12px; /* 左右之间的间距 */
    box-shadow: inset 0 0 20px rgba(0,0,0,0.02); /* 微微的内阴影，增加质感 */
    position: relative;
}

/* --- 左侧区域 --- */
.top-left-stickers {
    width: 38%; /* 左侧宽度 */
    position: relative; /* 为了让里面的照片绝对定位 */
    height: 100%;
}

/* 照片通用的样式 (白边 + 圆角) */
.sticker-card {
    position: absolute;
    background: #fff; /* 照片底色 */
    border: 3px solid #fff; /* 模拟白边 */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
    
    /* 居中显示上传提示文字 */
    display: flex;
    justify-content: center;
    align-items: center;
}

.sticker-card:active {
    transform: scale(0.95);
}

.sticker-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 8px; /* 图片本身的小圆角 */
}

/* 照片 1 (后面那个，左上角) */
.sticker-back {
    width: 75px;
    height: 75px;
    top: 5px;
    left: 0;
    z-index: 1;
    background-color: #d1d1d6; /* 没图时的占位色 */
}

/* 照片 2 (前面那个，右下角，大一点) */
.sticker-front {
    width: 85px;
    height: 85px;
    bottom: 5px;
    right: 0;
    z-index: 2; /* 盖住后面 */
    background-color: #c7c7cc;
}

/* --- 右侧区域 --- */
.top-right-chat-card {
    flex: 1; /* 占满剩余空间 */
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    position: relative;
    
    display: flex;
    justify-content: center;
    align-items: center;
}

.top-right-chat-card img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 充满容器 */
}

/* 上传提示文字 */
.upload-hint-text {
    position: absolute;
    font-size: 10px;
    color: #fff;
    text-align: center;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* 如果图片上传了，就隐藏提示字 */
.sticker-card img[src*="blob"] + .upload-hint-text,
.sticker-card img[src*="base64"] + .upload-hint-text,
.top-right-chat-card img[src*="blob"] + .upload-hint-text,
.top-right-chat-card img[src*="base64"] + .upload-hint-text {
    display: none;
}
/* =========================================
   UI 2.1 修复版：INS风卡片 (紧凑型尺寸适配)
   ========================================= */

.aesthetic-card {
    width: 100%;
    height: 100%;
    /* 背景色 */
    background: linear-gradient(135deg, #a8aab0 0%, #888b90 100%);
    border-radius: 20px;
    /* 缩小内边距，腾出空间 */
    padding: 8px 10px; 
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

/* 0. 背景图片层 */
.aes-bg-img {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 20px;
    z-index: 0;
    cursor: pointer;
}

/* 噪点纹理 */
.aesthetic-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
}

/* 提升层级，防止被背景遮挡 */
.aes-time, 
.aes-bubble-row, 
.aes-middle-section, 
.aes-input-bar {
    position: relative;
    z-index: 2;
}

/* 1. 顶部时间 (字体缩小) */
.aes-time {
    text-align: center;
    font-size: 10px; /* 12 -> 10 */
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    margin-bottom: 2px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* 2. 气泡行 (更紧凑) */
.aes-bubble-row {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 4px;
}

/* 修改这一块 */
.aes-bubble {
    background: #fff;
    color: #000;
    
    /* 1. 紧凑内边距 (整合了你刚才的内联样式) */
    padding: 4px 8px; 
    
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    
    /* 2. 布局锁定核心代码 */
    width: fit-content;    /* 宽度随文字变，但不超过max-width */
    max-width: 85%;        /* 限制最大宽度 */
    max-height: 38px;      /* 【关键】锁死最大高度！大约是两行字的高度 */
    overflow: hidden;      /* 【关键】超过高度的内容直接切掉，不显示 */
    
    /* 3. 如果文字太长显示省略号(可选，现代浏览器支持) */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 限制显示2行 */
    -webkit-box-orient: vertical;
    
    outline: none;
    cursor: text;
    line-height: 1.35;
}


/* =========================================
   UI 2.2 布局微调：图标位置优化 + 去除文字
   ========================================= */

/* 中间区域容器 */
.aes-middle-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 0;
    position: relative; /*以此为基准定位*/
}

/* 左侧装饰容器 (占满照片左边的所有空间) */
.aes-decor-left {
    flex: 1;
    height: 100%;
    position: relative; /* 内部图标绝对定位 */
}

/* 1. 笑脸图标 (定位在左侧空地的中间) */
.aes-icon-smiley {
    position: absolute;
    left: 25%;  /* 靠左侧 1/4 处，视觉上的中间 */
    top: 50%;
    transform: translateY(-50%); /* 垂直居中 */
}
.aes-icon-smiley i {
    font-size: 24px;
    color: #333; /* 深色笑脸 */
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.6)); /* 加点白晕，防背景太深 */
}

/* 2. 发送箭头 (紧贴照片左侧) */
.aes-icon-arrow {
    position: absolute;
    right: 8px; /* 离照片只有 8px 距离 */
    top: 50%;
    transform: translateY(-50%); /* 垂直居中 */
    display: flex;
}
.aes-icon-arrow i {
    font-size: 18px;
    color: #fff; /* 白色箭头 */
    transform: rotate(90deg); /* 旋转90度，指向右边的照片 */
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
}

/* 右侧照片框 (尺寸保持之前缩小的 68px) */
.aes-photo-frame {
    width: 68px;
    height: 68px;
    background: #e0e0e0;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    overflow: hidden;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
    z-index: 5; /* 保证照片在最上层 */
}
.aes-photo-frame:active { transform: scale(0.95); }
.aes-photo-frame img { width: 100%; height: 100%; object-fit: cover; }


/* 左侧装饰 (整体缩小) */
.aes-decor-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px; /* 间距缩小 */
    padding-left: 5px;
}
.aes-arrow-icon i {
    font-size: 20px; /* 24 -> 20 */
    color: #fff;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
}
.aes-weather-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
}
.aes-weather-group i {
    font-size: 22px; /* 28 -> 22 */
    color: #333;
}
.aes-weather-text {
    font-size: 9px; /* 11 -> 9 */
    color: #333;
    font-weight: bold;
    text-shadow: 0 0 4px rgba(255,255,255,0.6);
}

/* 右侧照片框 (大幅缩小适配高度) */
.aes-photo-frame {
    width: 68px; /* 90 -> 68 */
    height: 68px;
    background: #e0e0e0;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    overflow: hidden;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
}
.aes-photo-frame:active { transform: scale(0.95); }
.aes-photo-frame img { width: 100%; height: 100%; object-fit: cover; }

/* 4. 底部输入框 (变矮) */
.aes-input-bar {
    background: rgba(255, 255, 255, 0.95);
    height: 30px; /* 36 -> 30 */
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 0 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.aes-input-placeholder { font-size: 10px; color: #888; }
.aes-input-icons { display: flex; align-items: center; gap: 6px; }
.aes-input-icons i { font-size: 14px; color: #333; }
.aes-plus-circle {
    width: 22px; height: 22px; /* 26 -> 22 */
    background: #000; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
}
.aes-plus-circle i { color: #fff; font-size: 12px; }

/* === 第三排左侧：大方块照片墙 (尺寸锁定版) === */
.main-widget-card {
    width: 100%;
    height: 100%; /* 填满父容器 */
    
    background: #fff;
    border-radius: 24px;
    
    /* 关键：隐藏溢出，防止图片太大跑出来 */
    overflow: hidden; 
    
    /* 关键：相对定位，作为内部图片的坐标基准 */
    position: relative; 
    
    /* 交互效果 */
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    
    /* 让加号居中 */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 点击时的微动效 */
.main-widget-card:active {
    transform: scale(0.98);
}

/* 占位符图标 (+) */
.main-widget-placeholder {
    z-index: 0; /* 在底层 */
}

.main-widget-placeholder i {
    font-size: 32px;
    color: #d1d1d6;
}

/* 图片本体 - 强制锁定 */
.main-widget-card img {
    /* 核心修改：使用绝对定位 */
    position: absolute;
    top: 0;
    left: 0;
    
    /* 强制宽高 100%，只填满容器，绝不撑开 */
    width: 100%;
    height: 100%;
    
    /* 智能裁剪：保证图片填满且不变形，多余部分自动切掉 */
    object-fit: cover; 
    
    /* 显示层级最高，盖住加号 */
    z-index: 1; 
    display: block;
}


/* 按压效果 */
.main-widget-card:active {
    transform: scale(0.98);
}

/* 占位符图标 (+) */
.main-widget-placeholder i {
    font-size: 32px; /* 大一点的加号 */
    color: #d1d1d6;  /* 浅灰色 */
}

/* 图片本体 */
.main-widget-card img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 保证填满不变形 */
    display: block;
}
