/* Chat page overrides */
.chat-app .header {
  position: relative;
}

.back-link {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--primary);
}

.section-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: -0.5rem 0 1rem 0;
}

/* 登录卡片：与设计稿一致的层次与配色 */
.chat-app #auth-section.section--auth {
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  padding: 1.85rem 1.6rem 1.75rem;
  box-shadow: 0 4px 24px rgba(44, 36, 22, 0.08);
  border-color: rgba(125, 107, 79, 0.18);
}

.auth-card-head {
  margin-bottom: 1.35rem;
}

.chat-app #auth-section .auth-card-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--text);
  letter-spacing: 0.02em;
}

.auth-card-hint {
  margin: 0;
  line-height: 1.55;
  font-size: 0.88rem;
}

.auth-form {
  gap: 1.15rem;
}

.auth-form .form-row label {
  font-weight: 500;
  color: var(--text-muted);
}

.auth-form .form-row input[type="tel"],
.auth-form .form-row input[type="text"] {
  background: #faf8f4;
  border-color: rgba(125, 107, 79, 0.28);
}

.auth-form .form-row input:focus {
  border-color: var(--text);
  background: #fffdf9;
  box-shadow: 0 0 0 1px rgba(44, 36, 22, 0.06);
}

.auth-sms-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.65rem 0.85rem;
}

.auth-sms-code-wrap {
  min-width: 0;
}

.auth-sms-code-wrap label {
  display: block;
  margin-bottom: 0.35rem;
}

.auth-sms-code-wrap input {
  width: 100%;
  max-width: 12rem;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
}

.auth-sms-send {
  padding: 0.62rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  background: linear-gradient(180deg, #fffdf9 0%, #f5efe6 100%);
  color: var(--text);
  border: 1px solid rgba(125, 107, 79, 0.35);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(44, 36, 22, 0.04);
  align-self: end;
  margin-bottom: 0.02rem;
}

.auth-sms-send:hover:not(:disabled) {
  background: #fffdf9;
  border-color: var(--accent);
}

.auth-sms-send:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.auth-submit-primary {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.85rem 1.25rem;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(91, 78, 58, 0.2);
}

@media (max-width: 520px) {
  .auth-sms-row {
    grid-template-columns: 1fr;
  }

  .auth-sms-code-wrap input {
    max-width: none;
  }

  .auth-sms-send {
    width: 100%;
    justify-self: stretch;
  }
}

.wechat-display {
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.chat-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.conversation-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.profile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.profile-bar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.chart-birth-meta {
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

.chat-app .birth-clock-row .field-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.chat-app .birth-clock-row .radio-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
}

.chat-app .birth-clock-row .radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.chat-app .birth-clock-row .form-hint {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.label-with-note {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}

.label-note {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.unknown-time-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid rgba(125, 107, 79, 0.22);
  border-radius: 10px;
  background: #fffaf2;
  cursor: pointer;
}

.unknown-time-toggle input {
  margin-top: 0.18rem;
}

.unknown-time-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.unknown-time-title {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

.unknown-time-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

#test-user-time:disabled {
  color: var(--text-muted);
  background: #f2ede4;
  cursor: not-allowed;
}

.conversation-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.summary-message {
  border-color: #d7c8af;
  background: #fffcf6;
}

.summary-message-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.summary-message-content {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(44, 36, 22, 0.35);
}

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

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(44, 36, 22, 0.2);
  padding: 1rem 1rem 0.95rem;
}

.modal-card h3 {
  margin: 0;
  font-size: 1rem;
  font-family: var(--font-serif);
}

.modal-desc {
  margin: 0.4rem 0 0.7rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.modal-input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}

.modal-input:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-actions {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* 测试用户弹窗：限制高度，底部操作区固定可见 */
#test-user-modal .modal-card {
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
}

#test-user-modal .modal-card .form {
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.15rem;
}

#test-user-modal .modal-actions {
  position: sticky;
  bottom: 0;
  padding-top: 0.6rem;
  padding-bottom: 0.1rem;
  background: var(--bg-card);
}

.conversation-bar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.conversation-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.conversation-select {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}

.conversation-select:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-header-row h2 {
  margin: 0;
}

