/* ==================================================================
   轻语 Pigeon · 样式
   ----------------------------------------------------------------
   设计目标：手机上单手能用、深色护眼、字够大、按钮够大。
   「新人易上手」在视觉上的具体含义就是：
     · 一屏只做一件事
     · 主按钮永远显眼且只有一个
     · 不用图标表达关键操作，永远配文字
   ================================================================== */

:root {
  --bg: #0f1115;
  --surface: #161a21;
  --surface-2: #1e232c;
  --border: #2a303b;
  --text: #e8eaed;
  --muted: #98a2b3;
  --accent: #4f8cff;
  --accent-soft: #1e3a6b;
  --bubble-out: #2f5fd0;
  --bubble-in: #232935;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
  --radius: 14px;
  --tap: 44px; /* 移动端最小可点区域 */
}

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

/* ---------------------------------------------------------------
   关键规则：hidden 属性必须真的隐藏元素。
   浏览器默认的 [hidden]{display:none} 优先级极低（只是 UA 样式），
   任何显式 display 都会盖掉它 —— 比如 .boot{display:flex}、.modal{display:flex}。
   后果是「标记为隐藏的遮罩层仍然盖在页面上，拦截所有点击」，
   用户看到的是「整个页面点不动」。UI 测试就是这么抓到它的。
   --------------------------------------------------------------- */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  overscroll-behavior-y: none;
}

button, input, textarea {
  font: inherit;
  color: inherit;
}

/* ---------- 启动画面 ---------- */
.boot {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; background: var(--bg); z-index: 100;
}
.boot-mark { font-size: 56px; animation: float 2s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.boot-text { font-size: 17px; }
.boot-sub { font-size: 13px; color: var(--muted); }

/* ---------- 布局 ---------- */
#root {
  display: flex; flex-direction: column;
  height: 100%;
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg);
}

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 17px; margin: 0; flex: 1; font-weight: 600; }
.topbar .sub { font-size: 12px; color: var(--muted); font-weight: 400; }

.content { flex: 1; overflow-y: auto; padding: 14px; -webkit-overflow-scrolling: touch; }
.content.flush { padding: 0; }

/* ---------- 底部导航 ---------- */
.tabbar {
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; min-height: var(--tap);
  background: none; border: 0; cursor: pointer;
  padding: 10px 4px;
  color: var(--muted); font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.tabbar button .ico { font-size: 20px; }
.tabbar button.on { color: var(--accent); }
.tabbar button .badge {
  position: absolute; transform: translate(14px, -6px);
  background: var(--danger); color: #fff;
  font-size: 10px; min-width: 16px; height: 16px; line-height: 16px;
  border-radius: 8px; padding: 0 4px;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { font-size: 15px; margin: 0 0 6px; font-weight: 600; }
.card p { margin: 6px 0; color: var(--muted); font-size: 14px; }
.card.center { text-align: center; }

.steps { counter-reset: s; margin: 0; padding: 0; list-style: none; }
.steps li {
  counter-increment: s;
  position: relative; padding-left: 34px; margin: 12px 0;
  font-size: 14px; color: var(--muted);
}
.steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap);
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  transition: opacity .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }

/* ---------- 输入 ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, .textarea {
  width: 100%;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  resize: none;
}
.input:focus, .textarea:focus { border-color: var(--accent); }
.textarea { min-height: 90px; font-size: 13px; line-height: 1.5; }

/* ---------- 邀请码 ---------- */
.invite {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px; line-height: 1.5;
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  max-height: 130px; overflow-y: auto;
  color: var(--muted);
  user-select: all;
}

/* ---------- 列表 ---------- */
.list { margin: 0; padding: 0; list-style: none; }
.list li {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.list li:active { background: var(--surface-2); }
.avatar {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600; color: var(--accent);
}
.avatar.ck { background: #14532d; color: #4ade80; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { font-size: 12px; color: var(--muted); text-align: right; flex: 0 0 auto; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { font-size: 44px; margin-bottom: 10px; }

/* ---------- 聊天 ---------- */
.msgs { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 78%; display: flex; flex-direction: column; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg.in { align-self: flex-start; }
.bubble {
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.msg.out .bubble { background: var(--bubble-out); color: #fff; border-bottom-right-radius: 5px; }
.msg.in .bubble { background: var(--bubble-in); border-bottom-left-radius: 5px; }
.msg .stamp { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 6px; align-items: center; }
.voice-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; opacity: .85; margin-bottom: 3px;
}
.sysnote { align-self: center; font-size: 12px; color: var(--muted); text-align: center; padding: 4px 0; }

.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.composer textarea {
  flex: 1;
  min-height: var(--tap); max-height: 120px;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 22px;
  outline: none; resize: none;
  font-size: 15px;
}
.composer .icon-btn {
  width: var(--tap); height: var(--tap);
  flex: 0 0 var(--tap);
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 19px;
  display: flex; align-items: center; justify-content: center;
}
.composer .icon-btn.send { background: var(--accent); border-color: var(--accent); color: #fff; }
.composer .icon-btn.rec { background: var(--danger); border-color: var(--danger); color: #fff; animation: pulse 1.1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------- 指纹核验 ---------- */
.fingerprint {
  display: flex; gap: 8px; justify-content: center;
  font-size: 30px; letter-spacing: 3px;
  padding: 12px 0;
  user-select: none;
}
.verify-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.verify-banner.ok { color: var(--ok); }
.verify-banner.warn { color: var(--warn); }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 88px;
  transform: translateX(-50%);
  max-width: 90vw;
  padding: 11px 18px;
  background: #2b3240;
  border: 1px solid var(--border);
  border-radius: 22px;
  font-size: 14px;
  z-index: 60;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  animation: rise .2s ease-out;
}
.toast.err { background: #4a1d1d; border-color: #7f2b2b; }
.toast.ok { background: #14361f; border-color: #256b39; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal .card { max-width: 420px; width: 100%; margin: 0; max-height: 86vh; overflow-y: auto; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.modal-actions .btn { flex: 1; }

/* ---------- 杂项 ---------- */
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.pill {
  display: inline-block; font-size: 11px; padding: 2px 8px;
  border-radius: 10px; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
}
.pill.ok { color: var(--ok); border-color: #256b39; }
.pill.warn { color: var(--warn); border-color: #6b5220; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); word-break: break-all; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25); border-top-color: #fff;
  display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
