/* ==========================================================================
   新晃文旅智能体 · 小晃AI —— 样式表
   配色：侗族靛蓝 + 赭橙 + 稻穗金 + 宣纸米白
   布局：移动端优先，桌面端居中限宽（480px）
   ========================================================================== */

:root {
  /* —— 视觉参考站同源色板 —— */
  --dong-blue: #2d4a6e;        /* 侗族靛染深蓝 */
  --dong-blue-mid: #3d6491;    /* 靛蓝中调 */
  --dong-blue-light: #cdd9ea;  /* 靛蓝浅色 */
  --dong-orange: #c8773a;      /* 侗锦橙（赭橙）*/
  --dong-gold: #d4a843;        /* 稻穗金 */
  --dong-gold-light: #f0dfa0;
  --ink: #2e2618;              /* 墨棕 */
  --ink-light: #5c4e3a;
  --ink-muted: #a09078;
  --paper: #f5f0e6;            /* 宣纸色 */
  --paper-warm: #ede5d4;
  --paper-light: #faf7f0;

  --accent: var(--dong-blue);
  --accent-light: var(--dong-blue-light);
  --accent-mid: var(--dong-blue-mid);
  --user-bg: #e8f0f8;
  --user-border: rgba(45, 74, 110, 0.2);
  --border: rgba(45, 74, 110, 0.12);
  --border-strong: rgba(45, 74, 110, 0.22);
  --shadow: rgba(30, 40, 60, 0.1);
  --danger: #b4462f;
  --ok: #6bc87a;

  --radius: 12px;
  --radius-sm: 8px;
  --font-cn: 'Noto Serif SC', 'Source Han Serif CN', 'Songti SC', 'STSong', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;

  /* 键盘弹出时由 JS 动态更新 */
  --app-height: 100vh;
}

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

html, body {
  height: 100%;
  background: var(--paper);
  font-family: var(--font-sans);
  color: var(--ink);
  overscroll-behavior: none;
}

/* 侗族铜鼓纹氛围背景 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 10% 15%, rgba(45, 74, 110, 0.07) 0%, transparent 45%),
    radial-gradient(circle at 90% 85%, rgba(200, 119, 58, 0.06) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(212, 168, 67, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: var(--app-height);
  max-width: 480px;
  margin: 0 auto;
  background: var(--paper-light);
  border-left: 0.5px solid var(--border);
  border-right: 0.5px solid var(--border);
  z-index: 1;
  overflow: hidden;
}

@supports (height: 100dvh) {
  .app { height: 100dvh; }
}

/* ==========================================================================
   顶部导航
   ========================================================================== */

.header {
  position: relative;
  flex-shrink: 0;
  background: var(--dong-blue);
  padding: calc(14px + env(safe-area-inset-top)) 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: visible;
}

/* 侗族几何纹样 */
.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpolygon points='20,2 38,11 38,29 20,38 2,29 2,11' fill='none' stroke='rgba(255,255,255,0.06)' stroke-width='1'/%3E%3Cpolygon points='20,8 32,14 32,26 20,32 8,26 8,14' fill='none' stroke='rgba(255,255,255,0.05)' stroke-width='1'/%3E%3Ccircle cx='20' cy='20' r='4' fill='none' stroke='rgba(212,168,67,0.12)' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 40px 40px;
  pointer-events: none;
  opacity: 0.9;
}

/* 铜鼓环形装饰 */
.header::after {
  content: '';
  position: absolute;
  right: -20px;
  top: -20px;
  width: 100px;
  height: 100px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='45' fill='none' stroke='rgba(212,168,67,0.18)' stroke-width='1.5'/%3E%3Ccircle cx='50' cy='50' r='35' fill='none' stroke='rgba(212,168,67,0.12)' stroke-width='1'/%3E%3Ccircle cx='50' cy='50' r='20' fill='none' stroke='rgba(212,168,67,0.1)' stroke-width='1'/%3E%3C/svg%3E") no-repeat;
  background-size: contain;
  pointer-events: none;
}

.header-avatar {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  background: var(--dong-blue-mid);
  overflow: visible;
}

.header-avatar .avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.header-avatar .dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
  border: 1.5px solid var(--dong-blue);
  transition: background 0.3s;
}

.header-avatar .dot.offline { background: #c9a227; }
.header-avatar .dot.error { background: var(--danger); }

.header-info { flex: 1; min-width: 0; }

.header-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.06em;
  font-family: var(--font-cn);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.66);
  margin-top: 2px;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 15px;
}

