/* ================= COUPLE SPACE ================= */
#page-couple .screen {
    background:
        radial-gradient(120% 90% at 0% 0%, rgba(255, 226, 236, 0.75) 0%, rgba(255, 226, 236, 0.12) 45%, transparent 70%),
        radial-gradient(120% 90% at 100% 0%, rgba(225, 236, 255, 0.65) 0%, rgba(225, 236, 255, 0.1) 45%, transparent 70%),
        linear-gradient(180deg, #f7f8fc 0%, #f4f5f9 100%);
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

#page-couple .screen::-webkit-scrollbar {
    display: none;
}
#page-couple .screen {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.couple-page {
    position: relative;
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: calc(env(safe-area-inset-top, 20px) + 8px) 0 calc(env(safe-area-inset-bottom, 20px) + 14px);
    box-sizing: border-box;
}

.couple-enter-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(242, 245, 255, 0.93), rgba(250, 248, 252, 0.9));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 280ms ease;
}

.couple-page.is-entering .couple-enter-overlay {
    opacity: 1;
}

.couple-page.is-revealed .couple-enter-overlay.done {
    opacity: 0;
}

.couple-enter-core {
    text-align: center;
    color: #2d2d32;
}

.couple-enter-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.couple-enter-subtitle {
    margin-top: 8px;
    font-size: 12px;
    color: #6d7380;
}

.couple-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
}

.couple-back-btn {
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    color: #2a2a2d;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
}

.couple-header-title-wrap {
    min-width: 0;
}

.couple-header-title {
    font-size: 20px;
    font-weight: 800;
    color: #1f2229;
}

.couple-header-subtitle {
    margin-top: 2px;
    font-size: 12px;
    color: #6a7180;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.couple-toolbar {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    padding: 0 14px;
}

.couple-pill-btn {
    flex: 1;
    border: none;
    border-radius: 999px;
    padding: 9px 12px;
    font-size: 12px;
    font-weight: 700;
    color: #344054;
    background: rgba(255, 255, 255, 0.66);
    box-shadow: 0 8px 20px rgba(20, 28, 45, 0.06);
    cursor: pointer;
}

.couple-empty-hint {
    margin-top: 16px;
    margin-left: 14px;
    margin-right: 14px;
    border-radius: 16px;
    padding: 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #5e6470;
    background: rgba(255, 255, 255, 0.6);
    border: 1px dashed rgba(160, 175, 200, 0.4);
}

.couple-role-grid {
    margin-top: 14px;
    display: grid;
    gap: 10px;
    padding: 0 14px 4px 14px;
}

.couple-role-card {
    border-radius: 18px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.64);
    border: 1px solid rgba(255, 255, 255, 0.88);
    box-shadow: 0 12px 24px rgba(28, 37, 56, 0.08);
}

.couple-role-card.active {
    border-color: rgba(255, 113, 143, 0.44);
    box-shadow: 0 12px 26px rgba(255, 105, 141, 0.16);
}

.couple-role-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.couple-role-card-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.couple-role-meta {
    min-width: 0;
    flex: 1;
}

.couple-role-card-name {
    font-size: 15px;
    font-weight: 800;
    color: #21262f;
}

.couple-role-card-sub {
    margin-top: 2px;
    font-size: 12px;
    color: #6f7785;
}

.couple-role-info-row {
    margin-top: 9px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #596071;
}

.couple-role-info-row strong {
    color: #303744;
}

.couple-role-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.couple-card-btn {
    border: none;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.78);
    color: #364154;
}

.couple-card-btn.invite {
    color: #a12b53;
    background: rgba(255, 225, 236, 0.72);
}

.couple-card-btn.enter {
    color: #0f5a8a;
    background: rgba(220, 241, 255, 0.78);
}

.couple-card-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.couple-space-view {
    margin-top: 14px;
    padding: 0 14px 24px 14px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.couple-hero-card,
.couple-card {
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 14px 28px rgba(26, 35, 51, 0.08);
}

.couple-hero-card {
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.couple-hero-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.couple-role-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}

.couple-role-name {
    font-size: 17px;
    font-weight: 800;
    color: #1d232e;
}

.couple-stage-badge {
    margin-top: 6px;
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #8f3e57;
    background: rgba(255, 224, 235, 0.92);
}

.couple-intimacy-wrap {
    text-align: right;
}

.couple-intimacy-label {
    font-size: 12px;
    color: #6d7584;
}

.couple-intimacy-value {
    font-size: 26px;
    font-weight: 800;
    color: #1e2330;
}

.couple-main-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.couple-card {
    padding: 12px;
}

.couple-card-title {
    font-size: 13px;
    font-weight: 800;
    color: #273040;
}

.couple-list {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.couple-list-item {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #4a5162;
}

.couple-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.couple-segmented {
    display: inline-flex;
    gap: 4px;
    padding: 2px;
    border-radius: 999px;
    background: rgba(245, 247, 252, 0.9);
}

.couple-segmented button {
    border: none;
    background: transparent;
    color: #667089;
    font-size: 11px;
    padding: 5px 8px;
    border-radius: 999px;
    cursor: pointer;
}

.couple-segmented button.active {
    color: #2a3140;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.couple-memory-list {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.couple-memory-item {
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.95);
    padding: 9px 10px;
}

.couple-memory-summary {
    font-size: 12px;
    line-height: 1.45;
    color: #2f3748;
}

.couple-memory-meta {
    margin-top: 5px;
    font-size: 11px;
    color: #768097;
}

.couple-actions-row {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.couple-action-btn {
    border: none;
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #ff6a8b, #ff8ea6);
    cursor: pointer;
}

.couple-action-btn.secondary {
    color: #364054;
    background: rgba(255, 255, 255, 0.82);
}

.couple-reveal-item {
    opacity: 0;
    transform: translateY(12px);
    transition: transform 420ms cubic-bezier(.21,.65,.26,1), opacity 420ms ease;
}

.couple-page.is-revealed .couple-reveal-item {
    opacity: 1;
    transform: translateY(0);
}

.couple-page.is-revealed [data-reveal-order="2"] { transition-delay: 80ms; }
.couple-page.is-revealed [data-reveal-order="3"] { transition-delay: 140ms; }
.couple-page.is-revealed [data-reveal-order="4"] { transition-delay: 200ms; }
.couple-page.is-revealed [data-reveal-order="5"] { transition-delay: 260ms; }
/* =========== 全局和基础样式 =========== */
:root {
    --font-color: #2f2f2f; 
    --accent-color: #2b2b2b;
    --icon-gradient: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    --widget-bg: rgba(255, 255, 255, 0.82);
    --ins-bg: #f5f3f0;
    --ins-card: rgba(255, 255, 255, 0.94);
    --ins-accent: #e3ddd6;
    --ins-accent-strong: #d0c6bc;
    --ins-text: #2d2b29;
    --ins-border: rgba(120, 112, 104, 0.18);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    width: 100%;
    height: 100%;
    background: transparent;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    background: #ffffff; /* 全局背景改为白色 */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    overflow: hidden;
    overflow-x: hidden;
    overscroll-behavior: none;
}

/* SPA 页面容器 (限制宽度以兼容PC浏览器，还原白边消除) */
#spa-root {
    width: 100vw;
    max-width: 500px; /* 在电脑端防止拉成超宽，在手机端就是 100% */
    height: 100vh;
    position: relative;
    overflow: hidden;
    background: #ffffff; 
}

/* 隐藏无关特效 */
body.not-home::before, 
body.not-home::after {
    display: none !important;
}

.spa-page {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow-y: auto; 
    display: none; 
    background: #f9f9f9; 
}

.spa-page.active {
    display: block;
}

/* =========== Lock screen (iOS style) =========== */
.lock-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    background: linear-gradient(180deg, #e8e6e3 0%, #d4d0c8 50%, #c9c4bb 100%);
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 10vh;
}

.lock-screen-effects {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.lock-screen-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 400px;
    height: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.lock-screen-time {
    font-size: 72px;
    font-weight: 200;
    color: #2d2b29;
    letter-spacing: -2px;
    text-shadow: 0 1px 3px rgba(255,255,255,0.8);
}

.lock-screen-date {
    font-size: 18px;
    color: rgba(45, 43, 41, 0.75);
    margin-top: 4px;
    text-shadow: 0 1px 2px rgba(255,255,255,0.6);
}

.lock-screen-dots {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

.lock-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(45, 43, 41, 0.4);
    background: transparent;
    transition: background 0.2s, border-color 0.2s;
}

.lock-dot.filled {
    background: #2d2b29;
    border-color: #2d2b29;
}

.lock-screen-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 32px;
    padding: 0 40px;
}

.lock-key {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    color: #2d2b29;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.lock-key-zero {
    grid-column: 2;
}

.lock-key:active {
    background: rgba(255, 255, 255, 0.75);
    transform: scale(0.95);
}

.lock-screen-verify-hint {
    margin-top: 20px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    color: #2d2b29;
    font-size: 14px;
}

.lock-screen-emergency-btn {
    margin-top: auto;
    margin-bottom: 8px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(45, 43, 41, 0.2);
    border-radius: 24px;
    color: #2d2b29;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.lock-screen-emergency-btn:active {
    background: rgba(255, 255, 255, 0.7);
}

/* Lock screen particle effects */
.lock-particle {
    position: absolute;
    pointer-events: none;
    top: -20px;
    animation: lock-fall linear infinite;
}
.lock-leaf { color: #6b5344; font-size: 14px; animation-name: lock-fall-leaf; }
.lock-snow { color: rgba(255,255,255,0.95); font-size: 14px; }
.lock-cherry { color: #ffb7c5; font-size: 12px; animation-name: lock-fall-leaf; }
@keyframes lock-fall {
    0% { transform: translateY(0); }
    100% { transform: translateY(110vh); }
}
@keyframes lock-fall-leaf {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(110vh) rotate(360deg); }
}

.lock-emergency-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lock-emergency-content,
.lock-summon-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lock-emergency-option {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.lock-emergency-option:active {
    background: rgba(0, 0, 0, 0.05);
}

.lock-emergency-close {
    padding: 12px;
    background: transparent;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
}

.lock-summon-content h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #333;
}

.lock-summon-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lock-summon-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.lock-summon-item:active {
    background: rgba(0, 0, 0, 0.06);
}

.lock-summon-item img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

/* 手机壳与屏幕 */
.phone-case {
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
}
.screen {
    flex-grow: 1;
    background: #f9f9f9; 
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    height: 100%;
}

#page-home .screen {
    background: transparent;
}

/* 顶部状态栏 */
#status-bar {
    height: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    font-size: 12px;
    color: var(--font-color);
    font-weight: bold;
    background: transparent; /* 去除了半透明白底，与主屏幕背景无缝衔接 */
    position: relative;
    z-index: 100;
}

.edit-icon-btn {
    border: 1px solid rgba(255,255,255,0.8);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}
#save-layout-btn { background: rgba(216, 232, 221, 0.95); color: var(--ins-text); }
#cancel-layout-btn { background: rgba(244, 226, 210, 0.95); color: var(--ins-text); }

/* 主屏幕网格系统 */
.home-swiper {
    width: 100%; /* 去掉压缩，100% 充满，消除白边 */
    height: calc(100% - 100px); /* 留出底部 Dock 空间 */
    overflow: hidden;
    position: relative;
    touch-action: pan-y; 
}

.swiper-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease-out;
}

/* 恢复到均分，不超屏幕 */
.home-page-grid {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(7, 1fr); /* 7行高度均分，绝不溢出 */
    gap: 5px; /* 较小的间距，紧凑显示 */
    padding: 15px 15px; /* 合适内边距 */
    box-sizing: border-box;
    position: relative;
}

/* 背景格子层 */
.grid-slot-bg {
    border: 1px dashed rgba(0,0,0,0.15);
    border-radius: 20px;
    background: rgba(255,255,255,0.1);
    pointer-events: none;
    opacity: 0; 
    z-index: 1;
}
body.edit-mode .grid-slot-bg {
    opacity: 1;
    pointer-events: auto;
}

/* --- 网格项通用样式 --- */
.grid-item {
    z-index: 2;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0; /* 防止内容撑高行，严格按格子高度渲染 */
    position: relative;
    border-radius: 22%; 
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s ease, opacity 0.2s;
    user-select: none;
    -webkit-user-select: none;
    /* 避免出现不该有的灰色角边 */
    border: none !important; 
    overflow: visible; /* 必须 visible 让右上角删除按钮能够显示出边界 */
}

/* 强制清除 grid-item 内部各种组件可能自带的不良背景 */
.grid-item > * {
    border-radius: 22%;
    background: transparent !important; /* 强制干掉自带的灰色背景 */
    box-shadow: none !important;
    border: none !important;
}

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

/* --- 应用图标样式 (固定原大小) --- */
.app-item {
    background: transparent;
    box-shadow: none;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    justify-content: center;
}

.app-item .icon-image {
    width: 58px; /* 恢复原先舒适的绝对大小 */
    height: 58px;
    border-radius: 22%; 
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.app-item .icon-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 编辑主屏幕：避免系统对应用/Dock 图标长按呼出图片菜单、拖拽图片（与 photo-widget 一致） */
body.edit-mode #page-home .app-item .icon-image img,
body.edit-mode #page-home .dock-item .icon-image img {
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

.app-item .app-name {
    font-size: 11px;
    color: var(--font-color);
    margin-top: 5px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* --- 原有特定组件适配 --- */
.photo-widget {
    background: transparent;
    padding: 0;
    /* Removed overflow: hidden so delete button is visible */
}
.photo-widget img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 22%;
    pointer-events: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.2s ease;
}

/* 编辑主屏幕：露出可长按拖拽的边缘，并避免系统抢占图片长按 */
body.edit-mode .photo-widget {
    outline: 2px dashed rgba(0, 0, 0, 0.22);
    outline-offset: -2px;
    border-radius: 22%;
}
body.edit-mode .photo-widget img {
    transform: scale(0.92);
}

/* Custom widgets: no host “card” — only the user’s iframe content is visible */
.custom-widget {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    pointer-events: auto;
    touch-action: auto;
}

/* Override .grid-item > * squircle clip on the content wrapper */
.grid-item.custom-widget > *:not(.remove-widget-btn) {
    border-radius: 0 !important;
}

.custom-widget iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: transparent;
    pointer-events: auto;
    border-radius: 0;
    overflow: hidden;
    touch-action: auto;
}

body.edit-mode .custom-widget iframe {
    pointer-events: none;
}

.notepad-widget {
    background: rgba(255, 255, 255, 0.85);
    padding: 15px;
    align-items: flex-start;
    justify-content: flex-start;
}
.notepad-widget textarea {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    resize: none;
    font-size: 14px;
    color: #444;
    line-height: 1.5;
}
.notepad-widget textarea:focus { outline: none; }

/* 分页指示器 */
.page-indicators {
    position: absolute;
    bottom: 95px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 90;
}


.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    transition: all 0.3s;
}
.dot.active {
    background: rgba(0,0,0,0.6);
    width: 12px;
    border-radius: 4px;
}

/* --- 抽屉与编辑工具栏 --- */
.edit-toolbar {
    position: absolute;
    top: 32px;
    left: 12px;
    right: 12px;
    transform: none;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    z-index: 200;
    background: transparent;
    padding: 0;
}

