/* ========================================
   Engine Base Styles - 共享样式
   ======================================== */

:root {
    /* ─── 主题色 HSL 基础值（粉紫预设） ─── */
    --theme-h: 260;
    --theme-s: 80%;
    --theme-l: 66%;

    /* ─── 主题色派生（由 JS 动态计算写入） ─── */
    --theme-bg-start:  hsl(260, 80%, 66%);
    --theme-bg-mid:    hsl(270, 44%, 48%);
    --theme-bg-end:    hsl(300, 87%, 75%);
    --theme-header:    rgba(255,255,255,0.12);
    --theme-header-border: rgba(255,255,255,0.15);
    --theme-card:      rgba(255,255,255,0.1);
    --theme-card-border: rgba(255,255,255,0.12);
    --theme-text:      rgba(255,255,255,0.95);
    --theme-text-sub:  rgba(255,255,255,0.5);
    --theme-text-dim:  rgba(255,255,255,0.3);
    --theme-input-bg:  rgba(255,255,255,0.1);
    --theme-input-border: rgba(255,255,255,0.15);
    --theme-bubble-sent: rgba(255,255,255,0.2);
    --theme-bubble-recv: rgba(255,255,255,0.12);
    --theme-btn-gradient: linear-gradient(135deg, hsl(260,80%,66%), hsl(270,44%,48%), hsl(300,87%,75%));
    --theme-btn-glow: rgba(224,64,251,0.4);
    --theme-btn-glow2: rgba(255,107,157,0.4);

    /* ─── 品牌色 ─── */
    --primary:        #ff80ab;
    --primary-dark:   #e0608a;
    --primary-light:  #ffb0c8;
    --secondary:      #f48fb1;
    --accent:         #90caf9;

    /* ─── 背景 ─── */
    --bg:             #fce4ec;
    --bg-card:        #ffffff;
    --bg-header:      rgba(255,255,255,0.85);
    --bg-input:       #f5f5f5;
    --bg-hover:       #fdf6f8;
    --bg-overlay:     rgba(0,0,0,0.4);

    /* ─── 文字 ─── */
    --text:           #444444;
    --text-secondary: #888888;
    --text-light:     #999999;
    --text-white:     #ffffff;

    /* ─── 边框 ─── */
    --border:         #eeeeee;
    --border-light:   #f0f0f0;

    /* ─── 功能色 ─── */
    --success:        #4CAF50;
    --warning:        #ff9800;
    --danger:         #ff6b6b;
    --info:           #90caf9;

    /* ─── 圆角 ─── */
    --radius-sm:      8px;
    --radius-md:      12px;
    --radius-lg:      18px;
    --radius-full:    999px;

    /* ─── 阴影 ─── */
    --shadow-sm:      0 1px 4px rgba(0,0,0,0.06);
    --shadow-md:      0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg:      0 8px 30px rgba(0,0,0,0.12);

    /* ─── 布局 ─── */
    --phone-radius:   0px;
    --font:           -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --page-padding:   16px;
    --header-height:  50px;

    /* ─── 兼容旧变量 ─── */
    --bg-color: var(--bg);
    --primary-color: var(--primary);
    --secondary-color: var(--secondary);
    --accent-color: var(--accent);
    --text-color: var(--text);
    --white-color: var(--bg-card);
    --border-radius: var(--radius-lg);
    --phone-corner-radius: var(--phone-radius);
    --font-family: var(--font);
    --top-pinned-bg: #fff0f5;
    --online-status-color: var(--success);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-family);
    margin: 0; padding: 0;
    background: linear-gradient(135deg, #fce4ec, #f8bbd0);
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
}

.phone-screen {
    width: 100%; max-width: 420px; height: 100vh; max-height: 850px;
    background-color: var(--white-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border-radius: var(--phone-corner-radius);
    overflow: hidden; position: relative;
    display: flex; flex-direction: column;
}

/* Screens */
.screen {
    display: none; flex-direction: column; width: 100%; height: 100%;
    animation: fadeIn 0.5s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* App Header */
.app-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 20px;
    background-color: rgba(255,255,255,0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #eee;
    flex-shrink: 0; position: relative; z-index: 10;
}
.app-header .back-btn,
.app-header .action-btn {
    background: none; border: none;
    font-size: 24px; font-weight: bold;
    color: var(--primary-color); cursor: pointer;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
}
#cancel-multi-select-btn {
    font-size: 14px !important; font-weight: 500 !important;
    color: var(--white-color) !important;
    background-color: var(--primary-color) !important;
    border-radius: 10px !important;
    padding: 5px 10px !important; width: auto !important; height: auto !important;
}
.app-header .action-btn-group { display: flex; align-items: center; gap: 10px; }
.app-header .action-btn-group .action-btn {
    font-size: 16px; font-weight: 600; width: auto; padding: 6px 12px; border-radius: 10px;
}
.app-header .action-btn-group #create-group-btn {
    background-color: var(--primary-color); color: var(--white-color);
}
.app-header .action-btn-group #add-chat-btn {
    font-size: 28px; padding: 0; width: 40px; height: 40px;
    background-color: transparent; color: var(--primary-color); border-radius: 50%;
}
.app-header .action-btn img { width: 28px; height: 28px; }
.app-header .title-container {
    display: flex; flex-direction: column; align-items: center;
    text-align: center; position: absolute; left: 50%; transform: translateX(-50%);
}
.app-header .title { font-size: 18px; font-weight: 600; color: var(--text-color); margin: 0; }
.app-header .subtitle {
    font-size: 12px; color: #888; display: flex; align-items: center; margin-top: 2px;
}
.online-indicator {
    width: 8px; height: 8px; border-radius: 50%;
    background-color: var(--online-status-color); margin-right: 5px;
}
.app-header .placeholder { width: 40px; }

