:root {
  --app-opacity: 0.55;
  --panel-bg: rgba(16, 22, 38, var(--app-opacity));
  --panel-border: rgba(255, 255, 255, 0.12);
  --panel-shadow: 0 16px 50px rgba(0, 0, 0, 0.4);
  
  --accent-amber: #f2ad57;
  --accent-glow: rgba(242, 173, 87, 0.28);
  --accent-blue: #5593fc;
  
  --text-main: #ffffff;
  --text-muted: #d1d9ec;
  --text-dim: #9aa7c2;

  --user-bubble: rgba(43, 62, 110, 0.7);
  --bot-bubble: rgba(20, 27, 48, 0.65);

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background-color: #0c101d;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* 动态背景图层（支持通透透光与自定义切换） */
.custom-bg {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(10, 14, 26, 0.35), rgba(6, 9, 17, 0.55)),
    url('backgrounds/anime_cat_1.png');
  background-size: cover;
  background-position: center center;
  background-attachment: fixed;
  transition: background-image 0.4s ease-in-out;
  z-index: 0;
}

.ambient-glow {
  position: fixed;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 400px;
  background: radial-gradient(circle, rgba(242, 173, 87, 0.15) 0%, rgba(85, 147, 252, 0.08) 50%, transparent 80%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}

/* 应用主视窗卡片（超轻盈通透毛玻璃） */
.app-container {
  width: 100%;
  max-width: 920px;
  height: 94vh;
  margin: 3vh auto;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  overflow: hidden;
  transition: background 0.25s ease;
}

/* 顶部导航 */
.header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(12, 16, 30, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo-icon {
  font-size: 26px;
  filter: drop-shadow(0 0 10px rgba(242, 173, 87, 0.4));
  flex-shrink: 0;
}

.brand-text {
  min-width: 0;
  overflow: hidden;
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #fff 0%, #fedba8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.brand-text .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

.pill-btn.voice-active {
  background: rgba(242, 173, 87, 0.2);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
  box-shadow: 0 0 12px var(--accent-glow);
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(30deg);
}

/* 角色选择栏 */
.roles-bar {
  padding: 12px 24px;
  background: rgba(10, 14, 26, 0.35);
  border-bottom: 1px solid var(--panel-border);
}

.roles-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.roles-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.role-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.role-card:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.role-card.active {
  background: rgba(242, 173, 87, 0.18);
  border-color: var(--accent-amber);
  box-shadow: 0 4px 18px rgba(242, 173, 87, 0.25);
}

.role-emoji {
  font-size: 22px;
}

.role-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.role-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.role-card.active .role-name {
  color: var(--accent-amber);
}

.role-desc {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* 聊天消息区 */
.chat-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scroll-behavior: smooth;
}

.chat-viewport::-webkit-scrollbar {
  width: 6px;
}
.chat-viewport::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message-card {
  display: flex;
  gap: 12px;
  max-width: 86%;
  animation: messageIn 0.35s ease-out;
}

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

.message-card.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-card.assistant {
  align-self: flex-start;
}

.card-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.message-card.user .card-avatar {
  background: linear-gradient(135deg, #5593fc 0%, #2b3e6e 100%);
}

.card-content {
  background: var(--bot-bubble);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-card.user .card-content {
  background: var(--user-bubble);
  border-color: rgba(85, 147, 252, 0.3);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
}

.speaker-name {
  font-weight: 600;
  color: var(--accent-amber);
}

.message-card.user .speaker-name {
  color: #9cbffc;
}

.text-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-main);
  word-break: break-word;
}

/* 欢迎卡片特有样式 */
.welcome-card .card-content {
  background: rgba(242, 173, 87, 0.1);
  border-color: rgba(242, 173, 87, 0.3);
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.quick-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-pill:hover {
  background: rgba(242, 173, 87, 0.25);
  border-color: var(--accent-amber);
  color: var(--text-main);
}

/* 消息操作栏（重听语音按钮） */
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.replay-audio-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s;
}

.replay-audio-btn:hover {
  color: var(--accent-amber);
  background: rgba(255, 255, 255, 0.1);
}

/* 实时音频波形浮标 */
.audio-status-banner {
  margin: 0 24px 10px;
  padding: 8px 16px;
  background: rgba(242, 173, 87, 0.18);
  border: 1px solid var(--accent-amber);
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: fadeIn 0.3s ease;
}

.audio-status-banner.hidden {
  display: none;
}

.wave-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 16px;
}

.wave-bars .bar {
  width: 3px;
  height: 100%;
  background: var(--accent-amber);
  border-radius: 2px;
  animation: waveAnim 0.8s ease-in-out infinite alternate;
}

.wave-bars .bar:nth-child(2) { animation-delay: 0.2s; }
.wave-bars .bar:nth-child(3) { animation-delay: 0.4s; }
.wave-bars .bar:nth-child(4) { animation-delay: 0.6s; }

@keyframes waveAnim {
  0% { height: 20%; }
  100% { height: 100%; }
}

.audio-text {
  font-size: 12px;
  color: var(--accent-amber);
  font-weight: 500;
}

.stop-audio-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: var(--text-main);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
}

/* 输入区域 */
.input-container {
  padding: 14px 24px 18px;
  background: rgba(10, 14, 26, 0.45);
  border-top: 1px solid var(--panel-border);
}

.input-box-wrapper {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.25s;
}

.input-box-wrapper:focus-within {
  border-color: var(--accent-amber);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 15px var(--accent-glow);
}

.mic-button {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.mic-button:hover {
  color: var(--accent-amber);
  transform: scale(1.1);
}

.mic-button.recording {
  color: #ff4d4f;
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.2); }
}

#chatInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  min-height: 24px;
}

#chatInput::placeholder {
  color: var(--text-dim);
}

.send-button {
  background: var(--accent-amber);
  border: none;
  color: #0c101d;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.send-button:hover {
  background: #f7b968;
  transform: scale(1.05);
}

.send-button:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
  transform: none;
}

.footer-tips {
  margin-top: 8px;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
}

/* 壁纸选择器网格 */
.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 14px 0;
}

.wp-item {
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  transition: all 0.2s;
}

.wp-item:hover {
  border-color: var(--accent-amber);
  transform: translateY(-2px);
}

.wp-item.active {
  border-color: var(--accent-amber);
  box-shadow: 0 0 12px var(--accent-glow);
}

.wp-item img {
  width: 100%;
  height: 85px;
  object-fit: cover;
  display: block;
}

.wp-item span {
  font-size: 12px;
  padding: 6px 8px;
  color: var(--text-main);
  text-align: center;
  background: rgba(0, 0, 0, 0.4);
}

/* 自定义上传与滑块 */
.custom-upload-section {
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.file-input {
  width: 100%;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.opacity-slider-box {
  margin-top: 14px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-main);
  margin-bottom: 6px;
}

#opacitySlider {
  width: 100%;
  accent-color: var(--accent-amber);
  cursor: pointer;
}

/* 弹窗抽屉 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  width: 90%;
  max-width: 520px;
  background: #141a2e;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 14px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-main);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent-amber);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
}

.btn.primary {
  background: var(--accent-amber);
  color: #0c101d;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

/* 用户鉴权与通行证弹窗 */
.auth-pill-btn.logged-in {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.45);
  color: var(--accent-amber);
}

.auth-modal-card {
  max-width: 440px;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab:hover {
  color: var(--text-main);
}

.auth-tab.active {
  background: rgba(255, 255, 255, 0.14);
  color: var(--accent-amber);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-error-tip {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
}

.auth-notice-banner {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(129, 140, 248, 0.3);
  color: #c7d2fe;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  text-align: center;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.auth-submit-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
}

.auth-foot-tip {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 14px;
  text-align: center;
}

/* 历史档案抽屉与列表 */
.history-modal-card {
  max-width: 580px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}

.history-modal-card .modal-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 6px;
}

.history-actions-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

.new-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0c101d;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
  cursor: pointer;
  transition: all 0.2s;
}

