/* ============================================================
   Antigravity 移动端 H5 智能派发协同平台样式规范 (mobile.css)
   深色轻奢科技质感，移动端优先，支持桌面自适应
   ============================================================ */

:root {
  --bg-main: #07090f;
  --bg-sidebar: #0b101c;
  --bg-card: #121929;
  --bg-input: #101625;
  --accent-primary: #d4af37;           /* 鎏金/天辅道金 */
  --accent-hover: #bfa02e;
  --accent-glow: rgba(212, 175, 55, 0.35);
  --accent-cinnabar: #dc2626;         /* 朱砂篆刻红 */
  --accent-cinnabar-dark: #991b1b;
  --text-main: #fbf7ee;               /* 宣纸象牙白 */
  --text-muted: #c8bead;              /* 古绢淡茶 */
  --text-dim: #7f7869;                /* 徽墨浅灰 */
  --border-color: rgba(212, 175, 55, 0.18); /* 金丝回纹细线 */
  --border-gold: rgba(212, 175, 55, 0.4);
  --bubble-user: linear-gradient(135deg, #182338, #121c2e);
  --bubble-assistant: #0e1524;
  --danger-color: #ef4444;
  --success-color: #10b981;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

/* ================= 布局框架 ================= */
#app {
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* 侧边历史会话抽屉 */
.sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 290px;
  max-width: 82vw;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  display: none;
}

.sidebar-overlay.active {
  display: block;
}

.sidebar-header {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fbf7ee;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 11px;
  background: rgba(212, 175, 55, 0.15);
  color: #e5c158;
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.btn-new-chat {
  margin: 14px 16px;
  padding: 11px 16px;
  background: linear-gradient(135deg, #d4af37, #9b7a1e);
  color: #1a1200 !important;
  border: 1px solid rgba(255, 235, 160, 0.4);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.28);
  transition: all 0.2s;
}

.btn-new-chat:hover, .btn-new-chat:active {
  background: linear-gradient(135deg, #e5c158, #bfa02e);
  color: #0d0800 !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
  border: 1px solid transparent;
  gap: 8px;
}

.session-item:hover, .session-item:active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.session-item.active {
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.4);
  color: #fef08a;
}

.session-info-wrap {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.session-title-wrap {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 500;
  color: #fbf7ee;
}

.session-meta-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
  white-space: nowrap;
}

.session-meta-date {
  color: #a1a1aa;
}

.session-meta-badge {
  font-family: monospace;
  font-size: 10px;
  color: #d4af37;
  opacity: 0.9;
}

.session-actions-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.session-del-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 13.5px;
  padding: 3px 5px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.6;
}

.session-del-btn:hover {
  color: var(--danger-color);
  opacity: 1;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dc2626, #991b1b);
  border: 1px solid rgba(254, 202, 202, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.user-name-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role-badge {
  font-size: 11px;
  color: var(--text-dim);
}

/* ================= 主对话视口 ================= */
.main-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 50% 10%, rgba(212, 175, 55, 0.08) 0%, #0e1424 45%, var(--bg-main) 85%);
}

.main-header {
  padding: 8px 12px 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.22);
  background: rgba(11, 16, 28, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 50;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 34px;
}

.header-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-left: 2px;
  width: 100%;
}

.header-session-meta {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.icon-btn:hover, .icon-btn:active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.header-center-title {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  letter-spacing: 0.2px;
}

.header-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
  transition: all 0.2s;
}

.header-pill-btn:hover, .header-pill-btn:active {
  background: rgba(51, 65, 85, 0.95);
  border-color: rgba(212, 175, 55, 0.65);
  color: #ffffff;
}

.header-pill-gold {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.16), rgba(180, 83, 9, 0.16));
  border-color: rgba(212, 175, 55, 0.45);
  color: #fef08a;
}

.header-pill-gold:hover, .header-pill-gold:active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28), rgba(180, 83, 9, 0.28));
  border-color: rgba(212, 175, 55, 0.8);
  color: #ffffff;
}