.edit-btn {
    flex: 1;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--ins-border);
    background: var(--ins-card);
    color: var(--ins-text);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    backdrop-filter: blur(12px);
}
.edit-btn:active { transform: scale(0.97); }
.edit-btn.danger { background: var(--ins-accent-strong); border-color: var(--ins-border); color: var(--ins-text); }

.widget-drawer {
    position: absolute;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 60%;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top-left-radius: 25px;
    border-top-right-radius: 25px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
    z-index: 300;
    transition: bottom 0.3s cubic-bezier(0.1, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
}
.widget-drawer.open { bottom: 0; }

.drawer-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.drawer-header h3 { font-size: 16px; color: #333; margin:0; }

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    align-content: start;
}

.lib-item {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 10px;
    text-align: center;
    cursor: grab;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    position: relative;
}
.lib-item.fixed-item {
    border: 1px dashed #ff8787;
    background: #fff0f5;
    cursor: pointer;
}
.lib-item span { font-size: 10px; color: #666; margin-top: 5px; }

/* 移除按钮 */
.remove-widget-btn {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 28px;
    height: 28px;
    background: #ff3b30;
    color: white;
    border-radius: 50%;
    display: none;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    z-index: 99; /* 保证它最高 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    border: 2px solid #fff;
}
.edit-mode .grid-item .remove-widget-btn { display: flex; }
.edit-mode .app-item .remove-widget-btn { display: none; }


/* =========== 底部导航栏 (Dock) =========== */
#bottom-bar {
    position: absolute;
    bottom: 14px; 
    left: 14px; 
    right: 14px;
    width: calc(100% - 28px); 
    height: 72px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 12px;
    padding: 8px calc(10px + env(safe-area-inset-right, 0px)) 8px calc(10px + env(safe-area-inset-left, 0px));
    align-items: center;
    z-index: 100;
    box-sizing: border-box;
}

body.dragging {
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

body.dragging #bottom-bar {
    pointer-events: none;
    opacity: 0.6;
}

/* 白色半透明栏栏，第8行背景 */
#bottom-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.78);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 26px; 
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    z-index: -1; 
}

/* 确保它在底栏中垂直居中并大小一致 */
.dock-item {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dock-item .icon-image {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    background: rgba(255,255,255,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(0,0,0,0.12);
    border: 1px solid rgba(255,255,255,0.9);
}

.dock-item .icon-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
}

.dock-item .app-name {
    display: none !important; 
}

/* =========== 编辑模式动画 =========== */
@keyframes jiggle {
    0% { transform: rotate(-1deg); }
    50% { transform: rotate(1deg); }
    100% { transform: rotate(-1deg); }
}

.edit-mode .grid-item {
    animation: jiggle 0.3s infinite;
    cursor: grab;
    z-index: 10;
}

/* 拖拽时的样式 (Ghost element) */
.dragging-ghost {
    position: absolute;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.8;
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    transition: none !important;
}

.grid-item.drag-source {
    opacity: 0.3;
}

/* =========== 设置页面样式 =========== */
.settings-page {
    padding: 20px;
    color: var(--font-color);
    overflow-y: auto;
    height: 100%;
    background: var(--ins-bg);
}

#page-settings .screen,
#page-beautify .screen,
#page-world-book .screen,
#page-regex .screen,
#page-user-settings .screen,
#page-contact-edit .screen {
    background: #ffffff;
}

#page-settings .settings-page,
#page-beautify .beautify-page,
#page-world-book .worldbook-page,
#page-regex .regex-page {
    background: transparent;
    color: var(--ins-text);
}

#page-settings .settings-header,
#page-beautify .settings-header,
#page-world-book .settings-header,
#page-regex .settings-header {
    color: var(--ins-text);
}

#page-settings .settings-section,
#page-beautify .settings-section,
#page-beautify .theme-selection,
#page-beautify .icon-customization,
#page-beautify .css-customization,
#page-world-book .wb-category,
#page-regex .rx-item {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
}

#page-settings .settings-button,
#page-beautify .settings-button,
#page-world-book .settings-button,
#page-regex .settings-button,
#page-regex .rx-btn-row .edit-btn {
    background: rgba(255, 255, 255, 0.6) !important;
    color: #333 !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px);
    border-radius: 999px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    font-weight: 600;
}

#page-settings .back-button,
#page-beautify .back-button,
#page-world-book .back-button,
#page-regex .back-button {
    color: var(--ins-text);
}

#page-settings .settings-item input,
#page-settings .settings-item select,
#page-beautify .settings-item input,
#page-beautify .settings-item select,
#page-beautify textarea,
#page-world-book .form-group input,
#page-world-book .form-group textarea,
#page-world-book .form-group select,
#page-regex .form-group input,
#page-regex .form-group textarea,
#page-regex .form-group select {
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--ins-border);
    color: var(--ins-text);
}

#page-beautify .slider,
#page-settings .slider {
    background-color: rgba(217, 199, 184, 0.6);
}
#page-beautify input:checked + .slider,
#page-settings input:checked + .slider {
    background-color: var(--ins-accent-strong);
}

.settings-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
    padding-left: 40px; 
}

.settings-header h1 {
    font-size: 24px;
    margin: 0 auto;
}

.back-button {
    font-size: 30px;
    color: var(--font-color);
    text-decoration: none;
    position: absolute;
    left: 0;
    cursor: pointer;
}

.settings-section {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.api-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.api-section-header h2 {
    margin: 0;
}
.api-error-help {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.9);
    color: #b08f78;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.api-error-help:active {
    transform: scale(0.95);
}

.settings-section h2 {
    font-size: 18px;
    margin-bottom: 5px;
}

.settings-section p {
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 20px;
}

.settings-item {
    margin-bottom: 15px;
}

.settings-item label {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
}

.settings-item input,
.settings-item select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    background: #f5f5f5;
    color: var(--font-color);
}

/* Lock screen effects checkboxes inside 美化中心 should not inherit "full input" styles */
#page-beautify .lock-emergency-section input[type="checkbox"] {
    width: auto !important;
    padding: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    background: transparent !important;
    margin: 0 !important;
    height: auto;
    transform: none;
}

.settings-button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background-color: var(--accent-color);
    color: white;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}

.glass-btn {
    background: rgba(255, 255, 255, 0.6) !important;
    color: #333 !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05) !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
}

.button-group {
    display: flex;
    gap: 10px;
}

/* --- chat.html Styles --- */
#page-chat {
    background-color: var(--ins-bg);
}

#page-chat .screen {
    background-color: transparent;
    display: flex;
    flex-direction: column;
}

#page-chat .chat-header {
    height: 64px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    z-index: 100;
}

#page-chat .user-avatar-container {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--ins-border);
    background: #fff;
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
    cursor: pointer;
}

#page-chat .user-avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#page-chat .chat-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--ins-text);
    letter-spacing: 0.5px;
}

#page-chat .header-actions {
    width: 48px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

#page-chat .chat-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

#page-chat .chat-tabs {
    height: 56px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 0 38px;
    gap: 18px;
    box-shadow: 0 -10px 24px rgba(0,0,0,0.06);
}

#page-chat .chat-tab-item {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8d7c6f;
    cursor: pointer;
    transition: all 0.2s ease;
}

#page-chat .chat-tab-item.active {
    color: #b08f78;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

#page-chat .chat-tab-item span {
    display: none;
}

#page-chat .chat-tab-icon {
    width: 22px;
    height: 22px;
    position: relative;
    color: currentColor;
}

#page-chat .chat-tab-icon.icon-message {
    border: 2px solid currentColor;
    border-radius: 6px;
}
#page-chat .chat-tab-icon.icon-message::after {
    content: "";
    position: absolute;
    left: 4px;
    bottom: -4px;
    width: 6px;
    height: 6px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    background: transparent;
}

#page-chat .chat-tab-icon.icon-channel {
    background:
        linear-gradient(currentColor, currentColor) 6px 4px/2px 14px no-repeat,
        linear-gradient(currentColor, currentColor) 14px 4px/2px 14px no-repeat,
        linear-gradient(currentColor, currentColor) 4px 8px/14px 2px no-repeat,
        linear-gradient(currentColor, currentColor) 4px 14px/14px 2px no-repeat;
    border-radius: 4px;
}

#page-chat .chat-tab-icon.icon-contacts::before {
    content: "";
    position: absolute;
    top: 1px;
    left: 6px;
    width: 10px;
    height: 10px;
    border: 2px solid currentColor;
    border-radius: 50%;
}
#page-chat .chat-tab-icon.icon-contacts::after {
    content: "";
    position: absolute;
    bottom: 1px;
    left: 3px;
    width: 16px;
    height: 8px;
    border: 2px solid currentColor;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

#page-chat .chat-tab-icon.icon-moments {
    border: 2px solid currentColor;
    border-radius: 50%;
}
#page-chat .chat-tab-icon.icon-moments::after {
    content: "";
    position: absolute;
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    top: 4px;
    left: 4px;
}

#page-chat .chat-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 14px 0 70px;
    position: relative;
    height: calc(100% - 120px);
}

/* =========================
   Personal / Wallet (Glass)
   ========================= */

#page-chat .personal-page {
    padding: 14px 12px 90px;
}

#page-chat .personal-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 6px 14px;
}

#page-chat .personal-avatar {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.6);
    box-shadow: 0 8px 18px rgba(0,0,0,0.06);
}

#page-chat .personal-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#page-chat .personal-meta {
    min-width: 0;
}

#page-chat .personal-name {
    font-size: 18px;
    font-weight: 800;
    color: #2a2a2a;
    letter-spacing: 0.2px;
}

#page-chat .personal-subtitle {
    font-size: 12px;
    color: rgba(0,0,0,0.52);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

#page-chat .wallet-glass-card {
    margin: 6px 6px 14px;
    padding: 14px 14px 12px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255,255,255,0.62), rgba(255,255,255,0.28));
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow: 0 18px 40px rgba(0,0,0,0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    position: relative;
    overflow: hidden;
}

#page-chat .wallet-glass-card::before {
    content: "";
    position: absolute;
    top: -40px;
    right: -40px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 205, 185, 0.65), rgba(255,255,255,0));
    filter: blur(2px);
    pointer-events: none;
}

#page-chat .wallet-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#page-chat .wallet-card-title {
    font-size: 13px;
    color: rgba(0,0,0,0.6);
    font-weight: 700;
    letter-spacing: 0.4px;
}

#page-chat .wallet-mini-btn {
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.55);
    color: rgba(0,0,0,0.7);
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

#page-chat .wallet-balance-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 12px;
}

#page-chat .wallet-balance-currency {
    font-size: 16px;
    font-weight: 800;
    color: rgba(0,0,0,0.62);
}

#page-chat .wallet-balance-amount {
    font-size: 34px;
    font-weight: 900;
    color: #1c1c1c;
    letter-spacing: 0.6px;
}

#page-chat .wallet-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

#page-chat .wallet-primary-btn,
#page-chat .wallet-secondary-btn {
    flex: 1;
    border: 1px solid rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.45);
    color: #2a2a2a;
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#page-chat .wallet-primary-btn {
    background: linear-gradient(135deg, rgba(255, 230, 210, 0.75), rgba(255,255,255,0.45));
}

#page-chat .wallet-card-footnote {
    margin-top: 10px;
    font-size: 11px;
    color: rgba(0,0,0,0.46);
    line-height: 1.35;
}

/* 个人页 · 拍一拍（毛玻璃 + 拟态内凹输入） */
#page-chat .personal-poke-glass-card {
    margin: 0 6px 14px;
    padding: 16px 14px 14px;
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.22));
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow:
        0 20px 44px rgba(30, 40, 60, 0.1),
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 -2px 12px rgba(255, 255, 255, 0.35) inset;
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    position: relative;
    overflow: hidden;
}

#page-chat .personal-poke-glass-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(120% 80% at 10% 0%, rgba(255, 220, 200, 0.35), transparent 55%),
        radial-gradient(90% 70% at 100% 100%, rgba(200, 220, 255, 0.28), transparent 50%);
    opacity: 0.9;
}

#page-chat .personal-poke-card-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#page-chat .personal-poke-card-title {
    font-size: 14px;
    font-weight: 800;
    color: rgba(30, 30, 35, 0.88);
    letter-spacing: 0.3px;
}

#page-chat .personal-poke-card-badge {
    font-size: 10px;
    font-weight: 700;
    color: rgba(60, 80, 120, 0.75);
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.06), -1px -1px 6px rgba(255, 255, 255, 0.85);
}

#page-chat .personal-poke-card-desc {
    position: relative;
    z-index: 1;
    margin: 10px 0 12px;
    font-size: 11px;
    line-height: 1.5;
    color: rgba(0, 0, 0, 0.5);
}

#page-chat .personal-poke-row {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

#page-chat .personal-poke-input {
    flex: 1;
    min-width: 88px;
    padding: 10px 12px;
    font-size: 13px;
    color: #2a2a2a;
    border: none;
    border-radius: 14px;
    background: rgba(245, 246, 250, 0.85);
    box-shadow:
        inset 3px 3px 8px rgba(0, 0, 0, 0.07),
        inset -2px -2px 10px rgba(255, 255, 255, 0.95),
        0 1px 0 rgba(255, 255, 255, 0.8);
    outline: none;
    transition: box-shadow 0.2s ease, background 0.2s ease;
}

#page-chat .personal-poke-input:focus {
    background: rgba(255, 255, 255, 0.92);
    box-shadow:
        inset 4px 4px 10px rgba(0, 0, 0, 0.08),
        inset -2px -2px 12px rgba(255, 255, 255, 1),
        0 0 0 2px rgba(180, 200, 255, 0.35);
}

#page-chat .personal-poke-connector {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.45);
}

#page-chat .personal-poke-preview-wrap {
    position: relative;
    z-index: 1;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: inset 2px 2px 6px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#page-chat .personal-poke-preview-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

#page-chat .personal-poke-preview-text {
    font-size: 13px;
    font-weight: 700;
    color: rgba(40, 45, 55, 0.9);
    letter-spacing: 0.02em;
}

#page-chat .personal-poke-save-btn {
    position: relative;
    z-index: 1;
    width: 100%;
    margin-top: 12px;
    padding: 11px 14px;
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 14px;
    font-size: 13px;
    font-weight: 800;
    color: #2a2a2a;
    cursor: pointer;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 245, 235, 0.55));
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.08),
        0 1px 0 rgba(255, 255, 255, 0.95) inset;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#page-chat .personal-poke-save-btn:active {
    transform: scale(0.98);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

#page-chat .personal-poke-save-hint {
    position: relative;
    z-index: 1;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #1f9d55;
    margin-top: 8px;
    min-height: 16px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

#page-chat .personal-section {
    margin: 12px 6px 0;
}

#page-chat .personal-section-title {
    font-size: 12px;
    font-weight: 800;
    color: rgba(0,0,0,0.55);
    padding: 8px 2px;
}

#page-chat .personal-quick-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#page-chat .personal-quick-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 12px;
    border-radius: 16px;
    background: rgba(255,255,255,0.42);
    border: 1px solid rgba(255,255,255,0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 10px 26px rgba(0,0,0,0.06);
    cursor: pointer;
}

#page-chat .personal-quick-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

