/* 口袋 · 手机端界面
   所有颜色走 CSS 变量（tones.js 注入），换色调不改样式 */

:root {
  --primary: #3f86d4;
  --deep: #2a5f9e;
  --grad-a: #54a8e6;
  --grad-b: #2f6fb8;
  --page-a: #eaf5ff;
  --page-b: #cfe4f7;
  --surface: #ffffff;
  --soft: #f0f7ff;
  --text: #12283f;
  --muted: #6a8399;
  --ring: rgba(63, 134, 212, .28);
  --shadow: rgba(42, 95, 158, .16);
  --r: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

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

/* hidden 属性必须真的能藏住东西。
   浏览器默认样式里 [hidden] 只是 display:none，优先级最低 —— 元素自己一旦写了
   display:flex/block（比如 .appdl），就等于把 hidden 废掉：JS 里 el.hidden = true
   看着没反应、按钮还点不动（因为代码已经按「藏起来」提前 return 了，链接根本没填）。
   所以这里做全局兜底，以后新增带 hidden 的元素不用再一个个补规则。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: linear-gradient(170deg, var(--page-a), var(--page-b));
  transition: background .35s ease, color .35s ease;
  font-size: 15px;
  line-height: 1.5;
}

#sea {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.sea-bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, rgba(255,255,255,.95), var(--ring));
  opacity: .55;
  animation: rise linear infinite;
}
body.dark .bubble { opacity: .22; }
.b1 { width: 58px; height: 58px; left: 8%;  bottom: -70px; animation-duration: 26s; animation-delay: 0s; }
.b2 { width: 26px; height: 26px; left: 26%; bottom: -40px; animation-duration: 20s; animation-delay: 3s; }
.b3 { width: 40px; height: 40px; left: 62%; bottom: -60px; animation-duration: 30s; animation-delay: 6s; }
.b4 { width: 16px; height: 16px; left: 78%; bottom: -30px; animation-duration: 18s; animation-delay: 1s; }
.b5 { width: 34px; height: 34px; left: 44%; bottom: -50px; animation-duration: 24s; animation-delay: 9s; }
.b6 { width: 22px; height: 22px; left: 90%; bottom: -40px; animation-duration: 22s; animation-delay: 12s; }
@keyframes rise {
  0%   { transform: translate3d(0, 0, 0) scale(.9); }
  50%  { transform: translate3d(14px, -52vh, 0) scale(1.05); }
  100% { transform: translate3d(-10px, -104vh, 0) scale(.95); }
}

#app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.glass {
  background: color-mix(in srgb, var(--surface) 74%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid color-mix(in srgb, var(--surface) 60%, transparent);
  box-shadow: 0 8px 26px var(--shadow);
}
body.dark .glass { background: color-mix(in srgb, var(--surface) 78%, transparent); border-color: rgba(255,255,255,.06); }

.view {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  animation: fade .22s ease;
}
.view[hidden] { display: none; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  margin: 8px 10px 0;
  border-radius: var(--r);
  flex: none;
}
.top-avatar {
  width: 38px; height: 38px;
  border-radius: 13px;
  object-fit: cover;
  box-shadow: 0 3px 10px var(--shadow);
  background: var(--soft);
}
.top-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.top-meta.center { align-items: center; text-align: center; }
.top-meta b { font-size: 15.5px; font-weight: 650; letter-spacing: .2px; }
.top-meta small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  border: none; background: var(--soft); color: var(--muted);
  width: 32px; height: 32px; border-radius: 12px; font-size: 16px;
  display: grid; place-items: center;
}
.icon-btn:active { transform: scale(.94); }
/* http 地址下浏览器不给录音：按钮淡下去，别装作能按（点它会说明原因和出路） */
.icon-btn.mic-off { opacity: .4; }

/* ---------- 聊天 ---------- */
.chat-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scrollbar-width: none;
}
.chat-list::-webkit-scrollbar { display: none; }