.header-admin-btn {
  width: 30px;
  height: 30px;
  border-radius: 15px;
  font-size: 14px;
  border-color: rgba(212, 175, 55, 0.35);
  background: rgba(212, 175, 55, 0.08);
}

@media (max-width: 390px) {
  .hide-on-xs {
    display: none;
  }
}

/* 消息流主区域 */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.message-row {
  display: flex;
  gap: 10px;
  max-width: 92%;
  animation: messageIn 0.25s ease-out;
}

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

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

.avatar-mini {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-user {
  background: linear-gradient(135deg, #1e293b, #334155);
  color: #fbf7ee;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.avatar-ai {
  background: linear-gradient(135deg, #d4af37, #9b7a1e);
  color: #1a1200;
  font-weight: 800;
  border: 1px solid rgba(255, 235, 160, 0.5);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.bubble-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: calc(100% - 40px);
}

.bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.6;
  word-break: break-word;
}

.bubble.user {
  background: var(--bubble-user);
  color: #fbf7ee;
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-top-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.bubble.assistant {
  background: var(--bubble-assistant);
  color: #f5eedb;
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-top-left-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  position: relative;
}

/* 单项内容复制操作栏与按钮 */
.bubble-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: var(--text-dim);
}

.msg-copy-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all 0.15s;
}

.msg-copy-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: #d4af37;
  color: #fef08a;
}

/* 多选复选框 */
.msg-checkbox-wrap {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  flex-shrink: 0;
}

.is-batch-mode .msg-checkbox-wrap {
  display: flex;
}

.msg-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #d4af37;
}

.message-row.selected .bubble {
  outline: 2px solid #d4af37;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.35);
}

/* 浮动批量复制工具栏 */
.batch-actions-bar {
  position: sticky;
  bottom: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(212, 175, 55, 0.35);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.2s ease-out;
}

.batch-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #fef08a;
  font-weight: 600;
}

.batch-text-btn {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-size: 12.5px;
  cursor: pointer;
  padding: 2px 4px;
  text-decoration: underline;
}

.batch-text-btn:hover {
  color: #7dd3fc;
}

/* 顶部 PWA 添加到桌面胶囊按钮 */
.btn-pwa-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(180, 83, 9, 0.15));
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: #fef08a !important;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
  transition: all 0.2s;
}

.btn-pwa-pill:hover, .btn-pwa-pill:active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28), rgba(180, 83, 9, 0.28));
  border-color: rgba(212, 175, 55, 0.7);
  color: #ffffff !important;
  transform: translateY(-1px);
}

/* iOS 手势引导步骤 */
.ios-guide-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #6366f1;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-desc {
  font-size: 13.5px;
  color: #e2e8f0;
  line-height: 1.4;
  flex: 1;
}

.guide-icon {
  display: inline-block;
  padding: 0 4px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: #a5b4fc;
  font-weight: bold;
}

/* PDF 专属高辨识度产物卡片 (易道商用全景推演報告) */
.pdf-artifact-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(153, 27, 27, 0.22), rgba(18, 25, 41, 0.88));
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 12px;
  margin-top: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

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

.pdf-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, #b91c1c, #7f1d1d);
  border: 1px solid rgba(254, 202, 202, 0.35);
  color: #fef08a;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(185, 28, 28, 0.3);
}

.pdf-card-details {
  flex: 1;
  overflow: hidden;
}

.pdf-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #fef3c7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-card-sub {
  font-size: 11px;
  color: #c5bba8;
  margin-top: 2px;
}

.pdf-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

.btn-pdf-view {
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: #fef08a !important;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.btn-pdf-view:hover, .btn-pdf-view:active {
  background: rgba(212, 175, 55, 0.25);
  color: #ffffff !important;
}

