/* ============================================================
   蓝鲸 · 她的窗口 — 样式
   深海蓝夜色，一个只属于主人的房间。
   移动优先（390px），安全区、键盘、桌面侧栏、减少动效。
   ============================================================ */

/* ---------- 0. 设计 token ---------- */
:root {
  --sea-0: #071224;
  --sea-1: #0b1a33;
  --sea-2: #0f2444;
  --sea-3: #14304f;

  --her: #7fb8ff;          /* 她的蓝 */
  --her-deep: #2b5cff;
  --foam: #eaf3ff;         /* 泡沫白 */
  --cream: #f7efe2;        /* 饭碗米白 */
  --ink: #e6f0ff;
  --dim: #93aacb;
  --dim-2: #6d86a8;

  --line: rgba(127, 184, 255, .14);
  --line-strong: rgba(127, 184, 255, .24);
  --warm: #ffc48a;
  --bad: #ffb4a3;

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;

  --whale-body: #7fb8ff;
  --whale-fin: #2b5cff;
  --whale-belly: #eaf3ff;
  --whale-spout: #a9d0ff;

  --shadow-soft: 0 10px 30px rgba(0, 0, 0, .32);
  --ease: cubic-bezier(.22, .68, .36, 1);
}

/* ---------- 1. 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--sea-0);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

::selection { background: rgba(127, 184, 255, .3); color: #fff; }

:focus-visible {
  outline: 2px solid rgba(127, 184, 255, .75);
  outline-offset: 2px;
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
h1, h2, h3 { font-weight: 500; }

/* 整页的深海底色与光晕 */
body::before {
  content: "";
  position: fixed;
  inset: -20% -10% -10%;
  z-index: -2;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(43, 92, 255, .22), transparent 60%),
    radial-gradient(90% 60% at 12% 112%, rgba(20, 90, 160, .26), transparent 62%),
    linear-gradient(180deg, #0d2244 0%, var(--sea-1) 42%, var(--sea-0) 100%);
}

/* 极淡的星尘，只在桌面端出现，避免手机上浪费帧 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .5;
  background-image:
    radial-gradient(1px 1px at 18% 22%, rgba(234, 243, 255, .55), transparent 60%),
    radial-gradient(1px 1px at 72% 14%, rgba(234, 243, 255, .4), transparent 60%),
    radial-gradient(1px 1px at 84% 62%, rgba(234, 243, 255, .3), transparent 60%),
    radial-gradient(1px 1px at 32% 78%, rgba(234, 243, 255, .28), transparent 60%);
}

/* ---------- 2. 小鲸鱼（character 模块缺失时的兜底） ---------- */
.whale { display: block; width: 100%; height: 100%; overflow: visible; }

.whale .whale-spout { animation: spout 5.2s var(--ease) infinite; }
.whale .whale-tail { animation: tail 4.4s ease-in-out infinite; transform-origin: 47px 34.5px; }

@keyframes tail {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(4deg) translateY(-1px); }
}
@keyframes spout {
  0%, 62%, 100% { opacity: 0; transform: translateY(1px); }
  72% { opacity: .8; }
  86% { opacity: 0; transform: translateY(-3px); }
}

/* ---------- 3. 启动占位 ---------- */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--dim);
  font-size: 13px;
  letter-spacing: .08em;
}
.boot-whale { width: 74px; height: 74px; animation: bob 4.4s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-6px) rotate(1.5deg); }
}

/* ---------- 4. 连接页 ---------- */
.gate {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding:
    calc(28px + var(--safe-top))
    calc(22px + var(--safe-right))
    calc(34px + var(--safe-bottom))
    calc(22px + var(--safe-left));
  display: flex;
  justify-content: center;
}

.gate-inner {
  width: 100%;
  max-width: 420px;
  margin: auto;
  text-align: center;
}

.gate-art {
  position: relative;
  width: 148px;
  height: 148px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
}
.gate-art::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 55%, rgba(43, 92, 255, .38), transparent 68%);
  filter: blur(6px);
}
.gate-whale {
  position: relative;
  width: 118px;
  height: 118px;
  animation: bob 6s ease-in-out infinite;
  filter: drop-shadow(0 12px 22px rgba(43, 92, 255, .35));
}
.bub {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(234, 243, 255, .5), rgba(127, 184, 255, .06) 70%);
  border: 1px solid rgba(180, 216, 255, .18);
  animation: rise 9s linear infinite;
}
.b1 { width: 9px; height: 9px; left: 12%; bottom: 18%; animation-delay: -1s; }
.b2 { width: 6px; height: 6px; left: 76%; bottom: 26%; animation-delay: -4.5s; }
.b3 { width: 13px; height: 13px; left: 62%; bottom: 4%; animation-delay: -7s; }
@keyframes rise {
  0% { transform: translateY(6px); opacity: 0; }
  20% { opacity: .85; }
  100% { transform: translateY(-96px); opacity: 0; }
}

