* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, BlinkMacSystemFont, sans-serif; height: 100vh; overflow: hidden; background: #ffffff; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

.app-container { width: 100%; max-width: 400px; height: 100vh; max-height: 800px; margin: 0 auto; position: relative; display: flex; flex-direction: column; background: #ffffff; overflow: hidden; }

.page { display: none; flex-direction: column; height: 100%; width: 100%; position: absolute; top: 0; left: 0; background: #ffffff; overflow-y: auto; }
.page.active { display: flex; }

.top-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; margin-top: env(safe-area-inset-top, 10px);
    margin-left: 12px; margin-right: 12px;
    background: rgba(255, 255, 255, 0.75); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-radius: 999px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04); z-index: 10;
}
.icon-btn { width: 36px; height: 36px; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: background 0.2s; }
.icon-btn:active { background: rgba(0, 0, 0, 0.05); }
.icon-btn svg { width: 22px; height: 22px; stroke: #333; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.page-title { font-size: 16px; font-weight: 600; color: #333; }
.capsule-btn { border: none; padding: 6px 18px; border-radius: 999px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.capsule-btn.primary { background: #d0e8ff; color: #0066cc; }
.capsule-btn.primary:active { transform: scale(0.96); background: #b8dcff; }

.top-bar-actions { display: flex; align-items: center; gap: 10px; }

.trash-btn { 
    background: transparent; 
    width: 32px; height: 32px; 
    display: flex; align-items: center; justify-content: center; 
    border-radius: 50%;
    transition: all 0.2s ease;
}
.trash-btn svg { 
    width: 20px; height: 20px; 
    stroke: #999;
    stroke-width: 2; 
    transition: stroke 0.2s ease;
}
.trash-btn:active { transform: scale(0.85); }
.trash-btn.active { background-color: rgba(0, 122, 255, 0.1); }
.trash-btn.active svg { stroke: #007aff; }

.home-content { flex: 1; overflow-y: auto; padding: 16px 12px 100px; }
.empty-state { text-align: center; color: #aaa; font-size: 14px; line-height: 1.8; margin-top: 40vh; transform: translateY(-50%); }

.section-wrapper { margin-bottom: 16px; }
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 4px; cursor: pointer; user-select: none;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.section-title { font-size: 14px; font-weight: 600; color: #888; }
.section-arrow {
    width: 18px; height: 18px; stroke: #ccc; stroke-width: 2; fill: none;
    transition: transform 0.3s ease;
}
.section-header.collapsed .section-arrow { transform: rotate(-90deg); }
.section-body {
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.25s ease;
    max-height: 2000px;
    opacity: 1;
}
.section-body.collapsed {
    max-height: 0 !important;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.role-list-wrapper {
    border-radius: 20px; overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.7) 0%, rgba(208, 232, 255, 0.4) 100%);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}
.role-card {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04); user-select: none; -webkit-user-select: none; cursor: pointer;
    transition: background 0.15s; touch-action: manipulation;
}
.role-card:last-child { border-bottom: none; }
.role-card:active { background: rgba(0, 0, 0, 0.03); }
.role-avatar { width: 44px; height: 44px; border-radius: 50%; background: #e0e0e0; flex-shrink: 0; object-fit: cover; display: block; }
.role-avatar[src] { background: transparent; }
.role-info { flex: 1; min-width: 0; }
.role-name { font-size: 15px; font-weight: 600; color: #333; margin-bottom: 2px; }
.role-last-msg { font-size: 12px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-time { font-size: 11px; color: #bbb; flex-shrink: 0; align-self: flex-start; margin-top: 2px; }

.group-avatar {
    position: relative; width: 44px; height: 44px; flex-shrink: 0;
    background: #e0e0e0; border-radius: 50%; overflow: hidden;
    display: flex; flex-wrap: wrap; align-content: flex-start;
}
.group-avatar img {
    display: block; object-fit: cover;
    border: 1px solid #fff; box-sizing: border-box;
    background: #e0e0e0;
}
.group-avatar.count-2 img { width: 50%; height: 100%; }
.group-avatar.count-2 img:first-child { border-radius: 50% 0 0 50%; }
.group-avatar.count-2 img:last-child { border-radius: 0 50% 50% 0; }
.group-avatar.count-3 img:nth-child(1) { width: 100%; height: 50%; border-radius: 50% 50% 0 0; }
.group-avatar.count-3 img:nth-child(2),
.group-avatar.count-3 img:nth-child(3) { width: 50%; height: 50%; }
.group-avatar.count-3 img:nth-child(2) { border-radius: 0 0 0 50%; }
.group-avatar.count-3 img:nth-child(3) { border-radius: 0 0 50% 0; }
.group-avatar.count-4 img,
.group-avatar.count-more img { width: 50%; height: 50%; }
.group-avatar.count-4 img:nth-child(1),
.group-avatar.count-more img:nth-child(1) { border-radius: 50% 0 0 0; }
.group-avatar.count-4 img:nth-child(2),
.group-avatar.count-more img:nth-child(2) { border-radius: 0 50% 0 0; }
.group-avatar.count-4 img:nth-child(3),
.group-avatar.count-more img:nth-child(3) { border-radius: 0 0 0 50%; }
.group-avatar.count-4 img:nth-child(4),
.group-avatar.count-more img:nth-child(4) { border-radius: 0 0 50% 0; }

.group-create-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(6px);
    z-index: 1000; display: none; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.25s ease;
}
.group-create-overlay.active { display: flex; opacity: 1; }
.group-create-box {
    background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(20px);
    border-radius: 24px; padding: 24px 28px; width: 300px; max-height: 80vh;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    transform: scale(0.9); transition: transform 0.25s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex; flex-direction: column;
}
.group-create-overlay.active .group-create-box { transform: scale(1); }
.group-create-title { font-size: 16px; font-weight: 600; color: #333; text-align: center; margin-bottom: 8px; }
.group-create-hint { font-size: 13px; color: #888; text-align: center; margin-bottom: 12px; }
.group-create-list {
    flex: 1; overflow-y: auto; margin-bottom: 16px;
    display: flex; flex-direction: column; gap: 8px;
}
.group-create-list .member-item {
    display: flex; align-items: center; gap: 12px; padding: 8px 12px;
    background: rgba(255,255,255,0.5); border-radius: 12px;
    transition: background 0.2s; cursor: pointer;
}
.group-create-list .member-item:active { background: rgba(0,0,0,0.05); }
.group-create-list .member-item input[type="checkbox"] {
    width: 18px; height: 18px; accent-color: #0066cc; cursor: pointer;
}
.group-create-list .member-item .avatar {
    width: 32px; height: 32px; border-radius: 50%; background: #e0e0e0; flex-shrink: 0; object-fit: cover;
}
.group-create-list .member-item .name { font-size: 14px; font-weight: 500; color: #333; flex: 1; }
.group-create-btns { display: flex; gap: 12px; justify-content: center; }
.group-create-btns .capsule-btn { padding: 10px 28px; font-size: 14px; border-radius: 999px; border: none; cursor: pointer; transition: all 0.2s; }

.scroll-content { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 100px; }
.create-form label { display: block; margin-bottom: 14px; font-size: 13px; color: #666; font-weight: 500; }
.create-form input, .create-form textarea, .create-form select {
    display: block; width: 100%; margin-top: 6px; padding: 10px 14px;
    border: 1px solid rgba(0, 0, 0, 0.08); border-radius: 14px;
    background: rgba(255, 255, 255, 0.7); font-size: 15px; color: #333;
    outline: none; transition: border 0.2s, background 0.2s;
}
.create-form input:focus, .create-form textarea:focus, .create-form select:focus {
    border-color: #a0cfff; background: rgba(255, 255, 255, 0.95);
}

.avatar-upload-wrapper { display: flex; justify-content: center; margin-bottom: 28px; position: relative; }
.avatar-upload-label { cursor: pointer; display: block; }
.avatar-preview-circle {
    width: 80px; height: 80px; border-radius: 50%; background: #e0e0e0;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    border: 2px dashed rgba(0, 0, 0, 0.15); transition: all 0.2s;
}
.avatar-preview-circle:active { transform: scale(0.95); border-color: #a0cfff; }
.avatar-preview-circle img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-placeholder-text { font-size: 12px; color: #999; text-align: center; pointer-events: none; }

.bottom-action { position: absolute; bottom: 24px; left: 0; right: 0; display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); }
.save-btn { padding: 12px 48px; font-size: 16px; box-shadow: 0 4px 16px rgba(0, 102, 204, 0.15); }

.dock-wrapper {
    position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
    z-index: 100; padding-bottom: env(safe-area-inset-bottom, 0px);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.dock-wrapper.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.dock {
    display: flex; align-items: center; gap: 16px; padding: 8px 28px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.5); backdrop-filter: blur(24px) saturate(200%);
    -webkit-backdrop-filter: blur(24px) saturate(200%); border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}
.dock-item { display: flex; justify-content: center; align-items: center; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; border: none; background: transparent; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); }
.dock-item svg { width: 22px; height: 22px; stroke: #a1a1a6; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; transition: all 0.3s; }
.dock-item.active { background: rgba(255, 255, 255, 0.8); transform: translateY(-3px); }
.dock-item.active svg { stroke: #5ac8fa; filter: drop-shadow(0 0 8px rgba(90, 200, 250, 0.5)); }

.chat-bg { background: url('https://s3.bmp.ovh/2026/08/04/h24O93ED.jpg') no-repeat center center; background-size: cover; }
.chat-header .page-title { font-weight: 600; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px 12px 90px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; align-items: flex-start; gap: 10px; max-width: 85%; animation: fadeIn 0.2s ease; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.ai { align-self: flex-start; }
.msg .avatar { width: 36px; height: 36px; border-radius: 50%; background: #e0e0e0; flex-shrink: 0; object-fit: cover; }
.msg .bubble { padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.5; word-break: break-word; }
.msg.user .bubble { background: #95ec69; border-top-right-radius: 4px; }
.msg.ai .bubble { background: rgba(255, 255, 255, 0.9); border: 1px solid rgba(255,255,255,0.2); border-top-left-radius: 4px; backdrop-filter: blur(8px); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.chat-input-capsule {
    position: absolute; bottom: 24px; left: 16px; right: 16px;
    display: flex; align-items: center; gap: 8px; padding: 8px 14px;
    background: rgba(255, 255, 255, 0.75); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-radius: 999px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); border: 1px solid rgba(255, 255, 255, 0.4);
}
.capsule-icon-btn { width: 32px; height: 32px; border-radius: 50%; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0; }
.capsule-icon-btn:active { transform: scale(0.9); }
.capsule-icon-btn svg { width: 20px; height: 20px; }
.plus-btn { background: #d0e8ff; box-shadow: 0 2px 6px rgba(0, 102, 204, 0.15); }
.plus-btn:active { transform: scale(0.9); background: #b8dcff; }
#aiTriggerBtn { transition: all 0.3s; }
#aiTriggerBtn:active { transform: scale(0.85); }
.chat-input-capsule textarea { flex: 1; padding: 6px 0; border: none; background: transparent; font-size: 15px; resize: none; max-height: 80px; outline: none; line-height: 1.5; color: #333; }
.chat-input-capsule textarea::placeholder { color: #aaa; }
.send-btn { background: #0066cc; }
.send-btn svg { stroke: #fff; stroke-width: 2.5; width: 18px; height: 18px; }
.send-btn:active { transform: scale(0.85); }

.longpress-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px);
    z-index: 999; display: none; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.25s ease;
}
.longpress-overlay.active { display: flex; opacity: 1; }
.longpress-menu {
    background: #fff; border-radius: 24px; padding: 20px 30px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    display: flex; gap: 30px; transform: scale(0.9); transition: transform 0.25s ease;
}
.longpress-overlay.active .longpress-menu { transform: scale(1); }
.longpress-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: transparent; border: none; cursor: pointer; padding: 8px; border-radius: 12px; transition: background 0.2s;
}
.longpress-item:active { background: #f0f0f0; }
.longpress-item svg { width: 32px; height: 32px; }
.longpress-item span { font-size: 13px; font-weight: 500; color: #333; }

.settings-scroll { flex: 1; overflow-y: auto; padding: 16px 20px 100px; }
.setting-group {
    background: rgba(255, 255, 255, 0.8); border-radius: 16px;
    padding: 16px 18px; margin-bottom: 12px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}
.setting-label { font-size: 14px; font-weight: 500; color: #333; margin-bottom: 6px; }
.setting-input {
    width: 100%; padding: 8px 12px; border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px; font-size: 14px; background: rgba(255, 255, 255, 0.5);
    outline: none; transition: border 0.2s;
}
.setting-input:focus { border-color: #a0cfff; }
.setting-group.clickable {
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; transition: background 0.2s;
}
.setting-group.clickable:active { background: rgba(0, 0, 0, 0.03); }
.setting-arrow { width: 20px; height: 20px; }

.memory-scroll { flex: 1; overflow-y: auto; padding: 16px 12px 100px; display: flex; flex-direction: column; gap: 10px; }
.memory-card {
    background: linear-gradient(135deg, rgba(208, 232, 255, 0.4) 0%, rgba(255, 255, 255, 0.6) 100%);
    border-radius: 16px; padding: 14px 18px; border: 1px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px); font-size: 14px; color: #333; line-height: 1.6;
    user-select: none; -webkit-user-select: none; cursor: pointer; touch-action: manipulation;
    transition: background 0.2s;
}
.memory-card:active { background: rgba(208, 232, 255, 0.6); }
.memory-longpress-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px);
    z-index: 999; display: none; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.25s ease;
}
.memory-longpress-overlay.active { display: flex; opacity: 1; }
.memory-longpress-menu {
    background: #fff; border-radius: 24px; padding: 20px 30px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    display: flex; gap: 30px; transform: scale(0.9); transition: transform 0.25s ease;
}
.memory-longpress-overlay.active .memory-longpress-menu { transform: scale(1); }
.memory-input-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(6px);
    z-index: 1000; display: none; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.25s ease;
}
.memory-input-overlay.active { display: flex; opacity: 1; }
.memory-input-box {
    background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(20px);
    border-radius: 24px; padding: 24px 28px; width: 300px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    transform: scale(0.9); transition: transform 0.25s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
}
.memory-input-overlay.active .memory-input-box { transform: scale(1); }
.memory-input-title { font-size: 16px; font-weight: 600; color: #333; text-align: center; margin-bottom: 16px; }
.memory-textarea {
    width: 100%; padding: 12px; border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px; font-size: 14px; resize: vertical; min-height: 80px;
    background: rgba(255, 255, 255, 0.5); outline: none; font-family: inherit; line-height: 1.6;
}
.memory-textarea:focus { border-color: #a0cfff; }
.memory-input-btns { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }
.memory-input-btns .capsule-btn { padding: 10px 28px; font-size: 14px; border-radius: 999px; border: none; cursor: pointer; transition: all 0.2s; }

.profile-bg { background: linear-gradient(180deg, #d0e8ff 0%, #ffffff 100%); }
.profile-content { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 100px; }

.profile-info-capsule {
    background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(12px);
    border-radius: 20px; padding: 20px; margin-bottom: 24px;
    display: flex; align-items: center; gap: 16px;
    border: 1px solid rgba(255, 255, 255, 0.5);
}
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; background: #e0e0e0; flex-shrink: 0; object-fit: cover; }
.profile-names { flex: 1; min-width: 0; }
.profile-nickname { font-size: 20px; font-weight: 600; color: #333; margin-bottom: 4px; }
.profile-realname { font-size: 14px; color: #666; }

.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.profile-grid-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(208, 232, 255, 0.5) 100%);
    backdrop-filter: blur(8px); border-radius: 20px;
    padding: 24px 12px; display: flex; flex-direction: column; align-items: center;
    gap: 12px; border: 1px solid rgba(255, 255, 255, 0.5);
    cursor: pointer; transition: transform 0.15s; touch-action: manipulation;
}
.profile-grid-item:active { transform: scale(0.96); }
.profile-grid-item svg { width: 36px; height: 36px; }
.profile-grid-item span { font-size: 14px; font-weight: 500; color: #333; }

.diary-date-bar { background: #f5f5f5; padding: 10px 0; flex-shrink: 0; overflow-x: auto; overflow-y: hidden; width: 100%; }
.diary-date-scroll { display: flex; gap: 10px; padding: 0 16px; white-space: nowrap; }
.diary-date-scroll .date-capsule {
    background: rgba(255, 255, 255, 0.8); padding: 6px 18px;
    border-radius: 999px; font-size: 13px; color: #333;
    cursor: pointer; transition: all 0.2s; user-select: none; box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.diary-date-scroll .date-capsule.active { background: #d0e8ff; box-shadow: 0 2px 8px rgba(0,102,204,0.15); }
.diary-content { flex: 1; overflow-y: auto; padding: 16px; }
.diary-card {
    background: rgba(255, 255, 255, 0.9); border-radius: 16px;
    padding: 20px; margin-bottom: 12px; font-size: 15px; line-height: 1.8;
    color: #333; border: 1px solid rgba(255,255,255,0.3); box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    transition: all 0.2s; cursor: pointer;
}
.diary-card.selected { background: #d0e8ff !important; border-color: #0066cc !important; box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2); }

.moments-bg { background: #f7f7f7; }
.moments-header .top-bar-actions { margin-right: 4px; }

.moments-cover { position: relative; width: 100%; height: 180px; overflow: hidden; cursor: pointer; flex-shrink: 0; }
.moments-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.moments-cover-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.3));
    color: rgba(255,255,255,0.8); font-size: 12px; padding: 10px 16px;
    text-align: right; opacity: 0; transition: opacity 0.3s;
}
.moments-cover:hover .moments-cover-overlay { opacity: 1; }
.moments-cover:active .moments-cover-overlay { opacity: 0.6; }

.moments-scroll { flex: 1; overflow-y: auto; padding: 0 0 100px 0; background: #fff; }

.moments-item {
    display: flex; gap: 12px; padding: 16px 16px 12px 16px;
    background: #fff; border-bottom: 0.5px solid #f0f0f0;
    cursor: pointer; touch-action: manipulation; transition: all 0.2s;
}
.moments-item:last-child { border-bottom: none; }
.moments-item.selected { background: #d0e8ff !important; }

.moments-left { flex-shrink: 0; }
.moments-avatar { width: 44px; height: 44px; border-radius: 8px; background: #e0e0e0; object-fit: cover; display: block; }

.moments-right { flex: 1; min-width: 0; }
.moments-name { font-size: 15px; font-weight: 600; color: #576b95; margin-bottom: 4px; }
.moments-text { font-size: 15px; color: #333; line-height: 1.6; margin-top: 2px; word-wrap: break-word; }
.moments-time { font-size: 12px; color: #999; margin-top: 8px; }

.group-member-bar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    padding: 8px 0; width: 100%; flex-shrink: 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    overflow-x: auto; white-space: nowrap;
}
.group-member-scroll { display: flex; gap: 12px; padding: 0 16px; align-items: center; }
.group-member-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.group-member-item .avatar { width: 36px; height: 36px; border-radius: 50%; background: #e0e0e0; object-fit: cover; }
.group-member-item .name { font-size: 10px; color: #666; max-width: 40px; overflow: hidden; text-overflow: ellipsis; }

.group-settings-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(6px);
    z-index: 1000; display: none; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.25s ease;
}
.group-settings-overlay.active { display: flex; opacity: 1; }
.group-settings-box {
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(20px);
    border-radius: 24px; padding: 24px 28px; width: 300px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    transform: scale(0.9); transition: transform 0.25s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex; flex-direction: column; gap: 16px;
}
.group-settings-overlay.active .group-settings-box { transform: scale(1); }
.group-settings-title { font-size: 16px; font-weight: 600; color: #333; text-align: center; }
.group-settings-members {
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
    padding: 8px 0; border-top: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0;
}
.settings-member-item {
    background: #f0f0f0; padding: 4px 12px; border-radius: 999px;
    font-size: 12px; color: #333; display: flex; align-items: center; gap: 4px;
}
.group-settings-list { display: flex; flex-direction: column; gap: 6px; }
.settings-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 4px; border-bottom: 1px solid #f5f5f5; cursor: pointer; transition: background 0.2s;
}
.settings-item:active { background: rgba(0,0,0,0.02); }
.settings-item:last-child { border-bottom: none; }
.settings-item .settings-arrow { width: 16px; height: 16px; stroke: #ccc; stroke-width: 2; fill: none; }
.delete-item { border-top: 1px solid #ffebee; margin-top: 4px; padding-top: 12px; }
.group-settings-btns { display: flex; justify-content: center; margin-top: 8px; }
.group-settings-btns .capsule-btn { padding: 8px 28px; border-radius: 999px; border: none; cursor: pointer; }

/* ===== 我的页面样式 ===== */
.profile-capsule {
    background: #fff; border-radius: 24px; padding: 24px 16px 24px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04); margin-bottom: 24px;
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; transition: transform 0.1s; touch-action: manipulation;
}
.profile-capsule:active { transform: scale(0.98); }
.profile-left { display: flex; align-items: center; gap: 16px; }
.profile-avatar { width: 60px; height: 60px; border-radius: 50%; background: #e0e0e0; flex-shrink: 0; object-fit: cover; }
.profile-info { display: flex; flex-direction: column; }
.profile-nickname { font-size: 17px; font-weight: 600; color: #333; margin-bottom: 4px; }
.profile-identity { font-size: 13px; color: #888; }

.info-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.info-row {
    display: flex; align-items: center; justify-content: space-between;
    background: #ffffff; padding: 12px 18px; border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); border: 1px solid rgba(0, 0, 0, 0.02);
    cursor: pointer; transition: all 0.15s; touch-action: manipulation; color: #333;
}
.info-row:active { background: #f5f5f5; transform: scale(0.97); }
.info-label { font-size: 16px; font-weight: 500; }
.info-right { display: flex; align-items: center; gap: 12px; }
.info-value { color: #999; font-size: 14px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.info-avatar-preview { width: 32px; height: 32px; border-radius: 50%; background: #e0e0e0; flex-shrink: 0; object-fit: cover; }
.info-arrow { width: 18px; height: 18px; stroke: #ccc; stroke-width: 2; fill: none; }

.identity-header-box {
    background: #fff; border-radius: 24px; padding: 24px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04); margin-bottom: 16px;
    display: flex; flex-direction: column; align-items: center; position: relative;
}
.identity-header-box .label-current { position: absolute; top: 12px; left: 16px; font-size: 13px; color: #999; }
.identity-header-box .avatar { width: 70px; height: 70px; border-radius: 50%; background: #e0e0e0; margin-bottom: 8px; object-fit: cover; }
.identity-header-box .name { font-size: 16px; font-weight: 600; color: #333; }
.identity-header-box .details { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 2px; }
.identity-header-box .detail-line { font-size: 13px; color: #888; }
.identity-new-btn {
    align-self: flex-end; background: #d0e8ff; color: #0066cc; border: none;
    padding: 8px 20px; border-radius: 999px; font-weight: 500; font-size: 14px;
    cursor: pointer; transition: all 0.2s; margin-top: -44px; margin-bottom: 12px;
}
.identity-new-btn:active { transform: scale(0.96); }
.identity-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.identity-item {
    display: flex; align-items: center; justify-content: space-between;
    background: #ffffff; padding: 12px 18px; border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 2px solid transparent;
    cursor: pointer; transition: all 0.15s; touch-action: manipulation;
}
.identity-item:active { transform: scale(0.98); }
.identity-item .info-left { display: flex; align-items: center; gap: 12px; }
.identity-item .item-avatar { width: 36px; height: 36px; border-radius: 50%; background: #e0e0e0; object-fit: cover; }
.identity-item .item-name { font-size: 15px; font-weight: 500; color: #333; }
.identity-item .item-detail { font-size: 12px; color: #999; margin-left: 8px; }
.identity-item.selected { background: #d0e8ff; border-color: #0066cc; }
.identity-item.selected .item-name { color: #0066cc; }
.empty-tip { text-align: center; color: #999; margin-top: 20px; font-size: 14px; }

.create-form-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.create-input-row {
    display: flex; flex-direction: column; gap: 6px;
    background: #ffffff; padding: 12px 18px; border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.create-input-row label { font-size: 13px; color: #888; font-weight: 500; }
.create-input-row input, .create-input-row select {
    border: none; background: transparent; outline: none; font-size: 15px; color: #333; padding: 4px 0; width: 100%;
}
.create-input-row textarea {
    border: none; background: transparent; outline: none; font-size: 15px; color: #333; padding: 4px 0; width: 100%; resize: vertical; min-height: 60px; font-family: inherit; line-height: 1.5;
}
.create-btn {
    width: 100%; padding: 12px; border: none; border-radius: 999px; background: #d0e8ff; color: #0066cc;
    font-size: 16px; font-weight: 600; cursor: pointer; transition: 0.2s; margin-top: 8px;
}
.create-btn:active { transform: scale(0.96); }

.api-card {
    background: #ffffff; border-radius: 20px; padding: 20px 16px 24px 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04); border: 1px solid rgba(0,0,0,0.02);
}
.api-card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; font-size: 15px; font-weight: 600; color: #333;
}
.api-card-header .icon-svg { width: 18px; height: 18px; stroke: #999; stroke-width: 2; fill: none; margin-right: 8px; }
.api-card-header .left { display: flex; align-items: center; }
.api-card-header .right-btn {
    font-size: 12px; color: #999; background: #f0f0f0; padding: 4px 12px;
    border-radius: 999px; border: none; cursor: pointer; transition: 0.2s;
}
.api-card-header .right-btn:active { transform: scale(0.95); }
.input-group { margin-bottom: 14px; }
.input-group:last-child { margin-bottom: 0; }
.input-label { font-size: 13px; color: #666; margin-bottom: 6px; display: block; font-weight: 500; }
.input-wrapper {
    display: flex; align-items: center; gap: 8px;
    background: #f8f8f8; border: 1px solid #eee; border-radius: 12px;
    padding: 0 14px; transition: border 0.2s;
}
.input-wrapper:focus-within { border-color: #d0e8ff; background: #fff; }
.input-wrapper input {
    flex: 1; border: none; background: transparent; padding: 12px 0;
    font-size: 14px; color: #333; outline: none; width: 100%;
}
.input-wrapper input::placeholder { color: #bbb; }
.eye-btn { width: 32px; height: 32px; border: none; background: transparent; cursor: pointer; transition: 0.2s; }
.eye-btn:active { transform: scale(0.9); }
.eye-btn svg { width: 20px; height: 20px; stroke: #999; stroke-width: 2; fill: none; }
.range-group { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.range-header { display: flex; justify-content: space-between; font-size: 14px; color: #333; }
.range-header span:last-child { color: #999; font-weight: 500; }
input[type=range] { -webkit-appearance: none; width: 100%; height: 4px; border-radius: 999px; background: #e0e0e0; outline: none; transition: background 0.2s; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #d0e8ff; cursor: pointer; box-shadow: 0 1px 4px rgba(0,102,204,0.2); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; border: none; background: #d0e8ff; cursor: pointer; }

.log-list { display: flex; flex-direction: column; gap: 12px; }
.log-item {
    background: #f8f9fa; border-radius: 12px; padding: 12px 16px;
    border-left: 4px solid #ccc; display: flex; flex-direction: column; gap: 4px;
}
.log-item.success { border-left-color: #0066cc; }
.log-item.error { border-left-color: #ff4d4f; }
.log-header { display: flex; justify-content: space-between; font-size: 12px; color: #888; }
.log-method { font-weight: 500; color: #333; }
.log-url { font-size: 13px; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-response { font-size: 12px; color: #666; margin-top: 2px; }
.log-tokens { font-size: 11px; color: #999; margin-top: 4px; }
.clear-btn {
    width: 100%; padding: 12px; border: none; border-radius: 999px;
    background: #ffebee; color: #d32f2f; font-size: 14px; font-weight: 500;
    cursor: pointer; transition: 0.2s; margin-top: 8px;
}
.clear-btn:active { transform: scale(0.96); }

.switch-row {
    display: flex; justify-content: space-between; align-items: center;
    background: #ffffff; padding: 14px 20px; border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.02);
}
.switch-label { font-size: 15px; font-weight: 500; color: #333; }
.switch-desc { font-size: 13px; color: #999; margin-top: 4px; line-height: 1.4; }
.switch {
    position: relative; display: inline-block; width: 50px; height: 28px;
    flex-shrink: 0; cursor: pointer;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc; transition: .4s; border-radius: 34px;
}
.slider:before {
    position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px;
    background-color: white; transition: .4s; border-radius: 50%;
}
input:checked + .slider { background-color: #d0e8ff; }
input:checked + .slider:before { transform: translateX(22px); }

.menu-list { padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }
.menu-item {
    display: flex; justify-content: space-between; align-items: center;
    background: #ffffff; padding: 14px 20px; border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); border: 1px solid rgba(0, 0, 0, 0.02);
    cursor: pointer; font-size: 16px; font-weight: 500; color: #333;
    transition: all 0.15s; touch-action: manipulation;
}
.menu-item:active { transform: scale(0.97); background: #f5f5f5; }
.menu-item svg { width: 18px; height: 18px; stroke: #ccc; stroke-width: 2; fill: none; }

.top-placeholder { width: 36px; flex-shrink: 0; }

/* Toast 提示 */
#toastMessage {
    position: absolute; top: 100px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.8); color: #fff; padding: 8px 20px;
    border-radius: 999px; font-size: 14px; opacity: 0;
    transition: opacity 0.3s; pointer-events: none; white-space: nowrap; z-index: 99;
}
#toastMessage.show { opacity: 1; }

/* 底部长按菜单（身份编辑/删除） */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: flex-end;  /* ✅ 底部对齐 */
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.modal-overlay.active { display: flex; opacity: 1; }
.modal-content {
    width: 100%;
    max-width: 400px;  /* 限制宽度，居中显示 */
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px 20px 0 0;
    padding: 24px;
    padding-bottom: 40px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-title { font-size: 17px; font-weight: 600; color: #333; text-align: center; margin-bottom: 4px; }
.modal-select-group { display: flex; gap: 12px; justify-content: center; }
.modal-btn {
    flex: 1; padding: 12px; border: none; border-radius: 999px; font-size: 15px; font-weight: 500; cursor: pointer; transition: 0.2s; text-align: center;
}
.modal-btn.cancel { background: #f0f0f0; color: #666; }
.modal-btn.delete { background: #ffebee; color: #d32f2f; }
.modal-btn.edit { background: #d0e8ff; color: #0066cc; }
.modal-btn:active { transform: scale(0.95); }
.modal-bottom-line { height: 5px; width: 40px; background: #ddd; border-radius: 999px; align-self: center; margin-bottom: 8px; }

/* ===== API接入页面滚动修复 ===== */
#page-me-api .api-card {
    margin-bottom: 16px;
}
#page-me-api .bottom-actions {
    padding-bottom: 20px;
}

/* ===== API日志页面滚动修复 ===== */
#page-me-api-logs {
    overflow-y: auto;
}
#page-me-api-logs .log-list {
    padding-bottom: 20px;
}

/* ===== 修复所有"我的"子页面滚动 ===== */
#page-me-profile,
#page-me-identities,
#page-me-identity-create,
#page-me-api,
#page-me-settings,
#page-me-api-logs,
#page-me-bg-mode {
    overflow-y: auto;
}

#page-me-api .api-card:last-child {
    margin-bottom: 80px;
}
#page-me-api-logs .clear-btn {
    margin-bottom: 40px;
}

/* ============================================================
   历史聊天页面样式
   ============================================================ */
#page-history {
    padding: 0 16px 100px 16px;
    background: #ffffff;
}

.history-search-bar {
    padding: 12px 0 16px 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 5;
}
.history-search-bar input {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 999px;
    background: #f2f2f7;
    font-size: 15px;
    color: #333;
    outline: none;
    transition: background 0.2s;
}
.history-search-bar input::placeholder {
    color: #999;
}
.history-search-bar input:focus {
    background: #e8e8ed;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 20px;
    flex: 1;
}

.history-capsule {
    background: #ffffff;
    border-radius: 16px;
    padding: 14px 18px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}
.history-capsule:active {
    transform: scale(0.98);
    background: #f8f8fa;
}
.history-capsule .capsule-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}
.history-capsule .capsule-preview {
    font-size: 13px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-capsule .capsule-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: #bbb;
}
.history-capsule .capsule-time {
    color: #bbb;
}
.history-capsule .capsule-count {
    background: #f2f2f7;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    color: #888;
}
.history-capsule.active {
    border-color: #0066cc;
    background: rgba(208, 232, 255, 0.15);
}
.history-capsule.active .capsule-title {
    color: #0066cc;
}

.history-empty {
    text-align: center;
    color: #aaa;
    font-size: 14px;
    line-height: 1.8;
    margin-top: 30vh;
}

.history-bottom-fixed {
    position: sticky;
    bottom: 0;
    padding: 16px 0 24px 0;
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
}
.history-bottom-fixed .new-chat-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 999px;
    background: #d0e8ff;
    color: #0066cc;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.history-bottom-fixed .new-chat-btn:active {
    transform: scale(0.96);
    background: #b8dcff;
}
.history-bottom-fixed .new-chat-btn svg {
    width: 20px;
    height: 20px;
    stroke: #0066cc;
    stroke-width: 2.5;
    fill: none;
}

/* ============================================================
   加号面板样式（从单文件迁移）
   ============================================================ */
.plus-panel {
    display: none;
    position: absolute;
    bottom: 80px;
    left: 16px;
    right: 16px;
    background: #fff;
    border-radius: 24px;
    padding: 20px 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
    z-index: 50;
}
.plus-panel.active {
    display: block;
}
.plus-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 8px;
}
.plus-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: 0.2s;
    padding: 6px 0;
    border: none;
    background: transparent;
}
.plus-item:active {
    transform: scale(0.92);
}
.plus-item .icon-wrap {
    width: 52px;
    height: 52px;
    background: #f8f9fa;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #eee;
}
.plus-item .icon-wrap svg {
    width: 26px;
    height: 26px;
    stroke: #555;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.plus-item .label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

/* ============================================================
   语音卡片样式（从单文件迁移）
   ============================================================ */
.voice-card {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    max-width: 100%;
}
.voice-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.duration-label {
    font-size: 14px;
    color: #999;
    font-weight: 500;
    flex-shrink: 0;
}
.voice-bubble {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #95ec69;
    border-radius: 16px;
    border-top-right-radius: 4px;
    padding: 10px 18px;
    min-width: 80px;
    height: 44px;
    flex: 1;
    gap: 16px;
}
.bubble-spacer {
    flex: 1;
}
.wave-icon {
    display: flex;
    align-items: center;
    gap: 1.5px;
    height: 12px;
    flex-shrink: 0;
}
.wave-icon .bar {
    width: 2px;
    background: #333;
    border-radius: 1px;
    display: inline-block;
}
.wave-icon .bar:nth-child(1) { height: 6px; }
.wave-icon .bar:nth-child(2) { height: 10px; }
.wave-icon .bar:nth-child(3) { height: 7px; }
.wave-icon .bar:nth-child(4) { height: 9px; }
.text-bubble {
    background: #b8e6a0;
    padding: 8px 14px;
    border-radius: 12px;
    border-top-right-radius: 4px;
    font-size: 15px;
    color: #222;
    max-width: 200px;
    word-break: break-word;
    line-height: 1.4;
    align-self: flex-end;
}

/* ============================================================
   模态窗（加号栏共用）
   ============================================================ */
.plus-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}
.modal-overlay.active {
    display: flex;
    opacity: 1;
}
.modal-box {
    background: #fff;
    max-width: 340px;
    width: 90%;
    border-radius: 24px;
    padding: 24px 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay.active .modal-box {
    transform: scale(1);
}
.modal-title {
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
    color: #333;
}
.modal-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    min-height: 60px;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}
.modal-textarea:focus {
    border-color: #a0cfff;
}
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 18px;
}
.modal-btn {
    padding: 10px 28px;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}
.modal-btn.primary {
    background: #d0e8ff;
    color: #0066cc;
}
.modal-btn.primary:active {
    transform: scale(0.96);
}
.modal-btn.cancel {
    background: #f0f0f0;
    color: #666;
}
.modal-footer-hint {
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

/* ============================================================
   弹出卡片（心声/心事板）
   ============================================================ */
.popup-card-overlay {
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}
.popup-card-overlay.active {
    display: flex;
    opacity: 1;
}
.popup-card {
    background: #fff;
    max-width: 320px;
    width: 85%;
    border-radius: 24px;
    padding: 28px 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s;
    position: relative;
}
.popup-card-overlay.active .popup-card {
    transform: scale(1);
}
.popup-card .title {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
    color: #333;
}
.popup-card .content {
    font-size: 16px;
    line-height: 1.7;
    color: #444;
    margin-bottom: 16px;
    white-space: pre-wrap;
}
.popup-card .emotion-tag {
    position: absolute;
    bottom: 16px;
    right: 20px;
    font-size: 13px;
    color: #d47b6a;
    background: #fdf6f0;
    padding: 4px 12px;
    border-radius: 999px;
}
.popup-card .close-x {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 28px;
    height: 28px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #666;
    transition: 0.2s;
}
.popup-card .close-x:active {
    background: #e0e0e0;
    transform: scale(0.9);
}

/* ============================================================
   语音通话面板
   ============================================================ */
.call-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(20px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.call-overlay.active {
    display: flex;
}
.call-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 12px;
}
.call-name {
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}
.call-status {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 16px;
    border-radius: 999px;
    margin-bottom: 20px;
}
.call-chat-area {
    width: 100%;
    max-height: 40vh;
    overflow-y: auto;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
}
.call-chat-area .msg-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 80%;
    animation: fadeIn 0.25s ease;
}
.call-chat-area .msg-row.me {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.call-chat-area .msg-row .bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.call-chat-area .msg-row.me .bubble {
    background: rgba(255, 255, 255, 0.25);
}
.call-chat-area .msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.call-input-row {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 300px;
    margin-bottom: 20px;
}
.call-input-row input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 10px 16px;
    color: #fff;
    font-size: 15px;
    outline: none;
}
.call-input-row input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}
.call-input-row button {
    padding: 0 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 24px;
    color: #fff;
    cursor: pointer;
}
.call-hangup {
    width: 60px;
    height: 60px;
    background: #ff3b30;
    border: none;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 59, 48, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}
.call-hangup:active {
    transform: scale(0.9);
}
.call-hangup svg {
    width: 26px;
    height: 26px;
    stroke: #fff;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
}
/* ============================================================
   语音通话头像右下角小图标
   ============================================================ */

/* 头像容器 */
.msg .avatar-wrapper {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
}

.msg .avatar-wrapper .avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

/* 通话小图标 - 右下角蓝色圆标 */
.msg .call-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #0066cc;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    z-index: 2;
}

.msg .call-badge svg {
    width: 10px;
    height: 10px;
    stroke: #fff;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ============================================================
   语音卡片高度降低
   ============================================================ */

.voice-bubble {
    height: 32px !important;
    padding: 4px 12px !important;
    min-width: 50px !important;
}

.wave-icon {
    height: 10px !important;
    gap: 1.2px !important;
}

.wave-icon .bar {
    width: 1.8px !important;
    border-radius: 1px !important;
}

.wave-icon .bar:nth-child(1) { height: 5px !important; }
.wave-icon .bar:nth-child(2) { height: 9px !important; }
.wave-icon .bar:nth-child(3) { height: 6px !important; }
.wave-icon .bar:nth-child(4) { height: 8px !important; }

.text-bubble {
    font-size: 14px !important;
    padding: 4px 12px !important;
}

.duration-label {
    font-size: 12px !important;
}

.voice-card {
    gap: 4px !important;
}

/* ============================================================
   语音通话默认头像灰色占位
   ============================================================ */

#callAvatar {
    background: #e0e0e0;
    object-fit: cover;
}

#callAvatar[src=""] {
    opacity: 0;
}

/* 通话界面用户头像也灰色占位 */
.call-avatar-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #999;
    border: 2px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 12px;
}