.btn-pdf-download {
  background: linear-gradient(135deg, #d4af37, #9b7a1e);
  border: none;
  color: #1a1200 !important;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
  transition: all 0.15s;
}

.btn-pdf-download:hover, .btn-pdf-download:active {
  background: linear-gradient(135deg, #e5c158, #bfa02e);
  color: #0d0800 !important;
}

/* 附件胶囊与通用产物下载卡片 */
.attachment-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  margin-top: 8px;
  text-decoration: none;
  color: #e2e8f0;
  transition: all 0.2s;
}

.attachment-card:hover, .attachment-card:active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
}

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

.att-info {
  flex: 1;
  overflow: hidden;
}

.att-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.att-size {
  font-size: 11px;
  color: var(--text-dim);
}

.att-action-btn {
  padding: 4px 10px;
  border-radius: 6px;
  background: #4f46e5;
  color: #fff !important;
  font-size: 12px;
  border: none;
  cursor: pointer;
}

/* 执行中太极流转与周天呼吸灯 */
.executing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 12px;
  color: #fef08a;
  font-size: 13px;
  margin-top: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.taiji-spin-icon {
  font-size: 16px;
  display: inline-block;
  animation: taijiRotate 3s infinite linear;
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.6));
}

@keyframes taijiRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d4af37;
  box-shadow: 0 0 8px #d4af37;
  animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
}

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

/* 顶部推演局号一键复制胶囊 */
.session-copy-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: #fef08a;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.session-copy-pill:hover, .session-copy-pill:active {
  background: rgba(212, 175, 55, 0.28);
  border-color: #d4af37;
  color: #ffffff;
}

/* ================= 底部固定输入工具栏 (大行多行文本框) ================= */
.main-input-bar {
  padding: 10px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: rgba(11, 16, 28, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* 功能赋能条与关联标签 */
.input-feature-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 2px 2px 2px;
}

.btn-tool-pill {
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: #fef08a;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-tool-pill:hover, .btn-tool-pill:active {
  background: rgba(212, 175, 55, 0.22);
  border-color: rgba(212, 175, 55, 0.6);
  color: #ffffff;
}

.ref-session-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.22), rgba(180, 83, 9, 0.22));
  border: 1px solid rgba(212, 175, 55, 0.5);
  color: #fef08a;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}

.ref-session-chip-del {
  cursor: pointer;
  color: #ef4444;
  font-weight: 800;
  font-size: 13px;
  padding-left: 2px;
}

/* 附件暂存标签排 */
.staged-files-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: #fef08a;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
}

.file-chip-del {
  cursor: pointer;
  color: #ef4444;
  font-weight: bold;
}

.input-controls-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

/* 舒适多行大文本框 */
.input-textarea {
  flex: 1;
  min-height: 76px;
  max-height: 180px;
  background: var(--bg-card);
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 14.5px;
  color: #fbf7ee;
  resize: vertical;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.35);
}