#page-chat .personal-quick-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 900;
    color: rgba(0,0,0,0.65);
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(0,0,0,0.06);
}

#page-chat .personal-quick-text {
    min-width: 0;
}

#page-chat .personal-quick-name {
    font-size: 14px;
    font-weight: 900;
    color: #2a2a2a;
}

#page-chat .personal-quick-desc {
    font-size: 12px;
    color: rgba(0,0,0,0.48);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

#page-chat .personal-quick-arrow {
    font-size: 18px;
    color: rgba(0,0,0,0.25);
    font-weight: 900;
}

#page-chat .message-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Transfer card bubble */
.msg-bubble-transfer {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.transfer-card {
    min-width: 210px;
    max-width: 260px;
    border-radius: 18px;
    padding: 12px 14px 10px;
    background: linear-gradient(135deg, rgba(255,255,255,0.76), rgba(255,245,230,0.9));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow: 0 14px 30px rgba(0,0,0,0.10);
}

.transfer-card-header {
    display:flex;
    align-items:center;
    gap:8px;
    margin-bottom:6px;
}

.transfer-card-tag {
    font-size:11px;
    padding:2px 8px;
    border-radius:999px;
    border:1px solid currentColor;
    background: rgba(255,255,255,0.8);
}

.transfer-card-title {
    font-size:12px;
    color:rgba(0,0,0,0.65);
    font-weight:600;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.transfer-card-amount {
    margin-top:4px;
    font-size:24px;
    font-weight:900;
    color:#262626;
}

.transfer-card-remark {
    margin-top:4px;
    font-size:12px;
    color:rgba(0,0,0,0.55);
}

/* Red envelope card bubble */
.msg-bubble-red-envelope {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.red-envelope-card {
    min-width: 210px;
    max-width: 260px;
    border-radius: 18px;
    padding: 12px 14px 10px;
    background: linear-gradient(135deg, rgba(255, 205, 205, 0.62), rgba(255, 248, 236, 0.95));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,0.86);
    box-shadow: 0 18px 40px rgba(204, 0, 51, 0.10);
    position: relative;
    overflow: hidden;
}

.red-envelope-card::before {
    content: "";
    position: absolute;
    inset: -20px;
    background:
        radial-gradient(circle at 20% 15%, rgba(255, 214, 214, 0.9), transparent 45%),
        radial-gradient(circle at 70% 80%, rgba(255, 195, 120, 0.35), transparent 50%),
        linear-gradient(transparent, rgba(255,255,255,0.22));
    pointer-events: none;
}

.red-envelope-card::after {
    content: "";
    position: absolute;
    top: -35px;
    right: -35px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.85), rgba(255, 0, 80, 0.15) 42%, transparent 68%);
    filter: blur(1px);
    pointer-events: none;
}

.red-envelope-card--burst {
    animation: redEnvelopePop 0.9s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.red-envelope-card--burst::before {
    animation: redEnvelopeBurst 0.9s ease-out;
}

@keyframes redEnvelopePop {
    0% { transform: scale(1) rotate(0deg); }
    35% { transform: scale(1.04) rotate(-1deg); }
    70% { transform: scale(0.99) rotate(1deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes redEnvelopeBurst {
    0% { opacity: 0.0; transform: scale(0.85); }
    30% { opacity: 0.8; transform: scale(1.02); }
    100% { opacity: 0; transform: scale(1.12); }
}

.red-envelope-card-inner {
    position: relative;
    z-index: 1;
}

.red-envelope-card-header {
    display:flex;
    align-items:center;
    gap:8px;
    margin-bottom:6px;
}

.red-envelope-card-tag {
    font-size:11px;
    padding:2px 8px;
    border-radius:999px;
    border:1px solid currentColor;
    background: rgba(255,255,255,0.82);
    white-space: nowrap;
}

.red-envelope-card-title {
    font-size:12px;
    color:rgba(0,0,0,0.65);
    font-weight:600;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.red-envelope-card-amount {
    margin-top:4px;
    font-size:24px;
    font-weight:950;
    color:#7a0018;
    letter-spacing:0.2px;
}

.red-envelope-card-meta {
    margin-top:4px;
    font-size:12px;
    color:rgba(0,0,0,0.55);
}

.red-envelope-card-remark {
    margin-top:4px;
    font-size:12px;
    color:rgba(0,0,0,0.55);
}

.red-envelope-claim-btn {
    margin-top:10px;
    width:100%;
    border:none;
    border-radius:12px;
    padding:8px 0;
    font-size:13px;
    font-weight:800;
    background: linear-gradient(135deg, #ffe7ba, #fff1b8);
    color:#8c6b26;
    cursor:pointer;
    box-shadow: 0 10px 24px rgba(140,107,38,0.18);
    position: relative;
    overflow: hidden;
}

.red-envelope-claim-btn::before {
    content: "";
    position: absolute;
    inset: -40px;
    background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.55), transparent 50%);
    transform: translateX(-30%);
    opacity: 0.65;
}

.red-envelope-claim-btn:active {
    transform: translateY(1px) scale(0.99);
}

#page-chat .message-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    margin: 8px 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    cursor: pointer;
}
#page-chat .message-item:last-child {
    border-bottom: none;
}

#page-chat .msg-avatar {
    width: 46px;
    height: 46px;
    background: #f1eeea;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

#page-chat .msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#page-chat .msg-info {
    flex: 1;
}

#page-chat .msg-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ins-text);
    margin-bottom: 4px;
}

#page-chat .msg-preview {
    font-size: 12px;
    color: #8f827a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#page-chat .contact-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

#page-chat .contact-group-title {
    font-size: 12px;
    color: #9d9086;
    margin: 10px 5px 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

#page-chat .contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    margin: 8px 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    cursor: pointer;
}
#page-chat .contact-item:last-child {
    border-bottom: none;
}

#page-chat .contact-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #f1eeea;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

#page-chat .contact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#page-chat .contact-info {
    flex: 1;
}

#page-chat .contact-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--ins-text);
    margin-bottom: 2px;
}

#page-chat .contact-remark {
    font-size: 11px;
    color: #9a8f87;
}

.hidden {
    display: none !important;
}

.header-btn {
    text-decoration: none;
    color: #6b5f57;
    font-size: 20px;
    padding: 5px;
    cursor: pointer;
}

body.chat-beautify-custom #page-chat .screen,
body.chat-beautify-custom #page-chat-window #chat-container {
    background: var(--chat-bg, #f5f3f0);
}

body.chat-beautify-custom #page-chat .chat-header,
body.chat-beautify-custom #page-chat .chat-tabs,
body.chat-beautify-custom #page-chat-window .chat-header,
body.chat-beautify-custom #page-chat-window .input-wrapper {
    background: var(--chat-surface, #ffffff);
    border-color: var(--chat-border, rgba(120,112,104,0.18));
    box-shadow: none;
}

body.chat-beautify-custom #page-chat .message-item,
body.chat-beautify-custom #page-chat .contact-item {
    background: transparent;
    border-bottom-color: var(--chat-border, rgba(120,112,104,0.18));
    box-shadow: none;
}

body.chat-beautify-custom #page-chat-window .msg-bubble {
    background: var(--chat-surface, #ffffff);
    border: 1px solid var(--chat-border, rgba(120,112,104,0.18));
    box-shadow: none;
}

body.chat-beautify-custom #page-chat-window #input-box {
    background: var(--chat-input, #f9f6f2);
    border-color: var(--chat-border, rgba(120,112,104,0.18));
}

body.chat-beautify-custom #page-chat-window .send-btn {
    background: var(--chat-accent, #2b2b2b);
    color: #fff;
    box-shadow: none;
}

body.chat-beautify-custom #page-chat .chat-tab-icon {
    border: none;
    background-color: transparent;
}
body.chat-beautify-custom #page-chat .icon-message::after,
body.chat-beautify-custom #page-chat .icon-contacts::before,
body.chat-beautify-custom #page-chat .icon-contacts::after,
body.chat-beautify-custom #page-chat .icon-moments::after {
    content: none;
}

body.chat-beautify-custom #page-chat .msg-avatar,
body.chat-beautify-custom #page-chat .contact-avatar,
body.chat-beautify-custom #page-chat-window .msg-avatar {
    border-radius: 50%;
    overflow: hidden;
}
body.chat-beautify-custom #page-chat .msg-avatar img,
body.chat-beautify-custom #page-chat .contact-avatar img,
body.chat-beautify-custom #page-chat-window .msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- chat_window.html Styles --- */
#page-chat-window {
    background-color: var(--ins-bg);
}

#page-chat-window #chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    background: transparent;
    background-size: cover;
    background-position: center;
    transition: background 0.3s;
}
#page-chat-window .chat-header {
    height: 60px;
    background: rgba(255,255,255,0.94);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--ins-border);
}
#page-chat-window .chat-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ins-text);
}
#page-chat-window .header-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b5f57;
    border: 1px solid var(--ins-border);
    background: rgba(255,255,255,0.8);
}
#page-chat-window .header-btn.icon-back {
    font-size: 18px;
    font-weight: 600;
}

#page-chat-window #msg-area { 
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px; 
    scroll-behavior: smooth; 
    scrollbar-width: none;
    -ms-overflow-style: none;
}
#page-chat-window #msg-area::-webkit-scrollbar { display: none; }

#page-chat-window #load-more-btn { 
    text-align: center;
    color: #b08f78;
    cursor: pointer;
    padding: 8px 14px;
    font-size: 12px; 
    background: rgba(255,255,255,0.7);
    border-radius: 999px;
    width: fit-content;
    margin: 0 auto;
    border: 1px solid var(--ins-border);
}

#page-chat-window .msg-row {
    display: flex;
    gap: 10px;
    max-width: 85%;
    align-items: flex-start;
    animation: fadeIn 0.3s ease;
    position: relative;
    transition: transform 0.2s;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

#page-chat-window .msg-row.user { align-self: flex-end; flex-direction: row-reverse; }
#page-chat-window .msg-row.ai { align-self: flex-start; }

#page-chat-window .msg-content-wrapper {
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 52px);
    flex: 1;
}
#page-chat-window .msg-row.ai .msg-content-wrapper { align-items: flex-start; }
#page-chat-window .msg-row.user .msg-content-wrapper { align-items: flex-end; }

#page-chat-window .quote-bubble {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 16px 16px 16px 4px;
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
    max-width: 80%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    border: 1px solid rgba(255,255,255,0.8);
    word-break: break-word;
}
#page-chat-window .msg-row.user .quote-bubble {
    border-radius: 16px 16px 4px 16px;
    background: rgba(241, 231, 221, 0.6);
}

#page-chat-window .msg-avatar { 
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid var(--ins-border);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    cursor: pointer; 
    transition: transform 0.2s;
    margin-top: 2px; 
}
#page-chat-window .msg-avatar:active { transform: scale(0.9); }
#page-chat-window .msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

#page-chat-window .msg-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 6px 14px rgba(0,0,0,0.05);
    max-width: 100%;
    user-select: text;
    border: 1px solid var(--ins-border);
    background: rgba(255,255,255,0.96);
    color: var(--ins-text);
}
#page-chat-window .msg-row.user .msg-bubble { 
    background: #f1e7dd;
    color: #4f3e34;
    border-top-right-radius: 6px; 
}
#page-chat-window .msg-row.ai .msg-bubble { 
    background: #ffffff;
    color: var(--ins-text);
    border-top-left-radius: 6px; 
}

#page-chat-window .select-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #b08f78;
    display: none;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}
#page-chat-window .select-checkbox.checked { background: #b08f78; }
#page-chat-window .select-checkbox.checked::after { content: '✔'; color: white; font-size: 12px; }

body.select-mode .msg-row.user { flex-direction: row-reverse; }
body.select-mode .select-checkbox { display: flex; }
body.select-mode .msg-bubble { user-select: none; pointer-events: none; }
/* In select mode we still want "一起看" to be clickable. */
body.select-mode #page-chat-window .msg-bubble-book-share {
    pointer-events: auto !important;
}
body.select-mode #page-chat-window .msg-bubble-book-share .book-share-read-btn,
body.select-mode #page-chat-window .msg-bubble-book-share .book-share-desc-container {
    pointer-events: auto !important;
}

/* Always allow clicking on together-read card buttons */
#page-chat-window .msg-bubble-book-share .book-share-read-btn,
#page-chat-window .msg-bubble-book-share .book-share-desc-container {
    pointer-events: auto !important;
}

/* Ensure together-read overlay always above debug errors and clickable. */
#together-read-overlay {
    z-index: 200000 !important;
    pointer-events: auto !important;
}

#page-chat-window .input-wrapper {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid var(--ins-border);
    z-index: 100;
    width: 100%;
}

#page-chat-window .input-area {
    padding: 10px 14px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    min-height: 60px;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}

#page-chat-window .icon-btn {
    font-size: 24px;
    cursor: pointer;
    color: #6b5f57;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#page-chat-window .strawberry-btn { font-size: 26px; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.08)); }

/* --- Sticker Panel Styles --- */
.sticker-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(300px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #f5f5f5;
    z-index: 151; /* Above plus menu */
    display: none;
    flex-direction: column;
    border-top: 1px solid #ddd;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
}
.sticker-panel.active {
    display: flex;
}
.sticker-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 0 10px;
    height: 40px;
    border-bottom: 1px solid #ddd;
}
.sticker-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    flex-grow: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sticker-tabs::-webkit-scrollbar { display: none; }
.sticker-tab {
    padding: 10px 15px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    white-space: nowrap;
}
.sticker-tab.active {
    color: #b08f78;
    font-weight: bold;
    border-bottom: 2px solid #b08f78;
}
.close-sticker-btn {
    padding: 10px;
    cursor: pointer;
    color: #999;
    font-size: 16px;
}
.sticker-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 10px;
}
.sticker-item {
    width: calc(25% - 7.5px);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    border: 1px solid #eee;
    position: relative;
}
.sticker-item::before {
    content: "";
    display: block;
    padding-top: 100%;
}
.sticker-item img, .sticker-item .sticker-add-btn-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #999;
}
.sticker-item.sticker-add-btn {
    background: transparent;
    border: 1px dashed #ccc;
}
.chat-sticker-img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 10px;
    display: inline-block;
    vertical-align: middle;
    margin: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.icon-unified {
    width: 22px;
    height: 22px;
    border: 1.6px solid currentColor;
    border-radius: 6px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b5f57;
}
#btn-settings.icon-unified {
    border-radius: 7px;
}
#btn-settings.icon-unified::before {
    content: "";
    position: absolute;
    inset: 4px;
    border: 1.6px solid currentColor;
    border-radius: 50%;
}
#btn-settings.icon-unified::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 1.6px;
    background: currentColor;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}
#btn-strawberry.icon-unified {
    border-radius: 50%;
}
#btn-strawberry.icon-unified::before {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.18;
}
#btn-strawberry.icon-unified::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 1.6px;
    background: currentColor;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#page-chat-window #input-box {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 18px;
    padding: 10px 14px;
    font-size: 15px;
    max-height: 120px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    resize: none;
    color: var(--ins-text);
    user-select: text;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
#page-chat-window #input-box:focus { outline: none; border-color: rgba(255, 255, 255, 0.8); background: rgba(255, 255, 255, 0.8); }