/* Swipeable Pages */
.page-swipe-container {
    width: 100%; display: flex;
    transition: transform 0.35s cubic-bezier(0.25,0.46,0.45,0.94);
    will-change: transform; touch-action: pan-y;
}
.page-swipe-container.dragging { transition: none; }
.page-swipe-container > .swipe-page {
    min-width: 100%; width: 100%; height: 100%; flex-shrink: 0;
    overflow-y: auto; display: flex; flex-direction: column;
}
.page-indicators {
    display: flex; justify-content: center; gap: 8px;
    padding: 8px 0 4px; flex-shrink: 0; z-index: 20;
}
.page-indicators .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(0,0,0,0.2); transition: background 0.3s, transform 0.3s;
    cursor: pointer;
}
.page-indicators .dot.active {
    background: var(--primary-color); transform: scale(1.2);
}
#home-screen.day-mode .page-indicators .dot { background: rgba(255,255,255,0.4); }
#home-screen.day-mode .page-indicators .dot.active { background: rgba(255,255,255,0.9); }

/* Right Page - Module Hub */
.right-page { padding: 50px 0 60px; justify-content: flex-start; }
.right-page-empty {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 20px 40px;
}
.right-page-title {
    font-size: 14px; color: rgba(0,0,0,0.4); margin-bottom: 24px;
    letter-spacing: 1px; font-weight: 600;
}
#home-screen.day-mode .right-page-title {
    color: rgba(255,255,255,0.5); text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.right-page-grid {
    display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; justify-content: center;
}
.right-page-grid .app-icon {
    display: flex; flex-direction: column; align-items: center;
    cursor: pointer; text-decoration: none;
}
.right-page-grid .app-icon .icon-img {
    width: 60px; height: 60px; border-radius: 15px; margin-bottom: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s ease; object-fit: cover;
}
.right-page-grid .app-icon:hover .icon-img { transform: translateY(-5px); }
.right-page-grid .app-icon .app-name {
    font-size: 13px; color: var(--text-color); font-weight: 600;
    letter-spacing: 0.3px;
}
#home-screen.day-mode .right-page-grid .app-icon .app-name {
    color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Home Screen */
#home-screen {
    justify-content: space-between; background-size: cover; background-position: center;
    transition: background-image 0.5s ease-in-out; padding: 50px 0;
    position: relative;
}
#home-screen > .page-swipe-container {
    width: 100%; display: flex; flex: 1; min-height: 0;
    transition: transform 0.35s cubic-bezier(0.25,0.46,0.45,0.94);
    will-change: transform; touch-action: pan-y;
}
#home-screen > .page-swipe-container > .swipe-page {
    min-width: 100%; width: 100%; flex-shrink: 0;
    overflow-y: auto; display: flex; flex-direction: column;
}
#home-dock {
    display: flex; justify-content: center; align-items: center;
    padding: 6px 10px; gap: 15px; flex-shrink: 0;
    margin: 0 20px 8px;
    background-color: rgba(255,255,255,0.7);
    backdrop-filter: blur(10px); border-radius: var(--border-radius);
    min-height: 80px;
}
#home-dock .app-icon .icon-img {
    width: 55px; height: 55px; border-radius: 15px; margin-bottom: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s ease; object-fit: cover;
}
#home-dock .app-icon:hover .icon-img { transform: translateY(-3px); }
.time-widget { text-align: center; padding: 0 20px; color: var(--text-color); }
.time-widget .time { font-size: 72px; font-weight: 600; }
.time-widget .date { font-size: 18px; color: #666; }
#home-screen.day-mode .time-widget,
#home-screen.day-mode .time-widget .date,
#home-screen.day-mode .app-icon .app-name {
    color: var(--white-color); text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.app-grid {
    width: 100%; padding: 20px 40px;
    display: grid; grid-template-columns: repeat(3,1fr); gap: 20px;
    justify-content: center; align-content: center; margin-top: 40px;
}

.app-icon {
    display: flex; flex-direction: column; align-items: center;
    cursor: pointer; text-decoration: none;
}
.icon-img {
    width: 60px; height: 60px; border-radius: 15px; margin-bottom: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s ease; object-fit: cover;
}
.app-icon:hover .icon-img { transform: translateY(-5px); }
.app-icon .app-name { font-size: 13px; color: var(--text-color); font-weight: 600; letter-spacing: 0.3px; }

/* Content & Modals */
.content { flex-grow: 1; overflow-y: auto; padding: 20px; position: relative; }
.placeholder-text { text-align: center; color: #aaa; margin-top: 50px; }

.modal-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); z-index: 100;
    display: none; align-items: center; justify-content: center;
    animation: fadeIn 0.3s ease;
}
.modal-overlay.visible { display: flex; }
.modal-window {
    background: var(--white-color); padding: 25px; border-radius: var(--border-radius);
    box-shadow: 0 5px 25px rgba(0,0,0,0.15); width: 85%; max-width: 340px;
    animation: slideUp 0.4s ease-out;
}
.modal-window h3 { margin-top: 0; text-align: center; color: var(--primary-color); }
.modal-tabs {
    display: flex; gap: 0; margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}