.btn-send {
  background: linear-gradient(135deg, #d4af37, #9b7a1e);
  border: 1px solid rgba(255, 235, 160, 0.4);
  color: #1a1200 !important;
  min-width: 76px;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.35);
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.btn-send:hover, .btn-send:active {
  background: linear-gradient(135deg, #e5c158, #bfa02e);
  color: #0d0800 !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(212, 175, 55, 0.5);
}

.btn-send:disabled {
  background: rgba(255, 255, 255, 0.08);
  border-color: transparent;
  color: rgba(255, 255, 255, 0.3) !important;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 历史关联弹层中的项目卡片 */
.ref-session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.18s;
}

.ref-session-item:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: rgba(212, 175, 55, 0.5);
  transform: translateX(2px);
}

/* ================= 登录与后台管理抽屉弹层 ================= */
.drawer-panel {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 23, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  animation: modalFadeIn 0.2s ease-out;
  overflow-y: auto;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-input {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  color: #fff;
  outline: none;
}

.form-input:focus {
  border-color: #6366f1;
}

.btn-primary {
  background: linear-gradient(135deg, #d4af37, #9b7a1e);
  color: #1a1200 !important;
  border: 1px solid rgba(255, 235, 160, 0.4);
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.3);
}

.btn-primary:hover, .btn-primary:active {
  background: linear-gradient(135deg, #e5c158, #bfa02e);
  color: #0d0800 !important;
}

/* ================= 多端深度响应式适配 (手机 / 平板 / PC大屏) ================= */

/* 1. 平板中屏适配 (768px <= 宽度 < 1024px，如 iPad、折叠屏横屏) */
@media (min-width: 768px) and (max-width: 1023px) {
  .sidebar {
    position: relative;
    transform: translateX(0);
    width: 260px;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
  }
  .sidebar-overlay {
    display: none !important;
  }
  .btn-hamburger {
    display: none !important;
  }
  .main-viewport {
    background: radial-gradient(circle at 50% 12%, rgba(212, 175, 55, 0.09) 0%, #0d1424 50%, var(--bg-main) 90%);
  }
  .chat-container {
    max-width: 740px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 16px;
  }
  .main-input-bar {
    max-width: 740px;
    width: 100%;
    margin: 0 auto 10px auto;
    border-radius: 16px;
    border: 1px solid var(--border-color);
  }
  .qimen-quick-topics {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

/* 2. PC 桌面宽屏适配 (宽度 >= 1024px，如 1080P、2K、4K 显示器) */
@media (min-width: 1024px) {
  .sidebar {
    position: relative;
    transform: translateX(0);
    width: 300px;
    box-shadow: 6px 0 30px rgba(0, 0, 0, 0.5);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
  }
  .sidebar-overlay {
    display: none !important;
  }
  .btn-hamburger {
    display: none !important;
  }
  .main-viewport {
    background: radial-gradient(circle at 50% 10%, rgba(212, 175, 55, 0.1) 0%, #0d1322 45%, var(--bg-main) 85%);
  }
  .chat-container {
    max-width: 880px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px 30px 20px;
    gap: 22px;
  }
  .main-input-bar {
    max-width: 880px;
    width: 100%;
    margin: 0 auto 14px auto;
    border-radius: 18px;
    border: 1px solid rgba(212, 175, 55, 0.25);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  }
  .qimen-welcome-wrap {
    max-width: 680px;
  }
  .qimen-quick-topics {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .luoshu-matrix-card {
    max-width: 520px;
  }
  .luoshu-cell {
    padding: 10px 8px;
  }
  .luoshu-palace {
    font-size: 14px;
  }
  .luoshu-elements {
    font-size: 11px;
  }
}

/* ================= 奇门易道与环境风水专属动态交互组件 ================= */

/* 朱砂法印下落盖章弹性动效 */
@keyframes stampDrop {
  0% {
    opacity: 0;
    transform: scale(2.2) rotate(-14deg);
    filter: blur(4px);
  }
  60% {
    opacity: 1;
    transform: scale(0.96) rotate(0deg);
    filter: blur(0);
  }
  80% {
    transform: scale(1.06) rotate(1.5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.qimen-seal-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fef08a;
  background: linear-gradient(135deg, rgba(185, 28, 28, 0.9), rgba(127, 29, 29, 0.98));
  border: 1px solid rgba(254, 202, 202, 0.4);
  padding: 2px 8px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(185, 28, 28, 0.4);
  letter-spacing: 1px;
  animation: stampDrop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  transform-origin: center center;
}

/* 欢迎区太极光晕与牌匾 */
.qimen-welcome-wrap {
  text-align: center;
  margin: 15px auto 25px auto;
  max-width: 480px;
  width: 100%;
}

.taiji-emblem-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 10px;
}

.taiji-emblem {
  font-size: 44px;
  display: inline-block;
  animation: taijiRotate 12s infinite linear;
  filter: drop-shadow(0 0 16px rgba(212, 175, 55, 0.5));
}

.bagua-ring {
  font-size: 12.5px;
  letter-spacing: 4px;
  color: #d4af37;
  opacity: 0.9;
  margin-bottom: 6px;
  font-weight: 600;
}

/* 洛书九宫速查微缩盘 */
.luoshu-matrix-card {
  background: rgba(18, 25, 41, 0.7);
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 14px auto 16px auto;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.luoshu-header {
  font-size: 11.5px;
  font-weight: 700;
  color: #fef08a;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.2);
  padding-bottom: 5px;
}

.luoshu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.luoshu-cell {
  background: rgba(11, 16, 28, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
  transition: all 0.2s;
}

.luoshu-cell:hover {
  border-color: rgba(212, 175, 55, 0.5);
  background: rgba(212, 175, 55, 0.08);
}

.luoshu-palace {
  font-size: 12.5px;
  font-weight: 700;
  color: #fbf7ee;
}

.luoshu-elements {
  font-size: 10px;
  color: #c5bba8;
  margin-top: 1px;
}

/* 快捷起局测算胶囊组 */
.qimen-quick-topics {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  text-align: left;
}

.qimen-topic-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: rgba(18, 25, 41, 0.65);
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: 10px;
  color: #fbf7ee;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.qimen-topic-pill:hover, .qimen-topic-pill:active {
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.45);
  transform: translateX(2px);
  color: #fef08a;
}

.qimen-topic-pill-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* ================= 时空起局排盘仪式浮层动效 ================= */
.qimen-casting-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 9, 15, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.25s ease-out;
}

.casting-compass-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.casting-compass-outer {
  position: absolute;
  inset: 0;
  border: 2px dashed rgba(212, 175, 55, 0.45);
  border-radius: 50%;
  animation: taijiRotate 16s infinite linear;
}

.casting-compass-inner {
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(212, 175, 55, 0.6);
  border-radius: 50%;
  animation: taijiRotateReverse 10s infinite linear;
}

@keyframes taijiRotateReverse {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

.casting-taiji {
  font-size: 52px;
  animation: taijiRotate 2.5s infinite linear;
  filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.8));
}

.casting-title {
  font-size: 19px;
  font-weight: 800;
  color: #fef08a;
  letter-spacing: 2px;
  margin-bottom: 8px;
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
  text-align: center;
}

.casting-pillars {
  font-size: 13.5px;
  color: #fbf7ee;
  background: rgba(18, 25, 41, 0.88);
  border: 1px solid rgba(212, 175, 55, 0.38);
  border-radius: 10px;
  padding: 8px 16px;
  letter-spacing: 1px;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.casting-step-text {
  font-size: 12.5px;
  color: #c5bba8;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: center;
}

/* ================= 洛书宫位风水全息交互卡片 ================= */
.palace-detail-card {
  background: #111827;
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 14px;
  padding: 16px;
  margin-top: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  animation: messageIn 0.25s ease-out;
}

.palace-detail-title {
  font-size: 15px;
  font-weight: 700;
  color: #fef08a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.palace-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12.5px;
  color: #c5bba8;
  line-height: 1.5;
  margin-bottom: 12px;
}

.btn-palace-query {
  width: 100%;
  padding: 9px;
  background: linear-gradient(135deg, #d4af37, #9b7a1e);
  color: #1a1200 !important;
  font-weight: 700;
  font-size: 13px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-palace-query:hover {
  background: linear-gradient(135deg, #e5c158, #bfa02e);
}


/* ================= H5 富文本推演正文与国学排版美化 ================= */
.bubble {
  line-height: 1.68;
  letter-spacing: 0.2px;
  word-break: break-word;
}

.bubble-content-body > *:first-child {
  margin-top: 0 !important;
}

.bubble-content-body > *:last-child {
  margin-bottom: 0 !important;
}

.qimen-p {
  margin: 6px 0;
  color: #e2e8f0;
}

.qimen-h2 {
  margin: 14px 0 8px;
  padding-left: 10px;
  border-left: 3px solid #d4af37;
  font-size: 16px;
  font-weight: 700;
  color: #fef08a;
  line-height: 1.35;
}

.qimen-h3 {
  margin: 12px 0 6px;
  padding-left: 8px;
  border-left: 2.5px solid rgba(212, 175, 55, 0.75);
  font-size: 14.5px;
  font-weight: 700;
  color: #fde047;
  line-height: 1.35;
}

.qimen-h4 {
  margin: 10px 0 5px;
  font-size: 13.8px;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 5px;
}

.qimen-hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.05), rgba(212, 175, 55, 0.45), rgba(212, 175, 55, 0.05));
  margin: 12px 0;
}

.qimen-ul, .qimen-ol {
  margin: 6px 0;
  padding-left: 18px;
  color: #cbd5e1;
}

.qimen-ul li, .qimen-ol li {
  margin-bottom: 5px;
  line-height: 1.6;
}

.qimen-ul li::marker {
  color: #d4af37;
}

.qimen-ol li::marker {
  color: #fbbf24;
  font-weight: 600;
}

.qimen-blockquote {
  border-left: 3px solid #d4af37;
  padding: 8px 12px;
  margin: 8px 0;
  color: #e2e8f0;
  background: rgba(212, 175, 55, 0.07);
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
}

.qimen-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 10px 0;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.28);
  background: rgba(15, 23, 42, 0.75);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  -webkit-overflow-scrolling: touch;
}

.qimen-table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.qimen-table th {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.22), rgba(180, 83, 9, 0.22));
  color: #fef08a;
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.35);
  white-space: nowrap;
}

.qimen-table td {
  padding: 8px 10px;
  color: #e2e8f0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
  line-height: 1.5;
}

.qimen-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.025);
}

.qimen-table tbody tr:last-child td {
  border-bottom: none;
}

.qimen-file-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.32);
  color: #fef08a;
  font-size: 12px;
  font-weight: 500;
  margin: 0 2px;
}

