/* 设计稿补充样式（主布局/配色由 Tailwind 承担） */
body {
  background-color: #f9f9ff;
  -webkit-tap-highlight-color: transparent;
}

::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #d8e3fb;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #adc6ff;
}

.shadow-ambient {
  box-shadow: 0px 4px 12px rgba(0, 122, 255, 0.08);
}
.shadow-ambient-lg {
  box-shadow: 0px 8px 24px rgba(0, 122, 255, 0.12);
}

.page-brand-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
.page-brand-title:active {
  opacity: 0.85;
}
.page-brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 7px;
  flex-shrink: 0;
  background: transparent;
}

.glass-panel {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

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

.animate-fade-in-up {
  animation: fadeInUp 0.4s ease-out forwards;
  opacity: 0;
}

.pb-safe {
  padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
}

/* 顶栏语言切换 */
.lang-switch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 34px;
  height: 34px;
  padding: 0 6px;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: #0058bc;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, transform 0.12s ease;
}
.lang-btn:hover {
  background: rgba(0, 112, 235, 0.08);
}
.lang-btn:active {
  transform: scale(0.95);
}
.lang-btn-icon {
  font-size: 18px !important;
  line-height: 1;
}
.lang-btn-code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  min-width: 1.1em;
  text-align: center;
}
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 148px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(193, 198, 215, 0.45);
  box-shadow: 0 10px 28px rgba(0, 88, 188, 0.14);
  padding: 4px;
  z-index: 60;
}
.lang-menu.hidden {
  display: none;
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #414755;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.lang-option:hover {
  background: #f0f3ff;
}
.lang-option.is-active {
  background: #dee8ff;
  color: #0058bc;
  font-weight: 600;
}
.lang-option-short {
  width: 22px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #0058bc;
}
.lang-option-label {
  flex: 1;
}

/* 输入栏模式菜单 */
.mode-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  min-width: 128px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(193, 198, 215, 0.4);
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.12);
  padding: 4px;
  z-index: 30;
}
.mode-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #414755;
  background: transparent;
  border: none;
  font-family: inherit;
  cursor: pointer;
}
.mode-menu button.is-active,
.mode-menu button:active {
  background: #dee8ff;
  color: #0058bc;
}

/* 底栏 Tab — 对齐新设计稿 */
.nav-tab.is-active {
  background: #0070eb !important;
  color: #fefcff !important;
  border-radius: 0.75rem;
}
.nav-tab:not(.is-active) {
  background: transparent;
  color: #414755;
}

.fb-btn.picked {
  color: #0058bc !important;
}
.fb-btn[data-fb="down"].picked {
  color: #ba1a1a !important;
}
.fb-btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.feedback {
  justify-content: flex-end;
  width: 100%;
}