.modal-tab {
    flex: 1; padding: 10px 8px; border: none; background: transparent;
    font-size: 13px; font-weight: 600; color: #999; cursor: pointer;
    transition: all 0.2s; border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.modal-tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.modal-tab:hover { color: var(--secondary-color); }
#import-tab-panel { min-height: 200px; max-height: 70vh; overflow-y: auto; }
#import-tab-panel .import-section-text { max-height: 60px; }
#import-tab-panel .import-card-header { flex-shrink: 0; }

.import-dropzone {
    border: 2px dashed #ddd; border-radius: 12px; padding: 30px 20px;
    text-align: center; cursor: pointer; transition: all 0.2s;
}
.import-dropzone:hover { border-color: var(--primary-color); background: #fef6f9; }
.import-dropzone-icon { font-size: 36px; margin-bottom: 8px; }
.import-dropzone-text { font-size: 13px; color: #888; line-height: 1.5; }

.import-card-header {
    display: flex; align-items: center; gap: 12px; padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.import-card-avatar {
    width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
    background: #f0f0f0;
}
.import-card-name { font-size: 16px; font-weight: 600; color: #333; }

.import-section { margin: 10px 0; }
.import-section-label {
    font-size: 12px; font-weight: 600; color: #666;
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;
}
.import-section-text {
    font-size: 13px; color: #555; line-height: 1.5;
    max-height: 80px; overflow-y: auto; padding: 6px 8px;
    background: #f9f9f9; border-radius: 6px; white-space: pre-wrap;
}

.import-checkbox-row {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 0; font-size: 13px; color: #444; cursor: pointer;
}
.import-checkbox-row input[type="checkbox"] { width: auto; margin: 0; flex-shrink: 0; }
.import-checkbox-row.disabled { opacity: 0.6; cursor: not-allowed; }
.import-checkbox-row .count-badge {
    font-size: 11px; padding: 1px 6px; border-radius: 8px;
    background: #e8e8e8; color: #888; margin-left: auto;
}

.import-wb-item {
    display: flex; align-items: flex-start; gap: 6px;
    padding: 5px 0 5px 4px; font-size: 12px; color: #555;
    border-bottom: 1px solid #f5f5f5;
}

.import-actions { display: flex; gap: 8px; margin-top: 16px; }
.import-actions .btn { flex: 1; padding: 12px; font-size: 14px; }

#import-error {
    padding: 16px; border-radius: 8px; background: #fff0f0;
    text-align: center; color: #e53935; font-size: 13px; margin-top: 12px;
}
#import-error .btn { margin-top: 10px; }

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
#edit-group-member-modal,
#create-member-for-group-modal { z-index: 102; }
#edit-group-member-modal .avatar-preview,
#create-member-for-group-modal .avatar-preview { width: 80px; height: 80px; }

/* Context Menu */
.context-menu {
    position: fixed; z-index: 1000; background: white; border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15); overflow: hidden; padding: 5px 0;
    animation: fadeIn 0.1s ease;
}
.context-menu-item { padding: 10px 20px; cursor: pointer; }
.context-menu-item:hover { background-color: #f5f5f5; }
.context-menu-item.danger { color: #e53935; }

/* Action Sheet */
.action-sheet-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); z-index: 200;
    display: none; align-items: flex-end; animation: fadeIn 0.3s ease;
}
.action-sheet-overlay.visible { display: flex; }
.action-sheet {
    background: #f7f7f7; width: 100%;
    border-top-left-radius: 20px; border-top-right-radius: 20px;
    padding: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom));
    animation: slideUp 0.3s ease-out;
}
.action-sheet-button {
    width: 100%; background: white; border: none; padding: 15px;
    font-size: 16px; color: var(--primary-color); font-weight: 500;
    cursor: pointer; border-radius: 10px; margin-bottom: 8px;
}
.action-sheet-button.danger { color: #e53935; }
.action-sheet-button:last-child { margin-bottom: 0; }

/* Chat List */
#chat-list-screen .content,
#world-book-screen .content { padding: 10px 0 0 0; }
.list-container { list-style: none; margin: 0; padding: 0; }
.list-item {
    display: flex; align-items: center; padding: 10px 20px;
    cursor: pointer; border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease; position: relative;
}
.list-item:hover { background-color: #fdf6f8; }
.chat-item.pinned { background-color: var(--top-pinned-bg); }

/* 世界书开关 */
.wb-toggle-switch {
    position: relative; display: inline-block; width: 36px; height: 20px;
    flex-shrink: 0; margin-left: 8px; cursor: pointer; z-index: 2;
}
.wb-toggle-switch input { display: none; }
.wb-toggle-slider {
    position: absolute; inset: 0; background: #ccc;
    border-radius: 20px; transition: 0.25s;
}
.wb-toggle-slider::before {
    content: ''; position: absolute; width: 16px; height: 16px;
    left: 2px; bottom: 2px; background: #fff; border-radius: 50%;
    transition: 0.25s;
}
.wb-toggle-switch input:checked + .wb-toggle-slider { background: var(--primary-color); }
.wb-toggle-switch input:checked + .wb-toggle-slider::before { transform: translateX(16px); }
.chat-avatar {
    width: 50px; height: 50px; border-radius: 50%; margin-right: 15px;
    object-fit: cover; flex-shrink: 0; background-color: #eee;
}
.group-avatar { border-radius: 10px; }
.item-details { flex-grow: 1; overflow: hidden; }
.item-details-row { display: flex; justify-content: space-between; align-items: center; }
.item-name { font-weight: 600; color: var(--text-color); font-size: 16px; }
.item-real-name { font-size: 12px; color: #999; margin-top: 1px; }
.item-preview-wrapper { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.item-preview {
    font-size: 14px; color: #888; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; flex-grow: 1;
}
.pin-badge {
    background-color: var(--primary-color); color: white;
    font-size: 10px; font-weight: bold; padding: 2px 6px;
    border-radius: 5px; white-space: nowrap; flex-shrink: 0;
}

/* Chat Room */
#chat-room-screen { background-size: cover; background-position: center; overflow: hidden; position: relative; }
#chat-room-screen .content {
    display: flex; flex-direction: column; padding: 10px; padding-bottom: 10px;
    transition: padding-bottom 0.3s ease;
}
#chat-room-screen.multi-select-active .content { padding-bottom: 70px; }
.message-area {
    flex-grow: 1; overflow-y: auto; padding: 0 10px; scroll-behavior: smooth;
}

/* ─── 消息包装器 ─── */
.message-wrapper {
    display: flex; margin-bottom: 8px; align-items: flex-start;
    transition: background-color 0.2s; flex-direction: column;
    position: relative;
}
.message-wrapper.group-message { margin-bottom: 14px; }
.message-wrapper.sent { align-items: flex-end; }
.message-wrapper.received { align-items: flex-start; }
.message-wrapper.system-notification { align-items: center; }
.message-wrapper.multi-select-selected {
    background-color: rgba(144,202,249,0.2); border-radius: var(--border-radius);
}

/* ─── 气泡行（头像 + 气泡组）─── */
.bubble-row {
    display: flex; width: 100%; align-items: flex-start; gap: 8px;
}
.bubble-row.sent-row {
    flex-direction: row-reverse;
}

/* ─── 头像 ─── */
.msg-avatar {
    width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
    flex-shrink: 0; margin-top: 2px;
}
/* sent 消息显示用户头像 */
.bubble-row.sent-row .msg-avatar {
    /* visibility: hidden 已移除 —— 让用户头像可见 */
}

/* ─── 气泡组（昵称 + 气泡）─── */
.bubble-group {
    display: flex; flex-direction: column; max-width: calc(100% - 52px);
}
.bubble-row.sent-row .bubble-group {
    align-items: flex-end;
}
.bubble-row:not(.sent-row) .bubble-group {
    align-items: flex-start;
}

/* ─── 发送者昵称（群聊）─── */
.sender-name {
    font-size: 12px; color: #999; margin-bottom: 2px; margin-left: 4px;
    max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ─── 消息气泡 ─── */
.message-bubble {
    max-width: 260px; padding: 9px 13px; border-radius: 18px;
    word-wrap: break-word; line-height: 1.5;
    margin: 0; cursor: pointer; font-size: 15px;
    position: relative;
    /* 默认颜色 —— 会被 JS 内联样式覆盖 */
    background-color: #fff; color: #333;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
/* sent 默认颜色（微信绿风格，无主题时的 fallback） */
.message-bubble.sent {
    background-color: #95ec69; color: #000;
    border-bottom-right-radius: 4px;
}
/* received 默认颜色 */
.message-bubble.received {
    background-color: #fff; color: #333;
    border-bottom-left-radius: 4px;
}

/* 兼容旧类名 */
.message-bubble-row {
    display: flex; width: 100%; align-items: flex-start;
}
.message-wrapper.sent .message-bubble-row { flex-direction: row-reverse; }

/* ─── 多选复选框 ─── */
.msg-select-check {
    position: absolute; left: 4px; top: 12px;
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid #ccc; background: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: transparent; cursor: pointer;
    transition: all 0.2s; z-index: 5;
}
/* 默认隐藏复选框，避免非多选模式下显示圆圈 */
.message-area:not(.multi-select-active) .msg-select-check {
    display: none;
}
.message-wrapper.multi-select-selected .msg-select-check {
    border-color: var(--primary-color); background: var(--primary-color);
    color: #fff;
}
/* 进入多选模式时给 message-wrapper 左边留空 */
.message-area.multi-select-active .message-wrapper {
    padding-left: 36px;
}
.message-area.multi-select-active .message-wrapper.sent {
    padding-left: 36px; padding-right: 0;
}

/* ─── 其他旧元素 ─── */
.message-info { display: flex; flex-direction: column; align-items: center; position: relative; }
.group-nickname {
    position: absolute; top: -15px; font-size: 11px; color: #888;
    white-space: nowrap; width: 70px; text-align: center;
    overflow: hidden; text-overflow: ellipsis;
}
.message-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.message-time { font-size: 9px; color: #aaa; margin-top: 3px; }

/* ─── 系统通知 ─── */
.system-notification-bubble {
    background-color: rgba(200,200,200,0.5); color: #666;
    font-size: 12px; padding: 4px 10px; border-radius: 10px; text-align: center;
}

/* ─── 图片气泡 ─── */
.image-bubble {
    max-width: 280px; border-radius: var(--border-radius); margin: 0; padding: 4px;
    background-color: rgba(255,255,255,0.5); backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); cursor: pointer;
}
.image-bubble img { width: 100%; height: auto; display: block; border-radius: calc(var(--border-radius) - 4px); }
.message-wrapper.sent .image-bubble { border-bottom-right-radius: 5px; }
.message-wrapper.received .image-bubble { border-bottom-left-radius: 5px; }

/* ─── 语音气泡 ─── */
.voice-bubble {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-radius: var(--border-radius);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    margin: 0; cursor: pointer; transition: all 0.2s ease;
    min-width: 90px; max-width: 200px;
}
.message-wrapper.sent .voice-bubble { border-bottom-right-radius: 5px; flex-direction: row-reverse; }
.message-wrapper.received .voice-bubble { border-bottom-left-radius: 5px; }
.voice-bubble .play-icon { width: 18px; height: 18px; flex-shrink: 0; }
.voice-bubble .duration { font-size: 13px; margin: 0 8px; white-space: nowrap; }
.message-wrapper.sent .play-icon { transform: scaleX(-1); }
.voice-transcript {
    font-size: 14px; color: #555; background-color: rgba(255,255,255,0.7);
    padding: 8px 12px; margin-top: 5px; margin-left: 54px; margin-right: 54px;
    border-radius: 10px; line-height: 1.6; max-width: calc(100% - 108px);
    display: none; animation: fadeIn 0.3s ease;
}
.voice-transcript.active { display: block; }
.message-wrapper.sent .voice-transcript { align-self: flex-end; margin-right: 54px; margin-left: auto; }
.message-wrapper.received .voice-transcript { align-self: flex-start; margin-left: 54px; margin-right: auto; }

/* ─── PV 照片/视频卡片 ─── */
.pv-card {
    width: 230px; aspect-ratio: 1/1; background-color: #f0f0f0;
    border-radius: var(--border-radius); box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden; position: relative; cursor: pointer; margin: 0;
}
.message-wrapper.sent .pv-card { border-bottom-right-radius: 5px; }
.message-wrapper.received .pv-card { border-bottom-left-radius: 5px; }
.pv-card-image-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover; background-position: center;
    transition: opacity 0.5s ease-in-out; z-index: 2;
}
.pv-card-image-overlay.hidden { opacity: 0; pointer-events: none; }
.pv-card-content {
    padding: 15px; height: 100%; overflow-y: auto; color: var(--text-color);
    line-height: 1.6; font-size: 15px; background-color: white; position: relative; z-index: 1;
}
.pv-card-footer {
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    color: white; padding: 20px 10px 8px; font-size: 12px;
    display: flex; align-items: center; gap: 5px;
    position: absolute; bottom: 0; left: 0; width: 100%; z-index: 3;
    pointer-events: none; transition: opacity 0.5s ease-in-out;
}
.pv-card-footer.hidden { opacity: 0; }
.pv-card-footer svg { width: 14px; height: 14px; fill: white; flex-shrink: 0; }

/* ─── 转账卡片 ─── */
.transfer-card {
    width: 240px; height: auto; border-radius: var(--border-radius);
    margin: 0; overflow: hidden; position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); color: white;
}
.message-wrapper.sent .transfer-card { border-bottom-right-radius: 5px; }
.message-wrapper.received .transfer-card { border-bottom-left-radius: 5px; cursor: pointer; }
.transfer-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-size: cover; background-position: center;
    filter: blur(4px); transform: scale(1.1); z-index: 1;
}
.transfer-card.sent-transfer::before { background-image: url('../assets/icons/发红包.jpg'); }
.transfer-card.received-transfer::before { background-image: url('../assets/icons/收红包.jpg'); }
.transfer-card .overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.3); z-index: 2; transition: background-color 0.5s ease;
}
.transfer-card.received .overlay { background-color: rgba(255,182,193,0.4); }
.transfer-card.returned .overlay { background-color: rgba(100,100,100,0.5); }
.transfer-content {
    position: relative; z-index: 3; padding: 20px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.transfer-title { font-size: 14px; margin: 0 0 5px 0; opacity: 0.9; }
.transfer-amount { font-size: 28px; font-weight: bold; margin: 0; }
.transfer-remark {
    font-size: 14px; margin-top: 10px; opacity: 0.9;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.transfer-status {
    font-size: 12px; margin-top: 15px; padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.3); opacity: 0.8;
}

/* ─── 礼物卡片 ─── */
.gift-card {
    width: 230px; background-color: #fff; border: 2px solid #333;
    border-radius: var(--border-radius); box-shadow: 4px 4px 0px #ddd;
    padding: 10px; display: flex; align-items: center;
    cursor: pointer; margin: 0; position: relative; overflow: hidden;
}
.message-wrapper.sent .gift-card { border-bottom-right-radius: 5px; }
.message-wrapper.received .gift-card { border-bottom-left-radius: 5px; }
.gift-card-icon { width: 50px; height: 50px; margin-right: 15px; flex-shrink: 0; }
.gift-card-text {
    font-size: 16px; font-weight: bold; color: #333;
    font-family: 'Comic Sans MS','Chalkduster','Handwriting', cursive;
}
.gift-card-description {
    font-size: 14px; color: #555; background-color: rgba(240,240,240,0.9);
    padding: 8px 12px; margin-top: 5px; margin-left: 54px; margin-right: 54px;
    border-radius: 10px; line-height: 1.6; max-width: calc(100% - 108px);
    display: none; animation: fadeIn 0.3s ease;
}
.gift-card-description.active { display: block; }
.message-wrapper.sent .gift-card-description { align-self: flex-end; margin-right: 54px; margin-left: auto; }
.message-wrapper.received .gift-card-description { align-self: flex-start; margin-left: 54px; margin-right: auto; }
.gift-card-received-stamp {
    position: absolute; top: 5px; right: 5px; font-size: 14px; font-weight: bold;
    color: var(--primary-color); border: 2px solid var(--primary-color);
    border-radius: 8px; padding: 2px 6px; transform: rotate(15deg);
    opacity: 0; transition: opacity 0.3s ease;
    font-family: 'Comic Sans MS','Chalkduster','Handwriting', cursive;
}
.gift-card.received .gift-card-received-stamp { opacity: 1; }

/* Misc */
.load-more-btn {
    background-color: #e0e0e0; color: #757575; border: none;
    padding: 8px 16px; margin: 10px auto; border-radius: 15px;
    cursor: pointer; display: block; font-size: 13px; font-weight: 500;
}
.load-more-btn:hover { background-color: #d1d1d1; }
.typing-indicator {
    text-align: center; color: #aaa; font-style: italic;
    font-size: 14px; padding: 10px 0; display: none;
}

/* Sticker Bar */
#sticker-bar {
    flex-shrink: 0; padding: 0 10px 5px;
    display: flex; align-items: center;
    background: rgba(255,255,255,0.7); backdrop-filter: blur(10px);
}
.sticker-bar-btn { background: none; border: none; padding: 5px; cursor: pointer; }
.sticker-bar-btn svg { width: 28px; height: 28px; fill: #888; }

/* Sticker Modal */
#sticker-modal {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 35%; max-height: 250px; background: #f7f7f7;
    border-top-left-radius: 20px; border-top-right-radius: 20px;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
    z-index: 25; display: none; flex-direction: column;
}
#sticker-modal.visible { display: flex; animation: slideUp 0.3s ease-out; }
#sticker-modal .header {
    padding: 10px 15px; font-weight: bold; color: var(--text-color);
    border-bottom: 1px solid #eee; display: flex;
    justify-content: space-between; align-items: center;
}
.sticker-grid {
    flex-grow: 1; overflow-y: auto; padding: 15px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(70px,1fr)); gap: 15px;
}
.sticker-item, .sticker-grid-item {
  position: relative; display: flex; flex-direction: column;
  align-items: center; cursor: pointer;
}
.sticker-item img, .sticker-grid-item img { width: 60px; height: 60px; object-fit: contain; }
.sticker-item span, .sticker-grid-item span { font-size: 12px; color: #666; margin-top: 5px; text-align: center; }
#add-sticker-modal .modal-window { max-width: 360px; }
#sticker-preview {
    width: 100px; height: 100px; border: 2px dashed #ddd; border-radius: 10px;
    margin: 0 auto 15px; display: flex; align-items: center; justify-content: center;
    color: #aaa; background-color: #f9f9f9;
}
#sticker-preview img { max-width: 100%; max-height: 100%; }