#page-chat-window .send-btn {
    background: rgba(255, 255, 255, 0.6);
    color: #333;
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 18px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    height: 38px;
    align-self: center;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

#quote-bar { display: none; padding: 8px 15px; background: #fff0f5; font-size: 12px; color: #888; border-bottom: 1px solid #ffecec; justify-content: space-between; align-items: center; }

#context-menu {
    position: absolute; background: #fff; border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    padding: 5px; display: none; z-index: 200; flex-direction: column; min-width: 100px;
}
.ctx-item { padding: 10px 15px; font-size: 14px; color: #333; cursor: pointer; border-radius: 5px; }
.ctx-item:active { background: #f5f5f5; }

#delete-bar {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 60px;
    background: #fff; display: none; align-items: center; justify-content: space-between;
    padding: 0 20px; box-shadow: 0 -2px 10px rgba(0,0,0,0.05); z-index: 101;
}

.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 200; justify-content: center; align-items: center; backdrop-filter: blur(2px); }
.modal.active { display: flex !important; }
.modal-content { background: #fff; width: 90%; max-width: 380px; border-radius: 25px; padding: 25px; max-height: 85vh; overflow-y: auto; }

.api-error-modal {
    width: 92%;
    max-width: 420px;
    max-height: 88vh;
    padding: 22px;
}
.api-error-intro {
    font-size: 12px;
    color: #777;
    margin-bottom: 16px;
    line-height: 1.6;
}
.api-error-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.api-error-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(248,248,248,0.95);
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 6px 14px rgba(0,0,0,0.05);
}
.api-error-code {
    min-width: 64px;
    height: 32px;
    border-radius: 10px;
    background: #fff0f5;
    color: #cc0033;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 1px solid rgba(204,0,51,0.2);
}
.api-error-title {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}
.api-error-body p {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
    line-height: 1.5;
}
.api-error-body ul {
    padding-left: 18px;
    font-size: 11px;
    color: #666;
    line-height: 1.5;
}
.api-error-body code {
    background: rgba(0,0,0,0.05);
    padding: 1px 4px;
    border-radius: 4px;
}
#page-chat-window #modal-settings {
    align-items: stretch;
    justify-content: stretch;
}
#page-chat-window #modal-settings .modal-content {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    padding: 24px;
}
.modal h3 { margin-top: 0; margin-bottom: 20px; border-bottom: 2px dashed #ffecec; padding-bottom: 10px; color: #5d3a3a; display:flex; justify-content:space-between; }

.modal .setting-item { margin-bottom: 18px; }
.modal .setting-item label { display: block; font-size: 14px; color: #888; margin-bottom: 8px; font-weight: bold; }
.modal .setting-item input, .modal .setting-item textarea { width: 100%; padding: 10px; border: 1px solid #eee; border-radius: 10px; background: #fdfdfd; font-size: 14px; }

.range-input { display: flex; align-items: center; gap: 5px; }
.range-input input { width: 60px !important; text-align: center; }

#page-chat-window #plus-menu {
    position: absolute; 
    bottom: calc(76px + env(safe-area-inset-bottom, 0px)); 
    left: 12px; 
    right: 12px; 
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 20px; 
    padding: 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08); 
    display: none; 
    z-index: 150;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 8px;
}
#page-chat-window #plus-menu.active {
    display: grid !important;
}
.menu-item { 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 4px; 
    border-radius: 12px; 
    cursor: pointer; 
    color: #5d5d5d;
    font-size: 11px; 
    background: transparent;
    transition: all 0.2s ease;
    gap: 8px;
}
.menu-item:active { 
    background: rgba(0,0,0,0.04); 
    transform: scale(0.96);
}

/* Plus Menu Icons */
.menu-icon {
    width: 24px;
    height: 24px;
    position: relative;
    color: #4a4a4a;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 1. 对话总结 (Document lines) */
.icon-summary {
    border: 2px solid currentColor;
    border-radius: 4px;
    width: 20px; 
    height: 22px;
}
.icon-summary::before {
    content: ""; position: absolute; top: 4px; left: 3px; width: 10px; height: 2px; background: currentColor; border-radius: 1px;
}
.icon-summary::after {
    content: ""; position: absolute; top: 9px; left: 3px; width: 10px; height: 2px; background: currentColor; border-radius: 1px;
    box-shadow: 0 5px 0 currentColor;
}

/* 2. 重新回复 (Regenerate / Refresh) */
.icon-regenerate {
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    width: 20px; 
    height: 20px;
}
.icon-regenerate::after {
    content: ""; position: absolute; top: -4px; right: -2px; 
    border: 4px solid transparent; border-left-color: currentColor; border-top-color: currentColor;
    transform: rotate(45deg);
}

/* 3. 表情包 (Smiley Face) — 双眼与嘴相对圆心对称，避免嘴歪 */
.icon-emoji {
    border: 2px solid currentColor;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    box-sizing: border-box;
}
.icon-emoji::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 50%;
    width: 2px;
    height: 2px;
    /* 圆心 11px：两眼中心在 8px 与 14px，间距 6px */
    margin-left: -4px;
    background: currentColor;
    border-radius: 50%;
    box-shadow: 6px 0 0 currentColor;
}
.icon-emoji::after {
    content: "";
    position: absolute;
    bottom: 4px;
    left: 50%;
    width: 8px;
    height: 4px;
    margin-left: -4px; /* 嘴宽 8px，相对 22px 圆水平居中 */
    box-sizing: border-box;
    border: 2px solid currentColor;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

/* 4. 视频通话 (Video Camera) */
.icon-video {
    border: 2px solid currentColor;
    border-radius: 4px;
    width: 16px; 
    height: 12px;
    margin-left: -4px;
}
.icon-video::after {
    content: ""; position: absolute; right: -7px; top: 1px;
    border-top: 3px solid transparent; border-bottom: 3px solid transparent; border-left: 4px solid currentColor;
}

/* 5. 语音通话 (Phone/Audio) */
.icon-audio {
    width: 18px; 
    height: 18px;
    border: 2px solid currentColor;
    border-top: none; 
    border-left: none;
    border-radius: 0 0 6px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}
.icon-audio::before {
    content: ""; position: absolute; top: -3px; right: -2px; width: 6px; height: 6px; background: currentColor; border-radius: 3px;
}
.icon-audio::after {
    content: ""; position: absolute; bottom: -2px; left: -3px; width: 6px; height: 6px; background: currentColor; border-radius: 3px;
}

/* 6. 语音 (Microphone) */
.icon-voice {
    border: 2px solid currentColor;
    border-radius: 6px;
    width: 10px; 
    height: 14px;
    margin-top: -4px;
}
.icon-voice::before {
    content: ""; position: absolute; bottom: -5px; left: -5px; width: 14px; height: 8px;
    border: 2px solid currentColor; border-top: none; border-radius: 0 0 10px 10px;
}
.icon-voice::after {
    content: ""; position: absolute; bottom: -8px; left: 2px; width: 2px; height: 4px; background: currentColor;
}

/* 7. 图片 (Image) */
.icon-image-menu {
    border: 2px solid currentColor;
    border-radius: 4px;
    width: 22px; 
    height: 18px;
    overflow: hidden;
}
.icon-image-menu::before {
    content: ""; position: absolute; top: 2px; right: 3px; width: 3px; height: 3px; background: currentColor; border-radius: 50%;
}
.icon-image-menu::after {
    content: ""; position: absolute; bottom: -6px; left: -2px; width: 12px; height: 12px;
    border: 2px solid currentColor; transform: rotate(45deg); 
}

/* 8. 转账 (Transfer / Currency) */
.icon-transfer {
    width: 20px; 
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.icon-transfer::before {
    content: "¥"; font-size: 13px; font-weight: bold; line-height: 1; margin-top: 1px;
}

/* 8.x 红包 (Red Envelope) */
.icon-red-envelope {
    width: 20px;
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}
.icon-red-envelope::before {
    content: "红包";
    font-size: 7px;
    font-weight: 950;
    line-height: 1;
}
.icon-red-envelope::after {
    content: "";
    position: absolute;
    width: 0;
    height: 0;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid currentColor;
    opacity: 0.25;
    pointer-events: none;
}

/* 9. 定位 (Location Map Pin) */
.icon-location {
    width: 16px; 
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    margin-top: -4px;
}
.icon-location::before {
    content: ""; position: absolute; top: 3px; left: 3px; width: 6px; height: 6px; border: 2px solid currentColor; border-radius: 50%;
}

/* 10. 拍一拍 (Poke) */
.icon-poke {
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-radius: 50%;
}
.icon-poke::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 7px;
    width: 4px;
    height: 8px;
    border: 2px solid currentColor;
    border-radius: 3px;
    transform: rotate(18deg);
}
.icon-poke::after {
    content: "";
    position: absolute;
    top: 11px;
    left: 4px;
    width: 10px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transform: rotate(-18deg);
}

/* 11. 见面 (Meet) */
.icon-meet {
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-radius: 6px;
    position: relative;
}
.icon-meet::before {
    content: "";
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    top: 3px;
    left: 4px;
    background: currentColor;
    opacity: 0.35;
    box-shadow: 8px 8px 0 currentColor;
}
.icon-meet::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 11px;
    width: 10px;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.22;
}

/* 12. 一起看 (Book — 与加号面板其他项一致的线框风格) */
.icon-together-read {
    width: 16px;
    height: 18px;
    box-sizing: border-box;
    border: 2px solid currentColor;
    border-radius: 0 4px 4px 0;
    border-left-width: 3px;
    position: relative;
}
.icon-together-read::before {
    content: "";
    position: absolute;
    top: 4px;
    right: 2px;
    width: 6px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    box-shadow: 0 4px 0 currentColor;
}

.summary-card { background: #fff9c4; border-radius: 10px; padding: 10px; margin-bottom: 10px; font-size: 13px; color: #5d4037; }

#debug-toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); background: rgba(255, 135, 135, 0.9); color: white; padding: 8px 16px; border-radius: 20px; font-size: 13px; display: none; z-index: 999; }
.bg-preview { width: 100%; height: 100px; object-fit: cover; border-radius: 10px; margin-top: 5px; display: none; }

/* --- user_settings.html Styles --- */
.preset-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.preset-item { background: var(--ins-card); padding: 16px; border-radius: 14px; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--ins-border); cursor: pointer; box-shadow: 0 8px 18px rgba(0,0,0,0.04); }
.preset-info h3 { font-size: 16px; margin-bottom: 5px; color: var(--ins-text); }
.preset-info p { font-size: 12px; color: #7c726a; margin: 0; }
.preset-actions button { background: none; border: none; font-size: 18px; cursor: pointer; padding: 5px; color: #7c726a; }
.add-preset-btn { background: #222; color: white; border: none; width: 100%; padding: 12px; border-radius: 999px; font-size: 15px; margin-bottom: 20px; cursor: pointer; letter-spacing: 0.5px; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 14px; color: #555; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }
.relationship-list { margin-top: 10px; border-top: 1px dashed #eee; padding-top: 10px; }
.relation-item { background: #f5f5f5; padding: 10px; border-radius: 8px; margin-bottom: 8px; font-size: 13px; display: flex; justify-content: space-between; }
.ai-gen-section { background: #e3f2fd; padding: 15px; border-radius: 10px; margin-top: 15px; }
.ai-gen-btn { background: rgba(255, 255, 255, 0.6); color: #333; border: 1px solid rgba(255, 255, 255, 0.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 4px 15px rgba(0,0,0,0.05); padding: 8px 15px; border-radius: 20px; font-size: 12px; cursor: pointer; font-weight: 600; }
#debug-info { font-size: 10px; color: red; background: #ffe; padding: 5px; margin-bottom: 10px; border: 1px solid red; display: none; }

.wb-select-container { border: 1px solid #eee; border-radius: 10px; padding: 10px; background: #f9f9f9; max-height: 300px; overflow-y: auto; }
.wb-category-item { margin-bottom: 10px; }
.wb-cat-header { display: flex; align-items: center; padding: 8px; background: #eef; border-radius: 6px; cursor: pointer; }
.wb-cat-header input[type="checkbox"] { width: auto; margin-right: 10px; }
.wb-entries-list { padding-left: 20px; margin-top: 5px; display: none; }
.wb-entries-list.expanded { display: block; }
.wb-entry-item { display: flex; align-items: center; padding: 5px 0; font-size: 13px; }
.wb-entry-item input[type="checkbox"] { width: auto; margin-right: 8px; }
.floating-save-btn { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: 90%; background: rgba(255, 255, 255, 0.6); color: #333; border: 1px solid rgba(255, 255, 255, 0.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 15px; border-radius: 30px; font-size: 18px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); z-index: 100; font-weight: 600; }

.beautify-page {
    padding: 20px;
    color: var(--ins-text);
    overflow-y: auto;
    height: 100%;
    background: var(--ins-bg);
}
.chat-beautify-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}
.chat-beautify-panel {
    background: var(--ins-card);
    border: 1px solid var(--ins-border);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chat-beautify-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--ins-text);
}
#chat-beautify-template,
#chat-beautify-code {
    width: 100%;
    min-height: 200px;
    border-radius: 12px;
    border: 1px solid var(--ins-border);
    background: rgba(255,255,255,0.9);
    color: var(--ins-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
#page-user-settings .settings-page {
    background: transparent;
    color: var(--ins-text);
}
#page-user-settings .settings-section,
#page-user-settings .preset-item,
#page-user-settings .ai-gen-section {
    background: var(--ins-card);
    border: 1px solid var(--ins-border);
    box-shadow: 0 10px 22px rgba(0,0,0,0.04);
}
#page-user-settings .settings-button {
    background: #2b2b2b;
    color: #fff;
    border-radius: 999px;
    border: 1px solid #2b2b2b;
}
#page-user-settings .back-button {
    color: var(--ins-text);
}
#page-user-settings #edit-modal .modal-content {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    padding: 24px;
}
#page-user-settings #edit-modal {
    align-items: stretch;
    justify-content: stretch;
}
.theme-selection, .icon-customization, .css-customization {
    background: var(--widget-bg);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}
.theme-selection h2, .icon-customization h2, .css-customization h2 {
    font-size: 18px;
    margin-bottom: 15px;
}
.theme-buttons {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}
.theme-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    color: white;
    flex-grow: 1;
}
#theme-strawberry { background-color: #ffb3b3; }
#theme-orange { background-color: #ffc8a9; }
#theme-watermelon { background-color: #a8d8b5; }

.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 15px;
}
.icon-setter {
    text-align: center;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}
.icon-setter .icon-preview-container {
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
}
.icon-setter .icon-preview {
    width: 50px;
    height: 50px;
    background: var(--icon-gradient);
    border-radius: 50%;
    cursor: pointer;
    transition: width 0.1s, height 0.1s;
}
.icon-size-slider {
    width: 80%;
    margin-top: 5px;
}
#custom-css {
    width: 100%;
    height: 150px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(255,255,255,0.5);
    color: var(--font-color);
    font-family: monospace;
    resize: vertical;
}

.worldbook-page {
    padding: 20px;
    color: var(--font-color);
    overflow-y: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--ins-bg);
}

.wb-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.wb-category-list {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.wb-category {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid rgba(0,0,0,0.05);
}

.wb-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
}

.wb-category-title {
    font-weight: bold;
    font-size: 16px;
}