.day-divider {
  align-self: center;
  font-size: 11px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 66%, transparent);
  padding: 3px 12px;
  border-radius: 99px;
  margin: 2px 0 4px;
}

.msg {
  display: flex;
  gap: 8px;
  max-width: 86%;
  min-width: 0;
  animation: pop .26s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }

.msg.her { align-self: flex-start; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }

.msg .ava {
  width: 30px; height: 30px; border-radius: 11px; object-fit: cover;
  flex: none; background: var(--soft); box-shadow: 0 2px 6px var(--shadow);
}
.msg.me .ava { display: none; }

.bubble {
  position: relative;
  padding: 9px 13px;
  border-radius: 17px;
  font-size: 14.8px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 3px 12px var(--shadow);
  opacity: 1;
  max-width: 100%;
}
.msg.her .bubble {
  background: var(--surface);
  border-top-left-radius: 6px;
  color: var(--text);
}
.msg.me .bubble {
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  color: #fff;
  border-top-right-radius: 6px;
}
.msg.her .bubble:active { filter: brightness(.97); }

.bubble .stamp {
  display: block;
  font-size: 10px;
  margin-top: 3px;
  opacity: .5;
  text-align: right;
}
.msg.me .bubble .stamp { color: rgba(255,255,255,.85); }

.bubble .voice-btn {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 6px;
  border: none;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 99px;
}
.bubble.playing .voice-btn { background: var(--primary); color: #fff; }

.typing {
  margin: 0 14px 8px 52px;
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: 16px 16px 16px 6px;
  display: flex;
  gap: 4px;
  width: fit-content;
}
.typing[hidden] { display: none; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
  animation: blink 1.3s infinite;
}
.typing span:nth-child(2) { animation-delay: .18s; }
.typing span:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.inputbar {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin: 0 10px calc(76px + var(--safe-b));
  padding: 7px 7px 7px 12px;
  border-radius: 22px;
}
#chat-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  resize: none;
  max-height: 108px;
  padding: 7px 0;
  line-height: 1.5;
}
#chat-input::placeholder { color: var(--muted); }
.send-btn {
  width: 40px; height: 40px;
  border-radius: 14px;
  font-size: 17px;
  flex: none;
  display: grid; place-items: center;
  padding: 0;
}

.btn-primary {
  border: none;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 15px;
  box-shadow: 0 6px 18px var(--ring);
  transition: transform .12s ease, filter .12s ease;
}
.btn-primary:active { transform: scale(.97); filter: brightness(1.05); }
.btn-primary:disabled { opacity: .5; }

.btn-soft {
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 14px;
}
.btn-soft:active { transform: scale(.97); }

/* ---------- 空间 ---------- */
.moments-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px 96px; scrollbar-width: none; }
.moments-scroll::-webkit-scrollbar { display: none; }

.mood-card { border-radius: var(--r); padding: 14px 16px 8px; margin-bottom: 12px; }
.mood-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); }
.mood-head b { color: var(--primary); font-size: 15px; }
#mood-chart { width: 100%; height: 76px; display: block; }

.moment {
  border-radius: var(--r);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid color-mix(in srgb, var(--surface) 55%, transparent);
  padding: 14px 16px;
  margin-bottom: 11px;
  box-shadow: 0 6px 18px var(--shadow);
}
.moment .when { font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; }
.moment .body { margin-top: 7px; font-size: 14.6px; white-space: pre-wrap; word-break: break-word; }
.moment .tag {
  display: inline-block; margin-top: 9px; font-size: 11px;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent);
  padding: 2px 9px; border-radius: 99px;
}
.empty { text-align: center; color: var(--muted); font-size: 13.5px; padding: 40px 20px; line-height: 2; }

/* ---------- 宠物 ---------- */
.pet-stage {
  position: relative;
  flex: 1;
  min-height: 150px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.pet-halo {
  position: absolute;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 26%, transparent), transparent 68%);
  filter: blur(6px);
  animation: breathe 5s ease-in-out infinite;
}
@keyframes breathe { 0%,100% { transform: scale(1); opacity: .8; } 50% { transform: scale(1.08); opacity: 1; } }