.mode-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 20px;
  background: rgba(212, 168, 67, 0.22);
  border: 0.5px solid rgba(212, 168, 67, 0.5);
  color: #f0dfa0;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.header-menu-wrap { position: relative; flex-shrink: 0; }

.header-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0.5px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.85);
  transition: background 0.15s;
}

.header-btn:active { background: rgba(255, 255, 255, 0.2); }

.header-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  min-width: 148px;
  overflow: hidden;
  z-index: 999;
}

.header-dropdown.open { display: block; }

.header-dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 16px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background 0.12s;
}

.header-dropdown-item + .header-dropdown-item { border-top: 1px solid rgba(0, 0, 0, 0.06); }
.header-dropdown-item:active { background: #f5f5f5; }

/* 侗锦装饰线 */
.header-deco {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    transparent 0%, var(--dong-orange) 15%, var(--dong-gold) 35%,
    #fff 50%, var(--dong-gold) 65%, var(--dong-orange) 85%, transparent 100%);
  opacity: 0.85;
}

/* ==========================================================================
   场景标签栏
   ========================================================================== */

.scene-bar {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 10px 14px 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  background: var(--paper-warm);
  border-bottom: 0.5px solid var(--border);
}

.scene-bar::-webkit-scrollbar { display: none; }

.scene-tag {
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  letter-spacing: 0.03em;
  cursor: pointer;
  border: 0.5px solid var(--border);
  background: var(--paper-light);
  color: var(--ink-muted);
  transition: all 0.15s;
  font-family: var(--font-cn);
  user-select: none;
}

.scene-tag.active {
  background: var(--dong-blue);
  color: #fff;
  border-color: var(--dong-blue);
}

.scene-tag:active { opacity: 0.75; }

/* ==========================================================================
   消息区
   ========================================================================== */

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(45, 74, 110, 0.2) transparent;
  overscroll-behavior: contain;
}

.messages::-webkit-scrollbar { width: 3px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: rgba(45, 74, 110, 0.25); border-radius: 3px; }

.date-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.date-divider::before,
.date-divider::after {
  content: '';
  flex: 1;
  height: 0.5px;
  background: var(--border);
}

.msg-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: msg-in 0.25s ease-out;
  max-width: 100%;
}

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

.msg-row.user { flex-direction: row-reverse; }

.msg-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.msg-avatar.ai-avatar {
  background: var(--dong-blue);
  border-color: var(--dong-blue-mid);
}

.msg-avatar.user-avatar {
  background: var(--dong-blue-light);
  color: var(--dong-blue);
  border-color: var(--user-border);
  font-weight: 600;
}

.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.msg-body {
  max-width: 82%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-row.user .msg-body { align-items: flex-end; }

.msg-name {
  font-size: 11px;
  color: var(--ink-muted);
  padding: 0 4px;
  letter-spacing: 0.03em;
}

.bubble {
  padding: 10px 13px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
  overflow-wrap: anywhere;
  position: relative;
  max-width: 100%;
}

.bubble.ai {
  background: var(--paper-light);
  border: 0.5px solid var(--border);
  color: var(--ink);
  border-radius: 2px var(--radius) var(--radius) var(--radius);
  box-shadow: 1px 2px 6px var(--shadow);
}

.bubble.ai::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: linear-gradient(to bottom, var(--dong-orange), var(--dong-gold));
  border-radius: 2px;
}

.bubble.user {
  background: var(--user-bg);
  color: var(--ink);
  border-radius: var(--radius) 2px var(--radius) var(--radius);
  border: 0.5px solid var(--user-border);
  white-space: pre-wrap;
}

.bubble.user::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: linear-gradient(to bottom, var(--dong-blue), var(--dong-blue-light));
  border-radius: 2px;
}

.bubble.error {
  background: #fdf3f0;
  border-color: rgba(180, 70, 47, 0.35);
  color: #7a2e1c;
}

.bubble.error::before { background: linear-gradient(to bottom, var(--danger), var(--dong-orange)); }

/* 流式输出光标 */
.streaming-cursor::after {
  content: '▌';
  color: var(--dong-orange);
  font-size: 13px;
  margin-left: 1px;
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  to { visibility: hidden; }
}

.msg-time {
  font-size: 10px;
  color: var(--ink-muted);
  padding: 0 4px;
  opacity: 0.7;
}

