* { margin: 0; padding: 0; box-sizing: border-box; }

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes waveAnim {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}
@keyframes redPacketOpen {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
@keyframes rpOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes rpEnvelopeIn {
  from { opacity: 0; transform: scale(0.8) translateY(30px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes rpCoinSpin {
  0% { transform: rotateY(0deg) scale(1); }
  60% { transform: rotateY(540deg) scale(1.15); }
  100% { transform: rotateY(720deg) scale(1); }
}
@keyframes rpReveal {
  0% { opacity: 0; transform: translateY(24px) scale(0.7); }
  60% { opacity: 1; transform: translateY(-4px) scale(1.08); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes rpFlapOpen {
  0% { transform: rotateX(0deg); }
  100% { transform: rotateX(-180deg); }
}
@keyframes rpGoldRain {
  0% { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0; transform: translateY(120px) rotate(720deg); }
}

body {
  margin: 0;
  background: #faf7f5;
  font-family: 'Noto Sans SC', 'PingFang SC', -apple-system, sans-serif;
  transition: background 0.4s ease;
}
body.dark-body { background: #0d0d0d; }

.app-shell {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
}

.app-container {
  width: 100%;
  max-width: 500px;
  height: 100vh;
  height: 100dvh; /* iOS工具栏收起/弹出时不跳动，灵动岛机型全屏正确 */
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: background 0.4s ease, color 0.4s ease;
  background: #faf7f5;
  color: #2c2420;
}
.app-container.dark {
  background: #0d0d0d;
  color: #e8e0dc;
}

.header {
  height: calc(64px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 12px; padding-right: 12px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  z-index: 10;
  flex-shrink: 0;
  transition: background 0.4s ease, border-color 0.4s ease;
  background: #ffffff;
}
.dark .header {
  background: #1a1714;
  border-bottom-color: rgba(255,255,255,0.06);
}

.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border-radius: 50%;
  transition: background 0.2s;
  border: none; background: transparent; padding: 0;
}
.icon-btn:hover { background: rgba(0,0,0,0.04); }
.dark .icon-btn:hover { background: rgba(255,255,255,0.06); }

.header-left { display: flex; align-items: center; gap: 4px; width: 72px; }
.header-center { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; }
.header-right { display: flex; align-items: center; gap: 2px; width: 72px; justify-content: flex-end; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #ff6b4a, #ff8a6a);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.name-row { display: flex; align-items: center; gap: 8px; }
.name-text { font-weight: 600; font-size: 16px; letter-spacing: 0.3px; }
.typing-row { display: none; align-items: center; gap: 3px; font-size: 11px; color: var(--bubble-color); }
.typing-dots { display: inline-flex; gap: 2px; }
.typing-dot {
  width: 3px; height: 3px; border-radius: 50%; background: var(--bubble-color);
  animation: typingDot 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

.back-svg { stroke: #2c2420; }
.dark .back-svg { stroke: #e8e0dc; }
.light-svg { stroke: #999; }
.dark .light-svg { stroke: #777; }

.search-bar {
  padding: 8px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  animation: fadeIn 0.2s ease;
  background: #ffffff;
  transition: background 0.4s ease, border-color 0.4s ease;
}
.dark .search-bar {
  background: #1a1714;
  border-bottom-color: rgba(255,255,255,0.06);
}
.search-bar input {
  width: 100%; padding: 9px 16px; border-radius: 20px;
  border: 1px solid rgba(0,0,0,0.06); background: #faf7f5;
  color: #2c2420; font-size: 14px; outline: none; font-family: inherit;
}
.dark .search-bar input {
  border-color: rgba(255,255,255,0.06); background: #0d0d0d; color: #e8e0dc;
}

.chat-area {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}

.date-divider { display: flex; justify-content: center; }
.date-divider span {
  background: rgba(0,0,0,0.08); padding: 3px 14px;
  border-radius: 12px; font-size: 12px; color: #999;
}
.dark .date-divider span { color: #777; }

.msg-row { display: flex; animation: fadeIn 0.3s ease forwards; }
.msg-row.theirs { justify-content: flex-start; }
.msg-row.mine { justify-content: flex-end; }
.msg-content { display: flex; flex-direction: column; max-width: var(--bubble-max-width, 78%); position: relative; }
.msg-row.theirs .msg-content { align-items: flex-start; gap: 4px; }
.msg-row.mine .msg-content { align-items: flex-end; }

.msg-actions {
  display: none; gap: 2px; z-index: 5; margin-top: 2px;
}
.msg-row.theirs .msg-actions { justify-content: flex-start; }
.msg-row.mine .msg-actions { justify-content: flex-end; }
.msg-content:active .msg-actions, .msg-content:hover .msg-actions { display: flex; }
.msg-action-btn {
  background: none; border: none; cursor: pointer;
  padding: 4px; border-radius: 6px; display: flex;
  align-items: center; justify-content: center;
  opacity: 0.4; transition: opacity 0.2s, background 0.2s;
}
.msg-action-btn:hover { opacity: 0.8; background: rgba(0,0,0,0.05); }
.dark .msg-action-btn:hover { background: rgba(255,255,255,0.08); }
.msg-action-btn svg { width: 16px; height: 16px; stroke: #666; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dark .msg-action-btn svg { stroke: #888; }

:root { --bubble-color: #ff6b4a; --bubble-shadow: rgba(255,107,74,0.2); }
.bubble-theirs {
  padding: var(--bubble-padding, 11px 15px); border-radius: 4px 18px 18px 18px;
  background: var(--bubble-color); color: var(--bubble-text, #ffffff);
  font-size: 15px; line-height: var(--bubble-line-height, 1.6);
  box-shadow: 0 2px 8px var(--bubble-shadow);
  word-break: break-word;
}
.bubble-theirs .time-stamp {
  float: right; font-size: 11px; opacity: 0.75;
  margin-top: 4px; padding-left: 12px;
  display: flex; align-items: center; gap: 3px;
}

.bubble-mine {
  padding: var(--bubble-padding, 11px 15px); border-radius: 18px 4px 18px 18px;
  color: var(--my-bubble-text, inherit);
  background: var(--my-bubble-color, #ffffff); font-size: 15px; line-height: var(--bubble-line-height, 1.6);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: background 0.4s ease;
  word-break: break-word;
}
.dark .bubble-mine { background: var(--my-bubble-color-dark, #2a2420); }
.bubble-mine .time-stamp {
  float: right; font-size: 11px; margin-top: 4px; padding-left: 12px;
  display: flex; align-items: center; gap: 3px; color: #999;
}
.dark .bubble-mine .time-stamp { color: #777; }

.thinking-toggle {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px; cursor: pointer;
  font-size: 12px; padding: 4px 10px; border-radius: 10px; transition: background 0.2s;
  background: rgba(0,0,0,0.04); color: #999; border: none; font-family: inherit;
}
.dark .thinking-toggle { background: rgba(255,255,255,0.05); color: #777; }
.thinking-toggle:hover { background: rgba(0,0,0,0.06); }
.dark .thinking-toggle:hover { background: rgba(255,255,255,0.08); }
.thinking-toggle .arrow-svg { transition: transform 0.2s; stroke: #999; }
.dark .thinking-toggle .arrow-svg { stroke: #777; }
.thinking-toggle .clock-svg { stroke: #999; }
.dark .thinking-toggle .clock-svg { stroke: #777; }
.thinking-body {
  padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5;
  margin-bottom: 6px; font-style: italic; animation: fadeIn 0.2s ease;
  background: rgba(0,0,0,0.04); color: #999;
}
.dark .thinking-body { background: rgba(255,255,255,0.05); color: #777; }

.image-bubble {
  border-radius: 4px 18px 18px 18px; overflow: hidden; cursor: pointer;
  position: relative; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.image-placeholder {
  width: 240px; height: 160px;
  background: linear-gradient(135deg, #ffd4c4, #ffb8a0, #ffa388);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.image-placeholder-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; opacity: 0.6; }
.image-placeholder-inner span { color: white; font-size: 11px; letter-spacing: 0.5px; }
.image-time { position: absolute; bottom: 8px; right: 10px; font-size: 11px; color: white; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.msg-content.img-msg { max-width: 65%; }

.lightbox {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; animation: fadeIn 0.25s ease;
}
.lightbox-image {
  width: 90%; max-width: 440px; display: flex; align-items: center; justify-content: center;
}
.lightbox-image img {
  max-width: 100%; max-height: 80vh; border-radius: 8px; object-fit: contain;
}
.lightbox-close {
  position: absolute; top: 20px; right: 20px; width: 36px; height: 36px;
  background: rgba(255,255,255,0.15); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.voice-bubble {
  padding: 11px 15px; border-radius: 18px 4px 18px 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05); cursor: pointer; min-width: 180px;
  transition: background 0.4s ease; background: #ffffff;
}
.dark .voice-bubble { background: #2a2420; }
.voice-inner { display: flex; align-items: center; gap: 10px; }
.voice-play-btn {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background 0.2s; background: rgba(255,107,74,0.1);
}
.dark .voice-play-btn { background: rgba(255,107,74,0.15); }
.waveform-container { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.waveform-bars { height: 24px; display: flex; align-items: center; gap: 1.2px; }
.wave-bar { width: 2px; border-radius: 1px; transition: background 0.1s ease; background: #ccc; }
.dark .wave-bar { background: #555; }
.wave-bar.played { background: #ff6b4a; }
.voice-duration { font-size: 12px; flex-shrink: 0; color: #999; }
.dark .voice-duration { color: #777; }

.red-packet {
  background: linear-gradient(135deg, #f7c948, #f2994a, #e8573a);
  border-radius: 4px 18px 18px 18px; padding: 0; overflow: hidden;
  cursor: pointer; box-shadow: 0 3px 12px rgba(232,87,58,0.3);
  min-width: 220px; transition: transform 0.2s;
}
.red-packet:hover { transform: scale(1.02); }
.red-packet-top { padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.red-packet-icon {
  width: 44px; height: 44px; background: rgba(255,255,255,0.2);
  border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.red-packet-text { display: flex; flex-direction: column; gap: 3px; }
.red-packet-title { color: white; font-weight: 600; font-size: 16px; }
.red-packet-status { color: rgba(255,255,255,0.8); font-size: 12px; }
.red-packet-bottom {
  background: rgba(0,0,0,0.08); padding: 7px 18px;
  display: flex; justify-content: space-between; align-items: center;
}
.red-packet-bottom span { color: rgba(255,255,255,0.7); font-size: 11px; }
.red-packet-bottom span:last-child { color: rgba(255,255,255,0.6); }
.red-packet.opened { opacity: 0.7; cursor: default; }
.red-packet.opened .red-packet-status { color: rgba(255,255,255,0.6); }

.rp-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.65); z-index: 200;
  display: flex; align-items: center; justify-content: center;
  animation: rpOverlayIn 0.3s ease;
}
.rp-envelope {
  width: 300px; border-radius: 16px; overflow: hidden;
  background: linear-gradient(165deg, #e8573a 0%, #d4432a 40%, #c23520 100%);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: rpEnvelopeIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
  position: relative; text-align: center;
}
.rp-envelope-header {
  padding: 28px 24px 16px; position: relative;
}
.rp-envelope-avatar {
  width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 10px;
  background: linear-gradient(135deg, #ff6b4a, #ff8a6a);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 12px rgba(0,0,0,0.2);
}
.rp-envelope-sender { color: #ffd4c4; font-size: 14px; margin-bottom: 6px; }
.rp-envelope-note { color: #fff; font-size: 17px; font-weight: 500; line-height: 1.5; padding: 0 12px; }
.rp-envelope-divider {
  width: 60%; height: 1px; margin: 18px auto;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
}
.rp-coin-btn {
  width: 64px; height: 64px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #ffd700, #ffb800);
  box-shadow: 0 4px 20px rgba(255,200,0,0.4);
  cursor: pointer; margin: 0 auto 24px; display: flex;
  align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.rp-coin-btn:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(255,200,0,0.5); }
.rp-coin-btn:active { transform: scale(0.95); }
.rp-coin-btn.spinning { animation: rpCoinSpin 0.75s cubic-bezier(0.4, 0, 0.2, 1); pointer-events: none; }

.rp-result {
  padding: 32px 24px; animation: rpReveal 0.5s ease;
}
.rp-result-amount {
  font-size: 42px; font-weight: 700; color: #ffd700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2); margin-bottom: 4px;
}
.rp-result-unit { font-size: 16px; color: #ffd4c4; margin-bottom: 16px; }
.rp-result-note { font-size: 14px; color: rgba(255,255,255,0.8); line-height: 1.6; }
.rp-close-btn {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px;
  border-radius: 50%; border: none; background: rgba(0,0,0,0.2);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.rp-close-btn:hover { background: rgba(0,0,0,0.35); }
.rp-gold-particle {
  position: absolute; width: 8px; height: 8px; border-radius: 2px;
  background: #ffd700; animation: rpGoldRain 1s ease-out forwards;
  pointer-events: none;
}

.input-area {
  position: relative;
  border-top: 1px solid rgba(0,0,0,0.06);
  z-index: 10; flex-shrink: 0;
  transition: background 0.4s ease, border-color 0.4s ease;
  background: #ffffff;
  padding-bottom: env(safe-area-inset-bottom);
}
.dark .input-area {
  background: #1a1714;
  border-top-color: rgba(255,255,255,0.06);
}
.input-row {
  padding: 10px 12px; display: flex; align-items: center; gap: 6px;
}
.plus-btn { transition: background 0.2s, transform 0.3s; flex-shrink: 0; }
.plus-btn svg { stroke: #999; }
.dark .plus-btn svg { stroke: #666; }
.emoji-btn { flex-shrink: 0; }
.emoji-btn svg { stroke: #999; }
.dark .emoji-btn svg { stroke: #666; }

.input-field {
  flex: 1; min-width: 0; padding: 10px 14px; border-radius: 22px;
  border: 1px solid rgba(0,0,0,0.06); font-size: 15px;
  outline: none; font-family: inherit;
  transition: background 0.4s ease, border-color 0.2s;
  background: #f5f0ed; color: #2c2420;
}
.dark .input-field {
  border-color: rgba(255,255,255,0.06);
  background: #121010; color: #e8e0dc;
}
.input-field:focus { border-color: #ff6b4a; }

.send-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--bubble-color, #ff6b4a), color-mix(in srgb, var(--bubble-color, #ff6b4a) 70%, white));
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 2px 8px var(--bubble-shadow, rgba(255,107,74,0.3));
  transition: transform 0.15s, box-shadow 0.15s, background 0.3s;
  flex-shrink: 0; border: none; padding: 0;
}
.send-btn:hover { transform: scale(1.08); box-shadow: 0 3px 12px rgba(255,107,74,0.4); }
.send-btn:active { transform: scale(0.95); }
.send-btn.disabled { opacity: 0.5; pointer-events: none; }

.overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.35); z-index: 15;
  animation: fadeIn 0.2s ease;
}

.panel {
  position: absolute; bottom: 0; left: 0; right: 0;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  z-index: 20; padding: 20px;
  animation: fadeIn 0.25s ease;
  transition: background 0.4s ease; background: #ffffff;
}
.dark .panel { background: #1a1714; }
.panel-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 18px;
}
.panel-header span { font-weight: 600; font-size: 15px; }
.panel-close {
  cursor: pointer; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: background 0.2s;
  color: #999; background: none; border: none; padding: 0;
}
.dark .panel-close { color: #777; }
.panel-close:hover { background: rgba(0,0,0,0.04); }
.dark .panel-close:hover { background: rgba(255,255,255,0.06); }

.plus-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; text-align: center;
}
.plus-grid-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer;
}
.plus-grid-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s; background: #f8f4f1;
}
.dark .plus-grid-icon { background: rgba(255,255,255,0.06); }
.plus-grid-icon:hover { transform: scale(1.08); }
.plus-grid-item span { font-size: 12px; color: #999; }
.dark .plus-grid-item span { color: #777; }

.emoji-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 8px; text-align: center;
  max-height: 180px; overflow-y: auto;
}
.emoji-cell {
  font-size: 26px; cursor: pointer; padding: 6px;
  border-radius: 8px; transition: background 0.15s;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none;
}
.emoji-cell:hover { background: rgba(0,0,0,0.04); }
.dark .emoji-cell:hover { background: rgba(255,255,255,0.06); }

.meme-tabs {
  display: flex; gap: 0; border-bottom: 1px solid rgba(0,0,0,0.08);
  margin-bottom: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.meme-tabs::-webkit-scrollbar { display: none; }
.dark .meme-tabs { border-bottom-color: rgba(255,255,255,0.08); }
.meme-tab {
  padding: 6px 12px; font-size: 13px; border: none; background: none;
  color: #999; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s; font-family: inherit;
}
.meme-tab.active { color: var(--bubble-color, #ff6b4a); border-bottom-color: var(--bubble-color, #ff6b4a); }
.dark .meme-tab { color: #666; }
.dark .meme-tab.active { color: var(--bubble-color, #ff6b4a); }
.meme-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  max-height: 240px; overflow-y: auto; padding: 2px;
}
.meme-cell {
  aspect-ratio: 1; border-radius: 8px; overflow: hidden; cursor: pointer;
  border: none; background: #f0ece8; padding: 0; transition: transform 0.15s;
}
.dark .meme-cell { background: rgba(255,255,255,0.06); }
.meme-cell:hover { transform: scale(1.05); }
.meme-cell img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.meme-bubble {
  max-width: 180px; border-radius: 12px; overflow: hidden; cursor: pointer;
}
.meme-bubble img {
  width: 100%; display: block; border-radius: 12px;
}
.image-bubble {
  max-width: 220px; border-radius: 12px; overflow: hidden; cursor: pointer;
}
.image-bubble img {
  width: 100%; display: block; border-radius: 12px;
}

.hidden { display: none !important; }

.settings-panel {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 25; overflow-y: auto;
  animation: fadeIn 0.25s ease;
  transition: background 0.4s ease;
  background: #faf7f5;
}
.dark .settings-panel { background: #0d0d0d; }
.settings-header {
  height: calc(54px + env(safe-area-inset-top)); display: flex; align-items: center;
  padding: 0 12px; padding-top: env(safe-area-inset-top); gap: 12px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  background: #ffffff;
}
.settings-tab {
  flex: 1; padding: 10px 0; border: none; background: none; font-size: 13px;
  color: #999; cursor: pointer; font-family: inherit; transition: 0.2s;
  border-bottom: 2px solid transparent;
}
.settings-tab.active { color: #ff6b4a; border-bottom-color: #ff6b4a; }
.dark .settings-tab { color: #666; }
.dark .settings-tab.active { color: #ff6b4a; }
.dark .settings-header {
  background: #1a1714;
  border-bottom-color: rgba(255,255,255,0.06);
}
.settings-header span { font-weight: 600; font-size: 16px; }
.settings-body { padding: 16px; }
.setting-group {
  margin-bottom: 20px;
}
.setting-label {
  font-size: 13px; font-weight: 500; margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.setting-label .val { color: #ff6b4a; font-weight: 600; }
.setting-range {
  width: 100%; height: 4px; border-radius: 2px;
  -webkit-appearance: none; appearance: none;
  outline: none; cursor: pointer;
  background: rgba(0,0,0,0.08);
}
.dark .setting-range { background: rgba(255,255,255,0.1); }
.setting-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #ff6b4a; cursor: pointer;
  box-shadow: 0 1px 4px rgba(255,107,74,0.4);
}
.setting-select {
  width: 100%; padding: 9px 14px; border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08); font-size: 14px;
  font-family: inherit; outline: none; cursor: pointer;
  background: #ffffff; color: #2c2420;
}
.dark .setting-select {
  background: #1a1714; color: #e8e0dc;
  border-color: rgba(255,255,255,0.08);
}
.setting-hint {
  font-size: 11px; color: #999; margin-top: 4px; line-height: 1.4;
}
.dark .setting-hint { color: #666; }
.setting-divider {
  height: 1px; background: rgba(0,0,0,0.06); margin: 20px 0;
}
.dark .setting-divider { background: rgba(255,255,255,0.06); }
.setting-btn {
  width: 100%; padding: 11px; border-radius: 14px;
  border: none; font-size: 14px; font-family: inherit;
  cursor: pointer; transition: background 0.2s;
}
.setting-btn.primary {
  background: linear-gradient(135deg, #ff6b4a, #ff8a6a);
  color: white;
}
.setting-btn.danger {
  background: none; border: 1px solid #e55050;
  color: #e55050; margin-top: 8px;
}
.color-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.color-swatch {
  width: 32px; height: 32px; border-radius: 10px; cursor: pointer;
  border: 2px solid transparent; transition: border-color 0.2s, transform 0.15s;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: #2c2420; }
.dark .color-swatch.active { border-color: #fff; }
.style-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.style-chip {
  padding: 6px 14px; border-radius: 16px; font-size: 12px; cursor: pointer;
  border: 1px solid rgba(0,0,0,0.1); background: #f5f0ed; color: #2c2420;
  font-family: inherit; transition: all 0.2s;
}
.dark .style-chip { background: #1a1714; color: #e8e0dc; border-color: rgba(255,255,255,0.1); }
.style-chip.active { background: #ff6b4a; color: white; border-color: #ff6b4a; }
.wallpaper-input {
  width: 100%; padding: 9px 14px; border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08); font-size: 13px;
  font-family: inherit; outline: none; background: #ffffff; color: #2c2420;
}
.dark .wallpaper-input { background: #1a1714; color: #e8e0dc; border-color: rgba(255,255,255,0.08); }
.stream-cursor { animation: cursorBlink 0.8s infinite; opacity: 0.6; font-weight: 300; }
@keyframes cursorBlink { 0%, 100% { opacity: 0.6; } 50% { opacity: 0; } }
#setStream:checked + #streamSlider { background: #ff6b4a; }
#streamSlider::before {
  position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: .3s;
}
#setStream:checked + #streamSlider::before { transform: translateX(18px); }

/* ── Cache badge (缓存命中显示) ── */
.cache-badge {
  font-size: 7px; margin-right: 4px; cursor: pointer;
  opacity: 0.5; user-select: none;
}
.cache-badge:hover { opacity: 0.9; }
.usage-detail {
  font-size: 10px; color: #999; padding: 4px 8px; margin-top: 2px;
  background: rgba(0,0,0,0.04); border-radius: 8px; align-self: flex-start;
}
.dark .usage-detail { background: rgba(255,255,255,0.06); color: #888; }

/* ── Session drawer (多对话窗口) ── */
.session-drawer {
  position: absolute;
  top: calc(64px + env(safe-area-inset-top));
  left: 0; bottom: 0;
  width: 240px; max-width: 75%;
  background: #ffffff;
  border-right: 1px solid rgba(0,0,0,0.06);
  z-index: 30;
  display: flex; flex-direction: column;
  animation: fadeIn 0.2s ease;
  box-shadow: 4px 0 24px rgba(0,0,0,0.08);
}
.dark .session-drawer {
  background: #1a1714;
  border-right-color: rgba(255,255,255,0.06);
  box-shadow: 4px 0 24px rgba(0,0,0,0.4);
}
.session-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; font-weight: 600; font-size: 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.dark .session-drawer-header { border-bottom-color: rgba(255,255,255,0.06); }
.session-new-btn {
  border: none; background: var(--bubble-color, #ff6b4a); color: white;
  font-size: 12px; padding: 5px 12px; border-radius: 14px;
  cursor: pointer; font-family: inherit;
}
.session-list { flex: 1; overflow-y: auto; padding: 8px; }
.session-item {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  font-size: 14px; margin-bottom: 2px;
}
.session-item:hover { background: rgba(0,0,0,0.04); }
.dark .session-item:hover { background: rgba(255,255,255,0.05); }
.session-item.active {
  background: rgba(255,107,74,0.1);
  color: var(--bubble-color, #ff6b4a);
  font-weight: 600;
}
.session-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-action {
  border: none; background: none; font-size: 11px; color: #999;
  cursor: pointer; font-family: inherit; padding: 3px 6px; border-radius: 8px;
  flex-shrink: 0;
}
.session-action:hover { background: rgba(0,0,0,0.06); }
.session-action.danger:hover { color: #e55050; }
.session-empty { text-align: center; padding: 20px; color: #999; font-size: 13px; }

/* ── Search results (全会话搜索结果) ── */
.search-results {
  max-height: 45vh; overflow-y: auto; margin-top: 8px;
  border-radius: 12px; border: 1px solid rgba(0,0,0,0.06);
  background: #faf7f5;
}
.dark .search-results { background: #0d0d0d; border-color: rgba(255,255,255,0.06); }
.search-result-item {
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: rgba(0,0,0,0.03); }
.dark .search-result-item { border-bottom-color: rgba(255,255,255,0.04); }
.dark .search-result-item:hover { background: rgba(255,255,255,0.04); }
.search-result-meta { font-size: 11px; color: #999; margin-bottom: 3px; }
.search-result-text { font-size: 13px; line-height: 1.5; }

/* ── Voice bubble (语音条，老版样式复活 + 接上TTS) ── */
.voice-bubble {
  padding: 11px 15px; border-radius: 0 18px 18px 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05); cursor: pointer; min-width: 180px; max-width: 240px;
  transition: background 0.4s ease; background: #ffffff; margin-top: 4px;
}
.dark .voice-bubble { background: #2a2420; }
.voice-inner { display: flex; align-items: center; gap: 10px; }
.voice-play-btn {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background 0.2s; background: rgba(255,107,74,0.1);
}
.dark .voice-play-btn { background: rgba(255,107,74,0.15); }
.waveform-container { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.waveform-bars { height: 24px; display: flex; align-items: center; gap: 1.2px; }
.wave-bar { width: 2px; border-radius: 1px; transition: background 0.1s ease; background: #ccc; }
.dark .wave-bar { background: #555; }
.wave-bar.played { background: #ff6b4a; }
.voice-duration { font-size: 12px; flex-shrink: 0; color: #999; }
.dark .voice-duration { color: #777; }
.voice-bubble.loading .voice-play-btn { animation: voicePulse 1s infinite; }
@keyframes voicePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── 拍一拍 ── */
@keyframes patShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px) rotate(-0.5deg); }
  40% { transform: translateX(4px) rotate(0.5deg); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
.msg-row.pat-shake { animation: patShake 0.5s ease; }
.pat-line {
  text-align: center; font-size: 11px; color: #999;
  padding: 2px 0; transition: opacity 0.6s ease;
}
.pat-line.fade { opacity: 0; }

/* ── 关键词彩蛋 emoji雨 ── */
.emoji-rain-piece {
  position: absolute; top: -36px; z-index: 99;
  pointer-events: none; user-select: none;
  animation: emojiFall linear forwards;
}
@keyframes emojiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateY(105vh) rotate(300deg); opacity: 0; }
}

/* ── 操作按钮常驻显示（设置里可开关） ── */
.show-actions .msg-actions { display: flex; }

/* ── 收藏夹面板 ── */
.favs-list { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.fav-item {
  background: rgba(0,0,0,0.03); border-radius: 12px; padding: 10px 12px;
  font-size: 13px; line-height: 1.5; position: relative;
}
.dark .fav-item { background: rgba(255,255,255,0.05); }
.fav-item-meta { font-size: 11px; color: #999; margin-bottom: 4px; display: flex; justify-content: space-between; }
.fav-item-del { color: #e55050; cursor: pointer; font-size: 11px; }
.fav-empty { text-align: center; color: #999; font-size: 13px; padding: 24px 0; }

/* ── 引用（微信风格：输入框上方预览条 + 气泡内引用块） ── */
.quote-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px 0;
}
.quote-bar.hidden { display: none; }
.quote-bar-text {
  flex: 1; font-size: 12px; color: #888;
  background: rgba(0,0,0,0.05);
  border-left: 3px solid var(--bubble-color, #ff6b4a);
  padding: 6px 10px; border-radius: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dark .quote-bar-text { background: rgba(255,255,255,0.06); color: #999; }
.quote-bar-close {
  border: none; background: none; color: #999; cursor: pointer;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; flex-shrink: 0;
}
.quote-bar-close:hover { background: rgba(0,0,0,0.06); }
.quote-block {
  font-size: 12px; opacity: 0.8; line-height: 1.5;
  border-left: 3px solid rgba(0,0,0,0.25);
  background: rgba(0,0,0,0.07);
  padding: 5px 9px; margin-bottom: 7px; border-radius: 6px;
}
.dark .quote-block { border-left-color: rgba(255,255,255,0.25); background: rgba(255,255,255,0.08); }

/* ── 歌卡（点歌） ── */
.song-card {
  display: flex; align-items: center; gap: 10px;
  background: #ffffff; border-radius: 14px; padding: 10px 12px;
  min-width: 210px; max-width: 260px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.15s ease;
}
.song-card:active { transform: scale(0.98); }
.dark .song-card { background: #2a2420; }
.song-card img, .song-card-cover-fallback {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  object-fit: cover; display: flex; align-items: center; justify-content: center;
  background: rgba(255,107,74,0.1); font-size: 20px;
}
.song-card-info { flex: 1; overflow: hidden; }
.song-card-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-card-artist { font-size: 11px; color: #999; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.song-card-play {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,107,74,0.1);
}

/* ── 听歌面板 ── */
.music-search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.music-search-row input {
  flex: 1; padding: 9px 14px; border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08); font-size: 14px;
  font-family: inherit; outline: none; background: #faf7f5; color: #2c2420;
}
.dark .music-search-row input { background: #0d0d0d; color: #e8e0dc; border-color: rgba(255,255,255,0.08); }
.music-search-btn {
  border: none; background: linear-gradient(135deg, #ff6b4a, #ff8a6a); color: white;
  padding: 0 18px; border-radius: 14px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.music-results { max-height: 45vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.song-result {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 12px; background: rgba(0,0,0,0.03);
}
.dark .song-result { background: rgba(255,255,255,0.05); }
.song-result-pic { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: rgba(255,107,74,0.08); }
.song-result-info { flex: 1; overflow: hidden; }
.song-result-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-result-artist { font-size: 11px; color: #999; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.song-vip { font-size: 9px; color: #e8a33d; border: 1px solid #e8a33d; border-radius: 4px; padding: 0 3px; vertical-align: 1px; }
.song-result-actions { display: flex; gap: 5px; flex-shrink: 0; }
.song-mini-btn {
  border: none; cursor: pointer; font-family: inherit;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; background: rgba(255,107,74,0.1); color: #ff6b4a;
}
.song-mini-btn:active { transform: scale(0.92); }

/* ── 听歌悬浮按钮 ── */
.music-fab {
  position: absolute;
  right: 14px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  width: var(--fab-size, 46px); height: var(--fab-size, 46px);
  border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--bubble-color, #ff6b4a), color-mix(in srgb, var(--bubble-color, #ff6b4a) 70%, white));
  box-shadow: 0 4px 14px var(--bubble-shadow, rgba(255,107,74,0.4));
  display: flex; align-items: center; justify-content: center;
  opacity: var(--fab-opacity, 0.85);
  z-index: 15;
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.music-fab:active { transform: scale(0.92); }
.music-fab.hidden { display: none; }

/* ── 语音条下的中英文稿 ── */
.voice-transcript {
  max-width: 240px; margin-top: 4px; padding: 7px 10px;
  border-radius: 10px; background: rgba(0,0,0,0.04);
  font-size: 12px; line-height: 1.5;
}
.dark .voice-transcript { background: rgba(255,255,255,0.05); }
.voice-transcript-en { color: #666; }
.dark .voice-transcript-en { color: #aaa; }
.voice-transcript-zh { color: #999; margin-top: 3px; font-size: 11px; }

/* ── 红包账单 ── */
.bills-summary { display: flex; gap: 10px; margin-bottom: 12px; }
.bill-stat {
  flex: 1; background: linear-gradient(135deg, rgba(232,87,58,0.08), rgba(247,201,72,0.08));
  border-radius: 12px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.bill-stat span { font-size: 11px; color: #999; }
.bill-stat b { font-size: 17px; color: #e8573a; }


/* ── 发送键/音乐悬浮钮 与气泡样式联动：毛玻璃模式下按钮也变毛玻璃 ── */
.app-container[data-bubble-style="glass"] .send-btn,
.app-container[data-bubble-style="glass"] .music-fab {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.app-container.dark[data-bubble-style="glass"] .send-btn,
.app-container.dark[data-bubble-style="glass"] .music-fab {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}
.app-container[data-bubble-style="glass"] .send-btn svg { fill: var(--bubble-color, #ff6b4a); }
.app-container[data-bubble-style="glass"] .music-fab svg { stroke: var(--bubble-color, #ff6b4a); }
