/* ===== Main Styles ===== */
/* CSS变量定义 */
:root {
    --interface-bg: rgba(247, 247, 247, 0.6);
    --msg-name-color: #999999;
    --msg-time-color: #b0b0b0;
}

/* CSS样式 */
html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    background-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    height: 100%;
    overflow: hidden;
}

/* 手机容器 */
#phone-container {
    width: 330px;
    height: 660px;
    border: 8px solid #707070;
    border-radius: 42px;
    background: #707070;
    background-size: cover;
    background-position: center;
    box-shadow:
        inset 0 0 0 2px rgba(0, 0, 0, 0.1),
        0 20px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-sizing: content-box;
    transition: none !important;
}

/* Home Indicator */
#home-indicator {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    height: 3px;
    /* 更细 */
    background-color: #000;
    border-radius: 10px;
    z-index: 200;
    pointer-events: none;
}

/* --- 灵动岛 --- */
.status-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-top: 14px;
    padding-left: 26px;
    padding-right: 26px;
    box-sizing: border-box;
    z-index: 100;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
    transition: color 0.3s;
}

.status-bar.text-dark {
    color: #000;
}

.status-bar.text-dark svg {
    fill: #000;
}

.status-bar.text-light {
    color: #fff;
}

.status-bar.text-light svg {
    fill: #fff;
}

.sb-left {
    width: 60px;
    text-align: center;
    margin-top: -2px;
}

.sb-right {
    width: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.dynamic-island {
    width: 96px;
    height: 25px;
    background-color: #000;
    border-radius: 12px;
    position: absolute;
    left: 50%;
    top: 8px;
    transform: translateX(-50%);
    z-index: 101;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-right: 8px;
    pointer-events: auto;
}

.island-camera {
    width: 10px;
    height: 10px;
    background: #1a1a1a;
    border-radius: 50%;
    box-shadow: inset 0 0 3px rgba(255, 255, 255, 0.2);
}

/* --- 屏幕管理 --- */
.screen {
    flex: 1;
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-size: cover;
    background-position: center;
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.4s, filter 0.4s;
    overflow: hidden;
    background-color: #fff;
    /* 修复窄屏下页面左右晃动的问题 */
    overflow-x: hidden;
    box-sizing: border-box;
}

#home-screen {
    display: flex;
    z-index: 1;
    padding-top: 0;
    align-items: center;
    overflow-x: hidden;
    width: 100%;
    justify-content: center;
    background-color: #f3e5f5;
    opacity: 1;
}

/* 移除.slide-out 动画 */

/* 主屏幕时间 */
#home-clock {
    font-family: 'Dancing Script', 'Ma Shan Zheng', cursive, sans-serif;
    font-size: 60px;
    letter-spacing: 4px;
    color: #4a3b5e;
    margin-bottom: 80px;
    font-weight: normal;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 5;
}

/* 子页面 */
#message-list-screen {
    z-index: 8;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.05);
    background-color: #fff;
}

/* Right side sliders */
#chat-screen,
#dark-search-screen {
    z-index: 10;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.05);
    background-color: var(--interface-bg, #fff);
}

#chat-settings-screen {
    z-index: 20;
    /* Ensure it covers the chat screen */
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.05);
    background-color: var(--interface-bg, #fdf6f9);
}

/* Left side sliders */
#settings-screen,
#diary-screen {
    z-index: 10;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.05);
}

/* 移除 visible 状态动画 */

/* Message List Styles */
.message-list-body {
    flex: 1;
    background: #fff;
    overflow-y: auto;
}

.message-list-item {
    display: flex;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    align-items: center;
    transition: background-color 0.2s;
}

.message-list-item:active {
    background-color: #f5f5f5;
}

.message-list-avatar {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    margin-right: 12px;
    object-fit: cover;
    background-color: #eee;
}

.message-list-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.message-list-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.message-list-name {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.message-list-time {
    font-size: 12px;
    color: #999;
}

.message-list-preview {
    font-size: 14px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px 10px;
    padding: 0 15px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 50px;
}

.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
    width: 100%;
    min-width: 0;
}