.current-user {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chat-app .chat-section .messages {
  min-height: 280px;
  max-height: 50vh;
  margin-bottom: 1rem;
}

/* ChatGPT/DeepSeek 风格：内联 typing 指示器，无全屏蒙层 */
.message.typing {
  min-height: 2.5rem;
  display: flex;
  align-items: center;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.4s ease-in-out infinite both;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* 新对话建议卡片 */
.new-conv-suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f5f0ff, #ffe9f7);
  border: 1px solid #ddb8f5;
  border-radius: 14px;
  animation: fadeInUp 0.4s ease;
}

.new-conv-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.new-conv-text {
  flex: 1;
}

.new-conv-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #5a2d82;
}

.new-conv-subtitle {
  font-size: 0.8rem;
  color: #7c5295;
  margin-top: 2px;
}

.new-conv-btn {
  flex-shrink: 0;
  padding: 7px 14px;
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s;
}

.new-conv-btn:hover {
  background: #6d28d9;
}

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

/* ——— 出生地：必须用 .form-row .city-picker 提高优先级，覆盖 style.css 里 .form-row input ——— */
.chat-app .form-row .city-picker {
  --city-h: 44px;
  --city-r: 10px;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0.35rem;
}

/* 统一本区块内所有文本/数字输入（避免备注框与经纬度样式不一致） */
.chat-app .form-row .city-picker input[type="text"],
.chat-app .form-row .city-picker input[type="number"] {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: 100%;
  height: var(--city-h);
  margin: 0;
  padding: 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--city-r);
  font-size: 0.9375rem;
  font-family: inherit;
  line-height: 1.2;
  color: var(--text);
  background: #fffdf9;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-app .form-row .city-picker input[type="number"]::-webkit-outer-spin-button,
.chat-app .form-row .city-picker input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.chat-app .form-row .city-picker input[type="number"] {
  -moz-appearance: textfield;
}

.chat-app .form-row .city-picker input::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.chat-app .form-row .city-picker input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.12);
}

.chat-app .form-row .city-picker input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chat-app .city-panel {
  padding: 1rem 1rem 1.05rem;
  border-radius: var(--city-r);
  background: #fffdf9;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* 主路径：搜索 */
.chat-app .city-panel-search {
  border-color: rgba(139, 115, 85, 0.28);
}

/* 兜底：视觉弱化，与主路径区分 */
.chat-app .city-panel-fallback {
  padding: 0.85rem 0.95rem;
  background: var(--bg);
  border-style: dashed;
  border-color: var(--accent-soft);
  box-shadow: none;
}

.chat-app .city-panel-fallback .city-panel-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.chat-app .city-panel-fallback .city-panel-desc {
  font-size: 0.7rem;
}

.chat-app .form-row .city-picker .city-panel-fallback input[type="text"],
.chat-app .form-row .city-picker .city-panel-fallback input[type="number"] {
  background: rgba(255, 253, 248, 0.92);
}

.chat-app .city-fallback-bridge {
  margin: 0.85rem 0 0.25rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
  text-align: center;
}

.chat-app .city-fallback-bridge strong {
  color: var(--accent);
  font-weight: 600;
}

.chat-app .city-panel-search--disabled {
  opacity: 0.72;
}

.chat-app .city-panel-head {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.chat-app .city-panel-mark {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 0.4rem;
  border-radius: 50%;
  background: var(--accent);
}

.chat-app .city-panel-mark--coord {
  background: #7a8f94;
}

.chat-app .city-panel-titles {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.chat-app .city-panel-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.chat-app .city-panel-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* 搜索行：输入与按钮同高、同圆角（抵消 .btn 默认 padding） */
.chat-app .form-row .city-search-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
}

.chat-app .form-row .city-search-row > input[type="text"] {
  flex: 1;
  min-width: 0;
  width: auto;
  height: var(--city-h);
}

.chat-app .form-row .city-search-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-width: 5.5rem;
  height: var(--city-h);
  margin: 0;
  padding: 0 1rem;
  border: none;
  border-radius: var(--city-r);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  box-sizing: border-box;
  background: var(--primary);
  color: #fff;
  transition: background 0.2s;
}

.chat-app .form-row .city-search-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.chat-app .form-row .city-search-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-app .city-coords-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.85rem;
  align-items: start;
}