/* Chat Input */
.chat-input-wrapper { flex-shrink: 0; }
.message-input-area {
    display: flex; align-items: center; padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid #eee;
    background: rgba(255,255,255,0.7); backdrop-filter: blur(10px);
    flex-shrink: 0; gap: 10px;
    border-bottom-left-radius: var(--phone-corner-radius);
    border-bottom-right-radius: var(--phone-corner-radius);
    overflow: hidden;
}
.message-input-area input {
    flex-grow: 1; border: none; padding: 12px;
    border-radius: 18px; background-color: #f0f0f0;
}
.message-input-area input:focus { outline: none; }
.message-input-area .icon-btn {
    background: var(--primary-color); color: white; border: none; border-radius: 50%;
    width: 40px; height: 40px; cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: background-color 0.2s;
}
.message-input-area .icon-btn:disabled { background-color: #cccccc; cursor: not-allowed; }
.message-input-area .icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.message-input-area .icon-btn.send-btn { font-size: 18px; }

/* Multi-select Bar */
#multi-select-bar {
    position: absolute; bottom: 0; left: 0; width: 100%;
    background: rgba(255,255,255,0.9); backdrop-filter: blur(10px);
    display: none; justify-content: space-between; align-items: center;
    padding: 10px 20px; padding-bottom: calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid #eee; z-index: 20;
    border-bottom-left-radius: var(--phone-corner-radius);
    border-bottom-right-radius: var(--phone-corner-radius);
    animation: slideUp 0.3s ease-out;
}
#multi-select-bar.visible { display: flex; }