.app-item:active {
    opacity: 0.7;
    transform: scale(0.95);
    transition: 0.1s;
}

.app-icon-box {
    width: 100%;
    max-width: 58px;
    aspect-ratio: 1/1;
    height: auto;
    border-radius: 22%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e6e6fa;
    transition: background 0.3s;
    box-shadow: none;
    opacity: 0.72;
}

.app-icon-box svg {
    width: 55%;
    height: 55%;
    transition: fill 0.3s;
    fill: #483d8b;
}

.app-icon-image {
    width: 55%;
    height: 55%;
    background-color: #483d8b;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    transition: background-color 0.3s;
}

.app-name {
    font-size: 12px;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    color: #4a3b5e;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Header */
.app-header {
    height: 80px;
    padding-top: 40px;
    display: flex;
    align-items: center;
    padding-left: 15px;
    padding-right: 15px;
    /* 默认背景色 */
    background-color: #fff;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    z-index: 10;
    box-sizing: border-box;
    transition: background-color 0.3s;
}

/* 聊天相关页面的 header 用 interface-bg */
#chat-screen .app-header {
    background-color: var(--interface-bg);
}

#chat-settings-screen .app-header {
    background-color: #fff;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
}

.header-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    position: absolute;
    left: 0;
}

.header-btn-right {
    left: auto;
    right: 0;
    justify-content: flex-end;
}

.header-btn svg {
    width: 24px;
    height: 24px;
    fill: #181818;
}

.header-title {
    font-size: 17px;
    font-weight: 600;
    color: #181818;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    max-width: 70%;
}

/* Chat Area */
#chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

#chat-messages::-webkit-scrollbar {
    display: none;
}

.settings-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f2f2f7;
}

.settings-body::-webkit-scrollbar {
    display: none;
}

/* Blocked Status Icon */
.msg-status-blocked {
    color: #ff3b30;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: help;
    flex-shrink: 0;
    line-height: 1.2;
}

/* Message Meta Container (Time + Status) */
.msg-meta {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 1px;
    margin-bottom: 0px;
}

/* Adjust margins for meta container based on sender */
.message-row.sent .msg-meta {
    margin-right: 2px;
}

.message-row.received .msg-meta {
    margin-left: 2px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    vertical-align: middle;
}

.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: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #2196F3;
}

input:focus+.slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Add Contact Styles */
.contact-type-tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
    padding-bottom: 5px;
}

.contact-type-tabs .tab {
    flex: 1;
    text-align: center;
    padding: 8px;
    cursor: pointer;
    color: #999;
    font-size: 14px;
    position: relative;
    transition: color 0.3s;
}

.contact-type-tabs .tab.active {
    color: #333;
    font-weight: bold;
}

.contact-type-tabs .tab.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: #07c160;
    border-radius: 2px;
}

.group-input-item {
    margin-top: 8px;
}

/* Avatar Grid in Settings */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px 10px;
    padding: 10px 0;
}

.avatar-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.avatar-sq {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    /* Rounded Square */
    object-fit: cover;
    background: #eee;
    border: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: transform 0.1s;
}

.avatar-sq:active {
    transform: scale(0.95);
}

.avatar-name {
    font-size: 11px;
    color: #666;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Message Styles */
/* Love Effect */
.love-effect-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 999;
}

.love-heart {
    position: absolute;
    bottom: -20px;
    font-size: 24px;
    animation: floatUp 4s ease-in-out forwards;
    opacity: 0;
}

/* Typing indicator without avatar: make bubble align like received messages */
.typing-only {
    margin-left: 0;
    border-radius: 12px;
}

/* Group badge near name: 5px spacing and slight upward offset */
.group-badge {
    font-size: 10px;
    color: #999;
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 4px;
    margin-left: 5px;
    position: relative;
    top: -1px;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        transform: translateY(-600px) scale(1.5);
        opacity: 0;
    }
}