.chat-app .coord-input-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.chat-app .coord-dir-select {
  height: var(--city-h);
  padding: 0 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--city-r);
  background: #fffdf9;
  color: var(--text);
  font-size: 0.86rem;
}

@media (max-width: 420px) {
  .chat-app .city-coords-grid {
    grid-template-columns: 1fr;
  }
}

.chat-app .city-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 0.35rem;
}

.chat-app .city-field-wide {
  margin-top: 0.25rem;
}

/* 兜底「使用手动坐标」：线框次要，弱于上方「搜索」与底部「创建档案」 */
.chat-app .form-row .city-apply-btn {
  width: 100%;
  height: var(--city-h);
  margin-top: 0.75rem;
  padding: 0 1rem;
  border: 1px solid var(--primary);
  border-radius: var(--city-r);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-sizing: border-box;
  background: #fffef9;
  color: var(--primary);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.chat-app .form-row .city-apply-btn:hover {
  background: rgba(125, 107, 79, 0.07);
  border-color: var(--primary-hover);
  color: var(--primary-hover);
}

.chat-app .city-results {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0.2rem 0;
  max-height: 200px;
  overflow-y: auto;
  border-radius: var(--city-r);
  border: 1px solid var(--border);
  background: #fffdf9;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-soft) transparent;
}

.chat-app .city-results.hidden {
  display: none;
}

.chat-app .city-result-item {
  padding: 0.62rem 0.85rem;
  font-size: 0.88rem;
  line-height: 1.4;
  cursor: pointer;
  border-bottom: 1px solid rgba(229, 221, 208, 0.7);
  transition: background 0.15s;
}

.chat-app .city-result-item:last-child {
  border-bottom: none;
}

.chat-app .city-result-item:hover {
  background: rgba(139, 115, 85, 0.07);
}

.chat-app .city-result-item:active {
  background: rgba(139, 115, 85, 0.11);
}

.chat-app .city-hint {
  margin: 0.85rem 0 0;
  padding: 0 0.15rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-muted);
  opacity: 0.92;
}

.chat-app .selected-place {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(139, 115, 85, 0.09) 0%, rgba(196, 181, 160, 0.12) 100%);
  border: 1px solid rgba(139, 115, 85, 0.2);
  border-left: 4px solid var(--accent);
  box-shadow: 0 2px 12px rgba(44, 36, 22, 0.05);
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
}

.chat-app .selected-place.hidden {
  display: none;
}

.chat-app .selected-place-main {
  flex: 1;
  min-width: 0;
  font-family: var(--font-serif);
  font-size: 0.9rem;
}