/* Settings Sidebar */
.settings-sidebar {
    position: absolute; top: 0; right: -100%; width: 80%; height: 100%;
    background: #fff; box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right 0.4s ease-in-out; z-index: 101;
    display: flex; flex-direction: column;
}
.settings-sidebar.open { right: 0; }
.settings-sidebar .header {
    padding: 15px; border-bottom: 1px solid #eee;
    font-weight: bold; text-align: center; color: var(--primary-color);
}
.settings-sidebar .content { padding: 20px; overflow-y: auto; flex-grow: 1; }
.settings-sidebar .form-group textarea { height: 100px; resize: vertical; }
.settings-sidebar .avatar-setting {
    display: flex; align-items: center; gap: 15px; margin-bottom: 15px;
}
.settings-sidebar .avatar-preview {
    width: 60px; height: 60px; border-radius: 50%; object-fit: cover;
    border: 2px solid var(--primary-color); cursor: pointer;
}

/* 折叠面板 */
.settings-collapse {
    border: 1px solid #f0f0f0; border-radius: 10px; margin-bottom: 12px;
    overflow: visible; transition: border-color 0.2s;
}
.settings-collapse[open] { border-color: #e0e0e0; }
.settings-collapse[open] .settings-collapse-body { overflow-y: auto; max-height: 400px; }
.settings-collapse-title {
    padding: 12px 14px; font-size: 13px; font-weight: 600; color: #555;
    cursor: pointer; display: flex; align-items: center; gap: 6px;
    user-select: none; list-style: none; transition: background 0.15s;
}
.settings-collapse-title::-webkit-details-marker { display: none; }
.settings-collapse-title::before {
    content: '▶'; font-size: 10px; color: #bbb;
    transition: transform 0.2s;
}
.settings-collapse[open] .settings-collapse-title::before { transform: rotate(90deg); }
.settings-collapse-title:hover { background: #fafafa; }
.collapse-badge {
    margin-left: auto; font-size: 11px; padding: 1px 8px;
    border-radius: 10px; background: #e8e8e8; color: #888;
}
.settings-collapse-body {
    padding: 0 14px 14px; border-top: 1px solid #f5f5f5;
    padding-top: 12px;
}
.settings-collapse-body .form-group { margin-bottom: 10px; }
.settings-collapse-body .form-group:last-child { margin-bottom: 0; }
.settings-collapse-body .form-group textarea { height: 50px; min-height: 40px; font-size: 13px; }

/* 专属世界书条目 */
.builtin-wb-item {
    display: flex; align-items: flex-start; gap: 6px;
    padding: 8px; margin-bottom: 6px;
    background: #f9f9f9; border-radius: 8px; border: 1px solid #eee;
    position: relative;
}
.builtin-wb-item .wb-item-content { flex: 1; min-width: 0; }
.builtin-wb-item .wb-item-name {
    font-size: 12px; font-weight: 600; color: #444; margin-bottom: 2px;
}
.builtin-wb-item .wb-item-text {
    font-size: 11px; color: #888; max-height: 40px; overflow: hidden;
    white-space: pre-wrap; word-break: break-all;
}
.builtin-wb-item .wb-item-actions {
    display: flex; gap: 2px; flex-shrink: 0;
}
.builtin-wb-item .wb-item-actions button {
    border: none; background: transparent; cursor: pointer;
    padding: 4px 6px; font-size: 14px; border-radius: 6px;
    transition: background 0.15s;
}
.builtin-wb-item .wb-item-actions button:hover { background: #eee; }

/* 内嵌编辑区 */
.builtin-wb-edit-form {
    padding: 10px; background: #fff; border: 1px solid #e0e0e0;
    border-radius: 8px; margin-bottom: 8px;
}
.builtin-wb-edit-form input,
.builtin-wb-edit-form textarea {
    width: 100%; padding: 6px 8px; border: 1px solid #ddd;
    border-radius: 6px; font-size: 12px; box-sizing: border-box;
    margin-bottom: 6px;
}
.builtin-wb-edit-form textarea { height: 50px; resize: vertical; min-height: 40px; }
.builtin-wb-edit-actions { display: flex; gap: 6px; justify-content: flex-end; }
.builtin-wb-edit-actions button {
    padding: 4px 14px; border: none; border-radius: 6px;
    font-size: 12px; cursor: pointer; font-weight: 500;
}

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: var(--secondary-color); font-weight: 600; }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: 12px; border: 2px solid #fce4ec;
    border-radius: 10px; background-color: #fff;
    transition: border-color 0.3s; font-family: var(--font-family); font-size: 14px;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--primary-color); }