/* Group input button styles */
.group-add-btn,
.group-remove-btn {
    transition: background 0.12s ease, transform 0.08s ease;
}

.group-add-btn:hover,
.group-remove-btn:hover {
    background: rgba(0, 0, 0, 0.03);
}

.group-add-btn:active,
.group-remove-btn:active {
    transform: scale(0.96);
}

/* 消息行容器：包含头像、消息内容、时间等 */
.message-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    flex-shrink: 0;
}

/* 发送方（右侧）样式 */
.message-row.sent {
    flex-direction: row-reverse;
}

/* 接收方（左侧）样式 */
.message-row.received {
    flex-direction: row;
}

/* 头像样式 */
.avatar {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    background-color: #e0e0e0;
    object-fit: cover;
    flex-shrink: 0;
    border: none;
    margin-top: 0;
}

/* 消息内容容器：包含名字、气泡、心声等 */
.msg-container {
    display: flex;
    flex-direction: column;
    max-width: 65%;
}

.message-row.sent .msg-container {
    align-items: flex-end;
}

.message-row.received .msg-container {
    align-items: flex-start;
}

/* 名字样式 */
.msg-name {
    font-size: 12px;
    color: var(--msg-name-color);
    margin: 0 2px 2px 2px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 气泡和时间的包装器 */
.msg-wrapper {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 3px;
    margin-top: 2px;
}

.message-row.sent .msg-wrapper {
    flex-direction: row-reverse;
}

.message-row.received .msg-wrapper {
    flex-direction: row;
}

/* 心声气泡样式 */
.msg-thought {
    font-size: 12px;
    color: #333;
    background-color: rgba(200, 200, 200, 0.5);
    border-radius: 14px;
    padding: 4px 8px;
    margin-top: 0;
    line-height: 1.3;
    word-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
    text-align: left;
}

/* 所有气泡类型的通用样式 */
.bubble,
.location-card,
.transfer-card,
.file-card,
.voice-card-container,
.photo-card,
.sticker-bubble,
.real-audio-card {
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    transition: transform 0.1s;
    max-width: 100%;
}

/* 按压效果 */
.bubble.pressing,
.location-card.pressing,
.transfer-card.pressing,
.file-card.pressing,
.voice-card-container.pressing,
.photo-card.pressing,
.sticker-bubble.pressing,
.real-audio-card.pressing {
    transform: scale(0.98);
    filter: brightness(0.95);
}

/* 普通文本气泡样式 */
.bubble {
    padding: 7px 14px;
    border-radius: 18px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-line;
    font-size: var(--msg-font-size, 14px);
    opacity: 0.8;
}

/* 发送方文本气泡 */
.bubble-sent {
    background: #dcd0ff;
    color: #000;
    border-top-right-radius: 0px;
}

/* 接收方文本气泡 */
.bubble-received {
    background: #ffffff;
    color: #000;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    border-top-left-radius: 0px;
}

/* 消息时间样式 */
.msg-time {
    font-size: 10px;
    color: var(--msg-time-color);
    line-height: 1;
    user-select: none;
    padding: 0 2px;
    margin-bottom: 0px;
    flex-shrink: 0;
    min-width: 28px;
}

.message-row.sent .msg-time {
    text-align: right;
}

.message-row.received .msg-time {
    text-align: left;
}

/* 图片/视频卡片样式 */
.photo-card {
    border-radius: 18px;
    padding: 6px;
    overflow: visible;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
    font-size: 0;
    max-width: 160px;
    width: 100%;
    box-sizing: border-box;
}

.photo-card.sent {
    border-top-right-radius: 0px;
}

.photo-card.received {
    border-top-left-radius: 0px;
}

.photo-card img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

/* 表情包气泡样式 */
.sticker-bubble {
    border-radius: 14px;
    overflow: visible;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-size: 0;
    max-width: 100px;
}

.sticker-bubble img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 14px;
}

/* 语音卡片容器 */
.voice-card-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

