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

:root {
  --pink-50: #fdf2f8;
  --pink-100: #fce7f3;
  --pink-200: #fbcfe8;
  --pink-300: #f9a8d4;
  --pink-400: #f472b6;
  --pink-500: #ec4899;
  --pink-600: #db2777;
  --rose-100: #ffe4e6;
  --rose-200: #fecdd3;
  --rose-400: #fb7185;
  --rose-500: #f43f5e;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(135deg, var(--pink-50) 0%, var(--rose-100) 50%, var(--pink-100) 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

#heartCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--pink-50) 0%, var(--rose-100) 50%, var(--pink-100) 100%);
  padding: 16px;
}

.login-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  text-align: center;
  animation: fadeInUp 0.6s ease-out;
}

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

.login-hearts {
  font-size: 48px;
  margin-bottom: 16px;
  animation: heartBeat 1.5s ease-in-out infinite;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.15); }
  30% { transform: scale(1); }
  45% { transform: scale(1.1); }
  60% { transform: scale(1); }
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--pink-600);
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--gray-400);
  margin-bottom: 32px;
}

.login-form {
  text-align: left;
}

.login-input-group {
  margin-bottom: 20px;
}

.login-input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 8px;
}

.login-identity-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.identity-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border: 2px solid var(--pink-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--white);
  -webkit-user-select: none;
  user-select: none;
}

.identity-card:hover {
  border-color: var(--pink-400);
  background: var(--pink-50);
  transform: translateY(-2px);
}

.identity-card.selected {
  border-color: var(--pink-500);
  background: var(--pink-100);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15);
}

.identity-emoji {
  font-size: 32px;
}

.identity-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--pink-200);
  transition: all 0.2s ease;
}

.identity-card.selected .identity-avatar {
  border-color: var(--pink-500);
  box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.15);
}

.identity-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
}

.login-input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--pink-200);
  border-radius: var(--radius-sm);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s ease;
  background: var(--white);
}

.login-input-group input:focus {
  border-color: var(--pink-400);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
  min-height: 48px;
}

.login-btn:hover {
  background: linear-gradient(135deg, var(--pink-500), var(--pink-600));
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.login-error {
  color: var(--rose-500);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  min-height: 20px;
}

.field-error {
  font-size: 12px;
  font-weight: 500;
  color: var(--rose-500);
  margin-top: 6px;
  margin-bottom: 0;
  padding: 6px 10px;
  background: var(--rose-100);
  border-radius: 6px;
  border-left: 3px solid var(--rose-400);
  min-height: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease;
  line-height: 1.4;
}

.field-error.visible {
  max-height: 60px;
  opacity: 1;
  padding: 6px 10px;
  margin-top: 6px;
}

.login-input-group input.input-error {
  border-color: var(--rose-400);
  background: #fff5f7;
  animation: shake 0.4s ease;
}

.login-identity-cards.input-error .identity-card {
  border-color: var(--rose-300);
}

.login-identity-cards.input-error {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 800px;
  margin: 0 auto;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  padding-top: calc(12px + var(--safe-top));
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--pink-100);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-hearts {
  font-size: 24px;
  animation: heartBeat 1.5s ease-in-out infinite;
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--pink-500), var(--rose-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--pink-300);
  box-shadow: 0 2px 6px rgba(236, 72, 153, 0.2);
}

.current-user {
  font-size: 14px;
  font-weight: 600;
  color: var(--pink-500);
  padding: 4px 12px;
  background: var(--pink-100);
  border-radius: 20px;
}

.logout-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: background 0.2s ease;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logout-btn:hover {
  background: var(--pink-100);
}

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
  position: relative;
}

.chat-area::-webkit-scrollbar {
  width: 6px;
}

.chat-area::-webkit-scrollbar-track {
  background: transparent;
}

.chat-area::-webkit-scrollbar-thumb {
  background: var(--pink-200);
  border-radius: 3px;
}

.chat-area::-webkit-scrollbar-thumb:hover {
  background: var(--pink-300);
}

.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  color: var(--gray-400);
  font-size: 14px;
}

.load-more-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  color: var(--gray-400);
  font-size: 13px;
  background: linear-gradient(to bottom, var(--white), transparent);
  position: sticky;
  top: 0;
  z-index: 5;
}

.load-more-indicator .loading-spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--pink-200);
  border-top-color: var(--pink-400);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.messages-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-wrapper {
  display: flex;
  flex-direction: column;
  animation: messageIn 0.3s ease-out;
}

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

.message-wrapper.sender-xiaoyang {
  align-items: flex-start;
}

.message-wrapper.sender-xiaocai {
  align-items: flex-end;
}

.message-sender {
  font-size: 12px;
  color: var(--gray-400);
  margin-bottom: 4px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--pink-200);
}

.sender-xiaocai .message-avatar {
  border-color: var(--pink-400);
}