.form-group.radio-group { display: flex; gap: 20px; align-items: center; }
.form-group.radio-group label { margin-bottom: 0; }

/* Buttons */
.btn {
    width: 100%; padding: 15px; border-radius: 10px; border: none;
    font-size: 16px; font-weight: bold; cursor: pointer;
    transition: all 0.3s ease; display: flex; align-items: center;
    justify-content: center; gap: 8px; text-align: center;
}
.btn-primary { background-color: var(--primary-color); color: var(--white-color); }
.btn-primary:hover { background-color: var(--secondary-color); box-shadow: 0 4px 15px rgba(255,128,171,0.5); }
label.btn-primary { color: var(--white-color) !important; }
.btn-small { padding: 8px 16px; font-size: 14px; width: auto; }
.btn-secondary { background-color: var(--accent-color); color: var(--white-color); margin-bottom: 15px; }
.btn-secondary:hover { background-color: #64b5f6; box-shadow: 0 4px 15px rgba(144,202,249,0.5); }
/* AI 生成头像按钮 - 与上传按钮同一行区分 */
.btn-ai {
    background: linear-gradient(135deg, #7c4dff, #e040fb);
    color: #fff; border: none; border-radius: 10px;
    padding: 10px 14px; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.25s; white-space: nowrap;
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    flex: 1; height: 44px;
}
.btn-ai:hover { opacity: 0.88; box-shadow: 0 4px 18px rgba(124,77,255,0.45); }
.btn-ai:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-neutral { background-color: #bdbdbd; color: var(--white-color); }
.btn-neutral:hover { background-color: #9e9e9e; }
.btn-danger { background-color: #ef5350; color: white; }
.btn .spinner {
    display: none; width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.5);
    border-top-color: var(--white-color); border-radius: 50%;
    animation: spin 1s linear infinite;
}
.btn.loading .spinner { display: block; }
.btn.loading .btn-text { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Wallpaper */
.wallpaper-preview {
    width: 100%; aspect-ratio: 9/16; max-height: 400px;
    border-radius: var(--border-radius); margin-bottom: 25px;
    background-size: cover; background-position: center;
    border: 3px dashed var(--primary-color);
    display: flex; align-items: center; justify-content: center;
    color: var(--secondary-color); font-style: italic; background-color: #fff8fa;
}

/* Toast */
.toast {
    position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%);
    background-color: rgba(0,0,0,0.7); color: white;
    padding: 10px 20px; border-radius: 15px; font-size: 14px;
    opacity: 0; visibility: hidden; transition: opacity 0.5s, visibility 0.5s; z-index: 1000;
}
.toast.show { opacity: 1; visibility: visible; }

/* World Book Selection */
#world-book-selection-modal,
#invite-member-modal,
#group-recipient-selection-modal { z-index: 102; }
#world-book-selection-modal .modal-window,
#invite-member-modal .modal-window,
#group-recipient-selection-modal .modal-window { width: 90%; max-width: 380px; }
#world-book-selection-list,
#invite-member-selection-list,
#group-recipient-selection-list { list-style: none; padding: 0; margin: 0; max-height: 40vh; overflow-y: auto; }
.world-book-select-item,
.invite-member-select-item,
.group-recipient-select-item {
    display: flex; align-items: center; padding: 12px 5px; border-bottom: 1px solid #f0f0f0;
}
.world-book-select-item:last-child,
.invite-member-select-item:last-child,
.group-recipient-select-item:last-child { border-bottom: none; }
.world-book-select-item input[type="checkbox"],
.invite-member-select-item input[type="checkbox"],
.group-recipient-select-item input[type="checkbox"] { margin-right: 15px; width: 20px; height: 20px; }
.world-book-select-item label,
.invite-member-select-item label,
.group-recipient-select-item label {
    font-weight: 500; color: var(--text-color); display: flex; align-items: center; gap: 10px; width: 100%;
}
.invite-member-select-item img,
.group-recipient-select-item img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

/* Group Chat */
.member-selection-list { list-style: none; padding: 0; margin: 15px 0; max-height: 40vh; overflow-y: auto; }
.member-selection-item { display: flex; align-items: center; padding: 10px 5px; border-bottom: 1px solid #f0f0f0; }
.member-selection-item:last-child { border-bottom: none; }
.member-selection-item input[type="checkbox"] { margin-right: 15px; width: 20px; height: 20px; flex-shrink: 0; }
.member-selection-item img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; margin-right: 10px; }
.member-selection-item label { font-weight: 500; color: var(--text-color); }
#group-settings-sidebar .group-avatar-setting { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; }
#group-settings-sidebar .group-avatar-preview {
    width: 60px; height: 60px; border-radius: 10px; object-fit: cover;
    border: 2px solid var(--primary-color); cursor: pointer;
}
#group-settings-sidebar .group-members-list {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(60px,1fr)); gap: 15px; margin-top: 10px;
}
#group-settings-sidebar .group-member,
#group-settings-sidebar .add-member-btn {
    display: flex; flex-direction: column; align-items: center; cursor: pointer;
}
#group-settings-sidebar .group-member img {
    width: 50px; height: 50px; border-radius: 50%; object-fit: cover;
    margin-bottom: 5px; border: 2px solid #eee;
}
#group-settings-sidebar .add-member-btn .add-icon {
    width: 50px; height: 50px; border-radius: 50%; border: 2px dashed #ccc;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: #ccc; margin-bottom: 5px; transition: all 0.2s ease;
}
#group-settings-sidebar .add-member-btn:hover .add-icon { color: var(--primary-color); border-color: var(--primary-color); }
#group-settings-sidebar .group-member span,
#group-settings-sidebar .add-member-btn span { font-size: 12px; text-align: center; color: var(--text-color); }