/* 差评反馈弹窗 */
.fb-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.fb-modal.hidden {
  display: none;
}
.fb-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 28, 48, 0.45);
}
.fb-modal-sheet {
  position: relative;
  width: 100%;
  max-width: 28rem;
  max-height: min(85vh, 560px);
  overflow-y: auto;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 32px rgba(0, 88, 188, 0.12);
  animation: fbSheetIn 0.22s ease-out;
}
@keyframes fbSheetIn {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
.fb-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.fb-modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #23264a;
}
.fb-modal-close {
  border: none;
  background: transparent;
  color: #717786;
  padding: 4px;
  border-radius: 999px;
  display: inline-flex;
}
.fb-modal-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: #717786;
}
.fb-type-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.fb-type-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(193, 198, 215, 0.55);
  background: #f8f9fc;
  font-size: 14px;
  color: #23264a;
  cursor: pointer;
}
.fb-type-item:has(input:checked) {
  border-color: rgba(0, 88, 188, 0.45);
  background: #eef4ff;
  color: #0058bc;
  font-weight: 600;
}
.fb-type-item input {
  accent-color: #0058bc;
  width: 16px;
  height: 16px;
}
.fb-desc-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #414755;
  margin-bottom: 6px;
}
.fb-desc {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(193, 198, 215, 0.6);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
  color: #23264a;
  background: #fff;
  resize: vertical;
  min-height: 96px;
  font-family: inherit;
}
.fb-desc:focus {
  outline: none;
  border-color: #0058bc;
  box-shadow: 0 0 0 3px rgba(0, 88, 188, 0.12);
}
.fb-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.fb-btn-cancel,
.fb-btn-submit {
  flex: 1;
  height: 42px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.fb-btn-cancel {
  background: #f0f3ff;
  color: #414755;
}
.fb-btn-submit {
  background: #0058bc;
  color: #fff;
}
.fb-btn-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Markdown 气泡内容 */
.bubble-md p {
  margin: 0 0 0.5em;
}
.bubble-md p:last-child {
  margin-bottom: 0;
}
.bubble-md ul {
  margin: 0.4em 0;
  padding-left: 1.2em;
}
.bubble-md {
  font-size: 14px;
  line-height: 1.55;
}
.bubble-md h2,
.bubble-md h3 {
  margin: 0.35em 0;
  font-size: 14px;
  font-weight: 600;
}
.bubble-md code {
  font-size: 12px;
  background: #f0f3ff;
  padding: 1px 5px;
  border-radius: 4px;
}
.bubble-md a {
  color: #0070eb;
}
.bubble-md .md-img {
  display: block;
  max-width: 100%;
  border-radius: 10px;
  margin: 8px 0;
}
.bubble-md .md-gallery {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}
.bubble-md .md-gallery-item {
  width: 8rem;
  height: 6rem;
  border-radius: 0.5rem;
  overflow: hidden;
  flex-shrink: 0;
  scroll-snap-align: center;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.bubble-md .md-gallery-item .cap {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
  padding: 8px;
}
.bubble-md .md-gallery-item .cap span {
  font-size: 10px;
  color: #fff;
  font-weight: 600;
}
.bubble-md .md-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.typing {
  color: #414755;
  font-size: 13px;
}

.error-text {
  color: #ba1a1a;
  margin: 0;
}

.chip {
  border: 1px solid rgba(193, 198, 215, 0.7);
  background: rgba(255, 255, 255, 0.9);
  color: #414755;
  border-radius: 9999px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip:active {
  background: #dee8ff;
  border-color: #0058bc;
  color: #0058bc;
}

.kb-suggest-strip {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 -4px;
  padding: 0 4px 2px;
}
.kb-suggest-strip::-webkit-scrollbar {
  display: none;
}
.kb-suggest-track {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  width: max-content;
  min-height: 32px;
  align-items: center;
}
.kb-suggest-chip {
  flex: 0 0 auto;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid rgba(193, 198, 215, 0.65);
  background: rgba(255, 255, 255, 0.92);
  color: #23264a;
  border-radius: 9999px;
  padding: 7px 12px;
  font-size: 12px;
  line-height: 1.25;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s;
}
.kb-suggest-chip:active {
  background: #dee8ff;
  border-color: #0058bc;
  color: #0058bc;
  transform: scale(0.98);
}
.kb-suggest-strip.is-empty {
  display: none;
}

.status-error {
  color: #ba1a1a !important;
}

.fb-btn.picked {
  color: #0058bc;
  background: #dee8ff;
}

/* 单行动态检索提示 — 不展开，仅原地切换中文状态 */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.process-line {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(70%, 12.5rem);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(240, 243, 255, 0.85);
  border: 1px solid rgba(193, 198, 215, 0.35);
  vertical-align: middle;
}
.process-line.is-live {
  border-color: rgba(0, 113, 235, 0.22);
}
.process-line.is-done {
  background: rgba(233, 246, 238, 0.9);
  border-color: rgba(30, 140, 80, 0.22);
}
.process-line-icon {
  font-size: 15px !important;
  width: 15px;
  height: 15px;
  line-height: 15px;
  overflow: hidden;
  color: #006688;
  flex-shrink: 0;
}
.process-line.is-live .process-line-icon {
  color: #0058bc;
  animation: spin 1.1s linear infinite;
}
.process-line.is-done .process-line-icon {
  color: #1e8c50;
}
.process-line-text {
  font-size: 13px;
  font-weight: 500;
  color: #414755;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.process-line.is-done .process-line-text {
  color: #1e6b45;
}

/* Markdown 表格：窄屏横向滚动，避免竖线文本挤成一团 */
.bubble-md .md-table-wrap {
  margin: 8px 0 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(193, 198, 215, 0.5);
  border-radius: 10px;
  background: #fff;
}
.bubble-md .md-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  line-height: 1.5;
}
.bubble-md .md-table th,
.bubble-md .md-table td {
  padding: 7px 10px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid rgba(193, 198, 215, 0.35);
  border-right: 1px solid rgba(193, 198, 215, 0.25);
}
.bubble-md .md-table th:last-child,
.bubble-md .md-table td:last-child {
  border-right: none;
}
.bubble-md .md-table tr:last-child td {
  border-bottom: none;
}
.bubble-md .md-table thead th {
  background: #f0f3ff;
  color: #23264a;
  font-weight: 600;
  position: sticky;
  top: 0;
}
.bubble-md .md-table tbody tr:nth-child(even) {
  background: #fafbff;
}

/* 正文内穿插的简洁入口按钮 */
.bubble-md .md-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 10px;
}
.bubble-md .md-link-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: #eef4ff;
  color: #0058bc;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  border: 1px solid rgba(0, 88, 188, 0.14);
}
.bubble-md .md-link-btn:active {
  background: #dee8ff;
}