.message-bubble {
  max-width: 75%;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.sender-xiaoyang .message-bubble {
  background: var(--white);
  color: var(--gray-800);
  border-bottom-left-radius: 4px;
}

.sender-xiaocai .message-bubble {
  background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.message-image {
  max-width: 100%;
  max-height: 300px;
  min-width: 120px;
  min-height: 80px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  object-fit: contain;
  display: block;
  transition: opacity 0.3s ease;
}

.message-image:active {
  opacity: 0.8;
}

.message-image-wrapper {
  position: relative;
  max-width: 100%;
  min-width: 120px;
  min-height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.message-image-thumb {
  max-width: 100%;
  max-height: 300px;
  min-width: 120px;
  min-height: 80px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  object-fit: contain;
  display: block;
  filter: blur(4px);
  transform: scale(1.05);
  transition: opacity 0.3s ease;
}

.message-image-full {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  object-fit: contain;
  display: block;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.message-image-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.image-loader-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  animation: image-loader-spin 0.6s linear infinite;
}

.sender-xiaocai .image-loader-spinner {
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.7);
}

@keyframes image-loader-spin {
  to { transform: rotate(360deg); }
}

.message-image-caption {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
}

.sender-xiaocai .message-image-caption {
  color: rgba(255, 255, 255, 0.9);
}

.message-time {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 4px;
  padding: 0 8px;
}

.sender-xiaocai .message-time {
  text-align: right;
}

.message-edited {
  font-size: 11px;
  color: var(--gray-400);
  font-style: italic;
}

.message-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  padding: 0 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.message-wrapper:hover .message-actions,
.message-wrapper:focus-within .message-actions {
  opacity: 1;
}

.sender-xiaocai .message-actions {
  justify-content: flex-end;
}

.message-action-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  min-height: 32px;
  min-width: 44px;
}

.message-action-btn:hover {
  background: var(--pink-100);
  color: var(--pink-500);
}

.message-action-btn.delete-btn:hover {
  background: var(--rose-100);
  color: var(--rose-500);
}

.message-read-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  margin-top: 2px;
  padding: 0 8px;
}

.sender-xiaocai .message-read-status {
  justify-content: flex-end;
}

.read-status-unread {
  color: var(--pink-500);
  font-weight: 600;
}

.read-status-unread .unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  animation: unreadPulse 1.8s ease-in-out infinite;
  box-shadow: 0 0 4px rgba(236, 72, 153, 0.5);
}

@keyframes unreadPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.3); }
}

.read-status-read {
  color: var(--gray-400);
  font-size: 10px;
}

.read-status-just-changed {
  animation: readStatusPop 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes readStatusPop {
  0% { color: var(--pink-500); transform: scale(1.15); }
  50% { color: var(--pink-400); transform: scale(1.05); }
  100% { color: var(--gray-400); transform: scale(1); }
}

.message-wrapper.unread-message {
  position: relative;
}

.message-wrapper.unread-message .message-bubble {
  border-left: 3px solid var(--pink-400);
}

.sender-xiaocai.unread-message .message-bubble {
  border-left: none;
  border-right: 3px solid #fff;
  opacity: 0.95;
}

.message-wrapper.message-highlight {
  animation: messageHighlightPulse 1.5s ease-out;
}

@keyframes messageHighlightPulse {
  0% { background: rgba(244, 114, 182, 0.2); }
  50% { background: rgba(244, 114, 182, 0.15); }
  100% { background: transparent; }
}

.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  line-height: 20px;
  animation: badgeBounce 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 2px 6px rgba(236, 72, 153, 0.4);
}

@keyframes badgeBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.unread-badge.hidden {
  display: none;
}

.header-unread-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.message-new-arrive {
  opacity: 0;
  transform: translateY(20px);
}

.message-new-animate {
  animation: messageSlideIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

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

.new-message-indicator {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  background: linear-gradient(135deg, #ec4899, #f472b6);
  color: white;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
  transition: all 0.3s ease;
  user-select: none;
  min-height: 40px;
  min-width: 120px;
}

.new-message-indicator:hover {
  transform: translateX(-50%) scale(1.05);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5);
}

.new-message-indicator .indicator-text {
  position: relative;
  z-index: 1;
}

.indicator-bounce-in {
  animation: indicatorBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes indicatorBounce {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.3);
  }
  50% {
    transform: translateX(-50%) scale(1.1);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

.date-divider::before,
.date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--pink-200);
}

.date-divider span {
  font-size: 12px;
  color: var(--gray-400);
  white-space: nowrap;
}

.emoji-picker {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 400px;
  max-height: 300px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 100;
  overflow: hidden;
  animation: fadeInUp 0.2s ease-out;
}

.emoji-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--pink-100);
}

.emoji-picker-header span {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
}

.emoji-close-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-close-btn:hover {
  background: var(--pink-100);
  color: var(--gray-600);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 12px;
  overflow-y: auto;
  max-height: 240px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
}

.emoji-grid::-webkit-scrollbar {
  width: 4px;
}

.emoji-grid::-webkit-scrollbar-thumb {
  background: var(--pink-200);
  border-radius: 2px;
}

.emoji-item {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  min-height: 44px;
}

.emoji-item:hover {
  background: var(--pink-100);
  transform: scale(1.2);
}

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

/* ==================== 自定义表情样式 ==================== */

.emoji-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}

.emoji-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.emoji-tab:hover {
  background: var(--pink-100);
  color: var(--gray-600);
}

.emoji-tab.active {
  background: var(--pink-200);
  color: var(--gray-700);
  font-weight: 600;
}

.emoji-tab-content {
  display: none;
}

.emoji-tab-content.active {
  display: block;
}

.custom-emoji-toolbar {
  padding: 10px 12px 6px;
  border-bottom: 1px solid var(--pink-100);
}

.custom-emoji-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #ff6b9d, #ff8a80);
  color: white;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(255, 107, 157, 0.3);
}

.custom-emoji-upload-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4);
}

.custom-emoji-upload-btn svg {
  width: 16px;
  height: 16px;
}