/* ==========================================================================
   AI 回答排版（Markdown 渲染结果）
   ========================================================================== */

.bubble.ai .ai-hd {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-cn);
  color: var(--ink);
  margin: 14px 0 10px;
  padding-left: 10px;
  border-left: 3px solid var(--dong-blue);
  line-height: 1.4;
}

.bubble.ai > .ai-hd:first-child { margin-top: 0; }

.bubble.ai .ai-subhd {
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-cn);
  color: var(--ink);
  margin: 14px 0 8px;
  line-height: 1.5;
}

.bubble.ai .ai-li {
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.8;
  padding: 2px 0 2px 10px;
  position: relative;
}

.bubble.ai .ai-li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.85em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--dong-gold);
}

.bubble.ai .ai-li.ordered::before { display: none; }
.bubble.ai .ai-li.ordered { padding-left: 4px; }

.bubble.ai .ai-p {
  display: block;
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.8;
}

.bubble.ai .ai-field {
  display: flex;
  font-size: 14px;
  line-height: 1.7;
  padding: 1px 0;
}

.bubble.ai .ai-field .fl {
  flex-shrink: 0;
  color: var(--ink);
  font-weight: 700;
  font-family: var(--font-cn);
  padding-right: 4px;
}

.bubble.ai .ai-field .fv {
  color: var(--ink-light);
  flex: 1;
  min-width: 0;
}

.bubble.ai strong { color: var(--ink); font-weight: 700; }
.bubble.ai em { color: var(--ink-light); font-style: italic; }

.bubble.ai a {
  color: var(--dong-blue-mid);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.bubble.ai code {
  background: rgba(45, 74, 110, 0.08);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--dong-blue);
}

.bubble.ai pre {
  background: var(--paper-warm);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 8px 0;
  overflow-x: auto;
  max-width: 100%;
}

.bubble.ai pre code {
  background: none;
  padding: 0;
  color: var(--ink-light);
  font-size: 12.5px;
  line-height: 1.6;
}

.bubble.ai blockquote {
  margin: 8px 0;
  padding: 6px 10px;
  border-left: 3px solid var(--dong-gold);
  background: rgba(212, 168, 67, 0.08);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-light);
  font-size: 13px;
  line-height: 1.7;
}

.bubble.ai hr {
  border: none;
  height: 0.5px;
  background: var(--border-strong);
  margin: 12px 0 8px;
}

.bubble.ai .md-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  margin: 8px 0;
  -webkit-overflow-scrolling: touch;
}

.bubble.ai table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 100%;
}

.bubble.ai th,
.bubble.ai td {
  border: 0.5px solid var(--border);
  padding: 5px 8px;
  text-align: left;
  color: var(--ink-light);
  white-space: nowrap;
}

.bubble.ai th {
  background: var(--paper-warm);
  color: var(--ink);
  font-weight: 600;
}

/* 参考条目 */
.sources {
  margin-top: 2px;
  font-size: 11px;
}

.sources summary {
  cursor: pointer;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
}

.sources summary::-webkit-details-marker { display: none; }
.sources summary::before { content: '▸'; font-size: 9px; transition: transform 0.15s; }
.sources[open] summary::before { transform: rotate(90deg); }

.sources-list {
  margin-top: 5px;
  padding: 8px 10px;
  background: var(--paper-warm);
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border);
}

.sources-item {
  font-size: 11px;
  color: var(--ink-light);
  line-height: 1.7;
  padding: 2px 0;
}

.sources-item b { color: var(--ink); font-weight: 600; }
.sources-item span { color: var(--ink-muted); }

/* ==========================================================================
   欢迎卡
   ========================================================================== */

.welcome-card {
  background: linear-gradient(140deg, var(--dong-blue) 0%, #1e3a5f 100%);
  border-radius: var(--radius);
  padding: 16px;
  color: #eef4fb;
  position: relative;
  overflow: hidden;
  border: 0.5px solid rgba(45, 74, 110, 0.4);
}

.welcome-card::before {
  content: '新晃';
  position: absolute;
  right: -6px;
  top: -10px;
  font-size: 64px;
  font-family: var(--font-cn);
  font-weight: 900;
  color: rgba(255, 255, 255, 0.05);
  letter-spacing: -2px;
  pointer-events: none;
}

.welcome-card::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--dong-gold), var(--dong-orange), var(--dong-gold), transparent);
  opacity: 0.7;
}

.welcome-card-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  font-family: var(--font-cn);
  margin-bottom: 6px;
}