.new-chat-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.session-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(245, 158, 11, 0.3);
  transform: translateY(-1px);
}

.session-item.active {
  background: rgba(245, 158, 11, 0.12);
  border-color: var(--accent-amber);
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  flex: 1;
  margin-right: 10px;
}

.session-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-meta {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 12px;
}

.delete-session-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-session-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.empty-tip {
  text-align: center;
  padding: 36px 12px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

/* ---------------------------------------------------- */
/* 全面响应式移动端深度适配 (iPhone / Android / 窄屏) */
/* ---------------------------------------------------- */
@media (max-width: 768px) {
  .app-container {
    height: 100dvh;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  /* 顶部导航自适应分层 */
  .header {
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .brand {
    width: 100%;
    gap: 8px;
  }

  .logo-icon {
    font-size: 20px;
  }

  .brand-text h1 {
    font-size: 15px;
  }

  .brand-text .subtitle {
    font-size: 10.5px;
  }

  .header-controls {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .header-controls::-webkit-scrollbar {
    display: none;
  }

  .pill-btn {
    padding: 5px 10px;
    font-size: 11.5px;
    gap: 4px;
    border-radius: 20px;
    flex-shrink: 0;
    white-space: nowrap !important;
  }

  .icon-btn {
    padding: 5px 8px;
    font-size: 13px;
    flex-shrink: 0;
  }

  /* 角色横向平滑滑动条（代替拥挤的换行网格） */
  .roles-bar {
    padding: 8px 12px;
  }

  .roles-label {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .roles-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .roles-list::-webkit-scrollbar {
    display: none;
  }

  .role-card {
    flex: 0 0 136px;
    scroll-snap-align: start;
    padding: 8px 10px;
    border-radius: 12px;
    min-width: 0;
  }

  .role-emoji {
    font-size: 20px;
  }

  .role-name {
    font-size: 12px;
  }

  .role-desc {
    font-size: 10px;
  }

  /* 聊天主视窗 */
  .chat-viewport {
    padding: 10px 10px;
  }

  .message-card {
    max-width: 95%;
    padding: 10px 12px;
    border-radius: 14px;
    gap: 8px;
    margin-bottom: 12px;
  }

  .card-avatar {
    width: 32px;
    height: 32px;
    font-size: 16px;
    border-radius: 8px;
  }

  .card-header .speaker-name {
    font-size: 12px;
  }

  .card-header .timestamp {
    font-size: 10px;
  }

  .text-body {
    font-size: 13.5px;
    line-height: 1.6;
  }

  /* 欢迎卡片与快捷气泡 */
  .welcome-card h2 {
    font-size: 15px;
  }

  .welcome-card p {
    font-size: 12px;
  }

  .quick-prompts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
  }

  .quick-pill {
    width: 100%;
    text-align: left;
    font-size: 12px;
    padding: 7px 10px;
    border-radius: 10px;
    box-sizing: border-box;
  }

  /* 实时语音播放浮标 */
  .audio-status-banner {
    bottom: 74px;
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 20px;
  }

  /* 输入区域与安全区适配 */
  .input-container {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .input-box-wrapper {
    padding: 4px 8px;
    gap: 6px;
    border-radius: 20px;
  }

  .input-box-wrapper textarea {
    font-size: 15px; /* 大于14px防止手机Safari自动缩放 */
    padding: 6px 4px;
  }

  .send-button {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }

  .mic-button {
    font-size: 16px;
    padding: 4px;
  }

  .footer-tips {
    font-size: 9.5px;
    padding-top: 4px;
    text-align: center;
  }

  /* 弹窗抽屉移动端全屏友好尺寸 */
  .modal-card {
    width: 92%;
    max-width: 92%;
    padding: 18px 16px;
    border-radius: 16px;
    max-height: 85vh;
  }

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

  .history-modal-card {
    max-height: 85vh;
  }

  .auth-modal-card {
    max-height: 85vh;
  }
}