.custom-emoji-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px;
  overflow-y: auto;
  max-height: 200px;
}

.custom-emoji-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  gap: 8px;
  color: var(--gray-400);
}

.custom-emoji-empty span:first-child {
  font-size: 40px;
}

.custom-emoji-empty span:nth-child(2) {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-500);
}

.custom-emoji-empty span:last-child {
  font-size: 12px;
  color: var(--gray-400);
  text-align: center;
  max-width: 200px;
}

.custom-emoji-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: var(--gray-100);
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.custom-emoji-item:hover {
  transform: scale(1.05);
  border-color: var(--pink-300);
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.2);
}

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

.custom-emoji-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.custom-emoji-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.custom-emoji-item:hover .custom-emoji-delete {
  opacity: 1;
}

.custom-emoji-delete:hover {
  background: rgba(239, 68, 68, 0.8);
  transform: scale(1.1);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
  padding: 16px;
}

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

.modal-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-xl);
  animation: fadeInUp 0.3s ease-out;
}

.modal-card-small {
  max-width: 360px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-700);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background: var(--gray-100);
  color: var(--gray-600);
}

.modal-body {
  padding: 20px;
}

.modal-body p {
  font-size: 15px;
  color: var(--gray-600);
  line-height: 1.6;
}

.edit-textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--pink-200);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease;
}

.edit-textarea:focus {
  border-color: var(--pink-400);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--gray-100);
}

.modal-btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.modal-btn-cancel {
  background: var(--gray-100);
  color: var(--gray-600);
}

.modal-btn-cancel:hover {
  background: var(--gray-200);
}

.modal-btn-save {
  background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
  color: var(--white);
}

.modal-btn-save:hover {
  background: linear-gradient(135deg, var(--pink-500), var(--pink-600));
}

.modal-btn-delete {
  background: linear-gradient(135deg, var(--rose-400), var(--rose-500));
  color: var(--white);
}

.modal-btn-delete:hover {
  background: linear-gradient(135deg, var(--rose-500), #e11d48);
}

.image-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.image-preview-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  animation: fadeInUp 0.3s ease-out;
  overflow: hidden;
}

.image-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-weight: 600;
  color: var(--gray-700);
  font-size: 14px;
}

.image-preview-body {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 60vh;
  overflow: hidden;
}

.image-preview-body img {
  max-width: 100%;
  max-height: 55vh;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.image-preview-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--gray-100);
}

.image-view-container {
  position: relative;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-view-container img {
  max-width: 95vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  transition: transform 0.1s ease-out;
  transform-origin: center center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.image-view-container img.image-zoomed {
  max-width: none;
  max-height: none;
}

.image-view-loading {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: white;
  font-size: 14px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 2;
}

.image-view-loading .loading-spinner {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

.image-view-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  font-size: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-700);
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.image-view-close:hover {
  background: var(--white);
  transform: scale(1.1);
}

/* ========== 回复预览栏 ========== */
.reply-preview-bar {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--pink-50);
  border-bottom: 1px solid var(--pink-100);
  animation: replyBarSlideIn 0.2s ease-out;
}

.reply-preview-content {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.reply-preview-indicator {
  width: 3px;
  min-height: 32px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--pink-400), var(--pink-500));
  flex-shrink: 0;
  align-self: stretch;
}

.reply-preview-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.reply-preview-sender {
  font-size: 13px;
  font-weight: 600;
  color: var(--pink-500);
  letter-spacing: 0.02em;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-preview-text {
  font-size: 14px;
  color: var(--gray-600);
  letter-spacing: 0.01em;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-cancel-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: none;
  background: var(--gray-100);
  color: var(--gray-400);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.2s ease;
  margin-left: 10px;
}

.reply-cancel-btn:hover {
  background: var(--gray-200);
  color: var(--gray-600);
}

@keyframes replyBarSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 60px;
  }
}

/* ========== 消息内嵌回复引用 ========== */
.message-reply-ref {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: rgba(244, 114, 182, 0.06);
  border-left: 3px solid var(--pink-400);
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  transition: background 0.2s ease;
}

.message-reply-ref:hover {
  background: rgba(244, 114, 182, 0.12);
}

.message-reply-ref-indicator {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: var(--pink-400);
}

.message-reply-ref-body {
  min-width: 0;
  overflow: hidden;
}

.message-reply-ref-sender {
  font-size: 13px;
  font-weight: 600;
  color: var(--pink-500);
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.message-reply-ref-text {
  font-size: 13px;
  color: var(--gray-600);
  letter-spacing: 0.01em;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-reply-ref-thumb {
  width: 36px;
  height: 36px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 2px;
}

.sender-xiaocai .message-reply-ref {
  background: rgba(139, 92, 246, 0.08);
  border-left-color: var(--purple-400);
}

.sender-xiaocai .message-reply-ref:hover {
  background: rgba(139, 92, 246, 0.15);
}

.sender-xiaocai .message-reply-ref-indicator {
  color: var(--purple-400);
}

.sender-xiaocai .message-reply-ref-sender {
  color: var(--purple-500);
}

/* ========== 右键/长按上下文菜单 ========== */
.context-menu {
  position: fixed;
  z-index: 10000;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
  padding: 5px;
  min-width: 150px;
  animation: contextMenuIn 0.15s ease-out;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
  letter-spacing: 0.01em;
  line-height: 1.4;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  text-align: left;
}

.context-menu-item:hover {
  background: var(--pink-50);
  color: var(--pink-600);
}

.context-menu-item:active {
  background: var(--pink-100);
}

.context-menu-item svg {
  flex-shrink: 0;
  opacity: 0.75;
}

.context-menu-item:hover svg {
  opacity: 1;
}

.context-menu-item-danger {
  color: #dc2626;
}

.context-menu-item-danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}

@keyframes contextMenuIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.input-area {
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--pink-100);
  flex-shrink: 0;
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  flex-wrap: nowrap;
}