.gate-kicker {
  font-size: 10.5px;
  letter-spacing: .38em;
  text-indent: .38em;
  color: #7fa6d4;
  margin-bottom: 8px;
}
.gate-title {
  font-size: 40px;
  font-weight: 200;
  letter-spacing: .1em;
  text-indent: .1em;
  color: #f2f8ff;
  text-shadow: 0 0 34px rgba(127, 184, 255, .45);
}
.gate-sub {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.95;
  color: var(--dim);
}

.gate-form { margin-top: 26px; text-align: left; }

.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 11.5px;
  letter-spacing: .06em;
  color: var(--dim-2);
  margin: 0 0 7px 3px;
}
.field-row { display: flex; gap: 8px; align-items: stretch; }
.field-row .input { flex: 1 1 auto; min-width: 0; }

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: rgba(6, 18, 38, .72);
  color: var(--foam);
  font-size: 15px;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.input::placeholder { color: #5d7796; }
.input:focus {
  outline: none;
  border-color: rgba(127, 184, 255, .55);
  background: rgba(10, 26, 50, .88);
  box-shadow: 0 0 0 3px rgba(43, 92, 255, .14);
}

.primary-btn {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 14px;
  color: #f6faff;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .06em;
  background: linear-gradient(165deg, #3a6bff, #1d43cf);
  box-shadow: 0 12px 26px rgba(29, 67, 207, .38), inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: transform .14s var(--ease), filter .18s var(--ease);
}
.primary-btn:active { transform: scale(.985); }
.primary-btn:disabled { filter: grayscale(.25) brightness(.85); opacity: .7; }

.ghost-btn {
  flex: 0 0 auto;
  height: 46px;
  padding: 0 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: rgba(127, 184, 255, .07);
  color: var(--her);
  font-size: 12.5px;
  white-space: nowrap;
}
.ghost-btn:active { background: rgba(127, 184, 255, .14); }

.gate-msg {
  min-height: 22px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--bad);
  padding: 0 3px;
  margin-bottom: 10px;
  white-space: pre-line;
}
.gate-msg.ok { color: #9fe6c6; }

.gate-fine {
  margin-top: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--dim-2);
}

/* ---------- 5. 房间骨架 ---------- */
.shell {
  position: fixed;
  inset: 0;
  height: var(--app-h, 100dvh);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(240px, 32vh) minmax(0, 1fr) auto auto auto;
  grid-template-areas:
    "top"
    "net"
    "hero"
    "main"
    "note"
    "composer"
    "tabs";
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* ---------- 5.5 她的舞台（常驻上三分之一） ---------- */
.hero {
  grid-area: hero;
  position: relative;
  min-height: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 90% at 50% 8%, rgba(43, 92, 255, .18), transparent 62%),
    linear-gradient(180deg, rgba(9, 22, 44, .2), rgba(7, 18, 36, .55));
  border-bottom: 1px solid rgba(127, 184, 255, .07);
}
.hero canvas { width: 100%; height: 100%; display: block; }
/* 舞台上要自己接管手势：不交给浏览器的滚动/缩放，否则划到一半会 pointercancel */
.hero, .hero canvas { touch-action: none; }
.hero-tip {
  position: absolute; bottom: 8px; right: 12px;
  font-size: 10px; letter-spacing: .14em; color: rgba(169, 198, 232, .55);
  pointer-events: none; transition: opacity .5s ease;
}
.hero-tip.gone { opacity: 0; }
.hero-feed {
  position: absolute; left: 12px; bottom: 10px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(127, 184, 255, .22);
  background: rgba(13, 30, 57, .72);
  font-size: 20px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  backdrop-filter: blur(6px);
}
.hero-feed:active { transform: scale(.94); }
@media (min-width: 860px) {
  .hero { display: none; }
}

/* ---------- 6. 顶栏 ---------- */
.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(9px + var(--safe-top)) 14px 9px;
  background: linear-gradient(180deg, rgba(7, 18, 36, .92), rgba(7, 18, 36, .5));
  border-bottom: 1px solid rgba(127, 184, 255, .08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.portrait {
  position: relative;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 34%, rgba(127, 184, 255, .3), rgba(11, 26, 51, .9) 70%);
  box-shadow: inset 0 0 0 1px rgba(127, 184, 255, .22), 0 4px 14px rgba(0, 0, 0, .3);
}
.portrait canvas {
  display: none;
  width: 90%;
  height: 90%;        /* 留一点边，角色不会被圆形裁掉 */
  border-radius: 50%;
}
.portrait.has-character canvas { display: block; }
.portrait.has-character .portrait-fallback { display: none; }
.portrait-fallback { width: 29px; height: 29px; animation: bob 5.4s ease-in-out infinite; }
.portrait[data-state="thinking"] .portrait-fallback { animation-duration: 1.7s; }
.portrait[data-state="speaking"] .portrait-fallback { animation-duration: 2.4s; }

.who { flex: 1 1 auto; min-width: 0; }
.who-row { display: flex; align-items: center; gap: 7px; }
#herName {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .04em;
  color: #f2f8ff;
  white-space: nowrap;
}

