/* @budding: 聊天室与消息气泡 */
#chat-room-screen { background-size: cover; background-position: center; }
#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: 12px; align-items: flex-start; transition: background-color 0.2s; flex-direction: column; }
.message-wrapper.group-message { margin-bottom: 18px; }
.message-wrapper.sent { align-items: flex-end; }
.message-wrapper.received { align-items: flex-start; }
.message-wrapper.system-notification { align-items: center; }
.message-bubble-row { display: flex; width: 100%; align-items: flex-start; }
.message-wrapper.sent .message-bubble-row { flex-direction: row-reverse; }
.message-wrapper.multi-select-selected { background-color: rgba(144, 202, 249, 0.2); border-radius: var(--border-radius); }

.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; }

/* 各种气泡 */
.message-bubble { max-width: 260px; padding: 8px 12px; border-radius: var(--border-radius); word-wrap: break-word; line-height: 1.4; backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); margin: 0 8px; cursor: pointer; font-size: 15px; }
.message-bubble.sent { background-color: var(--accent-color); color: var(--white-color); border-bottom-right-radius: 5px; }
.message-bubble.received { background-color: var(--bg-color); color: var(--text-color); border-bottom-left-radius: 5px; }
.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: 120px; border-radius: var(--border-radius); margin: 0 8px; 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 8px; 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-bottom: 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-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 8px; }
.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 8px; 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('https://i.postimg.cc/sxN893WF/IMG-20250712.png'); }
.transfer-card.received-transfer::before { background-image: url('https://i.postimg.cc/FzR8LY7g/IMG-20250712-170703.png'); }
.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(180, 180, 180, 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 8px; 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-bottom: 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(--secondary-color); border: 2px solid var(--secondary-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; }

.typing-indicator { text-align: center; color: #aaa; font-style: italic; font-size: 14px; padding: 10px 0; display: none; }

/* 输入区与功能栏 */
.chat-input-wrapper { flex-shrink: 0; }
#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; }
#regenerate-btn svg, #summary-btn svg { fill: #888; }
.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:hover { background: var(--secondary-color); }
.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 { 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; }

/* 极简翻译 */
.message-translation { display: none; margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(128, 128, 128, 0.2); word-break: break-word; font-size: 0.95em; opacity: 0.9; }
.show-translation .message-translation { display: block; animation: fadeIn 0.2s ease; }