.wb-entries {
    display: none; 
    flex-direction: column;
    gap: 10px;
    padding-left: 10px;
    border-left: 2px solid rgba(0,0,0,0.1);
}

.wb-category.expanded .wb-entries {
    display: flex;
}

.wb-entry {
    background: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wb-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
    color: white;
}
.tag-global { background-color: #28a745; }
.tag-role { background-color: #007bff; }
.tag-pos-top { background-color: #dc3545; }
.tag-pos-pre { background-color: #ffc107; color: black; }
.tag-pos-post { background-color: #17a2b8; }

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.role-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
    border: 1px solid #eee;
    padding: 5px;
    border-radius: 8px;
    min-height: 40px;
}
.role-chip {
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
}
.role-chip.selected {
    background: #007bff;
    color: white;
}

.regex-page {
    padding: 20px;
    color: var(--font-color);
    overflow-y: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--ins-bg);
}

.rx-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.rx-list {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 80px;
}

.rx-item {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
    overflow: hidden;
    transition: all 0.3s ease;
}

.rx-item.disabled {
    background: rgba(240, 240, 240, 0.9);
    opacity: 0.8;
}

.rx-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: rgba(255,255,255,0.5);
}

.rx-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
}

.rx-name {
    font-weight: bold;
    font-size: 15px;
    color: #333;
}

.rx-preview-text {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.rx-expand-icon {
    transition: transform 0.3s;
    font-size: 12px;
    color: #999;
    margin-left: 10px;
}
.rx-item.expanded .rx-expand-icon {
    transform: rotate(180deg);
}

.rx-body {
    display: none;
    padding: 15px;
    border-top: 1px solid rgba(0,0,0,0.05);
    background: rgba(255,255,255,0.3);
}
.rx-item.expanded .rx-body {
    display: block;
}

.rx-detail-row {
    margin-bottom: 10px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.rx-label { color: #666; font-size: 12px; }
.rx-code {
    font-family: monospace;
    background: rgba(0,0,0,0.05);
    padding: 4px 8px;
    border-radius: 4px;
    color: #d63384;
    word-break: break-all;
}

.rx-test-zone {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #ccc;
}
.rx-test-input, .rx-test-output {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 5px;
    box-sizing: border-box;
}
.rx-test-output {
    background: #f8f9fa;
    color: #28a745;
    min-height: 20px;
}

.rx-btn-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}
.rx-btn-row .edit-btn {
    padding: 6px 15px;
    background: var(--ins-accent);
    color: var(--ins-text);
    border: 1px solid var(--ins-border);
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
}

.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
    flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider { background-color: #28a745; }
input:checked + .slider:before { transform: translateX(14px); }

.thought-modal-content {
    display: flex;
    flex-direction: column;
    padding: 0; 
    background-size: cover;
    background-position: center;
    border-radius: 20px;
    overflow: hidden;
    width: 90%;
    max-width: 340px;
    min-height: 400px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.thought-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 20px 10px 20px;
    z-index: 2;
}

.kaomoji-btn {
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.kaomoji-btn:hover { opacity: 1; transform: scale(1.1); }

.thought-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.thought-title {
    font-size: 14px;
    font-weight: bold;
}

.thought-style-name {
    font-size: 10px;
    opacity: 0.7;
}

.thought-separator {
    height: 1px;
    width: 80%;
    margin: 0 auto;
    opacity: 0.3;
}

.thought-display-area {
    padding: 20px;
    font-size: 15px;
    line-height: 1.6;
    min-height: 100px;
    flex-grow: 1;
    overflow-y: auto;
    white-space: pre-wrap;
    text-align: justify;
    z-index: 2;
}

.thought-content-shell {
    padding: 14px 18px 10px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.thought-panels {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
.thought-panel {
    position: relative;
    padding: 18px 16px 16px;
    border-radius: 18px;
    background: rgba(255,255,255,0.75);
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: inherit;
}
.thought-panel-body {
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    text-align: left;
}
.thought-panel-label {
    position: absolute;
    top: -12px;
    left: 16px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.12);
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}

.thought-history-toggle {
    padding: 10px;
    text-align: center;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.8;
    z-index: 2;
}

.thought-history-list {
    max-height: 150px;
    overflow-y: auto;
    padding: 10px 20px 20px;
    background: rgba(255,255,255,0.3);
    font-size: 12px;
}

.thought-history-item {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(0,0,0,0.1);
}
.thought-history-time { font-size: 10px; opacity: 0.6; display: block; margin-bottom: 2px; }

.close-btn-round {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    background: rgba(0,0,0,0.1);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    cursor: pointer;
    font-size: 16px;
    z-index: 30;
}

/* Custom Checkbox for Worldbook */
.wb-custom-checkbox {
    display: none;
}
.wb-checkbox-label {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #b08f78;
    cursor: pointer;
    position: relative;
    background: transparent;
    transition: all 0.2s ease;
}
.wb-custom-checkbox:checked + .wb-checkbox-label {
    background: #b08f78;
    border-color: #b08f78;
}
.wb-custom-checkbox:checked + .wb-checkbox-label::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

/* --- THEMES --- */

/* 1. 梦幻飘雪 (theme-snow-dream) */
@keyframes snow-fall {
    0% { transform: translateY(-20px) translateX(0) rotate(0deg); opacity: 0; }
    20% { opacity: 0.8; }
    100% { transform: translateY(300px) translateX(20px) rotate(360deg); opacity: 0; }
}
.theme-snow-dream {
    background: linear-gradient(135deg, #e0f2fe 0%, #ffffff 100%);
    color: #475569;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.8);
    position: relative;
    overflow: hidden;
    max-width: 320px;
    min-height: 420px;
}
.theme-snow-dream::before, .theme-snow-dream::after {
    content: "❄";
    position: absolute;
    color: rgba(255,255,255,0.5);
    font-size: 24px;
    animation: snow-fall 8s linear infinite;
    z-index: 0;
    filter: blur(1px);
}
.theme-snow-dream::after {
    font-size: 16px;
    left: 30%;
    animation-duration: 6s;
    animation-delay: 2s;
}
.theme-snow-dream .thought-top-bar, .theme-snow-dream .thought-display-area, .theme-snow-dream .thought-content-shell {
    position: relative;
    z-index: 2;
}
.theme-snow-dream .thought-title {
    color: #94a3b8;
    letter-spacing: 4px;
    font-weight: 300;
}
.theme-snow-dream .thought-separator {
    background: radial-gradient(circle, rgba(148,163,184,0.3) 0%, transparent 80%);
    height: 2px;
}
.theme-snow-dream .close-btn-round { top: 8px; right: 8px; background: rgba(255,255,255,0.5); color: #64748b; z-index: 30; }

.theme-snow-dream .thought-content-shell { padding: 10px 20px 20px; }
.theme-snow-dream .thought-panel {
    background: rgba(255,255,255,0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(148,163,184,0.1);
}
.theme-snow-dream .thought-panel-label {
    background: rgba(255,255,255,0.6);
    color: #64748b;
    border: none;
    box-shadow: none;
    font-weight: normal;
    border-radius: 8px;
    backdrop-filter: blur(4px);
}

/* 2. 水滴清晨 (theme-water-drop) */
@keyframes water-bg-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.theme-water-drop {
    background: linear-gradient(120deg, #e0f7fa, #b2ebf2, #e0f7fa, #80deea);
    background-size: 300% 300%;
    animation: water-bg-flow 8s ease infinite;
    color: #006064;
    font-family: -apple-system, system-ui, sans-serif;
    border-radius: 28px;
    border: 2px solid rgba(255,255,255,0.4);
    box-shadow: inset 10px 10px 20px rgba(255,255,255,0.5), 10px 10px 30px rgba(0,150,166,0.15);
    max-width: 330px;
    min-height: 380px;
    padding: 0;
    position: relative;
    overflow: hidden;
}
.theme-water-drop .thought-top-bar, .theme-water-drop .thought-display-area, .theme-water-drop .thought-content-shell {
    position: relative;
    z-index: 2;
}
.theme-water-drop .thought-title { color: #00838f; font-weight: bold; font-style: italic; }
.theme-water-drop .thought-separator { display: none; }
.theme-water-drop .close-btn-round { top: 8px; right: 8px; background: rgba(0,188,212,0.2); color: #006064; z-index: 30; }

.theme-water-drop .thought-content-shell { background: transparent; box-shadow: none; border: none; padding: 10px 20px; }
.theme-water-drop .thought-panel {
    background: rgba(255,255,255,0.6);
    border-radius: 40% 60% 50% 50% / 50% 50% 60% 40%; /* 内部面板稍微做出水滴感 */
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow: inset 2px 2px 5px rgba(255,255,255,0.9), 2px 5px 10px rgba(0,131,143,0.1);
    padding: 24px 20px;
    backdrop-filter: blur(10px);
}
.theme-water-drop .thought-panel-label {
    top: 5px; left: 20px; background: transparent; border: none; box-shadow: none; color: #00acc1; font-weight: 800; font-size: 12px;
}

/* 3. 可爱手账 (theme-cute-journal) */
.theme-cute-journal {
    background-color: #fff9f9;
    background-image: 
        linear-gradient(90deg, transparent 79px, #ffb6c1 79px, #ffb6c1 81px, transparent 81px),
        linear-gradient(#f0f0f0 1px, transparent 1px);
    background-size: 100% 24px;
    color: #5d4037;
    font-family: 'Comic Sans MS', 'Chalkboard SE', cursive, sans-serif;
    border-radius: 12px;
    border: 2px dashed #ffb6c1;
    max-width: 340px;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.05);
    position: relative;
}
.theme-cute-journal::before {
    content: "🍓"; position: absolute; top: 10px; left: 10px; font-size: 24px; transform: rotate(-15deg); z-index: 1; pointer-events: none;
}
.theme-cute-journal::after {
    content: "🎀"; position: absolute; bottom: 10px; right: 10px; font-size: 24px; transform: rotate(15deg); z-index: 1; pointer-events: none;
}
.theme-cute-journal .thought-title { color: #d81b60; font-weight: bold; background: #ffe0e5; padding: 2px 10px; border-radius: 10px; display: inline-block; position: relative; z-index: 2; }
.theme-cute-journal .thought-separator { display: none; }
.theme-cute-journal .close-btn-round { background: #ffcdd2; color: #d81b60; top: 8px; right: 8px; z-index: 30; }

.theme-cute-journal .thought-content-shell { padding: 15px; position: relative; z-index: 2; }
.theme-cute-journal .thought-panel {
    background: rgba(255,255,255,0.9);
    border: 3px solid #f8bbd0;
    border-radius: 8px;
    box-shadow: 3px 3px 0 #f8bbd0;
    margin-bottom: 10px;
}
.theme-cute-journal .thought-panel-label {
    background: #f48fb1;
    color: #fff;
    border: none;
    border-radius: 4px;
    transform: rotate(-3deg);
    top: -10px;
    left: 10px;
    padding: 4px 10px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

/* 4. 复古邮票 (theme-retro-stamp) */
.theme-retro-stamp {
    background: transparent;
    color: #3e2723;
    font-family: "Georgia", "Times New Roman", serif;
    border-radius: 8px;
    padding: 0;
    max-width: 320px;
    position: relative;
}
.theme-retro-stamp::before {
    content: "";
    position: absolute;
    inset: 0;
    background: #eaddcf url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100" height="100" filter="url(%23n)" opacity="0.08"/></svg>');
    /* 邮票锯齿边缘 */
    mask-image: radial-gradient(circle at 6px 6px, transparent 6px, black 6.5px);
    mask-size: 20px 20px;
    mask-position: -6px -6px;
    -webkit-mask-image: radial-gradient(circle at 6px 6px, transparent 6px, black 6.5px);
    -webkit-mask-size: 20px 20px;
    -webkit-mask-position: -6px -6px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
    z-index: 0;
}
.theme-retro-stamp .thought-top-bar,
.theme-retro-stamp .thought-separator,
.theme-retro-stamp .thought-display-area,
.theme-retro-stamp .thought-content-shell,
.theme-retro-stamp .thought-history-toggle,
.theme-retro-stamp .thought-history-list {
    position: relative;
    z-index: 2;
}
.theme-retro-stamp .thought-top-bar { border-bottom: 1px double #8d6e63; margin-bottom: 10px; padding: 24px 20px 10px 20px; }
.theme-retro-stamp .thought-title { color: #2e1d18; font-weight: bold; letter-spacing: 2px; }
.theme-retro-stamp .thought-separator { display: none; }
.theme-retro-stamp .close-btn-round { background: rgba(62,39,35,0.1); color: #3e2723; border-radius: 50%; border: 1px solid #3e2723; top: 8px; right: 8px; z-index: 30; }

.theme-retro-stamp .thought-content-shell { padding: 5px 20px 20px; }
.theme-retro-stamp .thought-panel {
    background: transparent;
    border: none;
    border-left: 3px double #795548;
    border-radius: 0;
    box-shadow: none;
    padding: 10px 15px;
}
.theme-retro-stamp .thought-panel-label {
    position: static;
    display: inline-block;
    background: #5d4037;
    color: #d7ccc8;
    border: none;
    border-radius: 2px;
    font-family: monospace;
    font-size: 10px;
    margin-bottom: 8px;
    padding: 2px 6px;
}

/* 5. 高冷拍立得 (theme-polaroid-chill) */
.theme-polaroid-chill {
    background: #f8f9fa;
    color: #343a40;
    font-family: "Helvetica Neue", sans-serif;
    border-radius: 2px;
    padding: 0 0 30px 0;
    max-width: 300px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15), 0 5px 15px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    position: relative;
}
.theme-polaroid-chill .thought-top-bar { justify-content: center; padding: 15px; }
.theme-polaroid-chill .thought-title { color: #adb5bd; font-size: 12px; text-transform: uppercase; letter-spacing: 3px; font-weight: normal; }
.theme-polaroid-chill .thought-separator { display: none; }
.theme-polaroid-chill .close-btn-round { top: 8px; right: 8px; background: rgba(0,0,0,0.05); color: #868e96; font-size: 16px; z-index: 30; border-radius: 50%; }

.theme-polaroid-chill .thought-content-shell { 
    background: #212529; 
    color: #f8f9fa; 
    padding: 20px; 
    margin: 0 15px;
    min-height: 250px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}
.theme-polaroid-chill .thought-panel {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 20px;
}
.theme-polaroid-chill .thought-panel-label {
    position: static;
    display: block;
    background: transparent;
    color: #868e96;
    border: none;
    border-bottom: 1px solid #495057;
    border-radius: 0;
    padding: 0 0 4px 0;
    margin-bottom: 8px;
    font-size: 10px;
    letter-spacing: 1px;
}
.theme-polaroid-chill .thought-history-toggle { color: #adb5bd; margin-top: 15px; text-align: center; }

/* 6. 暗黑墨韵 (theme-dark-ink) */
.theme-dark-ink {
    background-color: #121212;
    background-image: radial-gradient(circle at 80% 20%, rgba(50,50,50,0.4) 0%, transparent 40%),
                      radial-gradient(circle at 20% 80%, rgba(30,30,30,0.6) 0%, transparent 50%);
    color: #e0e0e0;
    font-family: "Songti SC", "SimSun", serif;
    border: 1px solid #333;
    border-radius: 0;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    max-width: 320px;
    position: relative;
    padding: 0;
}
.theme-dark-ink .thought-top-bar { padding: 20px; }
.theme-dark-ink .thought-title { font-size: 18px; color: #fff; letter-spacing: 4px; border-bottom: 1px solid #444; padding-bottom: 8px; }
.theme-dark-ink .thought-separator { display: none; }
.theme-dark-ink .close-btn-round { top: 8px; right: 8px; background: rgba(255,255,255,0.1); color: #ccc; font-size: 16px; z-index: 30; border-radius: 50%; }

.theme-dark-ink .thought-content-shell { padding: 5px 20px 20px; }
.theme-dark-ink .thought-panel {
    background: rgba(20,20,20,0.8);
    border: 1px solid #333;
    border-left: 4px solid #666;
    border-radius: 0;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    padding: 20px 15px 15px;
}
.theme-dark-ink .thought-panel-label {
    background: #121212;
    color: #aaa;
    border: 1px solid #333;
    border-radius: 0;
    font-family: monospace;
    top: -10px; left: 10px;
    padding: 2px 8px;
}

/* 聊天时间戳 */
.chat-timestamp {
    text-align: center;
    font-size: 11px;
    color: #b0b0b0;
    margin: 15px 0 10px 0;
    clear: both;
    width: 100%;
}

/* =========================================
   Glassmorphism UI (Settings & Contacts)
========================================= */
#page-user-settings .settings-page,
#page-contact-edit .settings-page {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    border-radius: 20px;
    padding: 20px;
    margin: 15px;
    height: calc(100% - 30px);
    overflow-y: auto;
}

#page-user-settings .phone-case .screen,
#page-contact-edit .phone-case .screen {
    background: #f0f2f5 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" opacity="0.1"><defs><pattern id="p" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="40" fill="%23aaa"/></pattern></defs><rect width="100%" height="100%" fill="url(%23p)"/></svg>') no-repeat center center / cover;
}

#page-user-settings .form-group input, 
#page-user-settings .form-group textarea, 
#page-user-settings .form-group select,
#page-contact-edit .form-group input, 
#page-contact-edit .form-group textarea, 
#page-contact-edit .form-group select {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px;
    transition: all 0.3s ease;
}

#page-user-settings .form-group input:focus, 
#page-user-settings .form-group textarea:focus, 
#page-user-settings .form-group select:focus,
#page-contact-edit .form-group input:focus, 
#page-contact-edit .form-group textarea:focus, 
#page-contact-edit .form-group select:focus {
    background: rgba(255, 255, 255, 0.9);
    outline: none;
    border-color: #b08f78;
    box-shadow: 0 0 0 3px rgba(176, 143, 120, 0.2);
}

.ai-gen-section {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    margin-bottom: 20px;
}
.ai-gen-section textarea {
    height: 100px !important;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    padding: 10px;
}

.relation-item {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
.relation-item input, .relation-item textarea {
    background: rgba(255, 255, 255, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    border-radius: 8px !important;
}

.rel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.connect-role-btn {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.6);
    color: #333;
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 4px 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    font-weight: 600;
}

.modal-list-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}
.modal-list-item:hover {
    background: #f9f9f9;
}
.modal-list-item img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

/* =========================================
   Moments Page Styles
========================================= */
.moments-header-wrap {
    width: 100%;
}
.moments-bg-container {
    background-color: var(--theme-color, #e6e6e6);
    background-size: cover;
    background-position: center;
}
.moments-avatar img {
    transition: transform 0.3s ease;
}
.moments-avatar:active img {
    transform: scale(0.9);
}
.moments-add-btn:active {
    opacity: 0.7;
}

.moment-card {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    position: relative;
}
.moment-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}
.moment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}
.moment-author-info {
    flex: 1;
}
.moment-author-name {
    font-weight: bold;
    font-size: 14px;
    color: #333;
}
.moment-time {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}
.moment-actions-btn {
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 0 5px;
}
.moment-content {
    font-size: 14px;
    color: #444;
    margin-bottom: 10px;
    line-height: 1.5;
    word-break: break-word;
}
.moment-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 5px;
    margin-bottom: 10px;
}
.moment-image-item {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    object-fit: cover;
    cursor: pointer;
}
.moment-text-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
    text-align: center;
    padding: 5px;
    box-sizing: border-box;
    cursor: pointer;
    border: 1px dashed #ccc;
}
.moment-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    padding-top: 10px;
    margin-top: 10px;
}
.moment-action-item {
    font-size: 12px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}
.moment-action-item:hover {
    color: var(--theme-color, #ff8787);
}
.moment-comments {
    background: rgba(255,255,255,0.3);
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    font-size: 13px;
}
.moment-comment-item {
    margin-bottom: 5px;
    word-break: break-word;
}
.moment-comment-author {
    font-weight: bold;
    color: #555;
    cursor: pointer;
}

.moment-menu {
    position: absolute;
    right: 15px;
    top: 45px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 10;
    display: none;
    overflow: hidden;
}
.moment-menu.active {
    display: block;
}
.moment-menu-item {
    padding: 10px 20px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
}
.moment-menu-item:hover {
    background: #f5f5f5;
}

.moment-summon-status {
    font-size: 12px;
    color: var(--theme-color, #ff8787);
    font-style: italic;
    margin-top: 5px;
    text-align: center;
}

.moment-reply-input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 15px;
    padding: 8px 12px;
    font-size: 13px;
    margin-top: 10px;
    background: rgba(255,255,255,0.7);
    outline: none;
}
.moment-reply-input:focus {
    border-color: var(--theme-color, #ff8787);
}

.moment-pinned-badge {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #b08f78;
    font-size: 16px;
    opacity: 0.8;
}

.moment-visibility-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px;
    border-radius: 5px;
}
.moment-visibility-item:hover {
    background: rgba(0,0,0,0.05);
}
.moment-visibility-item img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}
.moment-visibility-item span {
    font-size: 12px;
    color: #333;
    flex: 1;
}

/* Voice Bubble Styles */
.voice-bubble {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 12px;
    padding: 8px 16px;
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    min-width: 60px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid rgba(255,255,255,0.8);
    transition: all 0.3s ease;
    user-select: none;
    align-items: flex-start;
}
.msg-row.user .voice-bubble {
    background: rgba(241, 231, 221, 0.6);
    border: 1px solid rgba(241, 231, 221, 0.8);
}
.voice-bubble:active {
    transform: scale(0.98);
}
.voice-bubble-header {
    display: flex;
    align-items: center;
    color: #333;
    font-size: 16px;
}
.voice-text {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}
.voice-msg-container .voice-text-wrapper {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.voice-msg-container.show-text .voice-text-wrapper {
    max-height: 1000px;
    opacity: 1;
    margin-top: 8px;
}
.voice-duration-label {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

/* Voice Call Styles */
#voice-call-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
#voice-call-modal {
    width: 350px;
    height: 580px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
}
.vc-hangup {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    z-index: 10;
}
.voice-call-border {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    border-radius: 12px;
    border: 2px solid transparent;
    animation: vc-border-anim 4s linear infinite;
    z-index: -1;
}
@keyframes vc-border-anim {
    0% { border-image: conic-gradient(from 0deg, #000, #0000, #0000, #000) 1; }
    25% { border-image: conic-gradient(from 90deg, #000, #0000, #0000, #000) 1; }
    50% { border-image: conic-gradient(from 180deg, #000, #0000, #0000, #000) 1; }
    75% { border-image: conic-gradient(from 270deg, #000, #0000, #0000, #000) 1; }
    100% { border-image: conic-gradient(from 360deg, #000, #0000, #0000, #000) 1; }
}
.vc-header-card, .vc-chat-card {
    background: rgba(255,255,255,0.4);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
.vc-header-card {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.vc-header-card img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.8);
}
.vc-wave-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.vc-wave {
    width: 90px;
    height: 2px;
    background: linear-gradient(90deg, #888, #333, #888);
    background-size: 200% 100%;
    animation: wave-move 1.5s linear infinite;
}
@keyframes wave-move {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
#vc-status-text {
    font-size: 13px;
    color: #333;
}
.vc-chat-card {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    gap: 15px;
}
.vc-chat-area {
    flex-grow: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.vc-chat-area::-webkit-scrollbar { display: none; }
.vc-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.6;
    word-break: break-word;
}
.vc-msg.user {
    align-self: flex-end;
    background: rgba(50,50,50,0.8);
    color: white;
    border-bottom-right-radius: 4px;
}
.vc-msg.char {
    align-self: flex-start;
    background: rgba(255,255,255,0.8);
    color: #333;
    border-bottom-left-radius: 4px;
}
.vc-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.05);
}
#vc-input-box {
    flex: 1;
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    resize: none;
    outline: none;
}
.vc-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #333;
    transition: background 0.2s;
}
.vc-action-btn:hover {
    background: rgba(255,255,255,0.8);
}

.chat-system-event {
    text-align: center;
    color: #999;
    font-size: 12px;
    padding: 10px 0;
    margin: 5px 0;
}

/* 拍一拍：窄长便签式系统提示 */
.chat-system-event--poke {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 0 14px;
    margin: 6px 0 10px;
    pointer-events: none;
}

.chat-poke-note {
    display: inline-block;
    max-width: min(92%, 280px);
    padding: 8px 18px 9px;
    margin: 0 auto;
    text-align: center;
    font-size: 12px;
    line-height: 1.45;
    letter-spacing: 0.02em;
    color: #4a4035;
    background: linear-gradient(165deg, #fffdf6 0%, #fff6dc 48%, #ffeec8 100%);
    border: 1px solid rgba(212, 165, 116, 0.45);
    border-radius: 3px 10px 4px 8px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.85) inset,
        0 10px 22px rgba(120, 72, 30, 0.12),
        0 2px 6px rgba(90, 55, 20, 0.08);
    transform: rotate(-1.6deg);
    position: relative;
}

.chat-poke-note::before {
    content: '';
    position: absolute;
    top: -4px;
    right: 14px;
    width: 36px;
    height: 10px;
    background: rgba(255, 200, 120, 0.35);
    border-radius: 2px;
    transform: rotate(4deg);
    pointer-events: none;
}

/* 锁屏验证：毛玻璃卡片、居中 */
.chat-system-event--unlock-verify {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 20px;
    margin: 10px auto;
    max-width: min(92%, 320px);
    text-align: center;
    font-size: 14px;
    color: #333;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.chat-poke-note__text {
    display: block;
    position: relative;
    z-index: 1;
    font-weight: 600;
}

.incoming-call-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 10px 15px;
    margin: 10px 18px; /* Consistent with message area padding */
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    width: auto;
    max-width: none;
}

.incoming-call-text {
    flex-grow: 1;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin: 0 10px;
}

.vc-accept-btn, .vc-decline-btn {
    padding: 6px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

.vc-accept-btn {
    background: #e3f2fd;
    color: #1e3a8a;
    border-color: rgba(30, 58, 138, 0.2);
}

.vc-decline-btn {
    background: #f1f1f1;
    color: #555;
    border-color: rgba(0, 0, 0, 0.08);
}

.vc-accept-btn:active, .vc-decline-btn:active {
    transform: scale(0.95);
    box-shadow: none;
}

/* =========================================
   Video Call Styles
========================================= */
#video-call-overlay {
    background: transparent;
    z-index: 1001; /* Must be on top */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#video-main-view {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #111;
    z-index: 1;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.video-glass-overlay {
    position: absolute;
    inset: 0;
    background: inherit;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2;
    pointer-events: none;
    display: none; /* Can be toggled if user wants a blurry background */
}

#video-main-view img, #video-main-view video,
#video-pip-view img, #video-pip-view video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    position: relative;
}

#video-pip-view {
    position: absolute;
    top: 60px;
    right: 20px;
    left: auto;
    width: 100px;
    height: 150px;
    background: #222;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
    z-index: 20;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Swapped Mode */
#video-main-view.pip-mode {
    top: 60px;
    right: 20px;
    left: auto;
    width: 100px;
    height: 150px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 20;
}

#video-pip-view.main-mode {
    top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
    z-index: 1;
}

/* Header & Dialing */
#video-call-header {
    position: absolute;
    top: 40px;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 30;
    transition: opacity 0.5s;
}
.vc-top-avatars {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0,0,0,0.3);
    padding: 10px 20px;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.15);
}
.vc-top-avatars img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.8);
}
.vc-connection-line {
    display: flex;
    gap: 4px;
}
.vc-connection-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00ff88;
    box-shadow: 0 0 8px #00ff88;
    animation: vc-pulse 1.5s infinite;
}
.vc-connection-dot:nth-child(2) { animation-delay: 0.2s; }
.vc-connection-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes vc-pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

#video-call-status {
    color: #fff;
    font-size: 13px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    font-weight: 600;
    letter-spacing: 1px;
}

/* Hangup (Top Right) */
.video-hangup-btn {
    position: absolute;
    top: 50px;
    right: 20px;
    background: rgba(220, 53, 69, 0.85);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    z-index: 30;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
    backdrop-filter: blur(10px);
}
.video-hangup-btn:active {
    transform: scale(0.95);
}

/* Side Controls */
#video-side-controls {
    position: absolute;
    bottom: 80px;
    right: 20px;
    display: flex;
    flex-direction: row;
    gap: 15px;
    z-index: 30;
}
.video-control-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.video-control-btn:active {
    background: rgba(255,255,255,0.3);
    transform: scale(0.95);
}

/* Narration (Movie Subtitle) */
#video-narration-bar {
    position: absolute;
    bottom: 90px; /* 稍微上调，紧贴输入框 */
    left: 20px;
    right: 20px;
    text-align: center;
    z-index: 25;
    pointer-events: none;
}
#video-narration-text {
    color: #fff;
    font-size: 16px;
    font-family: "Songti SC", "SimSun", serif; /* 电影质感字体 */
    line-height: 1.6;
    letter-spacing: 1px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,1);
    background: rgba(0,0,0,0.1); /* 极其轻微的底色帮助阅读 */
    padding: 4px 12px;
    border-radius: 8px;
}

/* Bubbles Area */
#video-chat-bubbles {
    position: absolute;
    top: 230px; /* 恢复安全距离，避免遮挡PIP */
    bottom: 160px; /* 调整，为旁白和输入框留出空间 */
    left: 15px;
    right: 15px;
    width: auto;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 20;
    scrollbar-width: none;
    -ms-overflow-style: none;
    pointer-events: auto; /* 保证可以滑动 */
    padding: 15px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}
#video-chat-bubbles::-webkit-scrollbar { display: none; }

.vchat-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    max-width: 95%; /* 顶格 */
    word-break: break-word;
    line-height: 1.5;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    /* Adding text-shadow makes it readable on both dark and bright bgs */
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.vchat-bubble.user {
    background: rgba(43, 43, 43, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    align-self: flex-end; /* 用户靠右 */
    border-bottom-right-radius: 4px;
}
.vchat-bubble.ai {
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.6);
    color: #222;
    text-shadow: none; /* AI 的白色背景不需要黑阴影 */
    align-self: flex-start; /* AI靠左 */
    border-bottom-left-radius: 4px;
}

/* Bottom Input Area */
#video-chat-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px calc(15px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    display: flex;
    align-items: flex-end;
    gap: 12px;
    z-index: 30;
}
#vchat-input-box {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    resize: none;
    max-height: 100px;
    font-size: 14px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
#vchat-input-box:focus { outline: none; border-color: rgba(255,255,255,0.5); }
#vchat-input-box::placeholder { color: rgba(255,255,255,0.5); }

.vchat-action-btn.send {
    width: 60px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255,255,255,0.9);
    border: none;
    color: #111;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.vchat-action-btn.send:active { transform: scale(0.95); }

#video-call-overlay .icon-btn {
    color: rgba(255,255,255,0.9);
    width: 44px;
    height: 44px;
    margin-bottom: 0;
}

.thought-history-time {
    display: block;
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 4px;
    font-weight: bold;
}
/* Image bubble styles */
.msg-bubble-image {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.text-image-bubble {
    border: 1px dashed #a8a8a8;
    background: rgba(255, 255, 255, 0.7);
    padding: 15px;
    border-radius: 12px;
    font-size: 14px;
    color: #333;
    max-width: 250px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-break: break-word;
}

/* --- Click-to-zoom overlay for chat images (text images included) --- */
#page-chat-window img.chat-real-image {
    cursor: zoom-in;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body.image-zoom-open {
    overflow: hidden;
}

.image-zoom-overlay {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 20050; /* above modals */
}
.image-zoom-overlay.active {
    display: block;
}

.image-zoom-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.image-zoom-stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.image-zoom-img {
    max-width: min(96vw, 720px);
    max-height: 86vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 18px 60px rgba(0,0,0,0.35);
    background: rgba(255,255,255,0.92);
    image-rendering: auto;
    -webkit-user-select: none;
    user-select: none;
}

.image-zoom-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(0,0,0,0.35);
    color: #fff;
    font-size: 26px;
    line-height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.image-zoom-close:active {
    transform: scale(0.96);
}

/* --- Location modal + card styles --- */
.location-modal-content {
    background: rgba(250, 250, 250, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.8);
    border-radius: 22px;
    padding: 18px 18px 16px 18px;
    max-width: 420px;
}

.location-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.location-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
}

.location-sheet {
    display: flex;
    flex-direction: column;
    gap: 12px; /* 俩框分开一点点距离，营造悬浮感 */
}

.location-map-card,
.location-input-card {
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    overflow: hidden;
    position: relative;
}

.location-map-card {
    min-height: 240px;
    background: radial-gradient(1200px 400px at 20% 0%, rgba(176,143,120,0.18), transparent 55%),
                radial-gradient(900px 360px at 90% 20%, rgba(255,135,135,0.16), transparent 55%),
                rgba(255,255,255,0.55);
}

.location-map-grid {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to right, rgba(0,0,0,0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0,0,0,0.06) 1px, transparent 1px);
    background-size: 28px 28px;
    opacity: 0.55;
    transform: translate3d(0,0,0);
    animation: locGridFlow 8s linear infinite;
}

@keyframes locGridFlow {
    from { background-position: 0 0, 0 0; }
    to { background-position: 120px 90px, 120px 90px; }
}

.location-map-overlay {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 14px;
}

.location-map-row {
    display: flex;
    gap: 10px;
}

.location-pill {
    flex: 1;
    border-radius: 16px;
    padding: 12px 12px 10px 12px;
    background: rgba(255,255,255,0.68);
    border: 1px solid rgba(255,255,255,0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.location-pill-label {
    font-size: 11px;
    font-weight: 700;
    color: rgba(60,60,60,0.6);
    margin-bottom: 6px;
}
.location-pill-main {
    font-size: 14px;
    font-weight: 800;
    color: #2b2b2b;
    line-height: 1.25;
    word-break: break-word;
}
.location-pill-sub {
    margin-top: 6px;
    font-size: 11px;
    color: rgba(60,60,60,0.65);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.location-pill-user { box-shadow: inset 0 0 0 9999px rgba(227,242,253,0.35); }
.location-pill-ai { box-shadow: inset 0 0 0 9999px rgba(255,240,245,0.32); }

.location-map-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
}
.location-distance {
    font-size: 14px;
    font-weight: 800;
    color: #222;
}
.location-hint {
    font-size: 10px;
    color: rgba(60,60,60,0.55);
    text-align: right;
    max-width: 55%;
    line-height: 1.2;
}

.location-input-card {
    background: rgba(255,255,255,0.62);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 14px;
}

.location-input-title {
    font-size: 13px;
    font-weight: 800;
    color: #333;
    margin-bottom: 10px;
}

.location-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

#loc-detail-input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(120,112,104,0.18);
    background: rgba(255,255,255,0.7);
    font-size: 14px;
    outline: none;
}

.location-input-preview {
    margin-top: 10px;
    font-size: 12px;
    color: rgba(60,60,60,0.7);
}

/* Bubble card: location message */
#page-chat-window .location-card {
    background: rgba(255,255,255,0.72);
    border: 1px solid rgba(120,112,104,0.18);
    border-radius: 16px;
    padding: 12px 14px;
    min-width: 200px;
    max-width: 260px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.06);
}
#page-chat-window .location-card-title {
    font-size: 11px;
    font-weight: 800;
    color: rgba(60,60,60,0.55);
    letter-spacing: 0.6px;
    margin-bottom: 6px;
}
#page-chat-window .location-card-main {
    font-size: 15px;
    font-weight: 900;
    color: #222;
    line-height: 1.25;
    word-break: break-word;
}
#page-chat-window .location-card-sub {
    margin-top: 6px;
    font-size: 11px;
    color: rgba(60,60,60,0.65);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}


/* Meet mode (offline) themes: see css/meet-themes.css */

/* ============ 纪念日和信件样式 ============ */
#couple-anniversary-card {
    cursor: pointer;
    transition: all 0.3s;
}