/* Customize Screen */
#customize-screen .icon-custom-item {
    display: flex; align-items: center; gap: 15px;
    margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid #f0f0f0;
}
#customize-screen .icon-custom-item:last-child { border-bottom: none; }
#customize-screen .icon-preview { width: 50px; height: 50px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
#customize-screen .icon-details { flex-grow: 1; }
#customize-screen .icon-details p { margin: 0 0 8px 0; font-weight: 600; }
#customize-screen .icon-details input { width: calc(100% - 70px); }
#customize-screen .reset-icon-btn {
    background: #e0e0e0; color: #555; border: none; border-radius: 8px;
    padding: 8px 10px; font-size: 12px; cursor: pointer; margin-left: 10px;
}

/* ═══ API 配置预设列表 ═══ */
.api-preset-list { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.api-preset-card {
    background: #fff; border-radius: 14px; padding: 14px 16px;
    display: flex; align-items: center; gap: 12px; cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); transition: transform 0.15s, box-shadow 0.15s;
    border: 2px solid transparent;
}
.api-preset-card:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.1); }
.api-preset-card:active { transform: scale(0.98); }
.api-preset-card.active { border-color: var(--primary-color); background: #fff0f5; }
.api-preset-info { flex: 1; min-width: 0; }
.api-preset-name { font-size: 15px; font-weight: 700; color: var(--text-color); margin-bottom: 4px; }
.api-preset-meta { font-size: 12px; color: #999; margin-bottom: 2px; }
.api-preset-url { font-size: 11px; color: #bbb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.api-preset-actions { display: flex; gap: 6px; flex-shrink: 0; }
.api-preset-edit-btn, .api-preset-use-btn {
    padding: 6px 12px; border: none; border-radius: 8px; font-size: 12px;
    font-weight: 600; cursor: pointer; transition: transform 0.15s;
}
.api-preset-edit-btn { background: #f0f0f0; color: #666; }
.api-preset-use-btn { background: var(--primary-color); color: #fff; }
.api-preset-edit-btn:active, .api-preset-use-btn:active { transform: scale(0.95); }

/* ========================================
   统一组件库 - 各模块共用
   ======================================== */

/* ─── 标准页面头 ─── */
.page-header,
.shop-header-bar, .bili-header, .gacha-header, .games-header,
#wallpaper-screen .app-header, #font-settings-screen .app-header,
#customize-screen .app-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 20px; background: var(--bg-header);
    backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
    flex-shrink: 0; z-index: 10;
}

/* ─── 标准卡片 ─── */
.card {
    background: var(--bg-card); border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm); padding: 14px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.card:active { transform: scale(0.98); }

/* ─── 标准按钮 ─── */
.btn {
    padding: 10px 20px; border: none; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: transform 0.15s, opacity 0.15s; display: inline-flex;
    align-items: center; justify-content: center; gap: 6px;
}
.btn:active { transform: scale(0.95); }
.btn-primary { background: var(--primary); color: var(--text-white); }
.btn-secondary { background: var(--bg-input); color: var(--text); }
.btn-danger { background: var(--danger); color: var(--text-white); }
.btn-small { padding: 6px 14px; font-size: 12px; border-radius: 6px; }

/* ─── 标准输入框 ─── */
.input {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 14px; outline: none;
    background: var(--bg-input); transition: border-color 0.2s;
    box-sizing: border-box;
}
.input:focus { border-color: var(--primary); background: var(--bg-card); }

/* ─── 标准标签(chip) ─── */
.chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; border-radius: var(--radius-full);
    font-size: 12px; font-weight: 500; cursor: pointer;
    transition: all 0.2s; user-select: none;
}
.chip-default { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); }
.chip-default:hover { border-color: var(--primary); color: var(--primary); }
.chip-active { background: var(--primary); color: var(--text-white); border-color: var(--primary); }

/* ─── 标准弹窗 ─── */
.modal {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-overlay); z-index: 100;
    display: none; align-items: center; justify-content: center;
    animation: fadeIn 0.25s ease;
}
.modal.visible { display: flex; }
.modal-box {
    background: var(--bg-card); padding: 24px; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); width: 85%; max-width: 340px;
    animation: slideUp 0.35s ease-out;
}
.modal-box h3 { margin: 0 0 16px; text-align: center; color: var(--primary); font-size: 18px; }