.emoji-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-btn:hover {
  background: var(--pink-100);
}

.emoji-btn:active {
  background: var(--pink-200);
}

.sender-selector {
  position: relative;
  flex-shrink: 0;
}

.sender-display {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 38px;
  padding: 0 8px;
  border: 2px solid var(--pink-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 72px;
  -webkit-user-select: none;
  user-select: none;
}

.sender-display:hover {
  border-color: var(--pink-400);
}

.sender-display:active {
  background: var(--pink-50);
}

.sender-avatar-small {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--pink-200);
}

.sender-name-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--pink-600);
  white-space: nowrap;
}

.sender-arrow {
  color: var(--pink-400);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.sender-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--pink-100);
  z-index: 50;
  min-width: 120px;
  overflow: hidden;
  animation: fadeInUp 0.15s ease-out;
}

.sender-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
  -webkit-user-select: none;
  user-select: none;
}

.sender-option:hover {
  background: var(--pink-50);
}

.sender-option:active {
  background: var(--pink-100);
}

.sender-option:first-child {
  border-bottom: 1px solid var(--pink-100);
}

.sender-option .sender-avatar-small {
  width: 28px;
  height: 28px;
}

.image-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: none;
  background: none;
  color: var(--pink-400);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-btn:hover {
  background: var(--pink-100);
  color: var(--pink-500);
}

.image-btn:active {
  background: var(--pink-200);
}

.message-input {
  flex: 1;
  min-width: 0;
  height: 38px;
  max-height: 120px;
  padding: 8px 14px;
  border: 2px solid var(--pink-200);
  border-radius: 22px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  resize: none;
  transition: border-color 0.2s ease;
  line-height: 1.5;
  overflow-y: auto;
  -webkit-appearance: none;
}

.message-input:focus {
  border-color: var(--pink-400);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

.message-input::placeholder {
  color: var(--gray-300);
}

.send-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: none;
  background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
  color: var(--white);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.send-btn:hover {
  background: linear-gradient(135deg, var(--pink-500), var(--pink-600));
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.send-btn:active {
  transform: scale(0.95);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.voice-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: none;
  background: none;
  color: var(--pink-400);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-btn:hover {
  background: var(--pink-100);
  color: var(--pink-500);
}

.voice-btn:active {
  background: var(--pink-200);
}

.voice-btn.recording-active {
  background: var(--rose-400);
  color: var(--white);
  animation: voicePulse 1.5s ease-in-out infinite;
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); }
}

.voice-btn.recording-active:hover {
  background: var(--rose-500);
  color: var(--white);
}

.voice-recording-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

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

.voice-recording-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 32px 28px 20px;
  width: 90%;
  max-width: 320px;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: scaleIn 0.25s ease-out;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.voice-recording-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rose-500);
  animation: recordingBlink 1s ease-in-out infinite;
}

@keyframes recordingBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.voice-recording-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--rose-500);
}

.voice-timer {
  font-size: 36px;
  font-weight: 300;
  color: var(--gray-700);
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

.voice-waveform-container {
  width: 100%;
  height: 60px;
  background: var(--pink-50);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.voice-waveform {
  width: 100%;
  height: 100%;
  display: block;
}

.voice-recording-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--gray-400);
}

.voice-hint-arrow {
  font-size: 14px;
  animation: hintBounce 1.5s ease-in-out infinite;
}

@keyframes hintBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.voice-actions {
  display: flex;
  align-items: center;
  gap: 32px;
}

.voice-action-btn {
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.voice-cancel-btn {
  background: var(--gray-200);
  color: var(--gray-500);
}

.voice-cancel-btn:hover {
  background: var(--gray-300);
  color: var(--gray-700);
}

.voice-cancel-btn:active {
  transform: scale(0.92);
}

.voice-send-btn {
  background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
  color: var(--white);
  box-shadow: var(--shadow-md);
}

.voice-send-btn:hover {
  background: linear-gradient(135deg, var(--pink-500), var(--pink-600));
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

.voice-send-btn:active {
  transform: scale(0.95);
}

.voice-upload-progress {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  box-shadow: var(--shadow-lg);
  z-index: 260;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 200px;
}

.voice-upload-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--pink-100);
  border-radius: 2px;
  overflow: hidden;
}

.voice-upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pink-400), var(--pink-500));
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
}

.voice-upload-progress-text {
  font-size: 13px;
  color: var(--gray-500);
}

.message-voice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.message-voice-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--pink-400);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.message-voice.playing .message-voice-icon {
  background: var(--rose-400);
  animation: voicePulse 1.2s ease-in-out infinite;
}

.message-voice-icon svg {
  width: 18px;
  height: 18px;
}

.message-voice-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.message-voice-duration {
  font-size: 14px;
  font-weight: 500;
  color: inherit;
}

.message-voice-status {
  font-size: 11px;
  opacity: 0.7;
}

.message-voice-wave-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 20px;
}