#couple-anniversary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 182, 193, 0.15);
}

#couple-anniversary-modal {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#couple-letter-modal {
    animation: fadeIn 0.3s ease-out;
}

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

#couple-letter-envelope {
    animation: envelope-float 2s ease-in-out infinite;
}

@keyframes envelope-float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

#couple-letter-content {
    font-family: 'KaiTi', '楷体', serif;
    background: linear-gradient(135deg, #f5e6d3 0%, #e8d4b8 100%);
    box-shadow: 
        0 15px 50px rgba(0,0,0,0.12),
        inset 0 1px 0 rgba(255,255,255,0.6);
    position: relative;
}

#couple-letter-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.02) 2px,
            rgba(0,0,0,0.02) 4px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.02) 2px,
            rgba(0,0,0,0.02) 4px
        );
    pointer-events: none;
    border-radius: 16px;
}

#couple-letter-body {
    position: relative;
    z-index: 1;
}

/* 便签样式 */
.letter-sticker {
    position: absolute;
    background: rgba(255, 255, 200, 0.8);
    border: 1px solid rgba(200, 180, 100, 0.3);
    border-radius: 4px;
    padding: 8px;
    font-size: 12px;
    color: #666;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: rotate(-2deg);
    z-index: 2;
}

.letter-sticker:nth-child(2) {
    transform: rotate(3deg);
}

