/* ============================================================
   AI 思辨 — 专家直连转译器样式
   风格：象牙白 / 毛玻璃 / 极简 / 优雅（与主站 Hugo 统一）
   ============================================================ */

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

:root {
  --bg: #faf8f5;
  --bg-card: rgba(255, 255, 255, 0.65);
  --text: #2c2c2c;
  --text-secondary: #6b6b6b;
  --text-muted: #999;
  --border: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.05);
  --accent: #8b7355;
  --accent-light: rgba(139, 115, 85, 0.12);
  --gold: #b8944c;
  --gold-light: rgba(184, 148, 76, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 780px;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "STSong", "Songti SC", "SimSun", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

html {
  font-size: 17px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */
.site-header {
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(250, 248, 245, 0.8);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.back-link {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}
.back-link:hover {
  color: var(--accent);
}

/* ---------- Chat Main ---------- */
.chat-main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.5rem 0;
}

.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  padding-bottom: 1.5rem;
}

/* ---------- Welcome ---------- */
.welcome {
  text-align: center;
  padding: 3rem 1rem 1rem;
}

.welcome-title {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.welcome-sub {
  margin-top: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 30rem;
  margin-left: auto;
  margin-right: auto;
}

.example-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.example-chip {
  padding: 0.45rem 1rem;
  border-radius: 18px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
  line-height: 1.5;
}
.example-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Turn ---------- */
.turn {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.user-bubble {
  align-self: flex-end;
  max-width: 78%;
  padding: 0.65rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.ai-block {
  align-self: flex-start;
  max-width: 100%;
}

.ai-bubble {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: 1px solid var(--border-light);
  border-radius: 4px 16px 16px 16px;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.85;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ---------- Translated Block (提示词 B) ---------- */
.translated-block {
  align-self: flex-start;
  max-width: 100%;
  width: 100%;
}

.translated-block details {
  background: rgba(184, 148, 76, 0.04);
  border: 1px solid var(--gold-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.translated-block summary {
  cursor: pointer;
  padding: 0.5rem 0.9rem;
  font-size: 0.8rem;
  color: var(--gold);
  letter-spacing: 0.04em;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.translated-block summary::-webkit-details-marker {
  display: none;
}
.translated-block summary::before {
  content: "▾";
  transition: transform 0.2s;
  font-size: 0.75rem;
}
.translated-block details[open] summary::before {
  transform: rotate(-90deg);
}

.translated-body {
  padding: 0.5rem 0.9rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.translated-body pre {
  font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 16rem;
  overflow-y: auto;
}

.copy-b {
  align-self: flex-end;
  padding: 0.3rem 0.85rem;
  border-radius: 12px;
  font-size: 0.76rem;
  color: var(--gold);
  background: transparent;
  border: 1px solid var(--gold-light);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}
.copy-b:hover {
  background: var(--gold-light);
}

/* ---------- Toolbar（模式 / 模型选择） ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid var(--border-light);
  border-radius: 14px;
}

.tool-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.tool-select {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.1rem 0.2rem;
}
.tool-select:focus {
  color: var(--accent);
}

.tool-btn {
  padding: 0.25rem 0.75rem;
  border-radius: 14px;
  font-size: 0.78rem;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}
.tool-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.tool-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Toast 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 5.5rem;
  transform: translateX(-50%);
  padding: 0.55rem 1.1rem;
  border-radius: 16px;
  font-size: 0.82rem;
  color: #fff;
  background: rgba(44, 44, 44, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  z-index: 200;
  opacity: 1;
  transition: opacity 0.3s;
}
.toast-error {
  background: rgba(160, 68, 58, 0.92);
}
.toast-hide {
  opacity: 0;
}

/* ---------- 提示块 / 继续按钮 ---------- */
.note-block {
  align-self: flex-start;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--accent-light);
  border: 1px solid var(--border-light);
}

.continue-btn {
  align-self: flex-start;
  padding: 0.4rem 1rem;
  border-radius: 14px;
  font-size: 0.82rem;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}
.continue-btn:hover {
  background: var(--accent-light);
}
.continue-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- Skeleton Loading ---------- */
.skeleton {
  align-self: flex-start;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-light);
  border-radius: 4px 16px 16px 16px;
  background: var(--bg-card);
  min-width: 14rem;
  max-width: 80%;
}

.skeleton .sk-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.04em;
}

.skeleton .sk-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.09) 50%, rgba(0,0,0,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  margin-bottom: 0.5rem;
}
.skeleton .sk-line:last-child {
  width: 60%;
  margin-bottom: 0;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Error ---------- */
.error-block {
  align-self: flex-start;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(180, 80, 70, 0.08);
  border: 1px solid rgba(180, 80, 70, 0.18);
  color: #a0443a;
  font-size: 0.85rem;
}

/* ---------- Input Bar ---------- */
.input-bar {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(250,248,245,0) 0%, var(--bg) 40%);
  padding: 1rem 0 1.25rem;
}

.input-inner {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  background: var(--bg-card);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.6rem 0.6rem 0.6rem 1rem;
  transition: border-color 0.2s;
}
.input-inner:focus-within {
  border-color: var(--accent);
}

#input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--text);
  max-height: 8rem;
  padding: 0.35rem 0;
}

.send-btn {
  flex-shrink: 0;
  padding: 0.55rem 1.3rem;
  border: none;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  font-family: var(--font-sans);
  letter-spacing: 0.05em;
}
.send-btn:hover {
  opacity: 0.85;
}
.send-btn:active {
  transform: scale(0.97);
}
.send-btn:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.input-hint {
  text-align: center;
  margin-top: 0.6rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  html {
    font-size: 15px;
  }
  .user-bubble {
    max-width: 90%;
  }
  .welcome-title {
    font-size: 1.4rem;
  }
  .header-inner {
    padding: 0.75rem 1rem;
  }
  .brand-sub {
    display: none;
  }
}

/* ---------- 私人入口锁屏 ---------- */
.lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(250, 248, 245, 0.92);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}

.lock-card {
  width: min(22rem, 88vw);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.2rem 2rem 2rem;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
}

.lock-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.lock-sub {
  margin: 0.5rem 0 1.3rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.lock-input {
  width: 100%;
  border: 1px solid var(--border);
  outline: none;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text);
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.lock-input:focus {
  border-color: var(--accent);
}

.lock-btn {
  width: 100%;
  margin-top: 0.8rem;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 0.92rem;
  cursor: pointer;
  transition: opacity 0.2s;
  font-family: var(--font-sans);
  letter-spacing: 0.08em;
}
.lock-btn:hover {
  opacity: 0.85;
}
.lock-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.lock-msg {
  margin-top: 0.7rem;
  min-height: 1.1rem;
  font-size: 0.8rem;
  color: #a0443a;
}

/* ---------- 转译器管理面板 ---------- */
.translator-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 260;
  width: min(34rem, 92vw);
  max-height: 82vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.3rem 1.5rem 1.5rem;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.14);
}

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

.panel-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.panel-label {
  display: block;
  margin: 0.9rem 0 0.35rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.t-prompt {
  width: 100%;
  border: 1px solid var(--border);
  outline: none;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
  font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-secondary);
  resize: vertical;
  box-sizing: border-box;
}
.t-prompt:focus {
  border-color: var(--accent);
}

.panel-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.tool-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.tool-btn.primary:hover {
  background: var(--accent);
  opacity: 0.85;
}

.t-list {
  margin-top: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.t-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.5);
}

.t-list-item .t-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 0.4rem;
}

.t-list-item .t-del {
  border: none;
  background: transparent;
  color: #a0443a;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  font-family: var(--font-sans);
}
.t-list-item .t-del:hover {
  opacity: 0.7;
}
.t-list-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.6rem 0;
}