.message-voice-wave-bars .wave-bar {
  width: 2px;
  border-radius: 1px;
  background: currentColor;
  transition: height 0.1s ease;
  opacity: 0.6;
}

.message-voice.playing .message-voice-wave-bars .wave-bar {
  animation: waveBarAnimate 0.8s ease-in-out infinite;
}

.message-voice.playing .message-voice-wave-bars .wave-bar:nth-child(odd) {
  animation-delay: 0.15s;
}

@keyframes waveBarAnimate {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  color: var(--gray-700);
  z-index: 1100;
  animation: toastIn 0.3s ease-out;
  max-width: 90vw;
  text-align: center;
}

.toast.toast-error {
  border: 1px solid var(--rose-200);
  color: var(--rose-500);
}

.toast.toast-success {
  border: 1px solid var(--pink-200);
  color: var(--pink-600);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-state-emoji {
  font-size: 64px;
  margin-bottom: 16px;
  animation: heartBeat 1.5s ease-in-out infinite;
}

.empty-state-text {
  font-size: 16px;
  font-weight: 500;
}

.empty-state-subtext {
  font-size: 13px;
  margin-top: 8px;
  color: var(--gray-300);
}

@media (max-width: 600px) {
  .login-card {
    padding: 32px 24px;
  }

  .login-title {
    font-size: 24px;
  }

  .login-hearts {
    font-size: 40px;
  }

  .identity-avatar {
    width: 52px;
    height: 52px;
  }

  .app-header {
    padding: 10px 14px;
    padding-top: calc(10px + var(--safe-top));
  }

  .header-title {
    font-size: 17px;
  }

  .header-hearts {
    font-size: 20px;
  }

  .header-right {
    gap: 7px;
  }

  .current-user {
    font-size: 12px;
    padding: 3px 10px;
  }

  .chat-area {
    padding: 12px 10px;
  }

  .message-bubble {
    max-width: 82%;
    padding: 9px 14px;
    font-size: 15px;
  }

  .message-avatar {
    width: 24px;
    height: 24px;
  }

  .message-sender {
    font-size: 11px;
  }

  .message-image {
    max-height: 240px;
  }

  .message-image-thumb {
    max-height: 240px;
  }

  .message-image-full {
    max-height: 240px;
  }

  .input-area {
    padding: 8px 10px;
    padding-bottom: calc(8px + var(--safe-bottom));
  }

  .input-row {
    gap: 4px;
  }

  .emoji-picker {
    width: 95%;
    bottom: 70px;
    max-height: 260px;
  }

  .emoji-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    padding: 8px;
  }

  .emoji-item {
    font-size: 20px;
    padding: 4px;
    min-height: 40px;
  }

  .emoji-tab {
    padding: 6px 8px;
    font-size: 12px;
  }

  .custom-emoji-upload-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .custom-emoji-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px;
    max-height: 180px;
  }

  .custom-emoji-delete {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  .sender-display {
    height: 38px;
    padding: 0 6px;
    min-width: 60px;
  }

  .sender-name-text {
    font-size: 12px;
  }

  .sender-avatar-small {
    width: 22px;
    height: 22px;
  }

  .message-input {
    font-size: 16px;
    height: 38px;
    padding: 8px 12px;
  }

  .image-preview-card {
    max-width: 95%;
  }

  .image-preview-body img {
    max-height: 45vh;
  }

  .image-view-container img {
    max-height: 75vh;
  }

  .image-view-close {
    top: -44px;
  }

  .modal-card {
    max-width: 95%;
  }

  .modal-body {
    padding: 16px;
  }

  .edit-textarea {
    font-size: 16px;
  }

  .reply-preview-bar {
    padding: 8px 12px;
  }

  .reply-preview-sender {
    font-size: 12px;
  }

  .reply-preview-text {
    font-size: 13px;
  }

  .context-menu {
    min-width: 130px;
  }

  .context-menu-item {
    padding: 9px 12px;
    font-size: 13px;
    gap: 8px;
  }

  .message-reply-ref {
    padding: 6px 10px;
  }

  .message-reply-ref-sender {
    font-size: 12px;
  }

  .message-reply-ref-text {
    font-size: 12px;
  }

  .voice-recording-card {
    padding: 28px 20px 16px;
    width: 85%;
    max-width: 280px;
    gap: 12px;
  }

  .voice-timer {
    font-size: 30px;
  }

  .voice-waveform-container {
    height: 50px;
  }

  .voice-actions {
    gap: 24px;
  }

  .voice-action-btn {
    width: 50px;
    height: 50px;
  }

  .voice-upload-progress {
    bottom: 100px;
    min-width: 160px;
    padding: 12px 18px;
  }
}

@media (max-width: 380px) {
  .login-card {
    padding: 24px 18px;
  }

  .identity-card {
    padding: 12px 8px;
  }

  .identity-avatar {
    width: 44px;
    height: 44px;
  }

  .identity-name {
    font-size: 13px;
  }

  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .input-row {
    gap: 3px;
  }

  .voice-btn,
  .emoji-btn,
  .image-btn,
  .send-btn {
    width: 34px;
    height: 34px;
  }

  .emoji-btn {
    font-size: 18px;
  }

  .voice-btn svg,
  .image-btn svg {
    width: 18px;
    height: 18px;
  }

  .send-btn svg {
    width: 20px;
    height: 20px;
  }

  .message-input {
    height: 34px;
    padding: 6px 10px;
    font-size: 15px;
  }

  .sender-display {
    height: 34px;
    min-width: 56px;
    padding: 0 4px;
    gap: 2px;
  }

  .sender-name-text {
    font-size: 11px;
  }

  .sender-avatar-small {
    width: 20px;
    height: 20px;
  }

  .message-bubble {
    max-width: 85%;
    font-size: 14px;
    padding: 8px 12px;
  }

  .header-title {
    font-size: 15px;
  }
}