/* 发送方右对齐 */
.voice-card-container.sent {
    align-items: flex-end;
}

/* 接收方左对齐 */
.voice-card-container.received {
    align-items: flex-start;
}

/* 模拟语音卡片样式 - 仅包含语音条 */
.voice-card {
    padding: 0;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 18px;
    position: relative;
    word-break: break-word;
    white-space: normal;
    cursor: pointer;
}

.voice-card.sent {
    border-top-right-radius: 0px;
}

.voice-card.received {
    border-top-left-radius: 0px;
}

.voice-card:active {
    opacity: 0.8;
}

.voice-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 7px 10px;
    margin: 0;
    background: inherit;
    color: inherit;
    border-radius: inherit;
}

.voice-card.sent .voice-bar {
    flex-direction: row-reverse;
}

.voice-duration {
    font-size: 14px;
    font-weight: 500;
    min-width: 12px;
    padding: 0 3px;
    text-align: center;
}

.voice-waves {
    display: flex;
    align-items: center;
    gap: 2.5px;
    height: 100%;
    justify-content: flex-start;
    overflow: hidden;
    margin: 0;
}

.wave {
    width: 2px;
    background-color: currentColor;
    border-radius: 1px;
    opacity: 0.7;
}

/* 语音文字气泡 - 单独的小气泡 */
.voice-text-bubble {
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
    display: none;
    padding: 7px 10px;
    margin: 0;
    color: inherit;
    border-radius: 12px;
    margin-top: 0;
    flex-shrink: 0;
    background: inherit;
}

/* Show text state - 显示文字气泡 */
.voice-card-container.show-text .voice-text-bubble {
    display: block;
}

/* 真实音频卡片样式 */
.real-audio-card {
    padding: 5px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    max-width: 220px;
}

.real-audio-card audio {
    max-width: 100%;
    height: 32px;
}

.real-audio-card.sent {
    border-top-right-radius: 0px;
    background: #dcd0ff;
}

.real-audio-card.received {
    border-top-left-radius: 0px;
    background: #ffffff;
}

/* 位置、转账、文件卡片通用样式 */
.location-card,
.transfer-card,
.file-card {
    width: 200px;
    overflow: visible;
}

/* 位置卡片 */
.location-card {
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
}

.location-info {
    padding: 8px 10px;
    background: #fff;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.location-name {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-map {
    width: 100%;
    height: 60px;
    background-color: #f2f2f2;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="220" height="90" viewBox="0 0 220 90"><rect width="220" height="90" fill="%23f2f2f2"/><path d="M-10,30 Q50,10 110,30 T230,30" stroke="%23ddd" stroke-width="6" fill="none"/><path d="M30,90 Q60,50 90,90" stroke="%23ddd" stroke-width="6" fill="none"/><path d="M150,0 Q180,40 210,0" stroke="%23ddd" stroke-width="6" fill="none"/><circle cx="110" cy="45" r="4" fill="%23ea4e3d"/></svg>');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.location-pin {
    width: 20px;
    height: 20px;
    fill: #ea4e3d;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
    margin-bottom: 8px;
}

/* 转账卡片 */
.transfer-card {
    background: #ffacac;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s;
}

.transfer-card.completed {
    background: #ffdbdb;
}

.transfer-top {
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.transfer-icon-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.transfer-icon-circle svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
    stroke-width: 2;
    fill: none;
}

.transfer-content {
    flex: 1;
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.transfer-amount {
    font-size: 15px;
    font-weight: bold;
}

.transfer-note {
    font-size: 11px;
    opacity: 0.9;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transfer-bottom {
    background: #fff;
    padding: 4px 12px;
    font-size: 10px;
    color: #999;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* 文件卡片 */
.file-card {
    background: white;
    border-radius: 6px;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #eee;
}

.file-info {
    flex: 1;
    overflow: hidden;
}

.file-name {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    word-break: break-all;
}

.file-size {
    font-size: 9px;
    color: #999;
    margin-top: 3px;
}

.file-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
}

.file-icon svg {
    width: 100%;
    height: 100%;
    fill: #ddd;
}

/* Media Preview Bar */
#media-preview-bar {
    display: none;
    padding: 8px 12px;
    background: #fff;
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    z-index: 10;
    align-items: center;
}

#chat-screen #media-preview-bar,
#chat-settings-screen #media-preview-bar {
    background: var(--interface-bg);
}