.chat-app .btn-clear {
  flex-shrink: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.chat-app .btn-clear:hover {
  background: #fff;
  color: var(--text);
}

/* —— 星盘 placements + 轮盘 / 相位（限制高度，内部纵向滚动，少占聊天区） —— */
.chat-app .chart-panel {
  background: linear-gradient(180deg, #fffdf9 0%, rgba(196, 181, 160, 0.2) 55%, rgba(139, 115, 85, 0.08) 100%);
  border-radius: var(--radius, 12px);
  padding: 0.55rem 0.65rem 0.6rem;
  margin-bottom: 0.65rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  border: 1px solid rgba(139, 115, 85, 0.18);
  box-shadow: 0 4px 20px rgba(44, 36, 22, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  max-height: min(30vh, 260px);
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.chat-app .chart-placements-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0.45rem;
}

.chat-app .chart-placements {
  width: 100%;
  min-width: 260px;
  border-collapse: collapse;
  font-size: 0.72rem;
  color: var(--text);
}

.chat-app .chart-placements th,
.chat-app .chart-placements td {
  padding: 0.24rem 0.32rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.chat-app .chart-placements th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.chat-app .chart-placements-empty {
  margin: 0;
  padding: 0.35rem 0;
}

.chat-app .nowrap {
  white-space: nowrap;
}

.chat-app .chart-viz-wrap {
  margin-top: 0.35rem;
}

.chat-app .chart-viz-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.4rem;
}

.chat-app .chart-viz-tab {
  flex: 1;
  padding: 0.32rem 0.45rem;
  font-size: 0.76rem;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid rgba(139, 115, 85, 0.28);
  background: rgba(255, 253, 249, 0.7);
  color: var(--text-muted);
  cursor: pointer;
}

.chat-app .chart-viz-tab.is-active {
  background: linear-gradient(180deg, #fffdf9, #f0e6d8);
  color: var(--text);
  border-color: var(--accent);
}

.chat-app .chart-viz-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chat-app .chart-viz-pane.hidden {
  display: none;
}

.chat-app .chart-wheel-host {
  display: flex;
  justify-content: center;
  padding: 0.2rem 0;
}

.chat-app .natal-wheel-svg {
  width: 100%;
  max-width: 190px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(44, 36, 22, 0.08), inset 0 0 0 1px rgba(255, 220, 160, 0.45);
}

/* 仅对话内嵌：矩阵再缩一档，少占纵向空间 */
.chat-app .chart-panel .aspect-matrix-scroll {
  max-height: 72px;
  padding: 0.2rem 0.24rem 0.22rem;
}

.chat-app .chart-panel .aspect-matrix-embed-head {
  padding: 0.22rem 0.35rem 0.2rem;
}

.chat-app .chart-panel .aspect-matrix-embed-title {
  font-size: 0.7rem;
}

.chat-app .chart-panel .aspect-matrix-embed-hint {
  font-size: 0.58rem;
}

.chat-app .chart-panel .aspect-matrix-expand {
  width: 1.65rem;
  height: 1.65rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

.chat-app .chart-panel .astra-aspect-matrix.aspect-matrix-table--compact th,
.chat-app .chart-panel .astra-aspect-matrix.aspect-matrix-table--compact td {
  width: 1.58rem;
  min-width: 1.58rem;
  max-width: 1.58rem;
  height: 1.52rem;
  font-size: 0.48rem;
  padding: 0.02rem 0.01rem;
}

.chat-app .chart-panel .astra-aspect-matrix .asp-cell-inner {
  min-height: 1rem;
  gap: 0.02rem;
}

.chat-app .chart-panel .astra-aspect-matrix .asp-sym {
  font-size: 0.56rem;
}

.chat-app .chart-panel .astra-aspect-matrix .asp-orb {
  font-size: 0.42rem;
}

/* —— 相位矩阵（嵌入对话 + body 下全屏 lightbox；用 .astra-aspect-matrix 保证弹层内样式生效） —— */
.aspect-matrix-card {
  position: relative;
  border-radius: 12px;
  background: linear-gradient(180deg, #faf6f0 0%, #fffdf9 40%, #fffdf9 100%);
  border: 1px solid rgba(139, 115, 85, 0.22);
  box-shadow: 0 2px 14px rgba(44, 36, 22, 0.07);
  overflow: hidden;
}

.aspect-matrix-embed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem 0.4rem;
  border-bottom: 1px solid rgba(139, 115, 85, 0.14);
  background: rgba(255, 253, 249, 0.65);
}

.aspect-matrix-embed-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.aspect-matrix-embed-title {
  font-family: var(--font-serif, "Noto Serif SC", Georgia, serif);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text, #2c2416);
}

.aspect-matrix-embed-hint {
  font-size: 0.68rem;
  color: var(--text-muted, #6b5d4a);
  line-height: 1.3;
}

.aspect-matrix-expand {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(255, 253, 249, 0.9);
  box-shadow: 0 1px 6px rgba(44, 36, 22, 0.08);
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted, #6b5d4a);
}

.aspect-matrix-expand::before {
  content: "⛶";
}

.aspect-matrix-expand:focus-visible {
  outline: 2px solid var(--accent, #8b7355);
  outline-offset: 2px;
}

.aspect-matrix-scroll {
  max-height: 160px;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.4rem 0.38rem 0.45rem;
}

.aspect-matrix-table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.astra-aspect-matrix {
  table-layout: fixed;
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 0.64rem;
  background: #fffdf9;
}

.astra-aspect-matrix th,
.astra-aspect-matrix td {
  box-sizing: border-box;
  width: 2.28rem;
  min-width: 2.28rem;
  max-width: 2.28rem;
  height: 2.12rem;
  padding: 0.07rem 0.04rem;
  text-align: center;
  vertical-align: middle;
  border: 1px solid rgba(100, 88, 72, 0.22);
  line-height: 1.12;
}

.astra-aspect-matrix.aspect-matrix-table--compact th,
.astra-aspect-matrix.aspect-matrix-table--compact td {
  width: 1.92rem;
  min-width: 1.92rem;
  max-width: 1.92rem;
  height: 1.88rem;
  font-size: 0.58rem;
  padding: 0.05rem 0.03rem;
}

.astra-aspect-matrix thead th {
  background: linear-gradient(180deg, #f3ebe0, #ebe3d8);
  font-weight: 600;
  color: #4a3f32;
  font-family: Georgia, "Noto Serif SC", serif;
}

.astra-aspect-matrix tbody th {
  background: linear-gradient(90deg, #f3ebe0, #ebe3d8);
  font-weight: 600;
  color: #4a3f32;
  font-family: Georgia, "Noto Serif SC", serif;
}

.astra-aspect-matrix tbody td.asp-diag,
.astra-aspect-matrix tbody td.asp-upper {
  background: #f0ebe4;
}

.astra-aspect-matrix td.asp-empty {
  background: #faf8f5;
}

.astra-aspect-matrix .asp-cell-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.04rem;
  min-height: 1.75rem;
}

.astra-aspect-matrix .asp-sym {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1f1810;
  font-family: Georgia, "Noto Serif SC", serif;
}

.astra-aspect-matrix .asp-orb {
  display: block;
  font-size: 0.58rem;
  font-weight: 500;
  color: rgba(31, 24, 16, 0.72);
}

/* 参考「专业相位表」配色：紫=合/梅花，红=刑/冲，蓝=六合，绿=三分 */
.astra-aspect-matrix td.asp-conjunction,
.astra-aspect-matrix td.asp-quincunx {
  background: linear-gradient(180deg, #e8dff5, #ddd0ef);
}

.astra-aspect-matrix td.asp-square,
.astra-aspect-matrix td.asp-opposition {
  background: linear-gradient(180deg, #ffd9d2, #ffc9bf);
}

.astra-aspect-matrix td.asp-sextile {
  background: linear-gradient(180deg, #d4e9fc, #c5dff8);
}

.astra-aspect-matrix td.asp-trine {
  background: linear-gradient(180deg, #d8f0df, #c8e8d2);
}

.aspect-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.aspect-lightbox.hidden {
  display: none;
}

.aspect-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(44, 36, 22, 0.45);
  backdrop-filter: blur(4px);
}

.aspect-lightbox-inner {
  position: relative;
  z-index: 1;
  max-width: min(98vw, 1320px);
  max-height: 88vh;
  overflow-x: auto;
  overflow-y: auto;
  border-radius: 14px;
  background: var(--bg-card, #fffdf9);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  padding: 2.35rem 1.25rem 1.15rem;
}

.aspect-lightbox-close {
  position: absolute;
  top: 0.5rem;
  right: 0.55rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted, #6b5d4a);
  border-radius: 8px;
}

.aspect-lightbox-close:hover {
  background: rgba(139, 115, 85, 0.1);
}

.aspect-lightbox-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(88vh - 4.5rem);
  max-width: 100%;
}

.aspect-matrix-lb-head {
  padding: 0 0 0.85rem;
  margin-bottom: 0.65rem;
  border-bottom: 1px solid rgba(139, 115, 85, 0.16);
}

.aspect-matrix-lb-title {
  margin: 0;
  font-family: var(--font-serif, "Noto Serif SC", Georgia, serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text, #2c2416);
}

.aspect-matrix-lb-sub {
  margin: 0.28rem 0 0;
  font-size: 0.74rem;
  color: var(--text-muted, #6b5d4a);
  line-height: 1.4;
}

.aspect-matrix-card--fullscreen {
  box-shadow: none;
  border: none;
  background: transparent;
}

.aspect-matrix-card--fullscreen .astra-aspect-matrix {
  font-size: 0.78rem;
}

.aspect-matrix-card--fullscreen .astra-aspect-matrix th,
.aspect-matrix-card--fullscreen .astra-aspect-matrix td {
  width: 2.28rem;
  min-width: 2.28rem;
  max-width: 2.28rem;
  height: 2.15rem;
}

body.aspect-lightbox-open {
  overflow: hidden;
}