.pet-mascot {
  position: relative;
  width: min(52vw, 210px);
  aspect-ratio: 1;
  border-radius: 32% 32% 34% 34% / 30% 30% 36% 36%;
  overflow: hidden;
  box-shadow: 0 18px 40px var(--shadow), 0 0 0 4px color-mix(in srgb, var(--surface) 70%, transparent);
  animation: float 4.6s ease-in-out infinite;
  transition: transform .2s ease;
}
.pet-mascot img { width: 100%; height: 100%; object-fit: cover; display: block; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-.6deg); }
  50% { transform: translateY(-12px) rotate(.6deg); }
}
.pet-mascot.happy { animation: hop .5s ease 2, float 4.6s ease-in-out infinite 1s; }
@keyframes hop { 0%,100% { transform: translateY(0) scale(1); } 40% { transform: translateY(-22px) scale(1.05); } 70% { transform: translateY(2px) scale(.98); } }
.pet-mascot.sleepy { filter: saturate(.85) brightness(.97); animation-duration: 8s; }
.pet-mascot.shake { animation: shake .45s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-7px) rotate(-2deg); } 75% { transform: translateX(7px) rotate(2deg); } }

.pet-bubble {
  position: absolute;
  top: 8%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  max-width: 78%;
  border-radius: 16px;
  padding: 9px 14px;
  font-size: 13.6px;
  animation: pop .22s ease;
  z-index: 3;
}
.pet-bubble[hidden] { display: none; }

.pet-fx { position: absolute; inset: 0; pointer-events: none; }
.fx-emoji {
  position: absolute;
  font-size: 22px;
  animation: fly 1.1s ease-out forwards;
}
@keyframes fly {
  0% { opacity: 0; transform: translateY(10px) scale(.6); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-96px) scale(1.15) rotate(12deg); }
}

.pet-stats { margin: 0 12px; border-radius: var(--r); padding: 13px 15px; display: grid; gap: 10px; }
.stat { display: grid; grid-template-columns: 84px 1fr 34px; align-items: center; gap: 9px; font-size: 12.5px; color: var(--muted); }
.stat b { text-align: right; color: var(--text); font-size: 13px; }
.bar { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--primary) 12%, transparent); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0%; border-radius: 99px; background: linear-gradient(90deg, var(--grad-a), var(--grad-b)); transition: width .45s cubic-bezier(.3,.9,.3,1); }
.bar.low i { background: linear-gradient(90deg, #f2b04a, #e0673f); }

.pet-actions { margin: 10px 12px calc(76px + var(--safe-b)); border-radius: var(--r); padding: 12px; }
.food-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.food {
  border: none;
  background: var(--soft);
  border-radius: 14px;
  padding: 8px 2px 6px;
  display: grid;
  gap: 2px;
  place-items: center;
  font-size: 10.5px;
  color: var(--muted);
  font-family: inherit;
  transition: transform .12s ease, background .2s ease;
}
.food .ico { font-size: 20px; line-height: 1; }
.food:active { transform: scale(.92); background: color-mix(in srgb, var(--primary) 14%, var(--soft)); }
.pet-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }

/* ---------- 设置 ---------- */
.settings-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px 96px; scrollbar-width: none; }
.settings-scroll::-webkit-scrollbar { display: none; }
.card { border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.card h3 { margin: 0 0 3px; font-size: 14.5px; font-weight: 650; }
.card-sub { margin: 0 0 12px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13px; color: var(--muted); border-bottom: 1px dashed color-mix(in srgb, var(--muted) 22%, transparent); }
.kv:last-of-type { border-bottom: none; margin-bottom: 10px; }
.kv b { color: var(--text); font-weight: 600; max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tone-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tone {
  border: 2px solid transparent;
  background: transparent;
  border-radius: 16px;
  padding: 6px 5px 5px;
  display: grid;
  gap: 6px;
  place-items: center;
  font-size: 11px;
  color: var(--muted);
  font-family: inherit;
  transition: transform .12s ease;
}
.tone img { width: 100%; aspect-ratio: 1; border-radius: 13px; object-fit: cover; box-shadow: 0 4px 10px var(--shadow); }
.tone .sw {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 13px;
  box-shadow: 0 4px 10px var(--shadow);
  display: block;
}
.tone.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, transparent); color: var(--text); font-weight: 600; }
.tone:active { transform: scale(.95); }