#media-preview-bar.visible {
    display: flex;
}

.preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.preview-file-icon {
    font-size: 24px;
}

.preview-close {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #ff5555;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    font-weight: bold;
}

/* Input Bar */
#input-bar {
    display: flex;
    padding: 2px 5px 10px 5px;
    border-top: none;
    /* No white line */
    background-color: #fff;
    backdrop-filter: blur(10px);
    align-items: flex-end;
    flex-shrink: 0;
    z-index: 10;
    /* 减小输入框与上边缘间隙 */
    padding-bottom: 10px;
    transition: background-color 0.3s;
}

#chat-screen #input-bar {
    background-color: var(--interface-bg);
}

#chat-settings-screen #input-bar {
    background-color: #fff;
}

#input-bar textarea {
    margin-top: 5px;
    flex: 1;
    border: none;
    border-radius: 15px;
    padding: 8px 10px;
    font-size: 15px;
    resize: none;
    max-height: 80px;
    outline: none;
    min-height: 20px;
    background: rgba(245, 245, 245, 0.9);
    color: #000;
    margin-right: 4px;
    scrollbar-width: none;
    /* Firefox */
    overflow-y: auto;
    box-sizing: border-box;
    /* 隐藏滚动条 */
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

#input-bar textarea::-webkit-scrollbar {
    display: none;
}

#input-bar textarea::-webkit-scrollbar {
    display: none;
}

/* Chrome/Safari */

.toolbar-btn {
    background: transparent;
    color: var(--chat-btn-text, #333);
    border: none;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 2px;
    border-radius: 6px;
}

.toolbar-btn:hover {
    opacity: 0.9;
}

.toolbar-btn svg {
    width: 22px;
    height: 22px;
    stroke: var(--chat-btn-text, #580000);
    stroke-width: 1.5;
    fill: none;
    transition: stroke 0.2s;
}

.toolbar-btn.active svg {
    transform: rotate(45deg);
}

#plus-button {
    margin-right: 0px;
    padding: 0;
}

#emoji-button {
    margin-left: 0px;
    margin-right: 4px;
}

#send-button {
    background: transparent;
    color: var(--chat-btn-text, #ffffff);
    border-radius: 6px;
    height: 32px;
    padding: 0 12px;
    font-size: 15px;
    font-weight: 600;
    margin-left: 0px;
    margin-bottom: 3px;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

#send-button:hover {
    opacity: 0.9;
}

/* Menus */
#action-menu,
#emoji-menu {
    height: 0;
    background: #f7f7f7;
    border-top: none;
    transition: height 0.2s ease;
    overflow: hidden;
    flex-shrink: 0;
    z-index: 10;
}

#action-menu {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 0 20px;
}

#action-menu.open {
    height: 220px;
    padding: 25px 20px;
    border-top: 1px solid #e5e5e5;
}

#emoji-menu {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 0 15px;
    overflow-y: auto;
    box-sizing: border-box;
    align-content: flex-start;
}

#emoji-menu.open {
    height: 220px;
    padding: 15px;
    border-top: 1px solid #e5e5e5;
}

#emoji-menu::-webkit-scrollbar {
    display: none;
}

/* Quote Block */
.msg-quote {
    margin-bottom: 6px;
    margin-top: 0;
    padding: 8px 10px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    font-size: 12px;
    color: #555;
    display: flex;
    flex-direction: column;
    /* border-left: 3px solid #b0b0b0; */
    position: relative;
    user-select: none;
}