@media (max-width: 320px) {
  .sender-name-text {
    display: none;
  }

  .sender-display {
    min-width: 44px;
    justify-content: center;
  }

  .sender-arrow {
    display: none;
  }

  .input-row {
    gap: 2px;
  }

  .voice-btn,
  .emoji-btn,
  .image-btn,
  .send-btn {
    width: 32px;
    height: 32px;
  }

  .emoji-btn {
    font-size: 16px;
  }

  .voice-btn svg,
  .image-btn svg {
    width: 16px;
    height: 16px;
  }

  .send-btn svg {
    width: 18px;
    height: 18px;
  }

  .message-input {
    height: 32px;
    padding: 5px 8px;
    font-size: 14px;
  }

  .sender-display {
    height: 32px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .login-card {
    padding: 20px 32px;
  }

  .login-hearts {
    font-size: 28px;
    margin-bottom: 8px;
  }

  .login-title {
    font-size: 20px;
    margin-bottom: 4px;
  }

  .login-subtitle {
    margin-bottom: 16px;
  }

  .identity-avatar {
    width: 40px;
    height: 40px;
  }

  .app-header {
    padding: 6px 14px;
    padding-top: calc(6px + var(--safe-top));
  }

  .header-hearts {
    font-size: 18px;
  }

  .header-title {
    font-size: 16px;
  }

  .emoji-picker {
    bottom: 60px;
    max-height: 200px;
  }

  .emoji-grid {
    max-height: 160px;
  }

  .input-area {
    padding: 4px 10px;
    padding-bottom: calc(4px + var(--safe-bottom));
  }

  .input-row {
    gap: 3px;
  }

  .voice-btn,
  .emoji-btn,
  .image-btn,
  .send-btn {
    width: 34px;
    height: 34px;
  }

  .message-input {
    height: 34px;
    padding: 6px 10px;
  }

  .message-image {
    max-height: 180px;
  }
}

@media (hover: none) {
  .message-actions {
    opacity: 1;
  }

  .message-action-btn {
    font-size: 11px;
    padding: 2px 6px;
  }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .input-area {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  @media (max-width: 600px) {
    .input-area {
      padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }
  }
}

/* ========== 相册入口按钮 ========== */
.album-btn {
  background: none;
  border: none;
  color: var(--pink-400);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s ease;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.album-btn:hover {
  background: var(--pink-100);
  color: var(--pink-500);
  transform: scale(1.05);
}

.album-btn:active {
  background: var(--pink-200);
  transform: scale(0.95);
}

.email-settings-btn {
  background: none;
  border: none;
  color: var(--pink-400);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s ease;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.email-settings-btn:hover {
  background: var(--pink-100);
  color: var(--pink-500);
  transform: scale(1.05);
}

.email-settings-btn:active {
  background: var(--pink-200);
  transform: scale(0.95);
}

/* ========== 搜索按钮 ========== */
.search-btn {
  background: none;
  border: none;
  color: var(--pink-400);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s ease;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-btn:hover {
  background: var(--pink-100);
  color: var(--pink-500);
  transform: scale(1.05);
}

.search-btn:active {
  background: var(--pink-200);
  transform: scale(0.95);
}

/* ========== 搜索面板 ========== */
.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 60px;
  animation: fadeIn 0.2s ease;
}

.search-panel {
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideDown 0.25s ease;
}

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

.search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--pink-100);
}

.search-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--pink-500);
  margin: 0;
}

.search-close-btn {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
}

.search-close-btn:hover {
  background: var(--pink-100);
  color: var(--pink-500);
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--pink-50);
}

.search-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--pink-50);
  border-radius: var(--radius-md);
  padding: 0 12px;
  border: 1.5px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.search-input-wrapper:focus-within {
  border-color: var(--pink-300);
  background: var(--white);
}

.search-input-icon {
  color: var(--gray-400);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 10px 8px;
  font-size: 15px;
  color: var(--gray-700);
  min-width: 0;
}

.search-input::placeholder {
  color: var(--gray-400);
}

.clear-search-input {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.clear-search-input:hover {
  color: var(--pink-400);
}

.execute-search-btn {
  background: linear-gradient(135deg, var(--pink-400), var(--rose-400));
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.execute-search-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

.execute-search-btn:active {
  transform: scale(0.97);
}

.search-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--pink-50);
  flex-wrap: wrap;
}

.search-filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-filter-label {
  font-size: 12px;
  color: var(--gray-500);
  white-space: nowrap;
}

.search-filter-select,
.search-filter-date {
  border: 1px solid var(--pink-200);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 13px;
  color: var(--gray-700);
  background: var(--white);
  outline: none;
  transition: border-color 0.2s ease;
}

.search-filter-select:focus,
.search-filter-date:focus {
  border-color: var(--pink-400);
}

.search-filter-date {
  width: 130px;
}

.clear-filters-btn {
  background: none;
  border: 1px solid var(--pink-200);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.clear-filters-btn:hover {
  border-color: var(--pink-400);
  color: var(--pink-400);
}

/* 搜索历史 */
.search-history-section {
  padding: 10px 20px;
  border-bottom: 1px solid var(--pink-50);
}

.search-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.search-history-title {
  font-size: 12px;
  color: var(--gray-500);
  font-weight: 600;
}

.clear-history-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease;
}