/* ─── 空状态 ─── */
.empty-state {
    text-align: center; padding: 50px 20px; color: var(--text-light); font-size: 14px;
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; display: block; }

/* ─── 加载动画 ─── */
.loading-dots { display: flex; gap: 5px; justify-content: center; align-items: center; }
.loading-dots span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--primary); animation: dotBounce 1.2s infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce { 0%,80%,100% { transform: translateY(0); } 40% { transform: translateY(-8px); } }

/* ─── AI 图片加载占位 ─── */
.image-loading-bubble {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 16px; background: #f5f5f5; border-radius: 16px; min-width: 160px;
    margin: 0 8px;
}
.image-loading-bubble .loading-spinner {
    width: 28px; height: 28px;
    border: 3px solid #ddd; border-top-color: #666;
    border-radius: 50%; animation: imgSpin 0.8s linear infinite;
}
@keyframes imgSpin { to { transform: rotate(360deg); } }
.image-loading-bubble .progress-bar {
    width: 100%; height: 4px; background: #e0e0e0;
    border-radius: 2px; overflow: hidden;
}
.image-loading-bubble .progress-fill {
    width: 0%; height: 100%; background: #666;
    animation: progressIndeterminate 1.5s ease-in-out infinite;
}
@keyframes progressIndeterminate {
    0% { width: 0%; margin-left: 0; }
    50% { width: 60%; margin-left: 20%; }
    100% { width: 0%; margin-left: 100%; }
}
.image-loading-bubble span { font-size: 12px; color: #888; text-align: center; }
.image-error-bubble {
    padding: 8px 12px; border-radius: 12px; margin: 0 8px;
    background: #fff0f0; color: #c44; font-size: 13px;
    border: 1px solid #ffc0c0;
}

/* ─── AI 配图占位 ─── */
.image-placeholder {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; margin: 6px 0 0 0;
    background: rgba(0,0,0,0.03); border-radius: 12px;
    font-size: 13px; color: #888; max-width: 80%;
}
.image-placeholder-failed { color: #c44; background: rgba(255,240,240,0.5); }
.placeholder-spinner {
    width: 16px; height: 16px;
    border: 2px solid #ddd; border-top-color: #999;
    border-radius: 50%; animation: pSpin 0.8s linear infinite;
}
@keyframes pSpin { to { transform: rotate(360deg); } }

/* ─── 列表项 ─── */
.list-item {
    display: flex; align-items: center; padding: 12px 20px;
    cursor: pointer; border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
}
.list-item:hover { background: var(--bg-hover); }
.list-item:active { background: var(--bg-hover); }

/* ─── 动画复用 ─── */
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