.msg-quote-content {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

/* Message Action Menu */
.msg-action-menu {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 4px;
    display: flex;
    align-items: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center bottom;
}

.msg-action-menu.top {
    transform-origin: center top;
}

.msg-action-menu::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -6px;
    transform: translateX(-50%);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.95) transparent transparent transparent;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.05));
}

.msg-action-menu.top::after {
    top: -6px;
    bottom: auto;
    border-width: 0 6px 6px;
    border-color: transparent transparent rgba(255, 255, 255, 0.95) transparent;
    filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.05));
}

.msg-action-item {
    padding: 8px 14px;
    cursor: pointer;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msg-action-item:last-child {
    border-right: none;
}

.msg-action-item:active {
    background-color: #f5f0f6;
}

.msg-action-icon {
    width: 16px;
    height: 16px;
    display: block;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

.msg-action-item:active .msg-action-icon {
    transform: scale(0.9);
    opacity: 1;
}

/* Transfer Modal */
.transfer-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.transfer-modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.transfer-modal {
    width: 280px;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.transfer-modal-overlay.visible .transfer-modal {
    transform: scale(1);
}

.transfer-header {
    width: 100%;
    padding: 30px 0 20px;
    text-align: center;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.transfer-icon-large {
    width: 50px;
    height: 50px;
    background: #ffacac;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.transfer-icon-large svg {
    width: 28px;
    height: 28px;
    stroke: #fff;
    stroke-width: 2;
    fill: none;
}

.transfer-desc {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.transfer-amount-large {
    font-size: 32px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
}

.transfer-actions {
    width: 100%;
    padding: 0 20px 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    gap: 10px;
    justify-content: center;
}

.transfer-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s;
}

.transfer-btn-receive {
    background: #ffeef5;
    color: #666;
}

.transfer-btn-return {
    background: #f0f0f0;
    color: #666;
}

.transfer-btn:active {
    opacity: 0.8;
}

.transfer-info-text {
    width: 100%;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.transfer-close {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #666;
    font-size: 12px;
}

.action-icon-box {
    width: 55px;
    height: 55px;
    background: #fff;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e5e5;
}

.sticker-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.sticker-img {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 8px;
    background: #fff;
}

.sticker-add-btn {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
    border-radius: 8px;
    background: #f7f7f7;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #ccc;
    box-sizing: border-box;
}

.sticker-add-btn svg {
    width: 28px;
    height: 28px;
    fill: #999;
}

.sticker-name {
    font-size: 10px;
    color: #666;
    margin-top: 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Modals */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

#input-modal {
    z-index: 210;
}

/* Ensure input modal is on top */
.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    box-sizing: border-box;
    width: 85%;
    max-width: 300px;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 15px;
    transform: scale(0.9);
    transition: transform 0.2s;
    max-height: 70%;
    overflow-y: auto;
    scrollbar-width: none;
}

.modal-box::-webkit-scrollbar {
    display: none;
}

.modal-overlay.show .modal-box {
    transform: scale(1);
}

.modal-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 5px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.modal-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    font-weight: 500;
}

.btn-cancel {
    background: #f0f0f0;
    color: #333;
}

.btn-confirm {
    background: #07c160;
    color: white;
}

.btn-grey {
    background: #e5e5e5;
    color: #333;
}

.btn-grey:active {
    background: #d1d1d1;
}

#modal-inputs-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
    outline: none;
    scrollbar-width: none;
}

.modal-input::-webkit-scrollbar {
    display: none;
}

.modal-input:focus {
    border-color: #07c160;
}

/* Settings UI */
.settings-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #fdf6f9;
    /* 可爱粉色背景 */
}

.settings-body::-webkit-scrollbar {
    display: none;
}

.settings-section-title {
    display: block;
    font-size: 13px;
    color: #999;
    margin-left: 12px;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.setting-group {
    background: #fff;
    border-radius: 18px;
    padding: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.02);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.setting-group.no-border {
    border: none;
}

.setting-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    font-size: 15px;
    color: #333;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid #f7f7f7;
}

.settings-footer {
    padding: 20px;
    background: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    z-index: 10;
}

.btn-save {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #fff;
    border: none;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(255, 154, 158, 0.4);
    transition: transform 0.1s, box-shadow 0.1s;
}

.btn-save:active {
    transform: scale(0.98);
    box-shadow: 0 2px 6px rgba(255, 154, 158, 0.3);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-row>div {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.color-picker {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    padding: 0;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.setting-input-sm {
    width: 50px;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.file-upload-label {
    font-size: 12px;
    background: #f2f2f7;
    border: 1px solid #ddd;
    padding: 5px 10px;
    border-radius: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: background 0.2s;
    appearance: none;
    color: #333;
    font-family: inherit;
}

.file-upload-label:active {
    background: #e5e5ea;
}

.file-upload-input {
    display: none;
}

.preview-img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
    background: #eee;
    border: 1px solid #ddd;
}

.delete-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background-color: #c0c0c0;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.delete-btn svg {
    width: 10px;
    height: 10px;
    stroke: currentColor;
    stroke-width: 3;
}

.typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #888;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

.dark-result-item {
    border-bottom: 1px solid #333;
    padding: 10px 0;
    color: #ff69b4;
    font-family: monospace;
    animation: fadeIn 0.5s ease;
}

.dark-result-content {
    font-size: 14px;
    margin-bottom: 4px;
    word-break: break-all;
}

.dark-result-time {
    font-size: 10px;
    color: #880044;
    text-align: right;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Custom CSS Textarea Scrollbar ===== */
#set-custom-css::-webkit-scrollbar {
    display: none;
}

/* ===== Diary Styles ===== */
#diary-scroll-container::-webkit-scrollbar {
    display: none;
}

.diary-card {
    background: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}

.diary-card:active {
    transform: scale(0.99);
}

.diary-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 12px;
    color: #999;
    padding-bottom: 5px;
    border-bottom: 2px solid #f5f5f5;
}

.diary-date {
    font-weight: bold;
    color: #d4a5a5;
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 15px;
}

.diary-weather {
    background: #f5f5f5;
    color: #888;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    height: fit-content;
}

.diary-body {
    font-size: 15px;
    line-height: 28px;
    color: #666;
    background-image: url("data:image/svg+xml;utf8,<svg width='12' height='28' xmlns='http://www.w3.org/2000/svg'><rect x='0' y='27' width='6' height='1' fill='%23e0e0e0'/></svg>");
    background-attachment: local;
    word-break: break-all;
    text-align: justify;
}

.diary-body p {
    margin: 0;
}

/* ===== Update Content Scrollbar ===== */
#update-content::-webkit-scrollbar {
    display: none;
}