.clear-history-btn:hover {
  color: var(--pink-400);
}

.search-history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.search-history-item {
  background: var(--pink-50);
  border: 1px solid var(--pink-100);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-history-item:hover {
  background: var(--pink-100);
  color: var(--pink-500);
  border-color: var(--pink-200);
}

/* 搜索结果 */
.search-results {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: none;
  padding: 0;
}

.search-results-count {
  padding: 10px 20px 6px;
  font-size: 12px;
  color: var(--gray-400);
}

.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid var(--pink-50);
}

.search-result-item:hover {
  background: var(--pink-50);
}

.search-result-item:active {
  background: var(--pink-100);
}

.search-result-left {
  flex-shrink: 0;
}

.search-result-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--pink-200);
}

.search-result-body {
  flex: 1;
  min-width: 0;
}

.search-result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.search-result-sender {
  font-size: 13px;
  font-weight: 600;
}

.search-result-sender.sender-xiaoyang {
  color: #3b82f6;
}

.search-result-sender.sender-xiaocai {
  color: #ec4899;
}

.search-result-time {
  font-size: 11px;
  color: var(--gray-400);
}

.search-result-text {
  font-size: 14px;
  color: var(--gray-700);
  line-height: 1.5;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-image img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

.search-result-voice {
  font-size: 14px;
  color: var(--gray-500);
}

.search-result-jump {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

.search-result-jump:hover {
  color: var(--pink-400);
  background: var(--pink-100);
}

.search-highlight {
  background: rgba(251, 191, 36, 0.35);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.search-empty {
  text-align: center;
  padding: 40px 20px;
}

.search-empty-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.search-empty-text {
  font-size: 16px;
  color: var(--gray-500);
  font-weight: 600;
}

.search-empty-subtext {
  font-size: 13px;
  color: var(--gray-400);
  margin-top: 4px;
}

.search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  color: var(--gray-400);
  font-size: 14px;
}

/* 消息跳转高亮 */
.message-highlight {
  animation: highlightPulse 2s ease;
}

@keyframes highlightPulse {
  0% { background: rgba(251, 191, 36, 0.4); }
  100% { background: transparent; }
}

/* 跳转加载覆盖层 */
.jump-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  color: #fff;
  font-size: 14px;
  gap: 12px;
}

.jump-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ========== 搜索面板响应式 ========== */
@media (max-width: 480px) {
  .search-overlay {
    padding-top: 0;
    align-items: flex-end;
  }

  .search-panel {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .search-filters {
    gap: 6px;
  }

  .search-filter-date {
    width: 110px;
  }

  .search-filter-label {
    display: none;
  }
}

@media (max-width: 360px) {
  .search-filter-date {
    width: 95px;
    font-size: 12px;
  }
}

/* ========== 邮箱设置弹窗 ========== */
.email-settings-card {
  max-width: 440px;
}

.email-settings-desc {
  background: var(--pink-50);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
}

.email-settings-desc p {
  margin: 0;
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.6;
}

.email-input-group {
  margin-bottom: 20px;
}

.email-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.email-input-row {
  position: relative;
  display: flex;
  align-items: center;
}

.email-input {
  width: 100%;
  padding: 12px 16px;
  padding-right: 40px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--gray-800);
  background: var(--white);
  transition: all 0.2s ease;
  outline: none;
  letter-spacing: 0.01em;
}

.email-input:focus {
  border-color: var(--pink-400);
  box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.15);
}

.email-input::placeholder {
  color: var(--gray-400);
  font-size: 14px;
}

.email-input.email-input-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.email-input.email-input-success {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.email-clear-btn {
  position: absolute;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  background: var(--gray-100);
  color: var(--gray-400);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s ease;
}

.email-clear-btn:hover {
  background: var(--gray-200);
  color: var(--gray-600);
}

.email-error {
  font-size: 13px;
  color: #ef4444;
  margin-top: 6px;
  line-height: 1.4;
}

.email-status {
  font-size: 13px;
  color: #22c55e;
  margin-top: 6px;
  line-height: 1.4;
}

.email-reminder-info {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: var(--radius-md);
}

.email-reminder-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1;
}

.email-reminder-text {
  min-width: 0;
}

.email-reminder-text p {
  margin: 0;
  font-size: 12px;
  color: var(--gray-600);
  line-height: 1.6;
}

.email-reminder-text p + p {
  margin-top: 4px;
}

.email-reminder-text strong {
  color: var(--pink-500);
}

.modal-btn-secondary {
  background: var(--gray-100);
  color: var(--gray-600);
}

.modal-btn-secondary:hover:not(:disabled) {
  background: var(--gray-200);
}

.modal-btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-btn-primary {
  background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
  color: var(--white);
}

.modal-btn-primary:hover {
  background: linear-gradient(135deg, var(--pink-500), var(--pink-600));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(244, 114, 182, 0.3);
}

.modal-btn-primary:active {
  transform: translateY(0);
}

.email-section-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 20px 0;
}

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

.location-input {
  flex: 1;
  padding-right: 16px !important;
}

.get-location-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 2px solid var(--gray-200);
  background: var(--white);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.get-location-btn:hover {
  border-color: var(--pink-400);
  background: var(--pink-50);
}