.letter-sticker:nth-child(3) {
    transform: rotate(-1deg);
}

/* 纪念日列表项 */
.anniversary-item {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 182, 193, 0.2);
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 12px;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.anniversary-item:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 182, 193, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 182, 193, 0.15);
}

.anniversary-item.today {
    background: rgba(255, 240, 245, 0.7);
    border-color: rgba(255, 182, 193, 0.5);
    box-shadow: 0 8px 24px rgba(255, 182, 193, 0.2);
}

/* Meet mode (offline) themes: see css/meet-themes.css */

/* ================= 一起做 · 专注时光 ================= */
#page-focus .screen.focus-app-screen {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(230, 242, 255, 0.95) 0%, rgba(255, 248, 252, 0.92) 55%, rgba(255, 255, 255, 0.98) 100%);
}

.focus-page {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding: calc(env(safe-area-inset-top, 20px) + 4px) 14px calc(env(safe-area-inset-bottom, 20px) + 12px);
    font-family: 'Nunito', 'PingFang SC', system-ui, sans-serif;
    color: #3a4a5c;
}

.focus-panel {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    position: relative;
    padding-bottom: 20px;
}

.focus-page.focus-page-revealed .focus-splash {
    opacity: 0;
    pointer-events: none;
}

.focus-splash {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.95), rgba(225, 238, 255, 0.88));
    transition: opacity 420ms ease;
}

.focus-splash.focus-splash-done {
    opacity: 0;
    pointer-events: none;
}

.focus-splash-inner {
    text-align: center;
    animation: focus-splash-pop 1s ease both;
}

@keyframes focus-splash-pop {
    0% { transform: scale(0.92); opacity: 0; }
    55% { transform: scale(1.02); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.focus-splash-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 26px;
    font-weight: 500;
    color: #6b8cae;
    letter-spacing: 0.06em;
}

.focus-splash-sub {
    margin-top: 8px;
    font-size: 18px;
    color: #8fa3b8;
    font-family: 'Dancing Script', cursive;
}

.focus-splash-stars::before {
    content: '✦ · ✧ · ✦';
    display: block;
    font-size: 12px;
    color: rgba(180, 200, 230, 0.8);
    margin-bottom: 10px;
    letter-spacing: 0.2em;
}

.focus-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.focus-icon-btn {
    border: none;
    background: rgba(255, 255, 255, 0.55);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    color: #6b7f95;
    box-shadow: 0 4px 14px rgba(120, 150, 190, 0.15);
    cursor: pointer;
}

.focus-topbar-titles { flex: 1; text-align: center; }
.focus-topbar-title { font-weight: 800; font-size: 17px; color: #4a5f78; }
.focus-topbar-sub { font-size: 11px; color: #8a9bb0; margin-top: 2px; }
.focus-topbar-spacer { width: 36px; }

.focus-tabs {
    display: flex;
    gap: 8px;
    margin: 10px 0 14px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    border: 1px solid rgba(180, 200, 230, 0.35);
}

.focus-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 8px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    color: #7a8fa5;
    cursor: pointer;
}

.focus-tab.active {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(235, 245, 255, 0.95));
    color: #4a6a8a;
    box-shadow: 0 4px 12px rgba(130, 160, 200, 0.18);
}

.focus-stats-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.focus-pill-ghost {
    border: 1px solid rgba(180, 200, 230, 0.55);
    background: rgba(255, 255, 255, 0.55);
    color: #5a6f88;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.focus-circle-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58vh;
    padding: 20px 0 10px;
}

.focus-settings-fab {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(200, 215, 235, 0.7);
    background: rgba(255, 255, 255, 0.75);
    box-shadow: 0 6px 16px rgba(140, 170, 210, 0.2);
    cursor: pointer;
    font-size: 18px;
    color: #6b7f95;
    z-index: 5;
}

.focus-spin-ring {
    width: min(78vw, 300px);
    height: min(78vw, 300px);
    border-radius: 50%;
    padding: 10px;
    background: conic-gradient(from 0deg, rgba(255, 210, 230, 0.35), rgba(200, 230, 255, 0.45), rgba(255, 240, 220, 0.4), rgba(255, 210, 230, 0.35));
    animation: focus-orbit-spin 48s linear infinite;
    box-shadow: 0 18px 40px rgba(150, 175, 210, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

@keyframes focus-orbit-spin {
    to { transform: rotate(360deg); }
}

.focus-disc {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.95), rgba(230, 242, 255, 0.75) 45%, rgba(210, 228, 255, 0.85) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.65);
    animation: focus-disc-counter 48s linear infinite reverse;
}

@keyframes focus-disc-counter {
    to { transform: rotate(360deg); }
}

.focus-disc-inner {
    text-align: center;
    padding: 18px;
    max-width: 88%;
}

.focus-disc-kicker {
    font-size: 11px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: #9eb0c8;
    font-weight: 800;
}

.focus-disc-main-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 22px;
    margin-top: 6px;
    color: #5a7394;
}

.focus-disc-hint {
    font-size: 12px;
    color: #8a9bb5;
    line-height: 1.5;
    margin: 10px 0 16px;
}

.focus-btn-primary {
    border: none;
    border-radius: 999px;
    padding: 12px 26px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #a8c8ee, #c9b8e8);
    box-shadow: 0 10px 22px rgba(140, 160, 200, 0.35);
}

.focus-btn-soft {
    border: 1px solid rgba(200, 215, 235, 0.85);
    background: rgba(255, 255, 255, 0.65);
    color: #5a6f88;
    border-radius: 999px;
    padding: 11px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.focus-todo-placeholder {
    text-align: center;
    padding: 48px 20px;
    color: #8a9bb5;
    font-size: 14px;
}

.focus-todo-heart { font-size: 36px; margin-bottom: 12px; }

#focus-overlay-host {
    position: absolute;
    inset: 0;
    z-index: 40;
    pointer-events: none;
}

#focus-overlay-host > * {
    pointer-events: auto;
}

.focus-session-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: calc(env(safe-area-inset-top, 20px) + 6px) 0 0;
    overflow: hidden;
}

.focus-session-bg {
    position: absolute;
    inset: 0;
    background-color: #e8f2ff;
    background-image:
        linear-gradient(rgba(180, 200, 230, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(180, 200, 230, 0.12) 1px, transparent 1px);
    background-size: 22px 22px;
    z-index: 0;
}

.focus-session-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 0 14px 8px;
    flex-shrink: 0;
    z-index: 2;
    width: 100%;
    box-sizing: border-box;
}

.focus-session-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.focus-session-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 6px 18px rgba(140, 170, 210, 0.35);
}

.focus-session-name {
    font-size: 11px;
    color: #6a7f95;
    max-width: 72px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.focus-bubble-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    z-index: 2;
    transition: opacity 0.4s ease;
}

.focus-bubble-wrap.focus-bubble-hide {
    opacity: 0;
}

.focus-bubble {
    display: inline-block;
    max-width: 100%;
    padding: 10px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(200, 215, 235, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 13px;
    color: #4a5f78;
    line-height: 1.45;
    box-shadow: 0 8px 20px rgba(130, 160, 200, 0.15);
}

.focus-session-middle {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 4px 12px 8px;
    z-index: 1;
}

/* 倒计时：仅底层流动外环旋转，内盘与时间完全静止 */
.focus-session-count-wrap {
    position: relative;
    width: min(74vw, 268px);
    height: min(74vw, 268px);
    border-radius: 50%;
    box-shadow: 0 16px 36px rgba(150, 175, 210, 0.22);
}

.focus-session-count-flow {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
    /* 多段 pastel 色环，旋转时形成沿圆周流动的感觉 */
    background: conic-gradient(
        from 0deg,
        rgba(255, 200, 230, 0.92) 0deg,
        rgba(255, 235, 245, 0.55) 45deg,
        rgba(180, 220, 255, 0.88) 120deg,
        rgba(220, 245, 255, 0.6) 200deg,
        rgba(255, 240, 215, 0.85) 270deg,
        rgba(230, 210, 255, 0.7) 320deg,
        rgba(255, 200, 230, 0.92) 360deg
    );
    animation: focus-count-flow-rotate 14s linear infinite;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.45),
        0 0 24px rgba(200, 215, 245, 0.35);
}