/* ===== Call Chat Styles ===== */
#call-chat-container::-webkit-scrollbar {
    display: none;
}

.call-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
    animation: fadeIn 0.3s ease;
}

.call-bubble.sent {
    align-self: flex-end;
    background: #666666;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.call-bubble.received {
    align-self: flex-start;
    background: #333333;
    color: #fff;
    border-bottom-left-radius: 4px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes jump-exclamation {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.jumping-exclamation {
    display: inline-block;
    font-weight: bold;
    font-size: 18px;
    animation: jump-exclamation 0.6s infinite;
}

/* ===== Call Animation Styles ===== */
@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.ripple-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    animation: ripple 2s infinite;
    z-index: -1;
    display: none;
}

#call-screen.speaking .ripple-ring {
    display: block;
}

@keyframes wave-jump {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.jumping-dot {
    display: inline-block;
    animation: wave-jump 1s infinite;
    font-size: 32px;
    /* 点大一些 */
    margin: 0 4px;
    /* 距离宽一些 */
    line-height: 10px;
    /* 防止撑开高度 */
}

.jumping-dot:nth-child(1) {
    animation-delay: 0s;
}

.jumping-dot:nth-child(2) {
    animation-delay: 0.1s;
}

.jumping-dot:nth-child(3) {
    animation-delay: 0.2s;
}