.mood {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #b7d3f5;
  background: rgba(127, 184, 255, .1);
  border: 1px solid rgba(127, 184, 255, .16);
  white-space: nowrap;
}
.mood[data-mood="warm"] { color: #ffd9a8; background: rgba(255, 190, 120, .12); border-color: rgba(255, 190, 120, .22); }
.mood[data-mood="cool"] { color: #b9c6d8; background: rgba(160, 180, 210, .1); border-color: rgba(160, 180, 210, .18); }
.mood[data-mood="sleepy"] { color: #cdbcff; background: rgba(150, 120, 255, .12); border-color: rgba(150, 120, 255, .22); }
.mood[data-mood="sad"] { color: #ffc4cc; background: rgba(255, 140, 160, .1); border-color: rgba(255, 140, 160, .2); }
.mood[data-mood="curious"] { color: #9fe3ff; background: rgba(110, 210, 255, .1); border-color: rgba(110, 210, 255, .2); }

.conn-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7ee2b8;
  box-shadow: 0 0 8px rgba(126, 226, 184, .8);
  transition: background .3s var(--ease), box-shadow .3s var(--ease);
}
html[data-net="offline"] .conn-dot { background: #ffb37a; box-shadow: 0 0 8px rgba(255, 179, 122, .7); }
html[data-net="connecting"] .conn-dot { background: #6d86a8; box-shadow: none; }

.thought {
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--dim-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 15px;
  transition: opacity .4s var(--ease);
}
.thought.is-fresh { color: #a9c6e8; }

.vitals {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 46px auto;
  align-items: center;
  gap: 6px;
}
.vitals-label { font-size: 10px; color: var(--dim-2); }
.vitals-val { font-size: 10px; color: var(--dim); font-variant-numeric: tabular-nums; min-width: 24px; text-align: right; }
.bar {
  display: block;
  width: 46px;
  height: 5px;
  border-radius: 999px;
  background: rgba(127, 184, 255, .12);
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2b5cff, #7fb8ff);
  transition: width .8s var(--ease), background .4s var(--ease);
}
.bar-fill[data-level="mid"] { background: linear-gradient(90deg, #3a6bff, #9fc4ff); }
.bar-fill[data-level="low"] { background: linear-gradient(90deg, #8a6bd8, #c9b6ff); }

/* ---------- 7. 标签栏（手机在底部，桌面变侧栏） ---------- */
.tabs {
  grid-area: tabs;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
  padding: 6px 4px calc(6px + var(--safe-bottom));
  background: rgba(6, 16, 32, .9);
  border-top: 1px solid rgba(127, 184, 255, .09);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 46px;
  padding: 4px 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--dim-2);
  font-size: 10px;
  letter-spacing: .02em;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.tab svg { width: 21px; height: 21px; }
.tab:active { background: rgba(127, 184, 255, .07); }
.tab.is-active { color: var(--her); }
.tab.is-active::before {
  content: "";
  position: absolute;
  top: -7px;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--her), transparent);
}

.pulse-dot {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffb37a;
  box-shadow: 0 0 0 2px rgba(6, 16, 32, .9), 0 0 10px rgba(255, 179, 122, .8);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(.78); opacity: .6; }
}

/* ---------- 8. 面板 ---------- */
.panes { grid-area: main; min-height: 0; display: flex; }

.pane {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.pane-chat { overflow: hidden; }

.pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 6px;
}
.pane-head h2 {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .1em;
  color: #dbe9ff;
}

.mini-btn {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(127, 184, 255, .06);
  color: var(--dim);
  font-size: 11.5px;
}
.mini-btn:active { background: rgba(127, 184, 255, .14); color: var(--her); }

/* ---------- 9. 断线横幅（不打断，只提示） ---------- */
.netbanner {
  grid-area: net;
  margin: 8px 12px 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 14px;
  background: rgba(255, 168, 120, .09);
  border: 1px solid rgba(255, 168, 120, .2);
  color: #ffd9c2;
  font-size: 11.5px;
  animation: slide-in .3s var(--ease);
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.netbanner-dot {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffb37a;
  animation: pulse 2s ease-in-out infinite;
}
.netbanner-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.netbanner-text strong { font-weight: 500; color: #ffcdaa; font-size: 12px; }
.netbanner-text span { color: #c9a68f; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.netbanner .mini-btn { border-color: rgba(255, 168, 120, .28); background: rgba(255, 168, 120, .1); color: #ffd0ae; }

/* ---------- 10. 聊天流 ---------- */
.stream {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 10px 13px 16px;
  display: flex;
  flex-direction: column;
}
/* 消息少的时候贴着输入框，不飘在半空；多了这条 margin 会自己归零 */
.stream::before { content: ""; flex: 0 0 0; margin-top: auto; }
.stream:has(.empty)::before { display: none; }

.daydiv {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 2px 2px;
  font-size: 10.5px;
  letter-spacing: .14em;
  color: #5c7595;
}
.daydiv::before, .daydiv::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(127, 184, 255, .14), transparent);
}

.msg {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  margin-top: 9px;
  animation: msg-in .26s var(--ease) both;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg.her { justify-content: flex-start; }
.msg.action { justify-content: center; margin-top: 12px; }
.msg.action .action-pill {
  font-size: 12px; line-height: 1.5; color: var(--dim-2, #7f93b3);
  padding: 3px 12px; border-radius: 999px;
  border: 1px dashed rgba(127, 184, 255, .22);
  background: rgba(127, 184, 255, .05);
  letter-spacing: .02em;
}
.msg.me { justify-content: flex-end; }

.avatar {
  flex: 0 0 25px;
  width: 25px;
  height: 25px;
  margin-bottom: 15px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 42% 34%, rgba(127, 184, 255, .26), rgba(9, 22, 44, .95) 72%);
  box-shadow: inset 0 0 0 1px rgba(127, 184, 255, .18);
}
.avatar svg { width: 18px; height: 18px; }

.stack { display: flex; flex-direction: column; max-width: min(78%, 560px); min-width: 0; }
.msg.me .stack { align-items: flex-end; }

.bubble {
  padding: 10px 13px;
  border-radius: var(--r-md);
  font-size: 15px;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.msg.her .bubble {
  border-top-left-radius: 6px;
  color: #e8f2ff;
  background: linear-gradient(178deg, rgba(23, 52, 94, .92), rgba(14, 34, 66, .92));
  border: 1px solid rgba(127, 184, 255, .16);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
}
.msg.me .bubble {
  border-top-right-radius: 6px;
  color: #f4f9ff;
  background: linear-gradient(160deg, #3a6bff, #1d43cf);
  box-shadow: 0 8px 20px rgba(29, 67, 207, .3), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.msg.me .bubble.unsent { opacity: .62; }

.meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 4px 4px 0;
  font-size: 10px;
  color: #59718f;
}
.msg.me .meta { justify-content: flex-end; }

.tag {
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 9.5px;
  color: #9dc4f6;
  background: rgba(127, 184, 255, .1);
  border: 1px solid rgba(127, 184, 255, .14);
}
.tag.dim { color: #6d86a8; border-color: transparent; background: transparent; }

.resend {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 10px;
  color: var(--bad);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.typing .bubble { display: flex; gap: 4px; align-items: center; padding: 13px 15px; }
.typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #9dc4f6;
  animation: dot 1.3s ease-in-out infinite;
}
.typing i:nth-child(2) { animation-delay: .16s; }
.typing i:nth-child(3) { animation-delay: .32s; }
@keyframes dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.empty {
  margin: auto;
  padding: 24px 18px;
  text-align: center;
  color: var(--dim-2);
  font-size: 12.5px;
  line-height: 2;
}
.empty .whale { width: 56px; height: 56px; margin: 0 auto 10px; opacity: .8; }

/* ---------- 11. 输入区 ---------- */
.note {
  grid-area: note;
  margin: 0;
  padding: 0 16px 6px;
  font-size: 11.5px;
  line-height: 1.6;
  color: #ffc9ab;
  text-align: center;
}

.composer {
  grid-area: composer;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px 10px;
  background: linear-gradient(180deg, rgba(7, 18, 36, 0), rgba(7, 18, 36, .82) 38%);
}

.ta {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
  min-height: 46px;
  max-height: 132px;
  padding: 12px 14px;
  border-radius: 20px;
  resize: none;
  line-height: 1.5;
  font-size: 15px;
  background: rgba(11, 27, 52, .92);
  border: 1px solid var(--line);
}
.ta:focus { border-color: rgba(127, 184, 255, .42); box-shadow: 0 0 0 3px rgba(43, 92, 255, .1); }

.send-btn {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #f5f9ff;
  background: linear-gradient(160deg, #3a6bff, #1d43cf);
  box-shadow: 0 8px 20px rgba(29, 67, 207, .35), inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform .14s var(--ease), opacity .18s var(--ease);
}
.send-btn svg { width: 21px; height: 21px; margin-left: -1px; }
.send-btn:active { transform: scale(.94); }
.send-btn:disabled { opacity: .4; box-shadow: none; }

/* 非聊天面板不显示输入区 */
body[data-pane="diary"] .composer,
body[data-pane="life"] .composer,
body[data-pane="settings"] .composer { display: none; }

/* ---------- 12. 日记 ---------- */
.days {
  flex: 0 0 auto;
  display: flex;
  gap: 7px;
  padding: 6px 14px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.days::-webkit-scrollbar { display: none; }

.day {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(15, 36, 68, .55);
  color: var(--dim);
  font-size: 11.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.day.is-active {
  color: #0a1a30;
  background: linear-gradient(160deg, #a9d0ff, #7fb8ff);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(127, 184, 255, .28);
}

.paper {
  flex: 1 1 auto;
  margin: 0 14px 20px;
  padding: 20px 18px 30px;
  border-radius: 20px;
  background: linear-gradient(178deg, #fbf7ee, #f3ebdb);
  color: #33302b;
  font-size: 14.5px;
  line-height: 1.85;
  box-shadow: inset 0 0 0 1px rgba(60, 45, 20, .07), var(--shadow-soft);
  overflow-y: auto;
  overscroll-behavior: contain;
  background-image:
    linear-gradient(178deg, #fbf7ee, #f3ebdb),
    repeating-linear-gradient(180deg, transparent 0 27px, rgba(120, 96, 60, .07) 27px 28px);
}
.paper > * + * { margin-top: .72em; }
.paper h2, .paper h3, .paper h4 {
  font-weight: 600;
  line-height: 1.5;
  color: #2a2723;
  letter-spacing: .02em;
}
.paper h2 { font-size: 17px; }
.paper h3 { font-size: 15px; }
.paper h4 { font-size: 14px; }
.paper blockquote {
  margin-left: 0;
  margin-right: 0;
  padding: 2px 0 2px 12px;
  border-left: 3px solid #d9c9a8;
  color: #5f574a;
}
.paper ul, .paper ol { padding-left: 1.3em; }
.paper li + li { margin-top: .3em; }
.paper hr { border: 0; height: 1px; background: rgba(90, 70, 40, .18); margin: 1.1em 0; }
.paper code {
  padding: .1em .35em;
  border-radius: 5px;
  background: rgba(90, 70, 40, .1);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: .9em;
}
.paper pre.md-code {
  padding: 12px;
  border-radius: 10px;
  background: rgba(45, 38, 28, .92);
  color: #f2ead9;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.6;
}
.paper pre.md-code code { background: none; padding: 0; color: inherit; }
.paper a { color: #2b5cff; text-decoration: underline dotted; }
.pane-state.diary-state {
  padding: 6px 20px 26px;
  max-width: 620px;
}
.diary-state p { font-size: 12.5px; line-height: 2; color: var(--dim); }
.diary-state .mini-btn { margin-top: 14px; height: 32px; padding: 0 14px; }

/* ---------- 13. 她的人生 ---------- */
.timeline {
  list-style: none;
  padding: 6px 16px 30px;
  margin: 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 14px;
  bottom: 24px;
  width: 1px;
  background: linear-gradient(180deg, rgba(127, 184, 255, .3), rgba(127, 184, 255, .04));
}
.tl-item {
  position: relative;
  padding: 0 0 18px 26px;
}
.tl-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 8px;
  height: 8px;
  margin-left: 3px;
  border-radius: 50%;
  background: var(--her);
  box-shadow: 0 0 0 3px rgba(127, 184, 255, .12);
}
.tl-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  color: var(--dim-2);
  font-variant-numeric: tabular-nums;
}
.kind {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 9.5px;
  color: #a9c6e8;
  background: rgba(127, 184, 255, .09);
  border: 1px solid rgba(127, 184, 255, .14);
}
.tl-text {
  margin-top: 5px;
  font-size: 13.5px;
  line-height: 1.7;
  color: #d5e4f8;
  overflow-wrap: anywhere;
}
.pane-state {
  padding: 22px 18px;
  color: var(--dim-2);
  font-size: 12.5px;
  line-height: 1.9;
}

/* ---------- 14. 设置 ---------- */
.pane-settings { padding-bottom: 26px; }

.card {
  margin: 10px 14px 0;
  padding: 15px 16px;
  border-radius: 18px;
  background: rgba(13, 30, 56, .62);
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .16);
}
.card h3 {
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--dim-2);
  margin-bottom: 12px;
  text-transform: uppercase;
}
.card .field:last-of-type { margin-bottom: 4px; }
.card .input { height: 44px; font-size: 14px; }
.card .ghost-btn { height: 44px; }

.btn-row { display: flex; gap: 9px; margin-top: 4px; }
.btn-row .primary-btn { flex: 1 1 auto; height: 44px; font-size: 14px; }
.btn-row .ghost-btn { flex: 0 0 auto; }

.msg-line {
  min-height: 18px;
  margin-top: 10px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--dim);
}
.msg-line.bad { color: var(--bad); }
.msg-line.ok { color: #9fe6c6; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  color: #cfe0f7;
  padding: 4px 0 10px;
}
.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: rgba(127, 184, 255, .16);
  border: 1px solid var(--line-strong);
  transition: background .2s var(--ease);
  margin: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dce9fb;
  transition: transform .2s var(--ease);
}
.switch:checked { background: linear-gradient(160deg, #3a6bff, #1d43cf); }
.switch:checked::after { transform: translateX(18px); }

.fine {
  margin-top: 10px;
  font-size: 11px;
  line-height: 1.75;
  color: var(--dim-2);
}

.facts { display: grid; gap: 9px; }
.facts > div { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.facts dt { color: var(--dim-2); flex: 0 0 auto; }
.facts dd { color: #cfdff5; text-align: right; overflow-wrap: anywhere; }

/* ---------- 15. 桌面：她的房间变成一间屋子 ---------- */
@media (min-width: 860px) {
  .shell {
    position: relative;
    inset: auto;
    height: 100dvh;
    max-width: 1180px;
    margin: 0 auto;
    grid-template-columns: 104px minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "tabs top"
      "tabs net"
      "tabs main"
      "tabs note"
      "tabs composer";
    box-shadow: 0 0 0 1px rgba(127, 184, 255, .07), 0 30px 80px rgba(0, 0, 0, .5);
  }

  .topbar { padding: 16px 26px 14px; }
  .portrait { flex-basis: 44px; width: 44px; height: 44px; }
  .portrait-fallback { width: 31px; height: 31px; }
  #herName { font-size: 19px; }
  .thought { font-size: 12px; }
  .vitals { grid-template-columns: auto 66px auto; }
  .bar { width: 66px; height: 6px; }

  .tabs {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(6, auto);
    align-content: start;
    gap: 6px;
    padding: 22px 10px;
    background: rgba(6, 16, 32, .55);
    border-top: 0;
    border-right: 1px solid rgba(127, 184, 255, .08);
  }
  .tab {
    min-height: 62px;
    gap: 6px;
    font-size: 11px;
    border-radius: 14px;
  }
  .tab svg { width: 23px; height: 23px; }
  .tab.is-active { background: rgba(127, 184, 255, .09); }
  .tab.is-active::before {
    top: 50%;
    left: -10px;
    width: 2px;
    height: 22px;
    margin-top: -11px;
    background: linear-gradient(180deg, transparent, var(--her), transparent);
  }
  .pulse-dot { top: 12px; right: calc(50% - 20px); }

  .stream { padding: 16px 30px 22px; }
  .bubble { font-size: 15.5px; }
  .composer { padding: 10px 26px 18px; }
  .ta { max-width: 100%; }
  .note { padding: 0 26px 8px; }
  .pane-head { padding: 20px 28px 8px; }
  .days { padding: 4px 28px 12px; }
  .paper { margin: 0 28px 26px; padding: 26px 30px 40px; font-size: 15px; }
  .timeline { padding: 6px 30px 34px; }
  .card { margin: 12px 28px 0; }
}

@media (min-width: 1180px) {
  body::before { background:
    radial-gradient(100% 60% at 50% -10%, rgba(43, 92, 255, .18), transparent 62%),
    radial-gradient(80% 60% at 10% 112%, rgba(20, 90, 160, .22), transparent 60%),
    linear-gradient(180deg, #0a1c39 0%, #08152b 55%, #060f1f 100%);
  }
}

/* ---------- 16. 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

html[data-motion="reduce"] *,
html[data-motion="reduce"] *::before,
html[data-motion="reduce"] *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  scroll-behavior: auto !important;
}
html[data-motion="reduce"] .stream { scroll-behavior: auto; }

/* ---------- 17. 极窄屏（< 360）与横屏 ---------- */
@media (max-width: 359px) {
  .vitals-label { display: none; }
  .vitals { grid-template-columns: 38px auto; }
  .bar { width: 38px; }
  #herName { font-size: 16px; }
  .bubble { font-size: 14.5px; }
}

@media (max-height: 460px) and (orientation: landscape) {
  .portrait { flex-basis: 30px; width: 30px; height: 30px; }
  .portrait-fallback { width: 22px; height: 22px; }
  .thought { display: none; }
  .tab { min-height: 38px; }
}

/* ---------- 她知道的 ---------- */
.know-list { list-style: none; margin: 0; padding: 0 14px 24px; display: flex; flex-direction: column; gap: 12px; }
.know-item { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; padding: 14px 15px; border-radius: 16px; background: rgba(20, 38, 68, .72); border: 1px solid rgba(127, 184, 255, .14); }
.know-top { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; }
.know-top h3 { margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: 15px; font-weight: 600; line-height: 1.45; color: var(--ink); }
.know-badge { flex: none; font-size: 10px; padding: 2px 7px; border-radius: 999px; border: 1px solid rgba(127, 184, 255, .35); color: #9cc4ff; }
.know-badge[data-kind="没查到"] { border-color: rgba(255, 170, 120, .35); color: #ffb38a; }
.know-badge[data-kind="推测的"] { border-color: rgba(255, 220, 130, .35); color: #ffe08a; }
.know-facts { margin: 8px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.7; color: rgba(230, 240, 255, .82); }
.know-take { margin: 8px 0 0; font-size: 12.5px; line-height: 1.65; color: rgba(230, 240, 255, .62); }
.know-meta { margin: 8px 0 0; font-size: 11px; color: rgba(230, 240, 255, .38); }

.tab span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 她知道的：防溢出 */
.tabs { width: 100%; box-sizing: border-box; }
.tab { min-width: 0; }
.pane-knowledge { overflow-x: hidden; }
.know-list { width: 100%; box-sizing: border-box; }
.know-item { width: 100%; box-sizing: border-box; }
.know-item * { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }

html, body { max-width: 100vw; overflow-x: hidden; }
#app, .room { max-width: 100vw; }
.tab span { font-size: 9.5px; }

@media (max-width: 859px) {
  .tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 1 0 0; min-width: 54px; }
}

/* 长按抱抱：禁止文本选择/系统长按菜单抢手势 */
.hero, .hero canvas, #heroBox, #portraitBox, #portrait {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}

/* 角色遮罩：手势只落在她身上，不碰后面的文字 */
.hero-mask {
  position: absolute; inset: 0; z-index: 2; background: transparent;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.hero-tip { z-index: 3; pointer-events: none; }
.hero-feed { z-index: 4; }

.composer { position: relative; }
.send-btn.is-plus {
  background: rgba(16, 32, 58, .92);
  border: 1px solid rgba(127, 184, 255, .28);
  box-shadow: none;
  color: #9cc4ff;
}
.send-btn.is-plus .send-ico { font-size: 24px; font-weight: 400; }
.msg-media { display: block; max-width: 100%; max-height: 320px; border-radius: 12px; margin: 2px 0; background: #081428; }
.bubble video.msg-media { width: 100%; }

.speak-btn { border: 1px solid rgba(127,184,255,.25); background: transparent; color: #9cc4ff; border-radius: 999px; font-size: 10px; padding: 1px 7px; margin-left: 6px; }

.send-ico { font-size: 22px; line-height: 1; font-weight: 600; transform: translateY(-1px); }


/* ---------- 17. 棋：和小鲸鱼下一盘 ---------- */
.pane-chess { overflow-y: auto; }
.chess-layout {
  flex: 1 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 12px calc(18px + var(--safe-bottom));
}
.chess-main {
  width: 100%;
  max-width: 520px;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.chess-her { display: flex; align-items: flex-start; gap: 9px; }
.chess-face {
  position: relative;
  flex: 0 0 42px;
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 38% 32%, rgba(127,184,255,.32), rgba(11,26,51,.92) 72%);
  box-shadow: inset 0 0 0 1px rgba(127,184,255,.22), 0 4px 14px rgba(0,0,0,.28);
}
.chess-face svg { width: 30px; height: 30px; animation: bob 5.4s ease-in-out infinite; }
.chess-face[data-state="think"] svg { animation-duration: 1.8s; }

.chess-bubble {
  position: relative;
  flex: 1 1 auto;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 4px 14px 14px 14px;
  background: rgba(127,184,255,.09);
  border: 1px solid rgba(127,184,255,.15);
  color: #d8e7ff;
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  align-items: center;
}
.chess-bubble::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 14px;
  border: 6px solid transparent;
  border-left: 0;
  border-right-color: rgba(127,184,255,.09);
}
.chess-bubble.is-pop { animation: chess-pop .28s var(--ease); }
@keyframes chess-pop {
  from { opacity: .55; transform: translateY(2px); }
  to { opacity: 1; transform: none; }
}

.board-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 9.6 / 10.6;
  border-radius: 18px;
  overflow: hidden;
  background: #0b1729;
  box-shadow: 0 14px 38px rgba(0,0,0,.45), inset 0 0 0 1px rgba(127,184,255,.1);
}
#chessBoard {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
}

.chess-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 2px; }
.chess-turn {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(127,184,255,.1);
  border: 1px solid rgba(127,184,255,.14);
  color: #cfe2ff;
  white-space: nowrap;
}
.chess-turn.is-her { background: rgba(255,190,120,.1); border-color: rgba(255,190,120,.2); color: #ffd9a8; }
.chess-turn.is-check { background: rgba(255,110,90,.12); border-color: rgba(255,110,90,.24); color: #ffb8ad; }
.chess-turn.is-end { background: rgba(150,170,200,.1); border-color: rgba(150,170,200,.18); color: #c3cfdf; }
.chess-record { font-size: 10.5px; color: var(--dim-2); text-align: right; }

.chess-tools { display: flex; gap: 6px; }
.chess-btn {
  flex: 1 1 0;
  height: 36px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(127,184,255,.05);
  color: #c3d6ef;
  font-size: 12px;
  letter-spacing: .02em;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.chess-btn:active { background: rgba(127,184,255,.15); color: var(--her); }
.chess-btn:disabled { opacity: .35; }
.chess-sound { flex: 0 0 42px; font-size: 15px; }
.chess-sound.is-off { color: var(--dim-2); text-decoration: line-through; }

.chess-tip { margin: 0; padding: 0 2px; font-size: 10.5px; line-height: 1.5; color: var(--dim-2); }

.chess-over {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: rgba(4,12,24,.66);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.chess-over-card {
  width: 78%;
  max-width: 300px;
  padding: 20px 18px 18px;
  border-radius: 18px;
  text-align: center;
  background: linear-gradient(180deg, rgba(18,38,68,.96), rgba(9,22,42,.98));
  border: 1px solid rgba(127,184,255,.2);
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
  animation: chess-pop .3s var(--ease);
}
.chess-over-kicker { margin: 0 0 6px; font-size: 10.5px; letter-spacing: .16em; color: var(--dim-2); }
.chess-over-card h3 { margin: 0 0 8px; font-size: 20px; font-weight: 500; color: #f2f8ff; }
.chess-over-text { margin: 0 0 14px; font-size: 12.5px; line-height: 1.6; color: #c8d9ef; }
.chess-over-card .primary-btn { width: 100%; }

/* 棋盘占用整块面板时，把舞台和聊天输入让开 */
body[data-pane="chess"] .composer,
body[data-pane="chess"] .note { display: none; }

@media (min-width: 860px) {
  .chess-layout { padding: 20px 28px 30px; }
  .chess-main { max-width: 560px; }
}

@media (max-width: 859px) {
  body[data-pane="chess"] .hero { display: none; }
  body[data-pane="chess"] .shell {
    grid-template-rows: auto auto 0 minmax(0, 1fr) 0 0 auto;
  }
}

.chess-brain {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px;
  font-size: 11px;
  color: var(--dim-2);
  user-select: none;
  -webkit-user-select: none;
}
.chess-brain input { width: 14px; height: 14px; margin: 0; accent-color: var(--her); }
.chess-brain em { font-style: normal; opacity: .72; }

/* ---------- 助手留言（署名：助手，不是他说的） ---------- */
.msg.note { justify-content: center; margin: 10px 0; }
.msg.note .note-card {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: rgba(127, 184, 255, .07);
  border: 1px dashed var(--line-strong);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
}
.msg.note .note-from {
  display: inline-block;
  margin-bottom: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(127, 184, 255, .16);
  color: var(--her);
  font-size: 11px;
  letter-spacing: .08em;
}
.msg.note .note-text { white-space: pre-wrap; }

/* 引用回复 */
.reply-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
  margin: 0 10px 6px; padding: 6px 10px;
  border-left: 3px solid var(--accent, #6ad);
  background: rgba(255,255,255,.06); border-radius: 8px;
  font-size: 12px; line-height: 1.25; color: var(--muted, #9bb);
  max-height: 34px; overflow: hidden;
}
.reply-bar-txt { flex: 1 1 auto; min-width: 0; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar-txt b { color: var(--accent, #6ad); margin-right: 6px; }
.reply-cancel {
  flex: 0 0 auto; border: 0; background: transparent; color: var(--muted, #9bb);
  font-size: 18px; line-height: 1; padding: 2px 4px; cursor: pointer;
}
.quote {
  margin: 0 0 6px; padding: 5px 8px;
  border-left: 2px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.16); border-radius: 6px;
  font-size: 12.5px; line-height: 1.35; opacity: .85;
  max-height: 3.6em; overflow: hidden;
}

/* ★ 2026-10-29：消息操作条与多选 */
.msg-actions {
  position: fixed;
  left: 50%;
  bottom: 150px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(15, 26, 44, 0.96);
  border: 1px solid rgba(127, 184, 255, 0.35);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 60;
}
.msg-actions button {
  border: 0;
  background: rgba(127, 184, 255, 0.14);
  color: #eaf3ff;
  font: 13px/1.4 "PingFang SC", system-ui, sans-serif;
  padding: 8px 12px;
  border-radius: 10px;
}
.msg-actions button:active { background: rgba(127, 184, 255, 0.3); }

.select-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(15, 26, 44, 0.97);
  border-top: 1px solid rgba(127, 184, 255, 0.3);
  z-index: 60;
}
.select-bar .sel-count { color: #9fc4ff; font-size: 13px; flex: 1; }
.select-bar button {
  border: 0;
  background: rgba(127, 184, 255, 0.16);
  color: #eaf3ff;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 12px;
}
.select-bar button:active { background: rgba(127, 184, 255, 0.32); }

.bubble.selected {
  outline: 2px solid #7fb8ff;
  outline-offset: 2px;
  background: rgba(127, 184, 255, 0.12);
}

/* ★ 2026-10-29：字体大小三档 */
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(127, 184, 255, .06);
  color: var(--foam);
  font-size: 14px;
}
.seg button.on { border-color: rgba(127, 184, 255, .6); background: rgba(127, 184, 255, .18); }

html[data-font="s"] #pane-chat .bubble { font-size: 13px; }
html[data-font="s"] #pane-chat .meta, html[data-font="s"] #pane-chat .speak-btn { font-size: 10.5px; }
html[data-font="s"] #composer .input { font-size: 14px; }

html[data-font="l"] #pane-chat .bubble { font-size: 18px; line-height: 1.7; }
html[data-font="l"] #pane-chat .meta, html[data-font="l"] #pane-chat .speak-btn { font-size: 13px; }
html[data-font="l"] #composer .input { font-size: 18px; }

/* ★ 2026-10-29：视频全屏 */
.media-wrap { position: relative; }
.fs-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  border: 0;
  border-radius: 10px;
  background: rgba(6, 18, 38, 0.82);
  color: #cfe6ff;
  font-size: 12px;
  padding: 6px 10px;
  z-index: 5;
}
.fs-btn:active { background: rgba(43, 92, 255, 0.55); }

/* ★ 2026-10-29：未读分界 / 折叠历史 / 新消息浮标（⑤ 会话管理） */
.unread-divider {
  text-align: center;
  font-size: 11px;
  color: #9fc4ff;
  padding: 8px 0;
  opacity: .85;
}
.collapse-divider { text-align: center; padding: 8px 0; }
.collapse-divider button {
  border: 1px solid rgba(127, 184, 255, .3);
  background: rgba(127, 184, 255, .08);
  color: #9cc4ff;
  font-size: 11.5px;
  padding: 5px 14px;
  border-radius: 999px;
}
.collapse-divider button:active { background: rgba(127, 184, 255, .2); }

.jump-unread {
  position: fixed;
  right: 14px;
  bottom: 120px;
  z-index: 55;
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  color: #eaf3ff;
  background: linear-gradient(165deg, #3a6bff, #1d43cf);
  box-shadow: 0 10px 24px rgba(29, 67, 207, .4);
}
.jump-unread:active { transform: scale(.96); }