.chk { display: flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.chk input { accent-color: var(--primary); width: 16px; height: 16px; }

/* ---------- 底部导航 ---------- */
#tabbar {
  position: absolute;
  left: 10px; right: 10px;
  bottom: calc(10px + var(--safe-b));
  border-radius: 22px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px;
  z-index: 20;
}
#tabbar[hidden] { display: none; }
#tabbar button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 10.5px;
  display: grid;
  gap: 1px;
  place-items: center;
  padding: 6px 0 5px;
  border-radius: 16px;
  transition: color .18s ease, background .18s ease;
}
#tabbar button .tab-ico { font-size: 18px; line-height: 1.15; filter: grayscale(.4); transition: filter .18s ease, transform .18s ease; }
#tabbar button.on { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); font-weight: 650; }
#tabbar button.on .tab-ico { filter: none; transform: translateY(-1px); }

/* ---------- 配对页 ---------- */
#view-pair { padding: 24px 18px; justify-content: center; align-items: center; }
.pair-card {
  width: 100%;
  max-width: 400px;
  border-radius: 26px;
  padding: 26px 22px 22px;
  text-align: center;
}
.pair-avatar {
  width: 84px; height: 84px; border-radius: 26px; object-fit: cover;
  box-shadow: 0 12px 26px var(--shadow);
  margin-bottom: 12px;
}
.pair-card h1 { margin: 0; font-size: 22px; letter-spacing: 1px; }
.pair-sub { color: var(--muted); font-size: 13px; line-height: 1.75; margin: 8px 0 18px; }
.pair-card label {
  display: block;
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 11px;
}
.pair-card input {
  width: 100%;
  margin-top: 5px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 16%, transparent);
  background: var(--soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.pair-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.pair-card .btn-primary { width: 100%; margin-top: 6px; }
.pair-hint { color: var(--muted); font-size: 11.5px; line-height: 1.8; margin: 14px 0 0; }
.pair-err { color: #d8534f; font-size: 12.5px; margin: 10px 0 0; line-height: 1.75; white-space: pre-line; word-break: break-word; }

/* 下载条：只在手机浏览器里出现（app 壳里有 __pocketApp / PocketMic 标记，不显示）；
   右上角有关闭按钮，关过就记在 localStorage，不再骚扰 */
.appdl {
  margin: 10px 12px 0;
  padding: 12px 40px 12px 14px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.appdl-x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.appdl-x:active { background: rgba(128, 128, 128, 0.18); }
.appdl-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.appdl-text b { font-size: 13.5px; }
.appdl-text span { color: var(--muted); font-size: 12px; line-height: 1.7; }
.appdl-text .appdl-note { color: #c08a2d; }
.appdl-btn {
  flex-shrink: 0;
  text-decoration: none;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 12px;
  white-space: nowrap;
  /* 版本号走第二行小字：写进括号里会把按钮撑出屏幕（窄屏上没法收） */
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.25;
}
.appdl-btn i { font-style: normal; font-size: 10.5px; opacity: .85; }
.appdl-btn i:empty { display: none; }
.appdl-btn[hidden] { display: none; }

/* 代号速查（配对页折叠表）：报错时命中的那几条自动展开、标红 */
.pair-codes { margin: 6px 0 0; }
.pair-codes:empty { display: none; }
.code-wrap > summary { cursor: pointer; color: var(--muted); font-size: 12px; padding: 8px 0; list-style: none; }
.code-wrap > summary::-webkit-details-marker { display: none; }
.code-wrap > summary::before { content: '▸ '; }
.code-wrap[open] > summary::before { content: '▾ '; }
.code-row { border-left: 2px solid rgba(128, 128, 128, 0.28); margin: 5px 0 5px 2px; padding: 1px 0 1px 8px; }
.code-row > summary { cursor: pointer; font-size: 12px; line-height: 1.9; color: var(--fg, inherit); }
.code-row > p { margin: 3px 0; color: var(--muted); font-size: 11.5px; line-height: 1.7; }
.code-row > p i { font-style: normal; opacity: 0.75; }
.code-row.hit { border-left-color: #d8534f; background: rgba(216, 83, 79, 0.07); border-radius: 0 6px 6px 0; }
.code-row.hit > summary { color: #d8534f; font-weight: 600; }

/* 离线提示条 */
#offline {
  position: absolute;
  top: calc(6px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  background: #d8534f;
  color: #fff;
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 99px;
  z-index: 40;
  box-shadow: 0 6px 18px rgba(216, 83, 79, .35);
}
#offline[hidden] { display: none; }

/* ---------- 图片 / 语音 / emoji ---------- */
.bubble-img {
  display: block;
  max-width: min(220px, 100%);
  max-height: 260px;
  border-radius: 12px;
  margin-bottom: 4px;
  cursor: zoom-in;
  object-fit: cover;
}
.bubble-img:only-child { margin-bottom: 0; }

/* 待发图片：输入栏上方的一条，占文档流（不用 absolute，免得盖住输入栏） */
.img-preview {
  flex: none;
  margin: 0 10px 8px;
  padding: 6px 8px 6px 6px;
  border-radius: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  animation: pop .2s ease;
}
.img-preview[hidden] { display: none; }
.img-preview img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 9px;
  background: var(--soft);
  flex: none;
}
.img-preview .pv-meta { flex: 1; min-width: 0; }
.img-preview .pv-meta b { display: block; font-size: 12.5px; font-weight: 600; }
.img-preview .pv-meta small { color: var(--muted); font-size: 11px; }
.chip-btn {
  border: none;
  background: var(--primary);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 13px;
  flex: none;
  display: grid;
  place-items: center;
}

.rec-indicator {
  flex: none;
  align-self: center;
  margin: 0 auto 8px;
  padding: 7px 14px;
  border-radius: 99px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.rec-indicator[hidden] { display: none; }
.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e5484d;
  animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: .25; } }

.emoji-panel {
  flex: none;
  margin: 0 10px 8px;
  padding: 8px;
  border-radius: 16px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 168px;
  overflow-y: auto;
  animation: pop .18s ease;
}
.emoji-panel[hidden] { display: none; }
.emoji-item {
  border: none;
  background: transparent;
  font-size: 22px;
  padding: 5px 0;
  border-radius: 10px;
  line-height: 1.2;
}
.emoji-item:active { background: var(--ring); transform: scale(1.15); }

.inputbar .icon-btn { flex: none; width: 30px; height: 30px; font-size: 15px; }
/* 按住说话：手指移动不能变成滚页，否则松手事件会丢 */
#chat-mic { touch-action: none; -webkit-user-select: none; user-select: none; }
#chat-mic.recording { background: var(--primary); color: #fff; }

/* ---------- 换形象 ---------- */
.pet-avatar-btn {
  position: absolute;
  right: 14px;
  bottom: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 16px;
  display: grid;
  place-items: center;
  padding: 0;
  z-index: 5;
  opacity: .9;
}
.pet-avatar-btn:active { transform: scale(.92); }

.avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}
.avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  object-fit: cover;
  flex: none;
  background: var(--soft);
  box-shadow: 0 4px 14px var(--shadow);
}
.avatar-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-btns .btn-soft { padding: 8px 13px; font-size: 13px; }

/* ---------- 浮动提示 ---------- */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(92px + var(--safe-b));
  transform: translate(-50%, 8px);
  padding: 9px 16px;
  border-radius: 99px;
  font-size: 13px;
  color: var(--text);
  max-width: 82%;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 95;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