.qimen-code-inline {
  background: rgba(255, 255, 255, 0.1);
  color: #fde68a;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.qimen-code-block {
  background: rgba(0, 0, 0, 0.45);
  padding: 10px 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  border: 1px solid rgba(212, 175, 55, 0.18);
  color: #e2e8f0;
}


/* ================= 手机端极致适配优化 (< 600px) ================= */
@media (max-width: 600px) {
  .chat-container {
    padding: 12px 10px 16px 10px;
    gap: 14px;
  }

  .message-row {
    max-width: 100%;
    gap: 8px;
  }

  .message-row.assistant {
    width: 100%;
  }

  .avatar-mini {
    width: 26px;
    height: 26px;
    font-size: 10px;
    border-radius: 7px;
    flex-shrink: 0;
  }

  .bubble-wrap {
    min-width: 0;
    flex: 1;
    max-width: calc(100% - 34px);
  }

  .message-row.user .bubble-wrap {
    flex: 0 1 auto;
    max-width: 85%;
  }

  .bubble {
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 14px;
  }

  .qimen-table {
    min-width: 300px;
    font-size: 12px;
  }

  .qimen-table th, .qimen-table td {
    padding: 6px 8px;
  }

  .pdf-artifact-card {
    padding: 10px 12px;
  }

  .pdf-card-actions a {
    font-size: 12px;
    padding: 7px 10px;
  }

  .main-input-bar {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  }

  .btn-tool-pill {
    font-size: 11.5px;
    padding: 5px 9px;
  }

  .input-textarea {
    font-size: 14px;
    padding: 8px 10px;
  }

  .btn-send {
    padding: 0 14px;
    font-size: 13.5px;
  }

  .batch-actions-bar {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 8px;
  }
}


/* ================= 管理控制台全平台自适应 (PC + 手机) ================= */
.admin-tab-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  max-width: 720px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  flex-wrap: wrap;
}

.admin-create-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.admin-create-grid .form-group {
  min-width: 0;
}

.admin-create-grid .form-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.admin-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  margin-bottom: 10px;
}

.admin-user-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .drawer-panel {
    padding: 16px 12px;
  }

  .drawer-header {
    margin-bottom: 14px;
  }

  .admin-tab-bar {
    gap: 8px;
    margin-bottom: 12px;
  }

  .admin-tab-bar button {
    flex: 1;
    justify-content: center;
  }

  .admin-create-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .admin-user-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px;
  }

  .admin-user-actions {
    width: 100%;
    justify-content: flex-start;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }
}