.welcome-card-sub {
  font-size: 12px;
  color: rgba(238, 244, 251, 0.75);
  line-height: 1.65;
  margin-bottom: 12px;
}

.welcome-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.welcome-tag {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  border: 0.5px solid rgba(212, 168, 67, 0.4);
  color: #eef4fb;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.welcome-tag:active { background: rgba(212, 168, 67, 0.25); }

/* 快捷问题 */
.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 2px;
}

.chip {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  border: 0.5px solid var(--border-strong);
  background: var(--paper-light);
  color: var(--ink-light);
  cursor: pointer;
  letter-spacing: 0.03em;
  font-family: var(--font-cn);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
  text-align: left;
  line-height: 1.5;
}

.chip:active { background: var(--paper-warm); }

.quick-title {
  font-size: 12px;
  color: var(--ink-muted);
  margin: 2px 0 6px 2px;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   加载动画
   ========================================================================== */

.typing-dot {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 14px;
  background: var(--paper-light);
  border: 0.5px solid var(--border);
  border-radius: 2px var(--radius) var(--radius) var(--radius);
  width: fit-content;
  box-shadow: 1px 2px 6px var(--shadow);
}

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

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

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ==========================================================================
   底部输入区
   ========================================================================== */

.input-area {
  flex-shrink: 0;
  background: var(--paper-warm);
  border-top: 0.5px solid var(--border-strong);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--paper-light);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 6px 6px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-row:focus-within {
  border-color: var(--dong-blue);
  box-shadow: 0 0 0 2px rgba(45, 74, 110, 0.1);
}

.input-row textarea {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px; /* iOS 上小于 16px 会触发自动放大 */
  line-height: 1.5;
  color: var(--ink);
  font-family: var(--font-sans);
  resize: none;
  min-height: 24px;
  max-height: 96px;
  padding: 2px 0;
}

@media (min-width: 480px) {
  .input-row textarea { font-size: 14px; }
}

.input-row textarea::placeholder { color: var(--ink-muted); }
.input-row textarea:disabled { opacity: 0.6; }

.send-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--dong-blue);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, opacity 0.15s, background 0.15s;
  position: relative;
  overflow: hidden;
}

.send-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.25) 0%, transparent 60%);
}

.send-btn:active { transform: scale(0.93); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.send-btn svg { position: relative; z-index: 1; }
.send-btn.stopping { background: var(--danger); }

.input-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px 0;
  min-height: 26px;
}

.input-spacer { flex: 1; }

.tool-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  border: 0.5px solid transparent;
  background: transparent;
  transition: all 0.15s;
  letter-spacing: 0.02em;
  font-family: inherit;
}

.tool-btn:active { background: var(--paper-warm); border-color: var(--border); }

.char-counter {
  font-size: 11px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.char-counter.warn { color: var(--danger); }

.mode-hint {
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

/* ==========================================================================
   提示条
   ========================================================================== */

.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1200;
  width: min(92vw, 440px);
  pointer-events: none;
}

.toast {
  background: rgba(46, 38, 24, 0.94);
  color: #f7f2e8;
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  animation: toast-in 0.22s ease-out;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  pointer-events: auto;
}

.toast.error { background: rgba(122, 46, 28, 0.95); }
.toast.warn { background: rgba(140, 105, 30, 0.95); }

.toast button {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.16);
  border: none;
  color: inherit;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 20px;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
}

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

/* ==========================================================================
   关于本站弹窗
   ========================================================================== */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(30, 40, 60, 0.45);
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in 0.18s ease-out;
}

.modal-mask[hidden] { display: none; }

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  width: min(100%, 360px);
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}

.modal h3 {
  font-family: var(--font-cn);
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 12px;
  letter-spacing: 0.04em;
}

.modal-body {
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink-light);
}

.modal-body ul { margin: 8px 0 8px 18px; }
.modal-body li { margin-bottom: 5px; }
.modal-body strong { color: var(--ink); }

.modal-meta {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 0.5px solid var(--border);
  font-size: 11.5px;
  color: var(--ink-muted);
}

.modal-btn {
  margin-top: 16px;
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-sm);
  background: var(--dong-blue);
  color: #fff;
  border: none;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.04em;
}

.modal-btn:active { opacity: 0.85; }

/* ==========================================================================
   桌面端
   ========================================================================== */

@media (min-width: 480px) {
  .app { box-shadow: 0 0 40px rgba(30, 40, 60, 0.15); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