.focus-session-count-flow::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(
        from 90deg,
        transparent 0deg,
        rgba(255, 255, 255, 0.35) 25deg,
        transparent 55deg,
        rgba(255, 255, 255, 0.2) 120deg,
        transparent 180deg,
        rgba(255, 255, 255, 0.28) 260deg,
        transparent 320deg
    );
    animation: focus-count-flow-rotate 9s linear infinite reverse;
    mix-blend-mode: soft-light;
    opacity: 0.85;
}

@keyframes focus-count-flow-rotate {
    to { transform: rotate(360deg); }
}

.focus-session-count-disc {
    position: absolute;
    inset: 11px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.98), rgba(230, 242, 255, 0.82) 48%, rgba(210, 228, 255, 0.9) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 0 36px rgba(255, 255, 255, 0.65),
        0 0 0 1px rgba(255, 255, 255, 0.5);
    z-index: 1;
}

.focus-countdown-inner {
    text-align: center;
    padding: 8px;
    max-width: 92%;
}

.focus-countdown-label {
    font-size: 11px;
    color: #8fa3b8;
    letter-spacing: 0.14em;
}

.focus-countdown-big {
    margin-top: 6px;
    font-size: clamp(40px, 11vw, 52px);
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #6b8cae;
    text-shadow: 0 6px 22px rgba(150, 175, 210, 0.25);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.focus-countdown-sub {
    margin-top: 8px;
    font-size: 12px;
    color: #7a8fa5;
    line-height: 1.35;
    max-width: 220px;
    margin-left: auto;
    margin-right: auto;
}

.focus-session-footer {
    flex-shrink: 0;
    width: 100%;
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 20px));
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 3;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.42) 28%, rgba(255, 255, 255, 0.55));
}

.focus-btn-early-end {
    width: 100%;
    border: none;
    border-radius: 999px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #9ebfe8, #c4b5e8);
    box-shadow: 0 10px 26px rgba(130, 155, 200, 0.38);
}

.focus-link-btn {
    border: none;
    background: none;
    color: #7a90b0;
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px 0;
}

.focus-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 250, 252, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 10;
}

.focus-modal-on-top {
    z-index: 60;
}

.focus-modal {
    width: 100%;
    max-width: 340px;
    max-height: 82vh;
    overflow: auto;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 20px;
    border: 1px solid rgba(200, 215, 235, 0.55);
    box-shadow: 0 20px 50px rgba(140, 165, 200, 0.22);
}

.focus-modal-wide {
    max-width: 360px;
}

.focus-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(230, 235, 245, 0.9);
    font-weight: 800;
    color: #4a5f78;
}

.focus-modal-body {
    padding: 14px 16px 18px;
}

.focus-field-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #6a7f95;
    margin-bottom: 6px;
}

.focus-input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 12px;
    border-radius: 14px;
    border: 1px solid rgba(200, 215, 235, 0.85);
    background: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.focus-quick-min {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.focus-quick-min button {
    flex: 1;
    border-radius: 12px;
    border: 1px solid rgba(200, 215, 235, 0.7);
    background: rgba(245, 250, 255, 0.9);
    padding: 8px 0;
    font-weight: 800;
    color: #5a6f88;
    cursor: pointer;
}

.focus-wiz-roles {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.focus-wiz-role {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(220, 230, 245, 0.9);
    background: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    text-align: left;
}

.focus-wiz-role img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.focus-wiz-role.picked {
    border-color: rgba(170, 200, 240, 0.95);
    box-shadow: 0 6px 16px rgba(150, 175, 210, 0.22);
}

.focus-muted {
    color: #9aaabe;
    font-size: 12px;
    line-height: 1.45;
}

.focus-celebrate {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 248, 252, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.focus-celebrate-card {
    text-align: center;
    padding: 28px 24px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 210, 230, 0.45);
    box-shadow: 0 18px 44px rgba(200, 170, 200, 0.2);
    max-width: 300px;
}

.focus-celebrate-emoji {
    font-size: 40px;
    margin-bottom: 8px;
}

.focus-celebrate-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 22px;
    color: #6b7f95;
}

.focus-celebrate-desc {
    font-size: 13px;
    color: #8a9bb5;
    margin: 10px 0 18px;
}

.focus-post-modal {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(245, 248, 255, 0.55);
    backdrop-filter: blur(8px);
    z-index: 55;
}

.focus-post-card {
    width: 100%;
    max-width: 320px;
    padding: 20px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(220, 230, 245, 0.85);
    box-shadow: 0 16px 40px rgba(150, 170, 200, 0.2);
}

.focus-post-title {
    font-weight: 800;
    color: #4a5f78;
    margin-bottom: 10px;
}

.focus-post-line {
    font-size: 13px;
    color: #6a7f95;
    margin-bottom: 6px;
}

.focus-post-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.focus-stat-summary {
    text-align: center;
    font-size: 14px;
    color: #5a6f88;
    margin-bottom: 14px;
}

.focus-stat-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px;
    height: 160px;
    padding: 8px 4px 0;
    border-radius: 16px;
    background: rgba(245, 250, 255, 0.65);
    border: 1px solid rgba(220, 230, 245, 0.75);
}

.focus-stat-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    gap: 4px;
}

.focus-stat-bar {
    width: 100%;
    max-width: 28px;
    border-radius: 999px 999px 4px 4px;
    background: linear-gradient(180deg, rgba(255, 200, 230, 0.85), rgba(180, 215, 255, 0.75));
    min-height: 4px;
}

.focus-stat-label {
    font-size: 10px;
    color: #8a9bb5;
}

.focus-stat-min {
    font-size: 10px;
    color: #6a7f95;
    font-weight: 700;
}

.focus-stat-recent-title {
    margin-top: 16px;
    font-size: 12px;
    font-weight: 800;
    color: #6a7f95;
}

.focus-stat-recent {
    margin-top: 8px;
    max-height: 180px;
    overflow-y: auto;
    font-size: 12px;
    border-radius: 12px;
    border: 1px solid rgba(230, 238, 250, 0.9);
    background: rgba(255, 255, 255, 0.65);
}

.focus-stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr 48px 52px;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(235, 240, 250, 0.95);
    color: #5a6f88;
    align-items: center;
}

.focus-stat-task {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.focus-tr-list {
    max-height: 50vh;
    overflow-y: auto;
}

.focus-tr-line {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 0;
    border-bottom: 1px dashed rgba(220, 230, 245, 0.9);
}

.focus-tr-time {
    font-size: 11px;
    color: #9aaabe;
}

.focus-tr-text {
    font-size: 13px;
    color: #4a5f78;
    line-height: 1.45;
}

.chat-focus-share-card {
    width: min(320px, 92vw);
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(190, 210, 235, 0.65);
    box-shadow: 0 12px 32px rgba(150, 170, 210, 0.18);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(240, 248, 255, 0.92));
}

.chat-focus-share-ribbon {
    text-align: center;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.2em;
    color: #7a90b8;
    background: linear-gradient(90deg, rgba(255, 230, 245, 0.55), rgba(225, 240, 255, 0.75), rgba(255, 230, 245, 0.55));
}

.chat-focus-share-inner {
    padding: 14px 16px 16px;
}

.chat-focus-share-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 16px;
    text-align: center;
    color: #5a6f88;
    margin-bottom: 10px;
}

.chat-focus-share-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    color: #7a8fa5;
    margin-bottom: 6px;
}

.chat-focus-share-row strong {
    color: #4a5f78;
    font-weight: 700;
    text-align: right;
    max-width: 62%;
}

.chat-focus-share-sub {
    margin-top: 10px;
    font-size: 11px;
    font-weight: 800;
    color: #9aaabe;
    letter-spacing: 0.08em;
}

.chat-focus-share-lines {
    margin-top: 6px;
    max-height: 160px;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.45;
    color: #4a5f78;
}

.focus-share-line {
    padding: 4px 0;
    border-bottom: 1px dashed rgba(230, 238, 250, 0.95);
}

.focus-share-ts {
    color: #9aaabe;
    font-size: 11px;
    margin-right: 6px;
}

.focus-share-empty {
    color: #aab6cc;
    font-size: 12px;
}
/* ================= TODO & REMINDER STYLES ================= */
.focus-panel-todo-scroll {
    background: linear-gradient(to bottom, #eff4f9, #ffffff);
}

.todo-main-wrap {
    padding: 20px 15px;
    font-family: 'Playfair Display', '楷体', serif; /* elegant serif */
}

.todo-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.todo-header-title {
    font-size: 20px;
    font-weight: bold;
    color: #5c7b9a;
    position: relative;
    padding-left: 10px;
}
.todo-header-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 4px;
    background: #a9c0d9;
    border-radius: 4px;
}

.todo-icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #a9c0d9;
    transition: transform 0.2s;
}
.todo-icon-btn:hover {
    transform: scale(1.1);
}

.todo-week-tabs {
    display: flex;
    justify-content: space-between;
    background: rgba(255,255,255,0.6);
    border-radius: 20px;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(169, 192, 217, 0.15);
    margin-bottom: 20px;
}

.todo-day-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 8px 0;
    font-size: 13px;
    color: #8da4be;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}
.todo-day-btn.active {
    background: linear-gradient(135deg, #a9c0d9 0%, #c5d8e8 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(169, 192, 217, 0.4);
}

.todo-edit-area {
    background: #ffffff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 6px 20px rgba(169, 192, 217, 0.1);
    border: 1px dashed #c5d8e8;
}

.todo-input-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.todo-input-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.todo-input-item input {
    flex: 1;
    border: none;
    background: #f4f8fb;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    color: #4a5f78;
    outline: none;
    transition: background 0.2s;
}
.todo-input-item input:focus {
    background: #ebf1f6;
}

.todo-remove-btn {
    background: #ffebee;
    color: #ff8787;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.todo-edit-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    gap: 12px;
}

.todo-btn-soft {
    background: #f4f8fb;
    color: #5c7b9a;
    border: 1px solid #d3e1ef;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    flex: 1;
    transition: all 0.2s;
}
.todo-btn-soft:hover {
    background: #e3ecf5;
}

.todo-btn-primary {
    background: linear-gradient(135deg, #a9c0d9 0%, #c5d8e8 100%);
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    flex: 1;
    box-shadow: 0 4px 12px rgba(169, 192, 217, 0.3);
    transition: all 0.2s;
}
.todo-btn-primary:active {
    transform: scale(0.96);
}

.todo-divider {
    height: 1px;
    background: repeating-linear-gradient(to right, transparent, transparent 4px, #c5d8e8 4px, #c5d8e8 8px);
    margin: 24px 0;
    opacity: 0.5;
}

.todo-display-area {
    background: #ffffff;
    border-radius: 20px;
    padding: 20px 16px;
    box-shadow: 0 8px 30px rgba(169, 192, 217, 0.15);
    position: relative;
}
.todo-display-area::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    right: 20px;
    height: 12px;
    background: repeating-linear-gradient(-45deg, #f4e4e9, #f4e4e9 8px, #ffffff 8px, #ffffff 16px);
    border-radius: 6px;
    opacity: 0.8;
}

.todo-display-header {
    margin-bottom: 16px;
    text-align: center;
}

#todo-display-title {
    font-size: 16px;
    font-weight: bold;
    color: #5c7b9a;
    background: #f4f8fb;
    padding: 6px 20px;
    border-radius: 20px;
    display: inline-block;
}

.todo-table-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.todo-item {
    display: flex;
    align-items: center;
    background: #fcfdfe;
    border: 1px solid #ebf1f6;
    padding: 12px;
    border-radius: 14px;
    transition: all 0.3s;
}
.todo-item:hover {
    box-shadow: 0 2px 10px rgba(169, 192, 217, 0.1);
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    color: #aab6cc;
}
.todo-item.completed .todo-checkbox {
    background: #a9c0d9;
    border-color: #a9c0d9;
}
.todo-item.completed .todo-checkbox::after {
    content: '✓';
    color: white;
    font-size: 14px;
    position: absolute;
    left: 4px;
    top: -1px;
}

.todo-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid #a9c0d9;
    border-radius: 6px;
    margin-right: 12px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s;
}

.todo-text {
    flex: 1;
    font-size: 15px;
    color: #4a5f78;
    line-height: 1.4;
    word-break: break-all;
    transition: color 0.3s;
}

.todo-item-actions {
    display: flex;
    gap: 6px;
}

.todo-item-btn {
    background: none;
    border: none;
    color: #8da4be;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

/* Reminder Area */
.reminder-area {
    background: #ffffff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 15px rgba(169, 192, 217, 0.1);
}

.reminder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.reminder-title {
    font-size: 16px;
    font-weight: bold;
    color: #d18b9c; /* Pinkish touch for reminder */
}

.reminder-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reminder-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff5f7;
    border: 1px solid #fde0e6;
    padding: 12px;
    border-radius: 12px;
}

.reminder-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reminder-item-text {
    font-size: 14px;
    color: #b36b7c;
    font-weight: bold;
}

.reminder-item-time {
    font-size: 11px;
    color: #d89ba9;
}

.reminder-item-delete {
    background: rgba(209, 139, 156, 0.1);
    color: #d18b9c;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
}

/* Celebration Animation */
.celebration-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 24px 32px;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(169, 192, 217, 0.4);
    text-align: center;
    z-index: 10000;
    animation: popupBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes popupBounce {
    0% { transform: translate(-50%, -30%); opacity: 0; }
    100% { transform: translate(-50%, -50%); opacity: 1; }
}
.celebration-popup-emoji {
    font-size: 48px;
    margin-bottom: 10px;
}
.celebration-popup-text {
    font-size: 18px;
    font-weight: bold;
    color: #5c7b9a;
}
.celebration-popup-sub {
    font-size: 12px;
    color: #8da4be;
    margin-top: 4px;
}

/* To-Do Widget styles */
.widget-todo-container {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(240,248,255,0.9) 100%);
    backdrop-filter: blur(12px);
    border-radius: 22px;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.widget-todo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.widget-todo-title {
    font-size: 16px;
    font-weight: bold;
    color: #5c7b9a;
}
.widget-todo-date {
    font-size: 12px;
    color: #8da4be;
}
.widget-todo-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Custom scrollbar for widget */
    padding-right: 4px;
    pointer-events: auto; /* allow scrolling inside widget */
}
.widget-todo-list::-webkit-scrollbar {
    width: 3px;
}
.widget-todo-list::-webkit-scrollbar-thumb {
    background: #d3e1ef;
    border-radius: 3px;
}
.widget-todo-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(255,255,255,0.6);
    border-radius: 10px;
    transition: opacity 0.2s;
}
.widget-todo-item.completed {
    opacity: 0.6;
}
.widget-todo-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #a9c0d9;
    border-radius: 5px;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    margin-top: 2px;
}
.widget-todo-item.completed .widget-todo-checkbox {
    background: #a9c0d9;
}
.widget-todo-item.completed .widget-todo-checkbox::after {
    content: '✓';
    color: white;
    font-size: 12px;
    position: absolute;
    left: 2px;
    top: -1px;
}
.widget-todo-text {
    font-size: 14px;
    color: #4a5f78;
    line-height: 1.4;
    word-break: break-all;
}
.widget-todo-item.completed .widget-todo-text {
    text-decoration: line-through;
}
.widget-todo-empty {
    font-size: 13px;
    color: #aab6cc;
    text-align: center;
    margin-top: 20px;
}