.get-location-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.weather-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--pink-50);
  border-radius: var(--radius-md);
}

.weather-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.weather-toggle-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
}

.weather-toggle-desc {
  font-size: 12px;
  color: var(--gray-500);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gray-300);
  border-radius: 26px;
  transition: all 0.3s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* ========== 相册弹窗 ========== */
.album-modal-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: fadeInUp 0.3s ease-out;
}

.album-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--gray-100);
  flex-shrink: 0;
}

.album-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
  color: var(--white);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
}

.album-upload-btn:hover {
  background: linear-gradient(135deg, var(--pink-500), var(--pink-600));
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.album-upload-btn:active {
  transform: translateY(0);
}

.album-count {
  font-size: 13px;
  color: var(--gray-400);
  font-weight: 500;
}

/* ========== 上传进度条 ========== */
.album-upload-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--pink-50);
  border-bottom: 1px solid var(--pink-100);
  flex-shrink: 0;
}

.album-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--pink-100);
  border-radius: 3px;
  overflow: hidden;
}

.album-progress-fill {
  height: 100%;
  background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
}

.album-progress-text {
  font-size: 13px;
  color: var(--pink-600);
  font-weight: 500;
  white-space: nowrap;
}

/* ========== 相册网格 ========== */
.album-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
}

.album-grid::-webkit-scrollbar {
  width: 6px;
}

.album-grid::-webkit-scrollbar-thumb {
  background: var(--pink-200);
  border-radius: 3px;
}

.album-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

/* ========== 相册照片卡片 ========== */
.album-photo-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--gray-100);
  aspect-ratio: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: fadeInUp 0.3s ease-out;
}

.album-photo-card:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-lg);
}

.album-photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.album-photo-card .album-photo-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: none;
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 2;
}

.album-photo-card:hover .album-photo-delete {
  opacity: 1;
}

.album-photo-delete:hover {
  background: rgba(244, 63, 94, 0.8);
}

.album-photo-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.5));
  color: white;
  font-size: 11px;
  line-height: 1.4;
  pointer-events: none;
}

.album-photo-info .photo-uploader {
  font-weight: 600;
}

.album-photo-info .photo-date {
  opacity: 0.85;
}

/* ========== 相册视频卡片 ========== */
.album-video-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.album-video-wrapper .album-video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.album-video-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: white;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 3px;
  pointer-events: none;
  z-index: 1;
}

.album-photo-card:hover .album-video-play-icon {
  background: rgba(0, 0, 0, 0.7);
}

.video-view-wrapper {
  position: relative;
  display: inline-block;
}

.video-view-wrapper video {
  display: block;
  border-radius: 8px;
}

.video-buffer-bar {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  min-width: 100px;
  text-align: center;
  transition: opacity 0.3s ease;
}

.video-buffer-bar .video-buffer-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, #ff6b9d, #c44569);
  border-radius: 1px;
  width: 0%;
  transition: width 0.3s ease;
}

.video-buffer-bar .video-buffer-text {
  position: relative;
  z-index: 1;
}

/* ========== 相册空状态 ========== */
.album-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--gray-400);
  text-align: center;
}

/* ========== 拖拽排序功能 ========== */
.album-photo-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
  box-shadow: none;
  cursor: grabbing;
}

.album-photo-card.drag-over {
  border: 2px dashed var(--pink-400);
  background: var(--pink-50);
  transform: scale(1.05);
}

.album-grid-inner.sorting-mode .album-photo-card {
  cursor: grab;
}

.album-grid-inner.sorting-mode .album-photo-card:active {
  cursor: grabbing;
}

.album-drag-placeholder {
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.1), rgba(236, 72, 153, 0.15));
  border: 2px dashed var(--pink-300);
  border-radius: var(--radius-md);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulseDrag 1s ease-in-out infinite;
}

@keyframes pulseDrag {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

.album-empty-emoji {
  font-size: 56px;
  margin-bottom: 16px;
  animation: heartBeat 1.5s ease-in-out infinite;
}

.album-empty-text {
  font-size: 16px;
  font-weight: 500;
}

.album-empty-subtext {
  font-size: 13px;
  margin-top: 8px;
  color: var(--gray-300);
}

/* ========== 相册删除预览 ========== */
.album-delete-preview {
  margin-top: 12px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-height: 120px;
  display: flex;
  justify-content: center;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
}

.album-delete-preview img {
  max-height: 120px;
  max-width: 100%;
  object-fit: contain;
}

/* ========== 移动端适配 ========== */
@media (max-width: 600px) {
  .album-modal-card {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }

  .album-toolbar {
    padding: 10px 14px;
  }

  .album-upload-btn {
    padding: 7px 14px;
    font-size: 13px;
  }

  .album-grid {
    padding: 12px;
  }

  .album-grid-inner {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .album-photo-card .album-photo-delete {
    opacity: 1;
    width: 24px;
    height: 24px;
    font-size: 12px;
    top: 4px;
    right: 4px;
  }

  .album-photo-info {
    font-size: 10px;
    padding: 6px 8px;
  }

  .album-count {
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .album-grid-inner {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .album-toolbar {
    padding: 8px 12px;
  }

  .album-upload-btn {
    padding: 6px 12px;
    font-size: 12px;
    gap: 4px;
  }
}

@media (hover: none) {
  .album-photo-card .album-photo-delete {
    opacity: 1;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .album-modal-card {
    max-height: 95vh;
  }

  .album-grid-inner {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
  }
}
